Skip to content

Commit

Permalink
Fix release of single arch images to GHCR
Browse files Browse the repository at this point in the history
Add missing auth for ghcr.io
  • Loading branch information
AlanGreene authored and tekton-robot committed Nov 27, 2024
1 parent 66f4b04 commit bdab168
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tekton/resources/images/single-arch-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ spec:
workingDir: $(workspaces.source.path)
image: gcr.io/kaniko-project/executor:v1.8.0-debug
env:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: $(workspaces.secret.path)/release.json
- name: IMAGE_REGISTRY_CREDENTIALS
value: $(workspaces.secret.path)/credentials
- name: CONTEXT_PATH
value: $(params.contextPath)
- name: TAGS
Expand All @@ -76,6 +76,12 @@ spec:
DESTINATIONS=""
for tag in ${TAGS}; do DESTINATIONS="${DESTINATIONS} --destination ${IMAGE_URL}:${tag}"; done
IFS=$OIFS
IMAGE_REGISTRY_USER=tekton-robot
IMAGE_REGISTRY_TOKEN=$(cat "$IMAGE_REGISTRY_CREDENTIALS")
AUTH=$(echo -n ${IMAGE_REGISTRY_USER}:${IMAGE_REGISTRY_TOKEN} | base64)
echo "{\"auths\": {\"ghcr.io\": {\"auth\": \"${AUTH}\"}}}" > /kaniko/.docker/config.json
# Run the build
/kaniko/executor \
--dockerfile=Dockerfile \
Expand Down Expand Up @@ -126,7 +132,7 @@ spec:
storage: 1Gi
- name: secret
secret:
secretName: release-secret
secretName: ghcr-creds
params:
- name: contextPath
value: $(tt.params.contextPath)
Expand Down

0 comments on commit bdab168

Please sign in to comment.