BotDiscord/cicd/templates/dep/kubernetes-action.yaml
2024-06-28 01:12:45 +02:00

55 lines
1.6 KiB
YAML

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: kubernetes-actions
labels:
app.kubernetes.io/version: "0.2"
annotations:
tekton.dev/pipelines.minVersion: "0.17.0"
tekton.dev/categories: Kubernetes
tekton.dev/tags: CLI, kubectl
tekton.dev/displayName: "kubernetes actions"
tekton.dev/platforms: "linux/amd64"
spec:
description: >-
This task is the generic kubectl CLI task which can be used
to run all kinds of k8s commands
workspaces:
- name: manifest-dir
optional: true
- name: kubeconfig-dir
optional: true
results:
- name: output-result
description: some result can be emitted if someone wants to.
params:
- name: script
description: The Kubernetes CLI script to run
type: string
default: "kubectl $@"
- name: args
description: The Kubernetes CLI arguments to run
type: array
default:
- "help"
- name: image
default: gcr.io/cloud-builders/kubectl@sha256:8ab94be8b2b4f3d117f02d868b39540fddd225447abf4014f7ba4765cb39f753 #image is huge
description: Kubectl wrapper image
steps:
- name: kubectl
image: $(params.image)
script: |
#!/usr/bin/env bash
[[ "$(workspaces.manifest-dir.bound)" == "true" ]] && \
cd $(workspaces.manifest-dir.path)
[[ "$(workspaces.kubeconfig-dir.bound)" == "true" ]] && \
[[ -f $(workspaces.kubeconfig-dir.path)/kubeconfig ]] && \
export KUBECONFIG=$(workspaces.kubeconfig-dir.path)/kubeconfig
$(params.script)
args:
- "$(params.args)"