1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/resources/metadata/gitopsUpdateDeployment.yaml
Fabian Reh 9c870b2514
Gitops update deployment fixes (#2234)
* makes containerImage not mandatory

* Adds kubectl container

* Adds log statement to debug

* adds general to container image

* removes GENERAL again
Removes condition from Kubectl container

* removes workDir

* marks logs as debug

* adds workingdir again

* Adds author to commits

* Adds commit time now

* remove deprecated and reorder

* adds deprecated again to containerRegistryUrl
Adds GENERAL scope to containerImage

* updates generated file

* Renames containerImageNameTag

* adds else case

* adds debug log

* code cleanup

* adds debug log

* revert

* adds debug logs

* revert

* makes root path not hidden

* revert

* Read container properties

* Removes debug message

* Removes debug message

* Removes general scope again

* Fixes unit test

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-10-27 13:45:34 +01:00

121 lines
3.7 KiB
YAML

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.
As of today, it supports the update of deployment yaml files via kubectl patch. The container inside the yaml must be described within the following hierarchy: {"spec":{"template":{"spec":{"containers":[{...}]}}}}
spec:
inputs:
secrets:
- name: gitHttpsCredentialsId
description: Jenkins 'Username with password' credentials ID containing username/password for http access to your git repository.
type: jenkins
params:
- name: branchName
description: The name of the branch where the changes should get pushed into.
scope:
- PARAMETERS
- STAGES
- STEPS
type: string
default: master
- name: commitMessage
description: The commit message of the commit that will be done to do the changes.
scope:
- PARAMETERS
- STAGES
- STEPS
type: string
mandatory: true
default: Updated {{containerName}} to version {{containerImage}}
- 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
mandatory: true
- name: containerRegistryUrl
aliases:
- name: dockerRegistryUrl
type: string
description: http(s) url of the Container registry where the image is located
scope:
- GENERAL
- PARAMETERS
- STAGES
- STEPS
resourceRef:
- name: commonPipelineEnvironment
param: container/registryUrl
- name: containerImageNameTag
aliases:
- name: image
deprecated: true
- name: containerImage
type: string
description: Container image name with version tag to annotate in the deployment configuration.
scope:
- PARAMETERS
- STAGES
- STEPS
resourceRef:
- name: commonPipelineEnvironment
param: container/imageNameTag
containers:
- image: dtzar/helm-kubectl:2.12.1
workingDir: /config
options:
- name: -u
value: "0"