From 635b62755d05da94536bb7cbf9354fc6a8fde14a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Fri, 23 Sep 2022 17:28:59 +0200 Subject: [PATCH] improve k8s manifests --- k8s/pipeline.yaml | 3 +++ k8s/serviceaccount.yaml | 3 +++ k8s/task-deploy.yaml | 23 ++++++++++++++++------- 3 files changed, 22 insertions(+), 7 deletions(-) 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