fix
This commit is contained in:
@@ -15,17 +15,19 @@ spec:
|
|||||||
description: >-
|
description: >-
|
||||||
This task can be used to create a version from git history
|
This task can be used to create a version from git history
|
||||||
params:
|
params:
|
||||||
- description: branch to checkout to create a version for e.g. "develop"
|
- name: gitversion-image
|
||||||
name: branch
|
default: gittools/gitversion:6.0.0-alpine.3.18-7.0
|
||||||
|
description: The name of the toolbox image
|
||||||
type: string
|
type: string
|
||||||
results:
|
results:
|
||||||
- description: The calculated git version you could use for git tagging e.g. "0.1.0-tektonize.1-188"
|
- description: The calculated git version you could use for git tagging e.g. "0.1.0-tektonize.1-188"
|
||||||
name: gitVersion
|
name: gitVersion
|
||||||
- description: A normalized version for use in container images e.g. "0.1.0-tektonize.1-188"
|
- description: A normalized version for use in container images e.g. "0.1.0-tektonize.1-188"
|
||||||
name: packageVersion
|
name: packageVersion
|
||||||
|
- name: shortSHA
|
||||||
steps:
|
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)
|
workingDir: $(workspaces.source.path)
|
||||||
securityContext:
|
securityContext:
|
||||||
runAsUser: 0
|
runAsUser: 0
|
||||||
@@ -33,18 +35,14 @@ spec:
|
|||||||
- name: PARAM_BRANCH
|
- name: PARAM_BRANCH
|
||||||
value: $(params.branch)
|
value: $(params.branch)
|
||||||
script: |
|
script: |
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env ash
|
||||||
export PATH="$PATH:/tekton/home/.dotnet/tools"
|
ShortSha=$(/tools/dotnet-gitversion . /showvariable ShortSha)
|
||||||
dotnet tool install GitVersion.Tool --version 5.5.0 --tool-path "/tekton/home/.dotnet/tools"
|
echo -n "${ShortSha}" | tee $(results.shortSHA.path)
|
||||||
|
FullSemVer=$(/tools/dotnet-gitversion . /showvariable FullSemVer)
|
||||||
git checkout "${PARAM_BRANCH}"
|
echo -n "${FullSemVer}" | tee $(results.gitVersion.path)
|
||||||
|
|
||||||
export GITVERSION=$(dotnet gitversion /showvariable FullSemVer)
|
|
||||||
echo -n "${GITVERSION}" | tee $(results.gitVersion.path)
|
|
||||||
|
|
||||||
# normalize a bit because
|
# normalize a bit because
|
||||||
# image tags can only contain `abcdefghijklmnopqrstuvwxyz0123456789_-.ABCDEFGHIJKLMNOPQRSTUVWXYZ`
|
# 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)
|
echo -n "${PACKAGEVERSION}" | tee $(results.packageVersion.path)
|
||||||
workspaces:
|
workspaces:
|
||||||
- name: source
|
- name: source
|
||||||
|
|||||||
Reference in New Issue
Block a user