Files
cicd/common/templates/_task-git-semver.yaml

45 lines
1.4 KiB
YAML

{{- define "common.task-git-semver" }}
{{- $common := dict "Values" .Values.common -}}
{{- $noCommon := omit .Values "common" -}}
{{- $overrides := dict "Values" $noCommon -}}
{{- $noValues := omit . "Values" -}}
{{- with merge $noValues $overrides $common -}}
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: git-semver
namespace: {{ .Release.Namespace }}
spec:
params:
- name: gitrepositoryurl
type: string
- default: master
name: gitbranch
type: string
results:
- name: version
type: string
steps:
- env:
- name: PARAM_REPO
value: $(params.gitrepositoryurl)
- name: PARAM_BRANCH
value: $(params.gitbranch)
image: {{ .Values.quayHostname }}/goghvideo/gitversion:5.11.0-alpine.3.13-6.0
name: clone-and-calculate-semver
script: |
#!/usr/bin/env bash
USERNAME=$(cat /workspace/gitauth/username)
PASSWORD=$(cat /workspace/gitauth/password)
SEMVER=$(/tools/dotnet-gitversion /url ${PARAM_REPO} /b ${PARAM_BRANCH} /u ${USERNAME} /p ${PASSWORD} /dynamicRepoLocation /workspace/repo /overrideconfig mode=Mainline /overrideconfig commit-message-incrementing=MergeMessageOnly /showvariable MajorMinorPatch /verbosity quiet)
echo -n ${SEMVER} > $(results.version.path)
exit 0
securityContext:
runAsNonRoot: true
runAsUser: 65532
workspaces:
- name: repo
- name: gitauth
{{- end }}
{{- end }}