This commit is contained in:
2024-04-21 17:50:41 +02:00
parent dd86eca939
commit 93388577df
2 changed files with 6 additions and 2 deletions

View File

@@ -113,6 +113,9 @@ spec:
workspace: ssh workspace: ssh
- name: git-version - name: git-version
runAfter: [git-clone] runAfter: [git-clone]
params:
- name: branch
value: $(params.branch-name)
taskRef: taskRef:
name: git-version name: git-version
workspaces: workspaces:

View File

@@ -19,6 +19,8 @@ spec:
default: gittools/gitversion:6.0.0-alpine.3.18-7.0 default: gittools/gitversion:6.0.0-alpine.3.18-7.0
description: The name of the toolbox image description: The name of the toolbox image
type: string type: string
- name: branch
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
@@ -31,8 +33,7 @@ spec:
workingDir: $(workspaces.source.path) workingDir: $(workspaces.source.path)
script: | script: |
#!/usr/bin/env ash #!/usr/bin/env ash
git branch git checkout $(params.branch)
git log
ShortSha=$(/tools/dotnet-gitversion . /showvariable ShortSha) ShortSha=$(/tools/dotnet-gitversion . /showvariable ShortSha)
echo -n "${ShortSha}" | tee $(results.shortSHA.path) echo -n "${ShortSha}" | tee $(results.shortSHA.path)
FullSemVer=$(/tools/dotnet-gitversion . /showvariable FullSemVer) FullSemVer=$(/tools/dotnet-gitversion . /showvariable FullSemVer)