2020-10-20 09:05:17 +02:00
|
|
|
metadata:
|
|
|
|
name: gitopsUpdateDeployment
|
|
|
|
description: Updates Kubernetes Deployment Manifest in an Infrastructure Git Repository
|
|
|
|
longDescription: |
|
|
|
|
This step allows you to update the deployment manifest for Kubernetes in a git repository.
|
|
|
|
|
|
|
|
It can for example be used for GitOps scenarios where the update of the manifests triggers an update of the corresponding deployment in Kubernetes.
|
|
|
|
|
2020-11-03 19:29:46 +02:00
|
|
|
As of today, it supports the update of deployment yaml files via kubectl patch and update a whole helm template.
|
|
|
|
For kubectl the container inside the yaml must be described within the following hierarchy: `{"spec":{"template":{"spec":{"containers":[{...}]}}}}`
|
|
|
|
For helm the whole template is generated into a file and uploaded into the repository.
|
|
|
|
|
|
|
|
|
2020-10-20 09:05:17 +02:00
|
|
|
spec:
|
|
|
|
inputs:
|
|
|
|
secrets:
|
|
|
|
- name: gitHttpsCredentialsId
|
|
|
|
description: Jenkins 'Username with password' credentials ID containing username/password for http access to your git repository.
|
|
|
|
type: jenkins
|
2020-11-03 19:29:46 +02:00
|
|
|
resources:
|
|
|
|
- name: deployDescriptor
|
|
|
|
type: stash
|
2020-10-20 09:05:17 +02:00
|
|
|
params:
|
|
|
|
- name: branchName
|
|
|
|
description: The name of the branch where the changes should get pushed into.
|
|
|
|
scope:
|
|
|
|
- PARAMETERS
|
|
|
|
- STAGES
|
|
|
|
- STEPS
|
|
|
|
type: string
|
|
|
|
default: master
|
2020-11-03 19:29:46 +02:00
|
|
|
mandatory: true
|
2020-10-20 09:05:17 +02:00
|
|
|
- name: commitMessage
|
|
|
|
description: The commit message of the commit that will be done to do the changes.
|
2020-11-03 19:29:46 +02:00
|
|
|
longDescription: If the commit message is empty a default message in the form "Updated _containerName_ to version _containerImage_" will be used.
|
2020-10-20 09:05:17 +02:00
|
|
|
scope:
|
|
|
|
- PARAMETERS
|
|
|
|
- STAGES
|
|
|
|
- STEPS
|
|
|
|
type: string
|
|
|
|
- name: serverUrl
|
|
|
|
aliases:
|
|
|
|
- name: githubServerUrl
|
|
|
|
description: GitHub server url to the repository.
|
|
|
|
scope:
|
|
|
|
- GENERAL
|
|
|
|
- PARAMETERS
|
|
|
|
- STAGES
|
|
|
|
- STEPS
|
|
|
|
type: string
|
|
|
|
default: https://github.com
|
|
|
|
mandatory: true
|
|
|
|
- name: username
|
|
|
|
type: string
|
|
|
|
description: User name for git authentication
|
|
|
|
scope:
|
|
|
|
- PARAMETERS
|
|
|
|
- STAGES
|
|
|
|
- STEPS
|
|
|
|
mandatory: true
|
|
|
|
secret: true
|
|
|
|
resourceRef:
|
|
|
|
- name: gitHttpsCredentialsId
|
|
|
|
type: secret
|
|
|
|
param: username
|
|
|
|
- name: password
|
|
|
|
type: string
|
|
|
|
description: Password/token for git authentication.
|
|
|
|
scope:
|
|
|
|
- PARAMETERS
|
|
|
|
- STAGES
|
|
|
|
- STEPS
|
|
|
|
mandatory: true
|
|
|
|
secret: true
|
|
|
|
resourceRef:
|
|
|
|
- name: gitHttpsCredentialsId
|
|
|
|
type: secret
|
|
|
|
param: password
|
|
|
|
- name: filePath
|
|
|
|
description: Relative path in the git repository to the deployment descriptor file that shall be updated
|
|
|
|
scope:
|
|
|
|
- PARAMETERS
|
|
|
|
- STAGES
|
|
|
|
- STEPS
|
|
|
|
type: string
|
|
|
|
mandatory: true
|
|
|
|
- name: containerName
|
|
|
|
description: The name of the container to update
|
|
|
|
scope:
|
|
|
|
- PARAMETERS
|
|
|
|
- STAGES
|
|
|
|
- STEPS
|
|
|
|
type: string
|
|
|
|
- name: containerRegistryUrl
|
|
|
|
aliases:
|
|
|
|
- name: dockerRegistryUrl
|
|
|
|
type: string
|
2020-11-03 19:29:46 +02:00
|
|
|
mandatory: true
|
2020-10-20 09:05:17 +02:00
|
|
|
description: http(s) url of the Container registry where the image is located
|
|
|
|
scope:
|
|
|
|
- GENERAL
|
|
|
|
- PARAMETERS
|
|
|
|
- STAGES
|
|
|
|
- STEPS
|
|
|
|
resourceRef:
|
|
|
|
- name: commonPipelineEnvironment
|
|
|
|
param: container/registryUrl
|
2020-10-27 14:45:34 +02:00
|
|
|
- name: containerImageNameTag
|
2020-10-20 09:05:17 +02:00
|
|
|
aliases:
|
|
|
|
- name: image
|
|
|
|
deprecated: true
|
2020-10-27 14:45:34 +02:00
|
|
|
- name: containerImage
|
2020-10-20 09:05:17 +02:00
|
|
|
type: string
|
2020-11-03 19:29:46 +02:00
|
|
|
mandatory: true
|
2020-10-20 09:05:17 +02:00
|
|
|
description: Container image name with version tag to annotate in the deployment configuration.
|
|
|
|
scope:
|
|
|
|
- PARAMETERS
|
|
|
|
- STAGES
|
|
|
|
- STEPS
|
2020-10-27 14:45:34 +02:00
|
|
|
resourceRef:
|
|
|
|
- name: commonPipelineEnvironment
|
|
|
|
param: container/imageNameTag
|
2020-11-03 19:29:46 +02:00
|
|
|
- name: chartPath
|
|
|
|
aliases:
|
|
|
|
- name: helmChartPath
|
|
|
|
type: string
|
|
|
|
description: Defines the chart path for deployments using helm.
|
|
|
|
scope:
|
|
|
|
- PARAMETERS
|
|
|
|
- STAGES
|
|
|
|
- STEPS
|
|
|
|
- name: helmValues
|
|
|
|
type: "[]string"
|
|
|
|
description: List of helm values as YAML file reference or URL (as per helm parameter description for `-f` / `--values`)
|
|
|
|
scope:
|
|
|
|
- PARAMETERS
|
|
|
|
- STAGES
|
|
|
|
- STEPS
|
|
|
|
- name: deploymentName
|
|
|
|
aliases:
|
|
|
|
- name: helmDeploymentName
|
|
|
|
type: string
|
|
|
|
description: Defines the name of the deployment.
|
|
|
|
scope:
|
|
|
|
- PARAMETERS
|
|
|
|
- STAGES
|
|
|
|
- STEPS
|
|
|
|
# default: deployment
|
|
|
|
- name: tool
|
|
|
|
type: string
|
|
|
|
description: Defines the tool which should be used to update the deployment description.
|
|
|
|
mandatory: true
|
|
|
|
scope:
|
|
|
|
- PARAMETERS
|
|
|
|
- STAGES
|
|
|
|
- STEPS
|
|
|
|
default: kubectl
|
|
|
|
possibleValues:
|
|
|
|
- kubectl
|
|
|
|
- helm
|
2020-10-27 14:45:34 +02:00
|
|
|
containers:
|
2020-11-03 19:29:46 +02:00
|
|
|
- image: dtzar/helm-kubectl:3.3.4
|
|
|
|
workingDir: /config
|
|
|
|
options:
|
|
|
|
- name: -u
|
|
|
|
value: "0"
|
|
|
|
conditions:
|
|
|
|
- conditionRef: strings-equal
|
|
|
|
params:
|
|
|
|
- name: tool
|
|
|
|
value: helm
|
2020-10-27 14:45:34 +02:00
|
|
|
- image: dtzar/helm-kubectl:2.12.1
|
|
|
|
workingDir: /config
|
|
|
|
options:
|
|
|
|
- name: -u
|
|
|
|
value: "0"
|
2020-11-03 19:29:46 +02:00
|
|
|
conditions:
|
|
|
|
- conditionRef: strings-equal
|
|
|
|
params:
|
|
|
|
- name: tool
|
|
|
|
value: kubectl
|