fix
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user