Skip to content

Commit

Permalink
feat: Make possible run post/pre deploy in remote cluster (#133)
Browse files Browse the repository at this point in the history
Change-Id: Ic9aa3f83111c5ed803d7a734997368d040cf407d
  • Loading branch information
Mykola Serdiuk committed Feb 27, 2024
1 parent e093de8 commit e3f4705
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ spec:
description: |
Applications payload in format: {"codebase1": {"imageTag": "version1", "customValues": true}, "codebase2": {"imageTag": "version2", "customValues": true}}. For example: {"demo": {"imageTag": "main-20240103-141431", "customValues": true}, "myapp": {"imageTag": "0.1.0-SNAPSHOT.1", "customValues": true}}
type: string

- name: KUBECONFIG_SECRET_NAME
description: The name of secret with Kubeconfig to connect to the remote cluster
type: string
tasks:
- name: pre-deploy
taskRef:
kind: Task
name: run-quality-gate
params:
- name: KUBECONFIG_SECRET_NAME
value: $(params.KUBECONFIG_SECRET_NAME)
- name: BASE_IMAGE
value: "bitnami/kubectl:1.25.4"
- name: EXTRA_COMMANDS
Expand Down Expand Up @@ -60,6 +64,8 @@ spec:
runAfter:
- deploy-app
params:
- name: KUBECONFIG_SECRET_NAME
value: $(params.KUBECONFIG_SECRET_NAME)
- name: BASE_IMAGE
value: "bitnami/kubectl:1.25.4"
- name: EXTRA_COMMANDS
Expand Down
13 changes: 13 additions & 0 deletions charts/pipelines-library/templates/tasks/run-quality-gate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,22 @@ spec:
type: string
description: Extra commands
default: ""
- name: KUBECONFIG_SECRET_NAME
type: string
description: The name of secret with Kubeconfig to connect to the remote cluster
default: "in-cluster"
volumes:
- name: kubeconfig
secret:
secretName: $(params.KUBECONFIG_SECRET_NAME)
optional: true
steps:
- name: run
image: $(params.BASE_IMAGE)
volumeMounts:
- name: kubeconfig
mountPath: /workspace/source/kube
script: |
set -ex
export KUBECONFIG="workspace/source/kube/config"
$(params.EXTRA_COMMANDS)

0 comments on commit e3f4705

Please sign in to comment.