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.
2022-02-14 08:45:54 +02:00
As of today, it supports the update of deployment yaml files via kubectl patch, update a whole helm template and kustomize.
2022-02-18 09:43:34 +02:00
2022-02-14 08:45:54 +02:00
For *kubectl* the container inside the yaml must be described within the following hierarchy : `{"spec":{"template":{"spec":{"containers":[{...}]}}}}`
2022-02-18 09:43:34 +02:00
For *helm* the whole template is generated into a single file (`filePath`) and uploaded into the repository.
2022-02-14 08:45:54 +02:00
For *kustomize* the `images` section will be update with the current image.
2020-11-03 19:29:46 +02:00
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
2022-04-07 16:33:46 +02:00
- name : forcePush
type : bool
description : Force push to serverUrl
longDescription : |
To bypass branch-protections the git push command can be forced.
Example :
```yaml
steps :
gitopsUpdateDeployment :
forcePush : true
```
scope :
- PARAMETERS
- STAGES
- STEPS
mandatory : false
default : false
2020-10-20 09:05:17 +02:00
- 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
2022-03-11 10:25:46 +02:00
- type : vaultSecret
name : gitHttpsCredentialVaultSecretName
default : gitHttpsCredential
2020-10-20 09:05:17 +02:00
- 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
2022-03-11 10:25:46 +02:00
- type : vaultSecret
name : gitHttpsCredentialVaultSecretName
default : gitHttpsCredential
2020-10-20 09:05:17 +02:00
- name : filePath
2022-02-14 08:45:54 +02:00
description : |
Relative path in the git repository to the deployment descriptor file that shall be updated. For different tools this has different semantics :
2022-02-18 09:43:34 +02:00
* `kubectl` - path to the `deployment.yaml` that should be patched. Supports globbing.
* `helm` - path where the helm chart will be generated into. Here no globbing is supported.
* `kustomize` - path to the `kustomization.yaml`. Supports globbing.
2020-10-20 09:05:17 +02:00
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
2022-02-18 09:43:34 +02:00
description : Defines the chart path for deployments using helm. Globbing is supported to merge multiple charts into one resource.yaml that will be commited.
2020-11-03 19:29:46 +02:00
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
2022-02-14 08:45:54 +02:00
description : Defines the name of the deployment. In case of `kustomize` this is the name or alias of the image in the `kustomization.yaml`
2020-11-03 19:29:46 +02:00
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
2022-02-14 08:45:54 +02:00
- kustomize
2020-10-27 14:45:34 +02:00
containers :
2022-03-18 15:56:36 +02:00
- image : dtzar/helm-kubectl:3.8.0
2020-11-03 19:29:46 +02:00
workingDir : /config
options :
- name : -u
value : "0"
conditions :
- conditionRef : strings-equal
params :
- name : tool
value : helm
2022-03-18 15:56:36 +02:00
- image : dtzar/helm-kubectl:3.8.0
2020-10-27 14:45:34 +02:00
workingDir : /config
options :
- name : -u
value : "0"
2020-11-03 19:29:46 +02:00
conditions :
- conditionRef : strings-equal
params :
- name : tool
value : kubectl
2022-02-25 17:38:02 +02:00
- image : nekottyo/kustomize-kubeval:kustomizev4
2022-02-14 08:45:54 +02:00
workingDir : /config
options :
- name : -u
value : "0"
conditions :
- conditionRef : strings-equal
params :
- name : tool
value : kustomize