Skip to content

Commit 49e59b1

Browse files
authored
fix(ci): pin tag release reusable workflows (#1235)
1 parent cc2114e commit 49e59b1

4 files changed

Lines changed: 43 additions & 6 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ on:
3737
required: false
3838
type: string
3939
default: ""
40+
checkout-ref:
41+
description: "Git ref to check out for build inputs (defaults to the workflow SHA)"
42+
required: false
43+
type: string
44+
default: ""
4045

4146
env:
4247
MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -150,6 +155,7 @@ jobs:
150155
component: ${{ needs.resolve.outputs.binary_component }}
151156
arch: ${{ matrix.arch }}
152157
cargo-version: ${{ inputs['cargo-version'] }}
158+
checkout-ref: ${{ inputs['checkout-ref'] }}
153159
features: openshell-core/dev-settings
154160
artifact-name: ${{ needs.resolve.outputs.artifact_prefix }}-linux-${{ matrix.arch }}
155161
secrets: inherit
@@ -181,6 +187,7 @@ jobs:
181187
steps:
182188
- uses: actions/checkout@v6
183189
with:
190+
ref: ${{ inputs['checkout-ref'] || github.sha }}
184191
fetch-depth: 0
185192

186193
- name: Mark workspace safe for git

.github/workflows/e2e-test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ on:
1212
required: false
1313
type: string
1414
default: "linux-amd64-cpu8"
15+
checkout-ref:
16+
description: "Git ref to check out for test inputs (defaults to the workflow SHA)"
17+
required: false
18+
type: string
19+
default: ""
1520

1621
permissions:
1722
contents: read
@@ -54,6 +59,8 @@ jobs:
5459
OPENSHELL_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
5560
steps:
5661
- uses: actions/checkout@v6
62+
with:
63+
ref: ${{ inputs['checkout-ref'] || github.sha }}
5764

5865
- name: Install OS test dependencies
5966
if: matrix.apt_packages != ''

.github/workflows/release-tag.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
rpm_release: ${{ steps.v.outputs.rpm_release }}
4646
# Semver without 'v' prefix (e.g. 0.6.0), used for image tags and release body
4747
semver: ${{ steps.v.outputs.semver }}
48+
# Commit resolved from RELEASE_TAG, used for image tags and downstream metadata
49+
source_sha: ${{ steps.v.outputs.source_sha }}
4850
steps:
4951
- uses: actions/checkout@v6
5052
with:
@@ -67,33 +69,41 @@ jobs:
6769
echo "rpm_version=$(uv run python tasks/scripts/release.py get-version --rpm-version)" >> "$GITHUB_OUTPUT"
6870
echo "rpm_release=$(uv run python tasks/scripts/release.py get-version --rpm-release)" >> "$GITHUB_OUTPUT"
6971
echo "semver=${RELEASE_TAG#v}" >> "$GITHUB_OUTPUT"
72+
echo "source_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
7073
7174
build-gateway:
7275
needs: [compute-versions]
7376
uses: ./.github/workflows/docker-build.yml
7477
with:
7578
component: gateway
7679
cargo-version: ${{ needs.compute-versions.outputs.cargo_version }}
80+
image-tag: ${{ needs.compute-versions.outputs.source_sha }}
81+
checkout-ref: ${{ inputs.tag || github.ref }}
7782

7883
build-supervisor:
7984
needs: [compute-versions]
8085
uses: ./.github/workflows/docker-build.yml
8186
with:
8287
component: supervisor
8388
cargo-version: ${{ needs.compute-versions.outputs.cargo_version }}
89+
image-tag: ${{ needs.compute-versions.outputs.source_sha }}
90+
checkout-ref: ${{ inputs.tag || github.ref }}
8491

8592
build-cluster:
8693
needs: [compute-versions]
8794
uses: ./.github/workflows/docker-build.yml
8895
with:
8996
component: cluster
9097
cargo-version: ${{ needs.compute-versions.outputs.cargo_version }}
98+
image-tag: ${{ needs.compute-versions.outputs.source_sha }}
99+
checkout-ref: ${{ inputs.tag || github.ref }}
91100

92101
e2e:
93-
needs: [build-gateway, build-supervisor, build-cluster]
102+
needs: [compute-versions, build-gateway, build-supervisor, build-cluster]
94103
uses: ./.github/workflows/e2e-test.yml
95104
with:
96-
image-tag: ${{ github.sha }}
105+
image-tag: ${{ needs.compute-versions.outputs.source_sha }}
106+
checkout-ref: ${{ inputs.tag || github.ref }}
97107
runner: linux-arm64-cpu8
98108

99109
tag-ghcr-release:
@@ -110,16 +120,17 @@ jobs:
110120
set -euo pipefail
111121
REGISTRY="ghcr.io/nvidia/openshell"
112122
VERSION="${{ needs.compute-versions.outputs.semver }}"
123+
SOURCE_TAG="${{ needs.compute-versions.outputs.source_sha }}"
113124
for component in gateway supervisor cluster; do
114-
echo "Tagging ${REGISTRY}/${component}:${{ github.sha }} as ${VERSION} and latest..."
125+
echo "Tagging ${REGISTRY}/${component}:${SOURCE_TAG} as ${VERSION} and latest..."
115126
docker buildx imagetools create \
116127
--prefer-index=false \
117128
-t "${REGISTRY}/${component}:${VERSION}" \
118-
"${REGISTRY}/${component}:${{ github.sha }}"
129+
"${REGISTRY}/${component}:${SOURCE_TAG}"
119130
docker buildx imagetools create \
120131
--prefer-index=false \
121132
-t "${REGISTRY}/${component}:latest" \
122-
"${REGISTRY}/${component}:${{ github.sha }}"
133+
"${REGISTRY}/${component}:${SOURCE_TAG}"
123134
done
124135
125136
build-python-wheels-linux:
@@ -918,6 +929,7 @@ jobs:
918929
env:
919930
GITLAB_CI_TRIGGER_TOKEN: ${{ secrets.GITLAB_CI_TRIGGER_TOKEN }}
920931
GITLAB_CI_TRIGGER_URL: ${{ secrets.GITLAB_CI_TRIGGER_URL }}
932+
COMMIT_SHA: ${{ needs.compute-versions.outputs.source_sha }}
921933
RELEASE_VERSION: ${{ needs.compute-versions.outputs.python_version }}
922934
RELEASE_TAG: ${{ env.RELEASE_TAG }}
923935
WHEEL_FILENAMES: ${{ needs.release.outputs.wheel_filenames }}
@@ -936,7 +948,7 @@ jobs:
936948
-F "ref=main" \
937949
-F "variables[PIPELINE_ACTION]=publish_wheels" \
938950
-F "variables[GITHUB_REPOSITORY]=${GITHUB_REPOSITORY}" \
939-
-F "variables[COMMIT_SHA]=${GITHUB_SHA}" \
951+
-F "variables[COMMIT_SHA]=${COMMIT_SHA}" \
940952
-F "variables[RELEASE_TAG]=${RELEASE_TAG}" \
941953
-F "variables[RELEASE_VERSION]=${RELEASE_VERSION}" \
942954
-F "variables[RELEASE_KIND]=stable" \

.github/workflows/shadow-rust-native-build.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ on:
3737
required: false
3838
type: string
3939
default: ""
40+
checkout-ref:
41+
description: "Git ref to check out for build inputs (defaults to the workflow SHA)"
42+
required: false
43+
type: string
44+
default: ""
4045
workflow_dispatch:
4146
inputs:
4247
component:
@@ -75,6 +80,11 @@ on:
7580
required: false
7681
type: string
7782
default: ""
83+
checkout-ref:
84+
description: "Git ref to check out for build inputs (defaults to the workflow SHA)"
85+
required: false
86+
type: string
87+
default: ""
7888

7989
permissions:
8090
contents: read
@@ -113,6 +123,7 @@ jobs:
113123
steps:
114124
- uses: actions/checkout@v6
115125
with:
126+
ref: ${{ inputs['checkout-ref'] || github.sha }}
116127
fetch-depth: 0
117128

118129
- name: Mark workspace safe for git

0 commit comments

Comments
 (0)