From bdab168f03b184ec83a7d40728bfa262459e3485 Mon Sep 17 00:00:00 2001 From: Alan Greene Date: Tue, 26 Nov 2024 14:34:27 +0000 Subject: [PATCH] Fix release of single arch images to GHCR Add missing auth for ghcr.io --- tekton/resources/images/single-arch-template.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tekton/resources/images/single-arch-template.yaml b/tekton/resources/images/single-arch-template.yaml index 08e680854..f339cb5a4 100644 --- a/tekton/resources/images/single-arch-template.yaml +++ b/tekton/resources/images/single-arch-template.yaml @@ -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 @@ -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 \ @@ -126,7 +132,7 @@ spec: storage: 1Gi - name: secret secret: - secretName: release-secret + secretName: ghcr-creds params: - name: contextPath value: $(tt.params.contextPath)