charts/pipelines-library/templates/pipelines/go/gerrit-review.yaml (128 lines of code) (raw):
{{ if has "gerrit" .Values.global.gitProviders }}
{{ if or ( .Values.pipelines.deployableResources.go.beego ) ( .Values.pipelines.deployableResources.go.gin ) ( .Values.pipelines.deployableResources.go.operatorsdk )}}
{{- $registry := include "edp-tekton.registry" . -}}
{{- $raw := include "edp-tekton.resourceMapping.go" . | trimAll "[]" -}}
{{- $resources := $raw | split " " -}}
{{- range $framework := $resources }}
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: gerrit-go-{{ $framework }}-app-review
labels:
app.edp.epam.com/pipelinetype: review
{{- include "edp-tekton.labels" $ | nindent 4 }}
spec:
description: "The Review pipeline for building {{ $framework }}"
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/go-go-{{ $framework }}"
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: git-refspec
description: Refspec to fetch before checking out revision.
default: ""
type: string
- name: CODEBASE_NAME
default: "{{ $framework }}-go"
description: "Project name"
type: string
- name: image
default: '{{ $registry }}/golang:1.22-bookworm'
description: "go image version"
type: string
- name: targetBranch
description: Target branch of Merge Request
- name: changeNumber
description: Change number from Merge Request
- name: patchsetNumber
description: Patchset number from Merge Request
- name: CHART_DIR
description: "Deploy templates directory for helm-lint"
default: "deploy-templates"
- name: CT_CONFIGS_DIR
description: "ct-configs directory for helm-lint"
default: "."
tasks:
{{- include "gerrit-review-start" $ | nindent 4 }}
{{- include "get-cache" $ | nindent 4 }}
{{- include "helm-docs" $ | nindent 4 }}
# we don't need subPath for the source workspace, since we need to have access to both folders
# /source and /cache
- name: build
taskRef:
kind: Task
name: golang
runAfter:
- get-cache
params:
- name: BASE_IMAGE
value: $(params.image)
- name: EXTRA_COMMANDS
value: |
# we checkout the source code in the /source directory
# and hold cache in the /cache directory
cd source
make build
make test
workspaces:
- name: source
workspace: shared-workspace
- name: sonar
taskRef:
kind: Task
name: sonarqube-general
runAfter:
- build
params:
- name: SONAR_PROJECT_KEY
value: $(params.CODEBASE_NAME)
- name: SONAR_PROJECT_NAME
value: $(params.CODEBASE_NAME)
- name: target-branch
value: $(params.targetBranch)
- name: source-branch
value: $(params.git-refspec)
- name: key-id
value: $(params.changeNumber)
workspaces:
- name: source
workspace: shared-workspace
subPath: source
- name: dockerfile-lint
taskRef:
kind: Task
name: hadolint
runAfter:
- fetch-repository
workspaces:
- name: source
workspace: shared-workspace
subPath: source
{{ include "dockerbuild-verify-go" $ | nindent 4 }}
- name: helm-lint
taskRef:
kind: Task
name: helm-lint
runAfter:
- fetch-repository
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
{{- include "save-cache" $ | nindent 4 }}
{{ include "gerrit-review-vote" $ | nindent 2 }}
---
{{ end }}
{{ end }}
{{ end }}