From 275f66adf0f6898fbec46b13fae89597a73737ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Huss?= Date: Sun, 21 Apr 2024 17:36:45 +0200 Subject: [PATCH] fix --- .../tekton.dev_v1beta1_Task_git-version.yaml | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/share/gitea-tekton-org/tekton.dev_v1beta1_Task_git-version.yaml b/share/gitea-tekton-org/tekton.dev_v1beta1_Task_git-version.yaml index 3e071a6..88d6185 100644 --- a/share/gitea-tekton-org/tekton.dev_v1beta1_Task_git-version.yaml +++ b/share/gitea-tekton-org/tekton.dev_v1beta1_Task_git-version.yaml @@ -15,17 +15,19 @@ spec: description: >- This task can be used to create a version from git history params: - - description: branch to checkout to create a version for e.g. "develop" - name: branch + - name: gitversion-image + default: gittools/gitversion:6.0.0-alpine.3.18-7.0 + description: The name of the toolbox image type: string results: - description: The calculated git version you could use for git tagging e.g. "0.1.0-tektonize.1-188" name: gitVersion - description: A normalized version for use in container images e.g. "0.1.0-tektonize.1-188" name: packageVersion + - name: shortSHA steps: - - image: mcr.microsoft.com/dotnet/sdk:3.1-focal@sha256:1d31e2582f69920c3a6ea9498bb7da285baffbca7ea84d90d9e5b545604cc92d - name: set-git-version + - name: set-git-version + image: $(params.toolbox-image) workingDir: $(workspaces.source.path) securityContext: runAsUser: 0 @@ -33,18 +35,14 @@ spec: - name: PARAM_BRANCH value: $(params.branch) script: | - #!/usr/bin/env bash - export PATH="$PATH:/tekton/home/.dotnet/tools" - dotnet tool install GitVersion.Tool --version 5.5.0 --tool-path "/tekton/home/.dotnet/tools" - - git checkout "${PARAM_BRANCH}" - - export GITVERSION=$(dotnet gitversion /showvariable FullSemVer) - echo -n "${GITVERSION}" | tee $(results.gitVersion.path) - + #!/usr/bin/env ash + ShortSha=$(/tools/dotnet-gitversion . /showvariable ShortSha) + echo -n "${ShortSha}" | tee $(results.shortSHA.path) + FullSemVer=$(/tools/dotnet-gitversion . /showvariable FullSemVer) + echo -n "${FullSemVer}" | tee $(results.gitVersion.path) # normalize a bit because # image tags can only contain `abcdefghijklmnopqrstuvwxyz0123456789_-.ABCDEFGHIJKLMNOPQRSTUVWXYZ` - export PACKAGEVERSION=$(echo -n $GITVERSION | sed 's/[^-._0-9A-Za-z]/-/g') + PACKAGEVERSION=$(echo -n $FullSemVer | sed 's/[^-._0-9A-Za-z]/-/g') echo -n "${PACKAGEVERSION}" | tee $(results.packageVersion.path) workspaces: - name: source