softplayer-helmfile/charts/tekton-pipelines/templates/tasks/deploy-helmfile-base.yml

66 lines
2.0 KiB
YAML

---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: deploy-helmfile-base
namespace: {{ .Values.pipelineNamespace }}
labels:
{{- include "tekton-pipelines.labels" . | nindent 4 }}
spec:
params:
- name: namespace
type: string
- name: environment
type: string
steps:
- name: get-ssh-key
image: alpine/k8s:1.29.2
script: |-
#!/bin/sh
kubectl get secret "$(params.environment)"-config \
--namespace "$(params.namespace)" -o yaml \
| yq '.data.value' \
| base64 -d > /tmp/outputs/config
kubectl get configmap "$(params.environment)"-provider-outputs \
--namespace "$(params.namespace)" -o yaml \
| yq '.data."provider_outputs.yaml"' > /tmp/outputs/provider_outputs.yaml
chmod 0600 /tmp/outputs/config
- name: annonate-an-env-cm-installing
image: alpine/k8s:1.29.2
script: |-
#!/bin/sh
kubectl annotate --overwrite configmap \
"$(params.environment)" \
--namespace "$(params.namespace)" \
"softplayer.net/status=installing-dependencies"
- name: get-yq
image: mikefarah/yq
script: |-
#!/bin/sh
cp $(which yq) /tmp/outputs/yq
- name: deploy-helmfile
image: ghcr.io/helmfile/helmfile:v0.163.1
env:
- name: KUBECONFIG
value: /tmp/outputs/config
script: |-
#!/bin/sh
cp /tmp/outputs/yq /usr/bin/yq
mkdir -p /src
git clone https://git.badhouseplants.net/softplayer/softplayer-helmfile.git /src/helmfile
cd /src/helmfile/workload && helmfile sync
- name: annonate-an-env-cm-ready
image: alpine/k8s:1.29.2
script: |-
#!/bin/sh
kubectl annotate --overwrite configmap \
"$(params.environment)" \
--namespace "$(params.namespace)" \
"softplayer.net/status=ready"
workspaces:
- name: outputs
description: A folder to store outputs
optional: false
mountPath: /tmp/outputs