softplayer-helmfile/charts/tekton-pipelines/templates/tasks/install-app.yml

48 lines
1.5 KiB
YAML
Raw Normal View History

2024-05-04 16:42:28 +00:00
# ---------------------------------------------------------------------
# This task should create a flux resource that will deploy a helm
# chart to the environemnt
# -- Create an app secret with configs
# -- shell-operator is running a pipeline with confi
# -- Tekton is creating a flux HelmRelease resource
# ---------------------------------------------------------------------
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: install-app
namespace: {{ .Values.pipelineNamespace }}
labels:
{{- include "tekton-pipelines.labels" . | nindent 4 }}
spec:
params:
- name: namespace
type: string
- name: environment
type: string
- name: application
type: string
steps:
- name: create-an-app
image: fluxcd/flux-cli:v2.2.3
env:
- name: SP_STATE
value: present
- name: SP_ENV
value: $(params.environment)
- name: SP_APPLICATION
value: $(params.application)
- name: SP_ACCOUNT
value: $(params.namespace)
script: |-
#!/bin/sh
flux create source helm $SP_APPLICATION \
--namespace=$SP_ACCOUNT \
--url=oci://git.badhouseplants.net/softplayer/helm
flux create helmrelease $SP_APPLICATION \
--source=HelmRepository/$SP_APPLICATION \
--namespace=$SP_ACCOUNT \
--chart=helmrelease \
--values-from Secret/$SP_APPLICATION-config \
--kubeconfig-secret-ref=$SP_ENV-config \
--target-namespace=default