You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.7 KiB
70 lines
1.7 KiB
apiVersion: tekton.dev/v1beta1
|
|
kind: Task
|
|
metadata:
|
|
name: deploy
|
|
spec:
|
|
params:
|
|
- name: kustomizeImage
|
|
type: string
|
|
default: k8s.gcr.io/kustomize/kustomize:v4.5.5
|
|
- name: gitImage
|
|
type: string
|
|
default: docker.io/alpine/git:v2.26.2
|
|
- name: imageDigest
|
|
description: The digest of the last built image
|
|
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/sh
|
|
|
|
set -euo pipefail
|
|
|
|
echo "========================================================="
|
|
echo " kustomize edit set image"
|
|
echo "========================================================="
|
|
echo
|
|
|
|
echo "Setting image tag to digest $IMAGE_DIGEST..."
|
|
echo
|
|
|
|
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/sh
|
|
|
|
set -euo pipefail
|
|
|
|
git config --global user.email "nmasse@redhat.com"
|
|
git config --global user.name "GitOps Tekton Bot"
|
|
|
|
echo "========================================================="
|
|
echo " git push"
|
|
echo "========================================================="
|
|
echo
|
|
|
|
git add k8s/kustomization.yaml
|
|
git commit -m "deploy image function@$IMAGE_DIGEST"
|
|
git push origin HEAD:gitops
|
|
|
|
exit 0
|
|
|