Skip to content

Commit 254b690

Browse files
authored
operator version update nightly/tag (#166)
* operator version update nightly/tag * README update
1 parent 932b572 commit 254b690

File tree

2 files changed

+83
-31
lines changed

2 files changed

+83
-31
lines changed

.github/workflows/operator-version-update.yaml

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,70 @@
77
# http://www.apache.org/licenses/LICENSE-2.0
88

99
# Reusable workflow to perform operator version update
10-
# To perform csm-operator version update, needs three arguments as input to the workflow
10+
# To perform operator version update for csm-operator, needs two arguments as input to the workflow
1111
name: Operator version update
1212

1313
on:
1414
workflow_call:
1515
inputs:
1616
csm-version:
17-
description: 'CSM program version, ex: v1.12.0, v1.13.0, ...'
17+
description: 'CSM program version, ex: v1.14.0, v1.15.0, ...'
1818
required: true
1919
type: string
20-
latest-version:
21-
description: 'Latest operator version, ex: v1.7.0, v1.8.0, ...'
22-
required: true
23-
type: string
24-
existing-version:
25-
description: 'Existing operator version, ex: v1.6.0, 1.7.0, ...'
20+
update-option:
21+
description: 'Select the update flag, ex. "nightly" or "tag"'
2622
required: true
2723
type: string
2824

2925
jobs:
30-
operator-version-update:
26+
read-values:
3127
runs-on: ubuntu-latest
3228
steps:
33-
- name: Checkout code
29+
- name: Checkout csm repository
3430
uses: actions/checkout@v4
31+
with:
32+
repository: dell/csm
33+
path: csm
3534

36-
- name: Update operator version
35+
- name: Read values from csm-versions.yaml
36+
id: read_values
3737
run: |
38-
echo "Updating Operator version to --> ${{ inputs.latest-version }}"
39-
40-
if [ -f "$GITHUB_WORKSPACE/.github/scripts/operator-version-update.sh" ]; then
41-
bash $GITHUB_WORKSPACE/.github/scripts/operator-version-update.sh ${{ inputs.latest-version }} ${{ inputs.existing-version }} ${{ inputs.csm-version }}
38+
extract_value() {
39+
grep -E "^$1" csm/config/csm-versions.yaml | cut -d ':' -f 2 | tr -d ' '
40+
}
41+
42+
csm_version=$(extract_value 'csm-version')
43+
csm_operator=$(extract_value 'csm-operator')
44+
45+
echo "CSM_VERSION=$csm_version" >> $GITHUB_ENV
46+
echo "CSM_OPERATOR=$csm_operator" >> $GITHUB_ENV
47+
48+
- name: Checkout csm-operator repository
49+
uses: actions/checkout@v4
50+
with:
51+
repository: dell/csm-operator
52+
53+
- name: Install dos2unix
54+
run: sudo apt-get update && sudo apt-get install -y dos2unix
55+
56+
- name: Updating Operator version
57+
run: |
58+
echo "Input csm version --> ${{ inputs.csm-version }}"
59+
echo "Update flag --> ${{ inputs.update-option }}"
60+
csm_ver_provided=${{ inputs.csm-version }}
61+
62+
csm_repo_ver="$(echo -e "${CSM_VERSION}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
63+
csm_ver_provided="$(echo -e "${csm_ver_provided}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
64+
65+
if [ $csm_repo_ver == $csm_ver_provided ]; then
66+
echo "CSM version verified, proceeding with the update..."
67+
dos2unix $GITHUB_WORKSPACE/.github/scripts/operator-version-update.sh
68+
chmod +x $GITHUB_WORKSPACE/.github/scripts/operator-version-update.sh
69+
bash $GITHUB_WORKSPACE/.github/scripts/operator-version-update.sh ${{ inputs.csm-version }} ${{ inputs.update-option}}
70+
else
71+
echo "CSM version mismatch detected. Please verify and update the version file in the CSM repository."
4272
fi
73+
shell: bash
4374

4475
# Needed for signing commits using Github App tokens
4576
# See: https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#commit-signing
@@ -56,12 +87,11 @@ jobs:
5687
uses: peter-evans/create-pull-request@v7
5788
with:
5889
token: ${{ steps.generate-token.outputs.token }}
59-
branch: "operator-ver-bumpup-${{ inputs.latest-version }}"
60-
commit-message: "Update operator version to ${{ inputs.latest-version }}"
61-
title: "Update operator version to ${{ inputs.latest-version }}"
90+
branch: "operator-version-update-${{ inputs.csm-version }}"
91+
commit-message: "Update operator version for csm-${{ inputs.csm-version }}"
92+
title: "Update Operator version"
6293
body: |
63-
operator version updated to --> ${{ inputs.latest-version }}
64-
CSM version updated to --> ${{ inputs.csm-version }}
94+
csm-operator version updated to --> $CSM_OPERATOR
6595
6696
Auto-generated by [common-github-actions](https://github.com/dell/common-github-actions)
6797
sign-commits: true

README.md

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -354,15 +354,37 @@ on:
354354
355355
### operator-version-update
356356
357-
This workflow updates csm-operator repository with latest version of the operator for the given release.
358-
It also updates the CSM program version wherever it is used in csm-operator repository.
357+
This workflow updates csm-operator repository with latest versions of the operator version.
359358
360-
This workflow accepts total three parameters as input to the workflow (csm version, latest operator version, existing operator version).
359+
The workflow accepts two parameters as input:
360+
(CSM program version and update flag).
361+
362+
1. update flag = "nightly"
363+
- This has to be triggered in the beginning of the release.
364+
- This updates operator to the latest version and also updates the CSMVersion to latest.
365+
- Also points operator images to "nightly".
366+
367+
2. update flag = "tag"
368+
- This has to be triggered towards the content lock.
369+
- This flag simply updates "nightly" updated image in step-1 to actual release tag version of the operator.
370+
371+
Below is the example usage in csm-operator repository.
361372
362373
It expects a script to be present in the csm-operator repository ".github/scripts/operator-version-update.sh".
363374
375+
Make sure to update all the latest versions before you trigger this workflow <https://github.com/dell/csm/blob/main/config/csm-versions.yaml>
364376
Workflow needs to be triggered manually from csm-operator repository. Below is the example usage in csm-operator repository.
365377
378+
Example:
379+
380+
1. Beginning of the release
381+
- CSM program version = v1.15.0
382+
- update flag = "nightly"
383+
384+
2. At the content lock
385+
- CSM program version = v1.15.0
386+
- update flag = "tag"
387+
366388
```yaml
367389
name: Update CSM Operator version
368390
# reusable workflow
@@ -371,22 +393,22 @@ on: # yamllint disable-line rule:truthy
371393
workflow_dispatch:
372394
inputs:
373395
csm-version:
374-
description: 'CSM program version, ex: v1.12.0, v1.13.0, ...'
375-
required: true
376-
latest-version:
377-
description: 'Latest operator version, ex: v1.7.0, v1.8.0, ...'
396+
description: 'CSM program version, ex: v1.14.0, v1.15.0, ...'
378397
required: true
379-
existing-version:
380-
description: 'Existing operator version, ex: v1.6.0, 1.7.0, ...'
398+
update-option:
399+
description: 'Select the update flag, ex. "nightly" or "tag"'
381400
required: true
401+
type: choice
402+
options:
403+
- nightly
404+
- tag
382405
jobs:
383406
version-update:
384407
uses: dell/common-github-actions/.github/workflows/operator-version-update.yaml@main
385408
name: Operator version update
386409
with:
387-
latest-version: ${{ inputs.latest-version }}
388-
existing-version: ${{ inputs.existing-version }}
389410
csm-version: ${{ inputs.csm-version }}
411+
update-option: ${{ inputs.update-option}}
390412
secrets: inherit
391413
```
392414

0 commit comments

Comments
 (0)