7
7
# http://www.apache.org/licenses/LICENSE-2.0
8
8
9
9
# 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
11
11
name : Operator version update
12
12
13
13
on :
14
14
workflow_call :
15
15
inputs :
16
16
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, ...'
18
18
required : true
19
19
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"'
26
22
required : true
27
23
type : string
28
24
29
25
jobs :
30
- operator-version-update :
26
+ read-values :
31
27
runs-on : ubuntu-latest
32
28
steps :
33
- - name : Checkout code
29
+ - name : Checkout csm repository
34
30
uses : actions/checkout@v4
31
+ with :
32
+ repository : dell/csm
33
+ path : csm
35
34
36
- - name : Update operator version
35
+ - name : Read values from csm-versions.yaml
36
+ id : read_values
37
37
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."
42
72
fi
73
+ shell : bash
43
74
44
75
# Needed for signing commits using Github App tokens
45
76
# See: https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#commit-signing
@@ -56,12 +87,11 @@ jobs:
56
87
uses : peter-evans/create-pull-request@v7
57
88
with :
58
89
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"
62
93
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
65
95
66
96
Auto-generated by [common-github-actions](https://github.com/dell/common-github-actions)
67
97
sign-commits : true
0 commit comments