github.com/jaylevin/jenkins-library@v1.230.4/resources/metadata/gitopsUpdateDeployment.yaml (about) 1 metadata: 2 name: gitopsUpdateDeployment 3 description: Updates Kubernetes Deployment Manifest in an Infrastructure Git Repository 4 longDescription: | 5 This step allows you to update the deployment manifest for Kubernetes in a git repository. 6 7 It can for example be used for GitOps scenarios where the update of the manifests triggers an update of the corresponding deployment in Kubernetes. 8 9 As of today, it supports the update of deployment yaml files via kubectl patch, update a whole helm template and kustomize. 10 11 For *kubectl* the container inside the yaml must be described within the following hierarchy: `{"spec":{"template":{"spec":{"containers":[{...}]}}}}` 12 For *helm* the whole template is generated into a single file (`filePath`) and uploaded into the repository. 13 For *kustomize* the `images` section will be update with the current image. 14 15 16 spec: 17 inputs: 18 secrets: 19 - name: gitHttpsCredentialsId 20 description: Jenkins 'Username with password' credentials ID containing username/password for http access to your git repository. 21 type: jenkins 22 resources: 23 - name: deployDescriptor 24 type: stash 25 params: 26 - name: branchName 27 description: The name of the branch where the changes should get pushed into. 28 scope: 29 - PARAMETERS 30 - STAGES 31 - STEPS 32 type: string 33 default: master 34 mandatory: true 35 - name: commitMessage 36 description: The commit message of the commit that will be done to do the changes. 37 longDescription: If the commit message is empty a default message in the form "Updated _containerName_ to version _containerImage_" will be used. 38 scope: 39 - PARAMETERS 40 - STAGES 41 - STEPS 42 type: string 43 - name: serverUrl 44 aliases: 45 - name: githubServerUrl 46 description: GitHub server url to the repository. 47 scope: 48 - GENERAL 49 - PARAMETERS 50 - STAGES 51 - STEPS 52 type: string 53 default: https://github.com 54 mandatory: true 55 - name: forcePush 56 type: bool 57 description: Force push to serverUrl 58 longDescription: | 59 To bypass branch-protections the git push command can be forced. 60 61 Example: 62 ```yaml 63 steps: 64 gitopsUpdateDeployment: 65 forcePush: true 66 ``` 67 scope: 68 - PARAMETERS 69 - STAGES 70 - STEPS 71 mandatory: false 72 default: false 73 - name: username 74 type: string 75 description: User name for git authentication 76 scope: 77 - PARAMETERS 78 - STAGES 79 - STEPS 80 mandatory: true 81 secret: true 82 resourceRef: 83 - name: gitHttpsCredentialsId 84 type: secret 85 param: username 86 - type: vaultSecret 87 name: gitHttpsCredentialVaultSecretName 88 default: gitHttpsCredential 89 - name: password 90 type: string 91 description: Password/token for git authentication. 92 scope: 93 - PARAMETERS 94 - STAGES 95 - STEPS 96 mandatory: true 97 secret: true 98 resourceRef: 99 - name: gitHttpsCredentialsId 100 type: secret 101 param: password 102 - type: vaultSecret 103 name: gitHttpsCredentialVaultSecretName 104 default: gitHttpsCredential 105 - name: filePath 106 description: | 107 Relative path in the git repository to the deployment descriptor file that shall be updated. For different tools this has different semantics: 108 109 * `kubectl` - path to the `deployment.yaml` that should be patched. Supports globbing. 110 * `helm` - path where the helm chart will be generated into. Here no globbing is supported. 111 * `kustomize` - path to the `kustomization.yaml`. Supports globbing. 112 scope: 113 - PARAMETERS 114 - STAGES 115 - STEPS 116 type: string 117 mandatory: true 118 - name: containerName 119 description: The name of the container to update 120 scope: 121 - PARAMETERS 122 - STAGES 123 - STEPS 124 type: string 125 - name: containerRegistryUrl 126 aliases: 127 - name: dockerRegistryUrl 128 type: string 129 mandatory: true 130 description: http(s) url of the Container registry where the image is located 131 scope: 132 - GENERAL 133 - PARAMETERS 134 - STAGES 135 - STEPS 136 resourceRef: 137 - name: commonPipelineEnvironment 138 param: container/registryUrl 139 - name: containerImageNameTag 140 aliases: 141 - name: image 142 deprecated: true 143 - name: containerImage 144 type: string 145 mandatory: true 146 description: Container image name with version tag to annotate in the deployment configuration. 147 scope: 148 - PARAMETERS 149 - STAGES 150 - STEPS 151 resourceRef: 152 - name: commonPipelineEnvironment 153 param: container/imageNameTag 154 - name: chartPath 155 aliases: 156 - name: helmChartPath 157 type: string 158 description: Defines the chart path for deployments using helm. Globbing is supported to merge multiple charts into one resource.yaml that will be commited. 159 scope: 160 - PARAMETERS 161 - STAGES 162 - STEPS 163 - name: helmValues 164 type: "[]string" 165 description: List of helm values as YAML file reference or URL (as per helm parameter description for `-f` / `--values`) 166 scope: 167 - PARAMETERS 168 - STAGES 169 - STEPS 170 - name: deploymentName 171 aliases: 172 - name: helmDeploymentName 173 type: string 174 description: Defines the name of the deployment. In case of `kustomize` this is the name or alias of the image in the `kustomization.yaml` 175 scope: 176 - PARAMETERS 177 - STAGES 178 - STEPS 179 # default: deployment 180 - name: tool 181 type: string 182 description: Defines the tool which should be used to update the deployment description. 183 mandatory: true 184 scope: 185 - PARAMETERS 186 - STAGES 187 - STEPS 188 default: kubectl 189 possibleValues: 190 - kubectl 191 - helm 192 - kustomize 193 containers: 194 - image: dtzar/helm-kubectl:3.8.0 195 workingDir: /config 196 options: 197 - name: -u 198 value: "0" 199 conditions: 200 - conditionRef: strings-equal 201 params: 202 - name: tool 203 value: helm 204 - image: dtzar/helm-kubectl:3.8.0 205 workingDir: /config 206 options: 207 - name: -u 208 value: "0" 209 conditions: 210 - conditionRef: strings-equal 211 params: 212 - name: tool 213 value: kubectl 214 - image: nekottyo/kustomize-kubeval:kustomizev4 215 workingDir: /config 216 options: 217 - name: -u 218 value: "0" 219 conditions: 220 - conditionRef: strings-equal 221 params: 222 - name: tool 223 value: kustomize