This commit is contained in:
2024-04-25 15:40:15 +02:00
parent 27d8f765a6
commit 61ab8e5afd
5 changed files with 31 additions and 28 deletions

View File

@@ -16,27 +16,40 @@ spec:
the base-version to the current timestamp.
params:
- name: base-version
description: Base product version
- name: toolbox-image
default: sebt3/basic-toolbox-image:1.29.4
description: The name of the toolbox image
type: string
- name: branch
type: string
default: "1.0"
results:
- name: timestamp
description: Current timestamp
- name: commitcount
description: Current commitcount
- name: build-id
description: ID of the current build
description: Current commitcount
steps:
- name: get-timestamp
image: docker.io/library/bash:5.0.18@sha256:879f94a9da53dc064779e7a68339aecd60a9028ff884cacaa47ae752ca690404 #tag: 5.0.18
image: $(params.toolbox-image)
script: |
#!/usr/bin/env bash
ts=`date "+%Y%m%d-%H%M%S"`
echo "Current Timestamp: ${ts}"
echo ${ts} | tr -d "\n" | tee $(results.timestamp.path)
- name: get-buildid
image: docker.io/library/bash:5.0.18@sha256:879f94a9da53dc064779e7a68339aecd60a9028ff884cacaa47ae752ca690404 #tag: 5.0.18
echo -n "Current Timestamp: "
echo -n ${ts} | tee $(results.timestamp.path)
- name: get-commitcount
image: $(params.toolbox-image)
script: |
#!/usr/bin/env bash
ts=`cat $(results.timestamp.path)`
buildId=$(inputs.params.base-version)-${ts}
echo ${buildId} | tr -d "\n" | tee $(results.build-id.path)
cc=`git rev-list --count HEAD`
echo -n "Commit Count: "
echo -n ${cc} | tee $(results.commitcount.path)
- name: get-build-id
image: $(params.toolbox-image)
script: |
#!/usr/bin/env bash
ts=`cat $(results.timestamp.path)|sed 's/-/./`
cc=`cat $(results.commitcount.path)`
buildId="$(params.branch)-${cc}.${ts}"
echo -n "Build ID: "
echo -n ${buildId} | tee $(results.build-id.path)