@@ -13,8 +13,8 @@ on: # yamllint disable-line rule:truthy
13
13
env :
14
14
DIGEST_UPDATER_BRANCH : digest-updater-${{ github.run_id }}
15
15
BRANCH_NAME : ${{ github.event.inputs.branch || 'main' }}
16
- RELEASE_VERSION_N : 2024a
17
- RELEASE_VERSION_N_1 : 2023b
16
+ RELEASE_VERSION_N : 2024b
17
+ RELEASE_VERSION_N_1 : 2024a
18
18
jobs :
19
19
initialize :
20
20
runs-on : ubuntu-latest
36
36
# Create a new branch
37
37
- name : Create a new branch
38
38
run : |
39
- echo ${{ env.DIGEST_UPDATER_BRANCH }}
40
- git checkout -b ${{ env.DIGEST_UPDATER_BRANCH }}
41
- git push --set-upstream origin ${{ env.DIGEST_UPDATER_BRANCH }}
39
+ echo ${{ env.DIGEST_UPDATER_BRANCH }}
40
+ git checkout -b ${{ env.DIGEST_UPDATER_BRANCH }}
41
+ git push --set-upstream origin ${{ env.DIGEST_UPDATER_BRANCH }}
42
42
43
43
update-n-version :
44
44
needs : [initialize]
48
48
steps :
49
49
- name : Configure Git
50
50
run : |
51
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
52
- git config --global user.name "GitHub Actions"
51
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
52
+ git config --global user.name "GitHub Actions"
53
53
54
54
# Get latest build commit from the https://github.com/opendatahub-io/notebooks/${release_branch} using this as identifier for the latest tag name
55
55
- name : Retrive latest commit hash from the release branch
@@ -65,64 +65,65 @@ jobs:
65
65
with :
66
66
ref : ${{ env.DIGEST_UPDATER_BRANCH }}
67
67
68
- - name : Update the param .env file
68
+ - name : Update the params .env file
69
69
run : |
70
- PARAMS_ENV_PATH="manifests/base/params.env"
71
-
72
- echo Latest commit is: ${{ steps.hash-n.outputs.HASH_N }} on ${{ env.RELEASE_VERSION_N }}
73
-
74
- # Get the complete list of images N-version to update
75
- IMAGES=$(cat "${PARAMS_ENV_PATH}" | grep "\-n=" | cut -d "=" -f 1)
76
-
77
- for image in ${IMAGES}; do
78
- echo "CHECKING: '${image}'"
79
- img=$(grep -E "${image}=" "${PARAMS_ENV_PATH}" | cut -d '=' -f2)
80
- registry=$(echo "${img}" | cut -d '@' -f1)
81
-
82
- skopeo_metadata=$(skopeo inspect --retry-times 3 "docker://${img}")
83
-
84
- src_tag=$(echo "${skopeo_metadata}" | jq '.Env[] | select(startswith("OPENSHIFT_BUILD_NAME=")) | split("=")[1]' | tr -d '"' | sed 's/-amd64$//')
85
- regex="^$src_tag-${{ env.RELEASE_VERSION_N}}-\d+-${{ steps.hash-n.outputs.HASH_N }}\$"
86
- latest_tag=$(echo "${skopeo_metadata}" | jq -r --arg regex "$regex" '.RepoTags | map(select(. | test($regex))) | .[0]')
87
- # use `--no-tags` for skopeo once available in newer version
88
- digest=$(skopeo inspect --retry-times 3 "docker://${registry}:${latest_tag}" | jq .Digest | tr -d '"')
89
- output="${registry}@${digest}"
90
- echo "NEW: ${output}"
91
- sed -i "s|${image}=.*|${image}=${output}|" "${PARAMS_ENV_PATH}"
92
- done
93
-
94
- if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
95
- git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
96
- git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
97
- git add "${PARAMS_ENV_PATH}" && \
98
- git commit -m "Update images for release N via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && \
99
- git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
100
- else
101
- echo "There were no changes detected in the images for the ${{ env.RELEASE_VERSION_N }}"
102
- fi
70
+ PARAMS_ENV_PATH="manifests/base/params.env"
71
+
72
+ echo Latest commit is: ${{ steps.hash-n.outputs.HASH_N }} on ${{ env.RELEASE_VERSION_N }}
73
+
74
+ # Get the complete list of images N-version to update
75
+ IMAGES=$(grep "\-n=" "${PARAMS_ENV_PATH}" | cut -d "=" -f 1)
76
+
77
+ for image in ${IMAGES}; do
78
+ echo "CHECKING: '${image}'"
79
+ img=$(grep -E "${image}=" "${PARAMS_ENV_PATH}" | cut -d '=' -f2)
80
+ registry=$(echo "${img}" | cut -d '@' -f1)
81
+
82
+ skopeo_metadata=$(skopeo inspect --retry-times 3 "docker://${img}")
83
+
84
+ src_tag=$(echo "${skopeo_metadata}" | jq '.Env[] | select(startswith("OPENSHIFT_BUILD_NAME=")) | split("=")[1]' | tr -d '"' | sed 's/-amd64$//')
85
+ src_tag2=$(echo $src_tag | sed 's/python-3.9/python-3.11/')
86
+ regex="^$src_tag2-${{ env.RELEASE_VERSION_N}}-\d+-${{ steps.hash-n.outputs.HASH_N }}\$"
87
+ latest_tag=$(echo "${skopeo_metadata}" | jq -r --arg regex "$regex" '.RepoTags | map(select(. | test($regex))) | .[0]')
88
+ # use `--no-tags` for skopeo once available in newer version
89
+ digest=$(skopeo inspect --retry-times 3 "docker://${registry}:${latest_tag}" | jq .Digest | tr -d '"')
90
+ output="${registry}@${digest}"
91
+ echo "NEW: ${output}"
92
+ sed -i "s|${image}=.*|${image}=${output}|" "${PARAMS_ENV_PATH}"
93
+ done
94
+
95
+ if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
96
+ git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
97
+ git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
98
+ git add "${PARAMS_ENV_PATH}" && \
99
+ git commit -m "Update images for release N via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && \
100
+ git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
101
+ else
102
+ echo "There were no changes detected in the images for the ${{ env.RELEASE_VERSION_N }}"
103
+ fi
103
104
104
105
- name : Update the commit.env file
105
106
run : |
106
- COMMIT_ENV_PATH="manifests/base/commit.env"
107
-
108
- echo Latest commit is: ${{ steps.hash-n.outputs.HASH_N }} on ${{ env.RELEASE_VERSION_N }}
109
- # Get the complete list of images N-1 -version to update
110
- COMMIT=$(grep "\-n=" "${COMMIT_ENV_PATH}" | cut -d "=" -f 1)
111
-
112
- for val in ${COMMIT}; do
113
- echo "${val}"
114
- sed -i "s|${val}=.*|${val}=${{ steps.hash-n.outputs.HASH_N }}|" "${COMMIT_ENV_PATH}"
115
- done
116
-
117
- if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
118
- git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
119
- git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
120
- git add "${COMMIT_ENV_PATH}" && \
121
- git commit -m "Update image commits for release N via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && \
122
- git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
123
- else
124
- echo "There were no changes detected in the images for the ${{ env.RELEASE_VERSION_N }}"
125
- fi
107
+ COMMIT_ENV_PATH="manifests/base/commit.env"
108
+
109
+ echo Latest commit is: ${{ steps.hash-n.outputs.HASH_N }} on ${{ env.RELEASE_VERSION_N }}
110
+ # Get the complete list of commits N -version to update
111
+ COMMIT=$(grep "\-n=" "${COMMIT_ENV_PATH}" | cut -d "=" -f 1)
112
+
113
+ for val in ${COMMIT}; do
114
+ echo "${val}"
115
+ sed -i "s|${val}=.*|${val}=${{ steps.hash-n.outputs.HASH_N }}|" "${COMMIT_ENV_PATH}"
116
+ done
117
+
118
+ if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
119
+ git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
120
+ git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
121
+ git add "${COMMIT_ENV_PATH}" && \
122
+ git commit -m "Update image commits for release N via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && \
123
+ git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
124
+ else
125
+ echo "There were no changes detected in the images for the ${{ env.RELEASE_VERSION_N }}"
126
+ fi
126
127
127
128
update-n-1-version :
128
129
needs : [initialize, update-n-version]
@@ -132,8 +133,8 @@ jobs:
132
133
steps :
133
134
- name : Configure Git
134
135
run : |
135
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
136
- git config --global user.name "GitHub Actions"
136
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
137
+ git config --global user.name "GitHub Actions"
137
138
138
139
# Get latest build commit from the https://github.com/opendatahub-io/notebooks/${release_branch} using this as identifier for the latest tag name
139
140
- name : Retrive latest commit hash from the release branch
@@ -151,62 +152,62 @@ jobs:
151
152
152
153
- name : Update the param.env file
153
154
run : |
154
- PARAMS_ENV_PATH="manifests/base/params.env"
155
-
156
- echo Latest commit is: ${{ steps.hash-n-1.outputs.HASH_N_1 }} on ${{ env.RELEASE_VERSION_N_1 }}
157
-
158
- # Get the complete list of images N-1-version to update
159
- IMAGES=$(cat "${PARAMS_ENV_PATH}" | grep "\-n-1=" | cut -d "=" -f 1)
160
-
161
- for image in ${IMAGES}; do
162
- echo "CHECKING: '${image}'"
163
- img=$(grep -E "${image}=" "${PARAMS_ENV_PATH}" | cut -d '=' -f2)
164
- registry=$(echo "${img}" | cut -d '@' -f1)
165
-
166
- skopeo_metadata=$(skopeo inspect --retry-times 3 "docker://${img}")
167
-
168
- src_tag=$(echo "${skopeo_metadata}" | jq '.Env[] | select(startswith("OPENSHIFT_BUILD_NAME=")) | split("=")[1]' | tr -d '"' | sed 's/-amd64$//')
169
- regex="^$src_tag-${{ env.RELEASE_VERSION_N_1}}-\d+-${{ steps.hash-n-1.outputs.HASH_N_1 }}\$"
170
- latest_tag=$(echo "${skopeo_metadata}" | jq -r --arg regex "$regex" '.RepoTags | map(select(. | test($regex))) | .[0]')
171
- # use `--no-tags` for skopeo once available in newer version
172
- digest=$(skopeo inspect --retry-times 3 "docker://${registry}:${latest_tag}" | jq .Digest | tr -d '"')
173
- output="${registry}@${digest}"
174
- echo "NEW: ${output}"
175
- sed -i "s|${image}=.*|${image}=${output}|" "${PARAMS_ENV_PATH}"
176
- done
177
-
178
- if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
179
- git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
180
- git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
181
- git add "${PARAMS_ENV_PATH}" && \
182
- git commit -m "Update images for release N-1 via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && \
183
- git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
184
- else
185
- echo "There were no changes detected in the images for the ${{ env.RELEASE_VERSION_N_1 }}"
186
- fi
155
+ PARAMS_ENV_PATH="manifests/base/params.env"
156
+
157
+ echo Latest commit is: ${{ steps.hash-n-1.outputs.HASH_N_1 }} on ${{ env.RELEASE_VERSION_N_1 }}
158
+
159
+ # Get the complete list of images N-1-version to update
160
+ IMAGES=$(grep "\-n-1=" "${PARAMS_ENV_PATH} " | cut -d "=" -f 1)
161
+
162
+ for image in ${IMAGES}; do
163
+ echo "CHECKING: '${image}'"
164
+ img=$(grep -E "${image}=" "${PARAMS_ENV_PATH}" | cut -d '=' -f2)
165
+ registry=$(echo "${img}" | cut -d '@' -f1)
166
+
167
+ skopeo_metadata=$(skopeo inspect --retry-times 3 "docker://${img}")
168
+
169
+ src_tag=$(echo "${skopeo_metadata}" | jq '.Env[] | select(startswith("OPENSHIFT_BUILD_NAME=")) | split("=")[1]' | tr -d '"' | sed 's/-amd64$//')
170
+ regex="^$src_tag-${{ env.RELEASE_VERSION_N_1}}-\d+-${{ steps.hash-n-1.outputs.HASH_N_1 }}\$"
171
+ latest_tag=$(echo "${skopeo_metadata}" | jq -r --arg regex "$regex" '.RepoTags | map(select(. | test($regex))) | .[0]')
172
+ # use `--no-tags` for skopeo once available in newer version
173
+ digest=$(skopeo inspect --retry-times 3 "docker://${registry}:${latest_tag}" | jq .Digest | tr -d '"')
174
+ output="${registry}@${digest}"
175
+ echo "NEW: ${output}"
176
+ sed -i "s|${image}=.*|${image}=${output}|" "${PARAMS_ENV_PATH}"
177
+ done
178
+
179
+ if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
180
+ git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
181
+ git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
182
+ git add "${PARAMS_ENV_PATH}" && \
183
+ git commit -m "Update images for release N-1 via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && \
184
+ git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
185
+ else
186
+ echo "There were no changes detected in the images for the ${{ env.RELEASE_VERSION_N_1 }}"
187
+ fi
187
188
188
189
- name : Update the commit.env file
189
190
run : |
190
- COMMIT_ENV_PATH="manifests/base/commit.env"
191
-
192
- echo Latest commit is: ${{ steps.hash-n-1.outputs.HASH_N_1 }} on ${{ env.RELEASE_VERSION_N_1 }}
193
- # Get the complete list of images N-1-version to update
194
- COMMIT=$(grep "\-n-1=" "${COMMIT_ENV_PATH}" | cut -d "=" -f 1)
195
-
196
- for val in ${COMMIT}; do
197
- echo "${val}"
198
- sed -i "s|${val}=.*|${val}=${{ steps.hash-n-1.outputs.HASH_N_1 }}|" "${COMMIT_ENV_PATH}"
199
- done
200
-
201
- if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
202
- git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
203
- git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
204
- git add "${COMMIT_ENV_PATH}" && \
205
- git commit -m "Update image commits for release N via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && \
206
- git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
207
- else
208
- echo "There were no changes detected in the images for the ${{ env.RELEASE_VERSION_N }}"
209
- fi
191
+ COMMIT_ENV_PATH="manifests/base/commit.env"
192
+
193
+ echo Latest commit is: ${{ steps.hash-n-1.outputs.HASH_N_1 }} on ${{ env.RELEASE_VERSION_N_1 }}
194
+ # Get the complete list of images N-1-version to update
195
+ COMMIT=$(grep "\-n-1=" "${COMMIT_ENV_PATH}" | cut -d "=" -f 1)
196
+
197
+ for val in ${COMMIT}; do
198
+ echo "${val}"
199
+ sed -i "s|${val}=.*|${val}=${{ steps.hash-n-1.outputs.HASH_N_1 }}|" "${COMMIT_ENV_PATH}"
200
+ done
201
+
202
+ if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
203
+ git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
204
+ git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && \
205
+ git add "${COMMIT_ENV_PATH}" && \
206
+ git commit -m "Update image commits for release N-1 via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && \
207
+ git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
208
+ else
209
+ echo "There were no changes detected in the images for the ${{ env.RELEASE_VERSION_N_1 }}"
210
+ fi
210
211
211
212
open-pull-request :
212
213
needs : [update-n-version, update-n-1-version]
@@ -221,7 +222,7 @@ jobs:
221
222
uses : repo-sync/pull-request@v2
222
223
with :
223
224
source_branch : ${{ env.DIGEST_UPDATER_BRANCH }}
224
- destination_branch : ${{ env.BRANCH_NAME}}
225
+ destination_branch : ${{ env.BRANCH_NAME }}
225
226
github_token : ${{ secrets.GITHUB_TOKEN }}
226
227
pr_label : " automated pr"
227
228
pr_title : " [Digest Updater Action] Update Notebook Images"
@@ -233,4 +234,4 @@ jobs:
233
234
- `manifests/base/params.env` file with the latest updated SHA digests of the notebooks (N & N-1).
234
235
- `manifests/base/commit.env` file with the latest commit (N & N-1).
235
236
236
- :exclamation: **IMPORTANT NOTE**: Remember to delete the ` ${{ env.DIGEST_UPDATER_BRANCH }}` branch after merging the changes
237
+ :exclamation: **IMPORTANT NOTE**: Remember to delete the `${{ env.DIGEST_UPDATER_BRANCH }}` branch after merging the changes
0 commit comments