From 720bfb8b62bb35332f1bef309cd2c5fdafbdd687 Mon Sep 17 00:00:00 2001 From: Marcus Noble Date: Thu, 7 May 2020 17:06:08 +0100 Subject: [PATCH] Fixed docker publish in Tekton --- tekton/2-Setup/docker-creds.yaml | 12 ++++++++++++ tekton/eventlisteners/webhook.yaml | 4 ++++ tekton/tasks/docker-build-and-publish.yaml | 13 ++++++++++++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/tekton/2-Setup/docker-creds.yaml b/tekton/2-Setup/docker-creds.yaml index 3e61d03..3ec6db4 100644 --- a/tekton/2-Setup/docker-creds.yaml +++ b/tekton/2-Setup/docker-creds.yaml @@ -9,3 +9,15 @@ metadata: tekton.dev/docker-0: https://docker.cluster.fun/averagemarcus type: Opaque +--- + +apiVersion: v1 +kind: Secret +metadata: + name: docker-config + namespace: tekton-pipelines + annotations: + kube-1password: i6ngbk5zf4k52xgwdwnfup5bby + kube-1password/vault: Kubernetes + kube-1password/secret-text-key: config.json +type: Opaque diff --git a/tekton/eventlisteners/webhook.yaml b/tekton/eventlisteners/webhook.yaml index d482441..ebda81b 100644 --- a/tekton/eventlisteners/webhook.yaml +++ b/tekton/eventlisteners/webhook.yaml @@ -32,6 +32,8 @@ spec: expression: "split(body.ref, '/')[2]" - key: ref expression: "body.ref" + - key: number + expression: "0" bindings: - name: gitea-binding template: @@ -45,6 +47,8 @@ spec: expression: "body.sha" - key: ref expression: "body.ref" + - key: number + expression: "0" bindings: - name: gitea-binding template: diff --git a/tekton/tasks/docker-build-and-publish.yaml b/tekton/tasks/docker-build-and-publish.yaml index f467243..386d0e1 100644 --- a/tekton/tasks/docker-build-and-publish.yaml +++ b/tekton/tasks/docker-build-and-publish.yaml @@ -32,7 +32,7 @@ spec: image: gcr.io/kaniko-project/executor:latest env: - name: DOCKER_CONFIG - value: /tekton/home/.docker + value: /kaniko/.docker command: - /kaniko/executor - $(params.EXTRA_ARGS) @@ -43,3 +43,14 @@ spec: - --digest-file=/tekton/results/IMAGE_DIGEST securityContext: runAsUser: 0 + volumeMounts: + - name: docker-config + mountPath: /kaniko/.docker/config.json + subPath: config.json + volumes: + - name: docker-config + secret: + secretName: docker-config + + +