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

116 lines
3.6 KiB
YAML
Raw Normal View History

feat(Gitops): new step to update deployment (#2178) * kanikoExecute: improve user experience * ensure proper tags * update permissions in case a container runs with a different user we need to make sure that the orchestrator user can work on the file * update permissions * ensure availablility of directories on Jenkins * (fix) clean up tmp dir in test * add resilience for incorrect step yaml * incorporate PR feedback * Adds piper step to update deployment configuration in external git repository. https://github.wdf.sap.corp/ContinuousDelivery/piper-ita/issues/21 * Adds handling of branchName as an optional parameter * Update resources/metadata/gitopsUpdateDeployment.yaml Feedback about description Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com> * Adapt to interface guide * Refactors to GitopsExecRunner * Refactors to GitopsExecRunner in test * Removes unnecessary mocked methods * Adds tests for git utils * Adds new step to CommonStepsTest.groovy * Updates description from yaml * Restricts visibility of methods and interfaces Adds comments where necessary * Updates comments * Fixes URL name * updates description * updates generated file * Fixes compile issue in CommonStepsTest.groovy * Updates long description * Updates test to run green on all kind of OS * Removes global variables from tests * Default branch: master Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com> * Typo in Hierarchy Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com> * Refactors test to allow parallel execution * Renames utility variable in gitopsUpdateDeployment.go * Renames error variables in gitopsUpdateDeployment.go * simplified parameters for kubectl * Refactors util classes to use parameters rather than global variables * makes username and password mandatory * remove unnecessary mandatory flag * remove new methods from mock that are not necessary * replaces with EqualError * replaces with NoError * update generated file * refactor tests * refactor tests * make tests parallel executable * parallel execution of tests * Refactors interfaces to stop exposing interfaces * Feedback from PR * Simplifies failing mocks * Renames variables and interfaces * Fixes error messages * shorten variable names * Renames unused parameters in tests * Cleanup nil parameters * Typo * Wrap errors and remove unnecessary logs * Remove containername and filePath from GENERAL scope * correct generated file * corrects expected error messages Co-authored-by: OliverNocon <oliver.nocon@sap.com> Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
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.
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: containerImage
aliases:
- name: image
deprecated: true
- name: containerImageNameTag
type: string
description: Container image name with version tag to annotate in the deployment configuration.
resourceRef:
- name: commonPipelineEnvironment
param: container/imageNameTag
mandatory: true
scope:
- PARAMETERS
- STAGES
- STEPS