2727 type : string
2828 default : " "
2929 include-deb-upgrade-source :
30- description : Include the latest retained prerelease DEB and runtime images as upgrade inputs
30+ description : Include the latest published release DEB and runtime images as upgrade inputs
3131 required : false
3232 type : boolean
3333 default : false
3434 include-rpm-upgrade-source :
35- description : Include the latest retained prerelease RPMs and runtime images as upgrade inputs
35+ description : Include the latest published release RPMs and runtime images as upgrade inputs
3636 required : false
3737 type : boolean
3838 default : false
@@ -140,113 +140,37 @@ jobs:
140140 mv "${gateway_rpms[0]}" artifacts/packages/rpm/openshell-gateway.rpm
141141 rm -rf "$download_dir"
142142
143- - name : Resolve prerelease upgrade source
143+ - name : Resolve released upgrade source
144144 if : inputs['include-deb-upgrade-source'] || inputs['include-rpm-upgrade-source']
145145 id : upgrade-source
146146 env :
147147 GH_TOKEN : ${{ github.token }}
148- INCLUDE_DEB : ${{ inputs['include-deb-upgrade-source'] }}
149- INCLUDE_RPM : ${{ inputs['include-rpm-upgrade-source'] }}
150148 run : |
151149 set -euo pipefail
152- successful_run_ids=$(gh api --paginate \
153- "repos/${GITHUB_REPOSITORY}/actions/workflows/release-tag.yml/runs?status=success&per_page=100" \
154- --jq '.workflow_runs[] | select(.status == "completed" and .conclusion == "success") | .id')
155- artifact_records=$(gh api --paginate \
156- "repos/${GITHUB_REPOSITORY}/actions/artifacts?per_page=100" \
157- --jq '.artifacts[] | select(.expired == false) | [.workflow_run.id, .name] | @tsv')
158- source_record=$(printf '%s\n--ARTIFACTS--\n%s\n' "$successful_run_ids" "$artifact_records" | awk -F '\t' \
159- -v require_deb="$INCLUDE_DEB" -v require_rpm="$INCLUDE_RPM" '
160- $0 == "--ARTIFACTS--" {
161- reading_artifacts = 1
162- next
163- }
164- !reading_artifacts {
165- if ($1 ~ /^[0-9]+$/) successful_runs[$1] = 1
166- next
167- }
168- $1 in successful_runs {
169- run_id = $1
170- artifact = $2
171- tag = ""
172- if (artifact ~ /^openshell-v[0-9]+\.[0-9]+\.[0-9]+-pre\.[1-9][0-9]*-linux-amd64-deb$/) {
173- tag = artifact
174- sub(/^openshell-/, "", tag)
175- sub(/-linux-amd64-deb$/, "", tag)
176- deb[run_id SUBSEP tag] = artifact
177- } else if (artifact ~ /^openshell-v[0-9]+\.[0-9]+\.[0-9]+-pre\.[1-9][0-9]*-linux-x86_64-rpm$/) {
178- tag = artifact
179- sub(/^openshell-/, "", tag)
180- sub(/-linux-x86_64-rpm$/, "", tag)
181- rpm[run_id SUBSEP tag] = artifact
182- }
183- if (tag != "") {
184- candidates[run_id SUBSEP tag] = tag
185- runs[run_id SUBSEP tag] = run_id
186- }
187- }
188- END {
189- for (key in candidates) {
190- if (require_deb == "true" && !(key in deb)) continue
191- if (require_rpm == "true" && !(key in rpm)) continue
192- tag = candidates[key]
193- run_id = runs[key]
194- deb_artifact = (key in deb) ? deb[key] : "-"
195- rpm_artifact = (key in rpm) ? rpm[key] : "-"
196- version = tag
197- sub(/^v/, "", version)
198- split(version, parts, "-pre\\.")
199- split(parts[1], core, "\\.")
200- sequence = parts[2] + 0
201- if (!found || core[1] + 0 > major ||
202- (core[1] + 0 == major && core[2] + 0 > minor) ||
203- (core[1] + 0 == major && core[2] + 0 == minor && core[3] + 0 > patch) ||
204- (core[1] + 0 == major && core[2] + 0 == minor && core[3] + 0 == patch && sequence > prerelease)) {
205- selected = tag
206- selected_run = run_id
207- selected_deb = deb_artifact
208- selected_rpm = rpm_artifact
209- major = core[1] + 0
210- minor = core[2] + 0
211- patch = core[3] + 0
212- prerelease = sequence
213- found = 1
214- }
215- }
216- if (found) {
217- printf "%s\t%s\t%s\t%s\n", selected, selected_run, selected_deb, selected_rpm
218- }
219- }')
220- if [[ -z "$source_record" ]]; then
221- echo "no successful retained prerelease contains all requested package artifacts" >&2
222- exit 1
223- fi
224- IFS=$'\t' read -r source_tag source_run_id deb_artifact rpm_artifact <<< "$source_record"
225- {
226- echo "tag=${source_tag}"
227- echo "run-id=${source_run_id}"
228- if [[ "$deb_artifact" != "-" ]]; then echo "deb-artifact=${deb_artifact}"; fi
229- if [[ "$rpm_artifact" != "-" ]]; then echo "rpm-artifact=${rpm_artifact}"; fi
230- } >> "$GITHUB_OUTPUT"
150+ source_tag=$(gh release view --repo "$GITHUB_REPOSITORY" --json tagName --jq '.tagName')
151+ echo "tag=${source_tag}" >> "$GITHUB_OUTPUT"
231152
232- - name : Download prerelease Debian upgrade source
153+ - name : Download released Debian upgrade source
233154 if : inputs['include-deb-upgrade-source']
234- uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
235- with :
236- name : ${{ steps.upgrade-source.outputs['deb-artifact'] }}
237- path : artifacts/upgrade/deb/source/download
238- github-token : ${{ github.token }}
239- run-id : ${{ steps.upgrade-source.outputs['run-id'] }}
155+ env :
156+ GH_TOKEN : ${{ github.token }}
157+ SOURCE_TAG : ${{ steps.upgrade-source.outputs.tag }}
158+ run : |
159+ set -euo pipefail
160+ gh release download "$SOURCE_TAG" --repo "$GITHUB_REPOSITORY" \
161+ --pattern 'openshell_*_amd64.deb' \
162+ --pattern openshell-checksums-sha256.txt \
163+ --dir artifacts/upgrade/deb/source/download
240164
241- - name : Stage prerelease Debian upgrade source
165+ - name : Stage released Debian upgrade source
242166 if : inputs['include-deb-upgrade-source']
243167 run : |
244168 set -euo pipefail
245169 source_dir=artifacts/upgrade/deb/source
246170 download_dir="${source_dir}/download"
247171 deb_path=$(find "$download_dir" -maxdepth 1 -type f -name 'openshell_*_amd64.deb' -print -quit)
248172 if [[ -z "$deb_path" || ! -f "${download_dir}/openshell-checksums-sha256.txt" ]]; then
249- echo "prerelease source artifact did not contain the expected Debian package and checksums" >&2
173+ echo "released source artifact did not contain the expected Debian package and checksums" >&2
250174 exit 1
251175 fi
252176 (
@@ -261,7 +185,7 @@ jobs:
261185 # Packages do not embed OCI image payloads. Their gateway binaries pin
262186 # this release tag, while tmachine consumes tarballs to keep guest setup
263187 # independent of registry access.
264- - name : Export prerelease runtime images for upgrade sources
188+ - name : Export released runtime images for upgrade sources
265189 if : inputs['include-deb-upgrade-source'] || inputs['include-rpm-upgrade-source']
266190 env :
267191 IMAGE_TAG : ${{ steps.upgrade-source.outputs.tag }}
@@ -271,23 +195,25 @@ jobs:
271195 mkdir -p artifacts/upgrade/source-images
272196
273197 docker pull "ghcr.io/nvidia/openshell/sandbox:${image_tag}"
274- docker tag "ghcr.io/nvidia/openshell/sandbox:${image_tag}" openshell/sandbox:tmachine
275- docker save --output artifacts/upgrade/source-images/openshell-sandbox-tmachine.tar openshell/sandbox:tmachine
198+ docker save --output artifacts/upgrade/source-images/openshell-sandbox-tmachine.tar "ghcr.io/nvidia/openshell/sandbox:${image_tag}"
276199
277200 docker pull "ghcr.io/nvidia/openshell/supervisor:${image_tag}"
278- docker tag "ghcr.io/nvidia/openshell/supervisor:${image_tag}" openshell/supervisor:tmachine
279- docker save --output artifacts/upgrade/source-images/openshell-supervisor-tmachine.tar openshell/supervisor:tmachine
201+ docker save --output artifacts/upgrade/source-images/openshell-supervisor-tmachine.tar "ghcr.io/nvidia/openshell/supervisor:${image_tag}"
280202
281- - name : Download prerelease RPM upgrade source
203+ - name : Download released RPM upgrade source
282204 if : inputs['include-rpm-upgrade-source']
283- uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
284- with :
285- name : ${{ steps.upgrade-source.outputs['rpm-artifact'] }}
286- path : artifacts/upgrade/rpm/source/download
287- github-token : ${{ github.token }}
288- run-id : ${{ steps.upgrade-source.outputs['run-id'] }}
205+ env :
206+ GH_TOKEN : ${{ github.token }}
207+ SOURCE_TAG : ${{ steps.upgrade-source.outputs.tag }}
208+ run : |
209+ set -euo pipefail
210+ gh release download "$SOURCE_TAG" --repo "$GITHUB_REPOSITORY" \
211+ --pattern 'openshell-[0-9]*.x86_64.rpm' \
212+ --pattern 'openshell-gateway-[0-9]*.x86_64.rpm' \
213+ --pattern openshell-checksums-sha256.txt \
214+ --dir artifacts/upgrade/rpm/source/download
289215
290- - name : Stage prerelease RPM upgrade source
216+ - name : Stage released RPM upgrade source
291217 if : inputs['include-rpm-upgrade-source']
292218 run : |
293219 set -euo pipefail
@@ -296,7 +222,7 @@ jobs:
296222 cli_rpm=$(find "$download_dir" -maxdepth 1 -type f -name 'openshell-[0-9]*.x86_64.rpm' -print -quit)
297223 gateway_rpm=$(find "$download_dir" -maxdepth 1 -type f -name 'openshell-gateway-[0-9]*.x86_64.rpm' -print -quit)
298224 if [[ -z "$cli_rpm" || -z "$gateway_rpm" || ! -f "${download_dir}/openshell-checksums-sha256.txt" ]]; then
299- echo "prerelease source artifact did not contain the expected RPMs and checksums" >&2
225+ echo "released source artifact did not contain the expected RPMs and checksums" >&2
300226 exit 1
301227 fi
302228 (
0 commit comments