Skip to content

Commit

Permalink
chore: Align helm tasks and pipelines for new config approach (#47)
Browse files Browse the repository at this point in the history
* Update helm tasks
* Update parameter definition
* Update default versioning for helm tasks

Change-Id: Ic5f1fac20fe3935502fbf6f587325e56d159f82a
  • Loading branch information
Mykola Serdiuk committed Oct 19, 2023
1 parent 2341c18 commit d515fec
Show file tree
Hide file tree
Showing 20 changed files with 175 additions and 328 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ spec:
- name: get-version
taskRef:
kind: Task
name: get-version-default
name: get-version-helm-default
runAfter:
- gerrit-notify
params:
- name: CHART_DIR
- name: chart-dir
value: $(params.CHART_DIR)
- name: BRANCH_NAME
value: $(params.git-source-revision)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ spec:
- name: get-version
taskRef:
kind: Task
name: get-version-default
name: get-version-helm-default
runAfter:
- fetch-repository
params:
- name: CHART_DIR
- name: chart-dir
value: $(params.CHART_DIR)
- name: BRANCH_NAME
value: $(params.git-source-revision)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ spec:
- name: get-version
taskRef:
kind: Task
name: get-version-default
name: get-version-helm-default
runAfter:
- fetch-repository
params:
- name: CHART_DIR
- name: chart-dir
value: $(params.CHART_DIR)
- name: BRANCH_NAME
value: $(params.git-source-revision)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ spec:
- name: get-version
taskRef:
kind: Task
name: get-version-default
name: get-version-helm-default
runAfter:
- init-values
params:
- name: CHART_DIR
- name: chart-dir
value: $(params.CHART_DIR)
- name: BRANCH_NAME
value: $(params.git-source-revision)
Expand Down Expand Up @@ -114,12 +114,10 @@ spec:
runAfter:
- helm-template
params:
- name: TENANT_NAME
value: $(tasks.init-values.results.TENANT_NAME)
- name: CHART_DIR
- name: image-tag
value: "$(tasks.get-version.results.IS_TAG)"
- name: chart-dir
value: $(params.CHART_DIR)
- name: IS_TAG
value: $(tasks.get-version.results.VERSION)
workspaces:
- name: source
workspace: shared-workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,10 @@ spec:
runAfter:
- helm-template
params:
- name: TENANT_NAME
value: $(tasks.init-values.results.TENANT_NAME)
- name: CHART_DIR
- name: image-tag
value: "$(tasks.get-version.results.IS_TAG)"
- name: chart-dir
value: $(params.CHART_DIR)
- name: IS_TAG
value: $(tasks.get-version.results.VERSION)
workspaces:
- name: source
workspace: shared-workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ spec:
- name: get-version
taskRef:
kind: Task
name: get-version-default
name: get-version-helm-default
runAfter:
- init-values
params:
- name: CHART_DIR
- name: chart-dir
value: $(params.CHART_DIR)
- name: BRANCH_NAME
value: $(params.git-source-revision)
Expand All @@ -73,12 +73,10 @@ spec:
runAfter:
- helm-template
params:
- name: TENANT_NAME
value: $(tasks.init-values.results.TENANT_NAME)
- name: CHART_DIR
value: $(params.CHART_DIR)
- name: IS_TAG
- name: image-tag
value: $(tasks.get-version.results.VERSION)
- name: chart-dir
value: $(params.CHART_DIR)
workspaces:
- name: source
workspace: shared-workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,8 @@ spec:
runAfter:
- helm-template
params:
- name: TENANT_NAME
value: $(tasks.init-values.results.TENANT_NAME)
- name: CHART_DIR
- name: chart-dir
value: $(params.CHART_DIR)
- name: IS_TAG
value: $(tasks.get-version.results.VERSION)
workspaces:
- name: source
workspace: shared-workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,10 @@ spec:
- name: get-version
taskRef:
kind: Task
name: get-version-default
name: get-version-helm-default
runAfter:
- init-values
params:
- name: CHART_DIR
value: $(params.CHART_DIR)
- name: BRANCH_NAME
value: $(params.git-source-revision)
workspaces:
Expand Down Expand Up @@ -114,12 +112,10 @@ spec:
runAfter:
- helm-template
params:
- name: TENANT_NAME
value: $(tasks.init-values.results.TENANT_NAME)
- name: CHART_DIR
- name: image-tag
value: "$(tasks.get-version.results.IS_TAG)"
- name: chart-dir
value: $(params.CHART_DIR)
- name: IS_TAG
value: $(tasks.get-version.results.VERSION)
workspaces:
- name: source
workspace: shared-workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,10 @@ spec:
runAfter:
- helm-template
params:
- name: TENANT_NAME
value: $(tasks.init-values.results.TENANT_NAME)
- name: CHART_DIR
- name: image-tag
value: "$(tasks.get-version.results.IS_TAG)"
- name: chart-dir
value: $(params.CHART_DIR)
- name: IS_TAG
value: $(tasks.get-version.results.VERSION)
workspaces:
- name: source
workspace: shared-workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ spec:
- name: get-version
taskRef:
kind: Task
name: get-version-default
name: get-version-helm-default
runAfter:
- init-values
params:
- name: CHART_DIR
- name: chart-dir
value: $(params.CHART_DIR)
- name: BRANCH_NAME
value: $(params.git-source-revision)
Expand All @@ -73,12 +73,10 @@ spec:
runAfter:
- helm-template
params:
- name: TENANT_NAME
value: $(tasks.init-values.results.TENANT_NAME)
- name: CHART_DIR
value: $(params.CHART_DIR)
- name: IS_TAG
- name: image-tag
value: $(tasks.get-version.results.VERSION)
- name: chart-dir
value: $(params.CHART_DIR)
workspaces:
- name: source
workspace: shared-workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,8 @@ spec:
runAfter:
- helm-template
params:
- name: TENANT_NAME
value: $(tasks.init-values.results.TENANT_NAME)
- name: CHART_DIR
- name: chart-dir
value: $(params.CHART_DIR)
- name: IS_TAG
value: $(tasks.get-version.results.VERSION)
workspaces:
- name: source
workspace: shared-workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ spec:
- name: get-version
taskRef:
kind: Task
name: get-version-default
name: get-version-helm-default
runAfter:
- init-values
params:
- name: CHART_DIR
- name: chart-dir
value: $(params.CHART_DIR)
- name: BRANCH_NAME
value: $(params.git-source-revision)
Expand Down Expand Up @@ -99,8 +99,6 @@ spec:
runAfter:
- helm-lint
params:
- name: CHART_DIR
value: $(params.CHART_DIR)
- name: release_name
value: $(params.CODEBASE_NAME)
workspaces:
Expand All @@ -114,12 +112,10 @@ spec:
runAfter:
- helm-template
params:
- name: TENANT_NAME
value: $(tasks.init-values.results.TENANT_NAME)
- name: CHART_DIR
- name: image-tag
value: "$(tasks.get-version.results.IS_TAG)"
- name: chart-dir
value: $(params.CHART_DIR)
- name: IS_TAG
value: $(tasks.get-version.results.VERSION)
workspaces:
- name: source
workspace: shared-workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,10 @@ spec:
runAfter:
- helm-template
params:
- name: TENANT_NAME
value: $(tasks.init-values.results.TENANT_NAME)
- name: CHART_DIR
- name: image-tag
value: "$(tasks.get-version.results.IS_TAG)"
- name: chart-dir
value: $(params.CHART_DIR)
- name: IS_TAG
value: $(tasks.get-version.results.VERSION)
workspaces:
- name: source
workspace: shared-workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ spec:
- name: get-version
taskRef:
kind: Task
name: get-version-default
name: get-version-helm-default
runAfter:
- init-values
params:
- name: CHART_DIR
- name: chart-dir
value: $(params.CHART_DIR)
- name: BRANCH_NAME
value: $(params.git-source-revision)
Expand All @@ -73,12 +73,8 @@ spec:
runAfter:
- helm-template
params:
- name: TENANT_NAME
value: $(tasks.init-values.results.TENANT_NAME)
- name: CHART_DIR
- name: chart-dir
value: $(params.CHART_DIR)
- name: IS_TAG
value: $(tasks.get-version.results.VERSION)
workspaces:
- name: source
workspace: shared-workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,8 @@ spec:
runAfter:
- helm-template
params:
- name: TENANT_NAME
value: $(tasks.init-values.results.TENANT_NAME)
- name: CHART_DIR
- name: chart-dir
value: $(params.CHART_DIR)
- name: IS_TAG
value: $(tasks.get-version.results.VERSION)
workspaces:
- name: source
workspace: shared-workspace
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: get-version-helm-default
spec:
description:
workspaces:
- name: source
description: The workspace consisting of csharp project.
params:
- name: BRANCH_NAME
type: string
description: Codebasebranch name
- name: chart-dir
type: string
results:
- name: VERSION
description: "Application version"
- name: VCS_TAG
description: "VCS tag"
- name: IS_TAG
description: "CodebaseImageStream tag"
steps:
- name: get-version
image: linuxserver/yq
env:
- name: BRANCH_NAME
value: "$(params.BRANCH_NAME)"
- name: CHART_DIR
value: "$(params.chart-dir)"
workingDir: $(workspaces.source.path)
script: |
set -e
BUILD_VERSION=$(grep -m 1 -oE 'version:[[:space:]]*[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)*' ${CHART_DIR}/Chart.yaml | awk '{print $2}')
BUILD_VERSION=$(cat ${CHART_DIR}/Chart.yaml | yq -r ".version")
VCS_TAG="${BRANCH_NAME}-${BUILD_VERSION}"
IS_TAG="${BUILD_VERSION}"
echo "VCS tag - ${VCS_TAG}"
echo "IS tag - ${IS_TAG}"
echo "VERSION tag - ${BUILD_VERSION}"
printf "%s" "${VCS_TAG}" > "$(results.VCS_TAG.path)"
printf "%s" "${BUILD_VERSION}" > "$(results.VERSION.path)"
printf "%s" "${IS_TAG}" > "$(results.IS_TAG.path)"
Loading

0 comments on commit d515fec

Please sign in to comment.