Skip to content

Commit a670f1c

Browse files
committed
ci(common): use short hash in orchestrate e2e tests
1 parent a61f234 commit a670f1c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/workflows/test-suite-orchestrate-e2e-tests.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ jobs:
7979
host-version: ${{ steps.create-e2e-tests-input.outputs.host-version }}
8080
test-suite-version: ${{ steps.create-e2e-tests-input.outputs.test-suite-version }}
8181
steps:
82+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
83+
with:
84+
persist-credentials: 'false'
85+
8286
- id: create-e2e-tests-input
8387
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v0.8.0
8488
with:
@@ -89,9 +93,17 @@ jobs:
8993
console.log(`New commit hash: ${newCommitHash}`)
9094
console.log(`Docker build results: ${process.env.DOCKER_BUILD_RESULTS}`)
9195
96+
const { execSync } = require('child_process');
9297
const dockerBuildResults = JSON.parse(process.env.DOCKER_BUILD_RESULTS);
9398
function getImageTagIfBuilt(key, build_result) {
94-
let imageTag = dockerBuildResults[key].outputs[build_result] === 'success' ? newCommitHash : previousCommitHash;
99+
let imageCommit = dockerBuildResults[key].outputs[build_result] === 'success' ? newCommitHash : previousCommitHash;
100+
let imageTag;
101+
try {
102+
imageTag = execSync(`git rev-parse --short ${imageCommit}`, { encoding: 'utf8' }).trim();
103+
} catch (err) {
104+
console.log(`Failed to resolve short hash for ${imageCommit}, falling back to substring`);
105+
imageTag = imageCommit.substring(0, 7);
106+
}
95107
console.log(`Assigning image tag '${imageTag}' for ${key}`);
96108
return imageTag;
97109
}

0 commit comments

Comments
 (0)