Skip to content

Commit

Permalink
KONFLUX-3386 emit the commit timestamp
Browse files Browse the repository at this point in the history
Emit the commit timestamp as a result, this allows for subsequent tasks to consume it to get better reproducability.

Signed-off-by: Martin Basti <[email protected]>
  • Loading branch information
stuartwdouglas authored and MartinBasti committed Jun 14, 2024
1 parent 84f9441 commit 2c229bd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions task/git-clone-oci-ta/0.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The git-clone-oci-ta Task will clone a repo from the provided url and store it a
|---|---|
|SOURCE_ARTIFACT|The Trusted Artifact URI pointing to the artifact with the application source code.|
|commit|The precise commit SHA that was fetched by this Task.|
|commit-timestamp|The commit timestamp of the checkout|
|url|The precise URL that was fetched by this Task.|

## Workspaces
Expand Down
3 changes: 3 additions & 0 deletions task/git-clone-oci-ta/0.1/git-clone-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ spec:
type: string
- name: commit
description: The precise commit SHA that was fetched by this Task.
- name: commit-timestamp
description: The commit timestamp of the checkout
- name: url
description: The precise URL that was fetched by this Task.
volumes:
Expand Down Expand Up @@ -236,6 +238,7 @@ spec:
fi
printf "%s" "${RESULT_SHA}" >"$(results.commit.path)"
printf "%s" "${PARAM_URL}" >"$(results.url.path)"
git log -1 --pretty=%ct >"$(results.commit-timestamp.path)"
if [ "${PARAM_FETCH_TAGS}" = "true" ]; then
echo "Fetching tags"
Expand Down
3 changes: 3 additions & 0 deletions task/git-clone/0.1/git-clone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ spec:
name: commit
- description: The precise URL that was fetched by this Task.
name: url
- description: The commit timestamp of the checkout
name: commit-timestamp
steps:
- name: clone
env:
Expand Down Expand Up @@ -235,6 +237,7 @@ spec:
fi
printf "%s" "${RESULT_SHA}" > "$(results.commit.path)"
printf "%s" "${PARAM_URL}" > "$(results.url.path)"
git log -1 --pretty=%ct > "$(results.commit-timestamp.path)"
if [ "${PARAM_FETCH_TAGS}" = "true" ] ; then
echo "Fetching tags"
Expand Down

0 comments on commit 2c229bd

Please sign in to comment.