diff --git a/k8s/pipeline.yaml b/k8s/pipeline.yaml index f200e59..7f35bfc 100644 --- a/k8s/pipeline.yaml +++ b/k8s/pipeline.yaml @@ -79,5 +79,8 @@ spec: - name: src workspace: scratch subPath: gitops + - name: home + workspace: scratch + subPath: tekton taskRef: name: deploy diff --git a/k8s/serviceaccount.yaml b/k8s/serviceaccount.yaml index 884f70a..9f734a7 100644 --- a/k8s/serviceaccount.yaml +++ b/k8s/serviceaccount.yaml @@ -2,3 +2,6 @@ apiVersion: v1 kind: ServiceAccount metadata: name: tekton-robot +secrets: +- name: github-authentication + diff --git a/k8s/task-deploy.yaml b/k8s/task-deploy.yaml index 7eb4068..ef5faf3 100644 --- a/k8s/task-deploy.yaml +++ b/k8s/task-deploy.yaml @@ -15,17 +15,21 @@ spec: workspaces: - name: src mountPath: /src + - name: home + mountPath: /home/tekton steps: - name: kustomize image: $(params.kustomizeImage) workingDir: /src/k8s env: + - name: HOME + value: /home/tekton - name: IMAGE_DIGEST value: "$(params.imageDigest)" script: | - #!/bin/bash + #!/bin/sh - set -Eeuo pipefail + set -euo pipefail echo "=========================================================" echo " kustomize edit set image" @@ -35,19 +39,24 @@ spec: echo "Setting image tag to digest $IMAGE_DIGEST..." echo - kustomize edit set image function@$IMAGE_DIGEST + kustomize edit set image image-registry.openshift-image-registry.svc:5000/demo-appdev/function@$IMAGE_DIGEST exit 0 - name: git-push image: $(params.gitImage) workingDir: /src env: + - name: HOME + value: /home/tekton - name: IMAGE_DIGEST value: "$(params.imageDigest)" script: | - #!/bin/bash + #!/bin/sh - set -Eeuo pipefail + set -euo pipefail + + git config --global user.email "nmasse@redhat.com" + git config --global user.name "GitOps Tekton Bot" echo "=========================================================" echo " git push" @@ -55,7 +64,7 @@ spec: echo git add k8s/kustomization.yaml - git commit -m 'deploy image $IMAGE_DIGEST' - git push + git commit -m "deploy image function@$IMAGE_DIGEST" + git push origin HEAD:gitops exit 0