charts/pipelines-library/templates/pipelines/helm-pipelines/gerrit-build-lib-edp.yaml (180 lines of code) (raw):
{{ if has "gerrit" .Values.global.gitProviders }}
{{ if ( index .Values.pipelines.deployableResources "helm-pipeline" ) }}
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: gerrit-helm-pipeline-lib-build-edp
labels:
app.edp.epam.com/pipelinetype: build
{{- include "edp-tekton.labels" . | nindent 4 }}
spec:
description: "The Build pipeline for building Helm-pipelines library (EDP versioning)"
workspaces:
- name: shared-workspace
- name: ssh-creds
params:
- name: pipelineUrl
default: https://portal-{{ .Release.Namespace }}.{{ .Values.global.dnsWildCard }}/c/main/pipelines/$(context.pipelineRun.namespace)/$(context.pipelineRun.name)
type: string
- name: git-source-url
default: "https://github.com/epmd-edp/container-kaniko-docker"
description: git url to clone
type: string
- name: git-source-revision
description: 'git revision to checkout (branch, tag, sha, ref…)'
default: "edp"
type: string
- name: changeNumber
description: Change number from Merge Request
- name: patchsetNumber
description: Patchset number from Merge Request
- name: CODEBASE_NAME
description: "Project name"
type: string
- name: CODEBASEBRANCH_NAME
description: "Codebasebranch name"
type: string
- name: TICKET_NAME_PATTERN
description: "Ticket name pattern"
default: ""
- name: COMMIT_MESSAGE_PATTERN
description: "Pattern to validate a commit message"
default: ""
- name: COMMIT_MESSAGE
description: "Commit message"
default: ""
- name: JIRA_ISSUE_METADATA_PAYLOAD
description: "Jira Payload"
default: ""
- name: JIRA_SERVER
description: "Jira server name"
default: ""
- name: CHART_DIR
description: "The directory in source that contains the helm chart"
default: "."
- name: CT_CONFIGS_DIR
description: "ct-configs directory for helm-lint"
default: "."
{{- include "build-result" . | nindent 2 }}
tasks:
- name: fetch-repository
taskRef:
kind: Task
name: git-clone
params:
- name: url
value: $(params.git-source-url)
- name: revision
value: $(params.git-source-revision)
- name: subdirectory
value: source
workspaces:
- name: output
workspace: shared-workspace
- name: ssh-directory
workspace: ssh-creds
- name: gerrit-notify
taskRef:
kind: Task
name: gerrit-ssh-cmd
params:
- name: GERRIT_PORT
value: '{{ .Values.global.gerritSSHPort }}'
- name: SSH_GERRIT_COMMAND
value: review --message 'Build Started $(params.pipelineUrl)' $(params.changeNumber),$(params.patchsetNumber)
# we can trigger build pipeline without GerritPatchSet, so let's skip exit code if Patch doesn't exists
- name: ERR_EXIT_CODE
value: '0'
workspaces:
- name: ssh-directory
workspace: ssh-creds
- name: get-version
taskRef:
kind: Task
name: get-version-edp
runAfter:
- gerrit-notify
params:
- name: CODEBASEBRANCH_NAME
value: $(params.CODEBASEBRANCH_NAME)
- name: update-build-number
taskRef:
kind: Task
name: update-build-number-helm-chart
runAfter:
- get-version
params:
- name: CHART_DIR
value: $(params.CHART_DIR)
- name: VERSION
value: $(tasks.get-version.results.VERSION)
workspaces:
- name: source
workspace: shared-workspace
subPath: source
- name: helm-dependency-update
taskRef:
kind: Task
name: helm-dependency-update
runAfter:
- get-version
params:
- name: CHART_DIR
value: $(params.CHART_DIR)
workspaces:
- name: source
workspace: shared-workspace
subPath: source
- name: helm-lint
taskRef:
kind: Task
name: helm-lint
runAfter:
- helm-dependency-update
params:
- name: CHART_DIR
value: $(params.CHART_DIR)
- name: CT_CONFIGS_DIR
value: $(params.CT_CONFIGS_DIR)
workspaces:
- name: source
workspace: shared-workspace
subPath: source
- name: helm-template
taskRef:
kind: Task
name: helm-template
runAfter:
- helm-lint
params:
- name: release_name
value: $(params.CODEBASE_NAME)
- name: CHART_DIR
value: $(params.CHART_DIR)
workspaces:
- name: source
workspace: shared-workspace
subPath: source
- name: git-tag
taskRef:
kind: Task
name: git-cli
runAfter:
- helm-template
params:
- name: GIT_USER_EMAIL
value: edp-ci@edp.ci-user
- name: GIT_USER_NAME
value: edp-ci
- name: GIT_SCRIPT
value: |
git tag -a "$(tasks.get-version.results.VCS_TAG)" -m "Tag is added automatically by CI user"
git push --tags
workspaces:
- name: source
workspace: shared-workspace
subPath: source
- name: ssh-directory
workspace: ssh-creds
{{ include "finally-block-edp" . | nindent 2 }}
{{ end }}
{{ end }}