Files
stage-infra/Tekton/tasks/deploy-to-cluster.yaml

33 lines
1.0 KiB
YAML

---
apiVersion: tekton.dev/v1alpha1
kind: Task #this can be used to deploy a folder aswell as a file, but no replacing the names or versions
metadata:
name: deploy-to-cluster
namespace: tekton-pipeline-1
spec:
params:
- name: yaml-location
default: infra/
- name: command
default: apply
workspaces:
- name: source
mountpath: /source
results:
- name: state
description: state of the next github update
- name: description
description: description of the next github updated
steps:
- name: deploy-new-app
image: lachlanevenson/k8s-kubectl
script: |
kubectl $(params.command) -f /source/$(params.yaml-location)
if [ "$?" != 0 ]; then
printf "failure" > /tekton/results/state
printf "failure applying yaml file to cluster ($(params.yaml-location))" > /tekton/results/description
else
printf "success" > /tekton/results/state
printf "deployed the yaml files to the cluster"
fi
exit 0