55 lines
1.6 KiB
YAML
55 lines
1.6 KiB
YAML
|
---
|
||
|
apiVersion: tekton.dev/v1beta1
|
||
|
kind: Task
|
||
|
metadata:
|
||
|
name: prepare-hetzner-infra
|
||
|
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)"-ssh \
|
||
|
--namespace "$(params.namespace)" -o yaml \
|
||
|
| yq '.data."ssh_key.pub"' \
|
||
|
| base64 -d > /tmp/outputs/ssh_key.pub
|
||
|
chmod 0600 /tmp/outputs/ssh_key.pub
|
||
|
- name: create-hetzner-infra
|
||
|
image: git.badhouseplants.net/softplayer/softplayer-coskgne:latest
|
||
|
env:
|
||
|
- name: SP_STATE
|
||
|
value: present
|
||
|
- name: SP_ENV
|
||
|
value: $(params.environment)
|
||
|
- name: SP_CUSTOMER
|
||
|
value: $(params.namespace)
|
||
|
- name: SOPS_AGE_KEY
|
||
|
value: {{ .Values.providers.hetzner.ageKey }}
|
||
|
script: |-
|
||
|
#!/bin/sh
|
||
|
ansible-playbook /src/playbooks/providers/hetzner/playbook.yml
|
||
|
- name: save-inventory
|
||
|
image: alpine/k8s:1.29.2
|
||
|
script: |-
|
||
|
#!/bin/sh
|
||
|
kubectl delete secret \
|
||
|
"$(params.environment)"-inventory \
|
||
|
--namespace "$(params.namespace)"
|
||
|
kubectl create secret generic \
|
||
|
"$(params.environment)"-inventory \
|
||
|
--namespace "$(params.namespace)" \
|
||
|
--from-file /tmp/outputs/inventory.yaml
|
||
|
workspaces:
|
||
|
- name: outputs
|
||
|
description: A folder to store outputs
|
||
|
optional: false
|
||
|
mountPath: /tmp/outputs
|