Skip to content

Commit b2cadf9

Browse files
authored
ci: install gh CLI on self-hosted runner in promote workflow (#822)
Self-hosted infra runners don't ship gh CLI (unlike ubuntu-latest GitHub-hosted runners). Add gh to the apt-get install step so the Create GitHub release step doesn't fail with 'gh: command not found'. Also add digest input validation: if a digest is provided it must match sha256:<64 hex chars> to fail fast before skopeo is invoked.
1 parent 1034e7a commit b2cadf9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

.github/workflows/promote.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ jobs:
5252
username: ${{ vars.DOCKER_REGISTRY_USER }}
5353
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
5454

55-
- name: Install skopeo and jq
55+
- name: Install skopeo, jq, and gh
5656
run: |
5757
sudo apt-get update
58-
sudo apt-get install -y skopeo jq
58+
sudo apt-get install -y skopeo jq gh
5959
6060
# Resolve the source digest BEFORE copying to :prod. This avoids the
6161
# inspect-after-write race where reading back :prod could in theory hit a
@@ -66,6 +66,10 @@ jobs:
6666
run: |
6767
set -euo pipefail
6868
DIGEST_INPUT="${{ inputs.digest }}"
69+
if [ -n "$DIGEST_INPUT" ] && ! echo "$DIGEST_INPUT" | grep -qE '^sha256:[a-f0-9]{64}$'; then
70+
echo "::error::digest input must be 'sha256:<64 hex chars>', got: '${DIGEST_INPUT}'"
71+
exit 1
72+
fi
6973
if [ -n "$DIGEST_INPUT" ]; then
7074
echo "Promoting by digest: ${DIGEST_INPUT}"
7175
SOURCE="${{ env.IMAGE }}@${DIGEST_INPUT}"

0 commit comments

Comments
 (0)