@@ -51,53 +51,75 @@ jobs:
51
51
git config --global user.email "github-actions[bot]@users.noreply.github.com"
52
52
git config --global user.name "GitHub Actions"
53
53
54
- # Get the latest weekly build commit hash: https://github.com/opendatahub-io/notebooks/commits/2024a
55
- - name : Checkout upstream notebooks repo
56
- uses : actions/checkout@v4
57
- with :
58
- repository : opendatahub-io/notebooks.git
59
- ref : ${{ env.RELEASE_VERSION_N }}
60
-
61
- - name : Retrieve latest weekly commit hash from the release branch
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
+ - name : Retrive latest commit hash from the release branch
62
56
id : hash-n
63
57
shell : bash
64
58
run : |
65
- echo "HASH_N=$(git rev-parse --short HEAD)" >> ${GITHUB_OUTPUT}
59
+ PAYLOAD=$(curl --silent -H 'Accept: application/vnd.github.v4.raw' https://api.github.com/repos/opendatahub-io/notebooks/commits?sha=$RELEASE_VERSION_N&per_page=1)
60
+ echo "HASH_N=$(echo $PAYLOAD | jq -r '.[0].sha[0:7]')" >> ${GITHUB_OUTPUT}
66
61
67
62
# Checkout the release branch to apply the updates
68
63
- name : Checkout release branch
69
64
uses : actions/checkout@v4
70
65
with :
71
66
ref : ${{ env.DIGEST_UPDATER_BRANCH }}
72
67
73
- - name : Fetch digest, and update the params .env file
68
+ - name : Update the param .env file
74
69
run : |
75
70
echo Latest commit is: ${{ steps.hash-n.outputs.HASH_N }} on ${{ env.RELEASE_VERSION_N}}
76
- IMAGES=("odh-minimal-notebook-image-n" "odh-minimal-gpu-notebook-image-n" "odh-pytorch-gpu-notebook-image-n" "odh-generic-data-science-notebook-image-n" "odh-tensorflow-gpu-notebook-image-n" "odh-trustyai-notebook-image-n")
71
+ IMAGES=("odh-minimal-notebook-image-n"
72
+ "odh-minimal-gpu-notebook-image-n"
73
+ "odh-pytorch-gpu-notebook-image-n"
74
+ "odh-generic-data-science-notebook-image-n"
75
+ "odh-tensorflow-gpu-notebook-image-n"
76
+ "odh-trustyai-notebook-image-n"
77
+ "odh-codeserver-notebook-n"
78
+ "odh-rstudio-notebook-n"
79
+ "odh-rstudio-gpu-notebook-n")
80
+
77
81
for ((i=0;i<${#IMAGES[@]};++i)); do
78
82
image=${IMAGES[$i]}
79
- echo $image
83
+ echo "CHECKING: " $image
80
84
img=$(cat manifests/base/params.env | grep -E "${image}=" | cut -d '=' -f2)
81
85
registry=$(echo $img | cut -d '@' -f1)
82
86
src_tag=$(skopeo inspect docker://$img | jq '.Env[] | select(startswith("OPENSHIFT_BUILD_NAME=")) | split("=")[1]' | tr -d '"' | sed 's/-amd64$//')
83
87
regex="$src_tag-${{ env.RELEASE_VERSION_N}}-\d+-${{ steps.hash-n.outputs.HASH_N }}"
84
88
latest_tag=$(skopeo inspect docker://$img | jq -r --arg regex "$regex" '.RepoTags | map(select(. | test($regex))) | .[0]')
85
89
digest=$(skopeo inspect docker://$registry:$latest_tag | jq .Digest | tr -d '"')
86
90
output=$registry@$digest
87
- echo $output
91
+ echo "NEW:" $output
88
92
sed -i "s|${image}=.*|${image}=$output|" manifests/base/params.env
89
93
done
90
- git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && git add manifests/base/params.env && git commit -m "Update images for release N via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
94
+ if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
95
+ git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && git add manifests/base/params.env && git commit -m "Update images for release N via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
96
+ else
97
+ echo "There were no changes detected in the images for the ${{ env.RELEASE_VERSION_N}}"
98
+ fi
91
99
92
- - name : Fetch digest, and update the commit.env file
100
+ - name : Update the commit.env file
93
101
run : |
94
102
echo Latest commit is: ${{ steps.hash-n.outputs.HASH_N }} on ${{ env.RELEASE_VERSION_N}}
95
- COMMIT=("odh-minimal-notebook-image-commit-n" "odh-minimal-gpu-notebook-image-commit-n" "odh-pytorch-gpu-notebook-image-commit-n" "odh-generic-data-science-notebook-image-commit-n" "odh-tensorflow-gpu-notebook-image-commit-n" "odh-trustyai-notebook-image-commit-n")
103
+ COMMIT=("odh-minimal-notebook-image-commit-n"
104
+ "odh-minimal-gpu-notebook-image-commit-n"
105
+ "odh-pytorch-gpu-notebook-image-commit-n"
106
+ "odh-generic-data-science-notebook-image-commit-n"
107
+ "odh-tensorflow-gpu-notebook-image-commit-n"
108
+ "odh-trustyai-notebook-image-commit-n"
109
+ "odh-codeserver-notebook-n"
110
+ "odh-rstudio-notebook-n"
111
+ "odh-rstudio-gpu-notebook-n")
112
+
96
113
for val in "${COMMIT[@]}"; do
97
114
echo $val
98
115
sed -i "s|${val}=.*|${val}=${{ steps.hash-n.outputs.HASH_N }}|" manifests/base/commit.env
99
116
done
100
- git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && git add manifests/base/commit.env && git commit -m "Update image commits for release N via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
117
+ if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
118
+ git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && git add manifests/base/commit.env && git commit -m "Update image commits for release N via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
119
+ else
120
+ echo "There were no changes detected in the images for the ${{ env.RELEASE_VERSION_N}}"
121
+ fi
122
+
101
123
update-n-1-version :
102
124
needs : [initialize, update-n-version]
103
125
runs-on : ubuntu-latest
@@ -109,54 +131,74 @@ jobs:
109
131
git config --global user.email "github-actions[bot]@users.noreply.github.com"
110
132
git config --global user.name "GitHub Actions"
111
133
112
- # Get the latest weekly build commit hash: https://github.com/opendatahub-io/notebooks/commits/2023b
113
- - name : Checkout upstream notebooks repo
114
- uses : actions/checkout@v4
115
- with :
116
- repository : opendatahub-io/notebooks.git
117
- ref : ${{ env.RELEASE_VERSION_N_1 }}
118
-
119
- - name : Retrieve latest weekly commit hash from the release branch
134
+ # Get latest build commit from the https://github.com/opendatahub-io/notebooks/${release_branch} using this as identifier for the latest tag name
135
+ - name : Retrive latest commit hash from the release branch
120
136
id : hash-n-1
121
137
shell : bash
122
138
run : |
123
- echo "HASH_N_1=$(git rev-parse --short HEAD)" >> ${GITHUB_OUTPUT}
139
+ PAYLOAD=$(curl --silent -H 'Accept: application/vnd.github.v4.raw' https://api.github.com/repos/opendatahub-io/notebooks/commits?sha=$RELEASE_VERSION_N_1&per_page=1)
140
+ echo "HASH_N_1=$(echo $PAYLOAD | jq -r '.[0].sha[0:7]')" >> ${GITHUB_OUTPUT}
124
141
125
142
# Checkout the release branch to apply the updates
126
143
- name : Checkout release branch
127
144
uses : actions/checkout@v4
128
145
with :
129
146
ref : ${{ env.DIGEST_UPDATER_BRANCH }}
130
147
131
- - name : Fetch digest, and update the params .env file
148
+ - name : Update the param .env file
132
149
run : |
133
150
echo Latest commit is: ${{ steps.hash-n-1.outputs.HASH_N_1 }} on ${{ env.RELEASE_VERSION_N_1}}
134
- IMAGES=("odh-minimal-notebook-image-n-1" "odh-minimal-gpu-notebook-image-n-1" "odh-pytorch-gpu-notebook-image-n-1" "odh-generic-data-science-notebook-image-n-1" "odh-tensorflow-gpu-notebook-image-n-1" "odh-trustyai-notebook-image-n-1")
151
+ IMAGES=("odh-minimal-notebook-image-n-1"
152
+ "odh-minimal-gpu-notebook-image-n-1"
153
+ "odh-pytorch-gpu-notebook-image-n-1"
154
+ "odh-generic-data-science-notebook-image-n-1"
155
+ "odh-tensorflow-gpu-notebook-image-n-1"
156
+ "odh-trustyai-notebook-image-n-1"
157
+ "odh-codeserver-notebook-n-1"
158
+ "odh-rstudio-notebook-n-1"
159
+ "odh-rstudio-gpu-notebook-n-1")
160
+
135
161
for ((i=0;i<${#IMAGES[@]};++i)); do
136
162
image=${IMAGES[$i]}
137
- echo $image
163
+ echo "CHECKING: " $image
138
164
img=$(cat manifests/base/params.env | grep -E "${image}=" | cut -d '=' -f2)
139
165
registry=$(echo $img | cut -d '@' -f1)
140
166
src_tag=$(skopeo inspect docker://$img | jq '.Env[] | select(startswith("OPENSHIFT_BUILD_NAME=")) | split("=")[1]' | tr -d '"' | sed 's/-amd64$//')
141
167
regex="$src_tag-${{ env.RELEASE_VERSION_N_1}}-\d+-${{ steps.hash-n-1.outputs.HASH_N_1 }}"
142
168
latest_tag=$(skopeo inspect docker://$img | jq -r --arg regex "$regex" '.RepoTags | map(select(. | test($regex))) | .[0]')
143
169
digest=$(skopeo inspect docker://$registry:$latest_tag | jq .Digest | tr -d '"')
144
170
output=$registry@$digest
145
- echo $output
171
+ echo "NEW:" $output
146
172
sed -i "s|${image}=.*|${image}=$output|" manifests/base/params.env
147
173
done
148
- git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && git add manifests/base/params.env && git commit -m "Update images for release N-1 via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
149
-
150
- - name : Fetch digest, and update the commit.env file
174
+ if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
175
+ git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && git add manifests/base/params.env && git commit -m "Update images for release N-1 via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
176
+ else
177
+ echo "There were no changes detected in the images for the ${{ env.RELEASE_VERSION_N_1}}"
178
+ fi
179
+ - name : Update the commit.env file
151
180
run : |
152
181
echo Latest commit is: ${{ steps.hash-n-1.outputs.HASH_N_1 }} on ${{ env.RELEASE_VERSION_N_1}}
153
- COMMIT=("odh-minimal-notebook-image-commit-n-1" "odh-minimal-gpu-notebook-image-commit-n-1" "odh-pytorch-gpu-notebook-image-commit-n-1" "odh-generic-data-science-notebook-image-commit-n-1" "odh-tensorflow-gpu-notebook-image-commit-n-1" "odh-trustyai-notebook-image-commit-n-1")
182
+ COMMIT=("odh-minimal-notebook-image-commit-n-1"
183
+ "odh-minimal-gpu-notebook-image-commit-n-1"
184
+ "odh-pytorch-gpu-notebook-image-commit-n-1"
185
+ "odh-generic-data-science-notebook-image-commit-n-1"
186
+ "odh-tensorflow-gpu-notebook-image-commit-n-1"
187
+ "odh-trustyai-notebook-image-commit-n-1"
188
+ "odh-codeserver-notebook-n-1"
189
+ "odh-rstudio-notebook-n-1"
190
+ "odh-rstudio-gpu-notebook-n-1")
191
+
154
192
for val in "${COMMIT[@]}"; do
155
193
echo $val
156
194
sed -i "s|${val}=.*|${val}=${{ steps.hash-n-1.outputs.HASH_N_1 }}|" manifests/base/commit.env
157
195
done
158
- git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && git add manifests/base/commit.env && git commit -m "Update image commits for release N-1 via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
159
- # Creates the Pull Request
196
+ if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
197
+ git fetch origin ${{ env.DIGEST_UPDATER_BRANCH }} && git pull origin ${{ env.DIGEST_UPDATER_BRANCH }} && git add manifests/base/commit.env && git commit -m "Update image commits for release N via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && git push origin ${{ env.DIGEST_UPDATER_BRANCH }}
198
+ else
199
+ echo "There were no changes detected in the images for the ${{ env.RELEASE_VERSION_N}}"
200
+ fi
201
+
160
202
open-pull-request :
161
203
needs : [update-n-version, update-n-1-version]
162
204
runs-on : ubuntu-latest
@@ -173,11 +215,13 @@ jobs:
173
215
destination_branch : ${{ env.BRANCH_NAME}}
174
216
github_token : ${{ secrets.GITHUB_TOKEN }}
175
217
pr_label : " automated pr"
176
- pr_title : " [Digest Updater Action] Update notebook's imageStreams image tag to digest format "
218
+ pr_title : " [Digest Updater Action] Update Notebook Images "
177
219
pr_body : |
178
220
:rocket: This is an automated Pull Request.
179
-
180
- This PR updates the `manifests/base/params.env` file with the latest updated SHA digests of the notebooks (N & N-1).
181
221
Created by `/.github/workflows/notebooks-digest-updater-upstream.yaml`
182
222
223
+ This PR updates the following files:
224
+ - `manifests/base/params.env` file with the latest updated SHA digests of the notebooks (N & N-1).
225
+ - `manifests/base/commit.env` file with the latest commit (N & N-1).
226
+
183
227
:exclamation: **IMPORTANT NOTE**: Remember to delete the ` ${{ env.DIGEST_UPDATER_BRANCH }}` branch after merging the changes
0 commit comments