Skip to content

Commit

Permalink
feat!: Align promotion procedure to the new format (#96)
Browse files Browse the repository at this point in the history
Switch from
   app=ver1 app2=ver2
to JSON format
  {"app": "ver1", "app2": "ver2"}

JIRA: EPMDEDP-13010

BREAKING CHANGE: We need to change format of payload that we pass
to CD Pipeline

Signed-off-by: Sergiy Kulanov <[email protected]>
Change-Id: Id348688c12e7ae34e716367033478b3794ee977c
  • Loading branch information
SergK committed Jan 12, 2024
1 parent fad6f92 commit f95e6e0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,17 @@ spec:
- name: EXTRA_COMMANDS
value:
echo "Hello World"

- name: promote-images
taskRef:
kind: Task
name: promote-images
runAfter:
- post-deploy
params:
- name: APPLICATIONS_PAYLOAD
value: $(params.APPLICATIONS_PAYLOAD)
- name: CDPIPELINE_STAGE
value: $(params.CDSTAGE)
- name: CDPIPELINE_CR
value: $(params.CDPIPELINE)
17 changes: 8 additions & 9 deletions charts/pipelines-library/templates/tasks/promote-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@ spec:
- name: BASE_IMAGE
description: The base image for the task.
type: string
default: bitnami/kubectl:1.25.4
- name: CODEBASE_TAG
description: "Codebases with a tag, separated by tabs. Example: foo=1.23 bar=master-1 baz=0.0.1-SNAPSHOT"
default: sergk/edp-argocd-cli:0.2.0-dev
- name: APPLICATIONS_PAYLOAD
description: |
Applications payload in format: '{"codebase1": "version1", "codebase2": "version2"}. For example: '{"demo": "main-20240103-141431", "myapp": "0.1.0-SNAPSHOT.1"}'
type: string
default: ""
- name: CDPIPELINE_CR
description: CDPipeline custom resource name
type: string
default: ""
- name: CDPIPELINE_STAGE
description: Stage name in CD Pipeline
type: string
default: ""
- name: CBIS_CRD
description: CodebaseImageStream custom resource definition.
type: string
Expand All @@ -32,12 +30,13 @@ spec:
description: CDPipeline custom resource definition.
type: string
default: "cdpipelines.v2.edp.epam.com"

steps:
- name: annotate
image: $(params.BASE_IMAGE)
env:
- name: CODEBASE_TAG
value: "$(params.CODEBASE_TAG)"
- name: APPLICATIONS_PAYLOAD
value: "$(params.APPLICATIONS_PAYLOAD)"
- name: CDPIPELINE_CR
value: "$(params.CDPIPELINE_CR)"
- name: CDPIPELINE_STAGE
Expand All @@ -47,7 +46,7 @@ spec:
script: |
set -ex
STAGE_CR="${CDPIPELINE_CR}-${CDPIPELINE_STAGE}"
for i in ${CODEBASE_TAG}; do
echo ${APPLICATIONS_PAYLOAD} | jq -r 'to_entries[] | "\(.key)=\(.value)"' | while read i; do
kubectl annotate --overwrite "${STAGE_CRD}" "${STAGE_CR}" "app.edp.epam.com/${i}"
done
- name: promote-images
Expand Down

0 comments on commit f95e6e0

Please sign in to comment.