Skip to content

Commit

Permalink
Add short-commit to git-clone-oci-ta task as well
Browse files Browse the repository at this point in the history
- Update parameter format to match other parameters (use camel case)
- Update READMEs
  • Loading branch information
samdoran committed Sep 18, 2024
1 parent e721def commit 2d4f493
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions task/git-clone-oci-ta/0.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ The git-clone-oci-ta Task will clone a repo from the provided url and store it a
|url|Repository URL to clone from.||true|
|userHome|Absolute path to the user's home directory. Set this explicitly if you are running the image as a non-root user. |/tekton/home|false|
|verbose|Log the commands that are executed during `git-clone`'s operation.|false|false|
|shortCommitLength|Length of the returned short-commit|7|false|

## Results
|name|description|
|---|---|
|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.|
|short-commit|The commit SHA that was fetched by this Task shortened to `shortCommitLength` number of characters|
|commit-timestamp|The commit timestamp of the checkout|
|url|The precise URL that was fetched by this Task.|

Expand Down
7 changes: 7 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 @@ -94,13 +94,19 @@ spec:
operation.
type: string
default: "false"
- name: shortCommitLength
description: Length of short commit SHA
type: string
default: 7
results:
- name: SOURCE_ARTIFACT
description: The Trusted Artifact URI pointing to the artifact with
the application source code.
type: string
- name: commit
description: The precise commit SHA that was fetched by this Task.
- name: short-commit
description: The commit SHA that was fetched by this Task limited to params.shortCommitLength number of characters
- name: commit-timestamp
description: The commit timestamp of the checkout
- name: url
Expand Down Expand Up @@ -237,6 +243,7 @@ spec:
exit "${EXIT_CODE}"
fi
printf "%s" "${RESULT_SHA}" >"$(results.commit.path)"
printf "%s" "${RESULT_SHA::$(params.shortCommitLength)}" > "$(results.short-commit.path)"
printf "%s" "${PARAM_URL}" >"$(results.url.path)"
printf "%s" "$(git log -1 --pretty=%ct)" >"$(results.commit-timestamp.path)"
Expand Down
4 changes: 2 additions & 2 deletions task/git-clone/0.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ The git-clone Task will clone a repo from the provided url into the output Works
|userHome|Absolute path to the user's home directory. Set this explicitly if you are running the image as a non-root user or have overridden the gitInitImage param with an image containing custom user configuration. |/tekton/home|false|
|enableSymlinkCheck|Check symlinks in the repo. If they're pointing outside of the repo, the build will fail.|true|false|
|fetchTags|Fetch all tags for the repo.|false|false|
|short-commit-length|Length of the returned short-commit|7|false|
|shortCommitLength|Length of the returned short-commit|7|false|

## Results
|name|description|
|---|---|
|commit|The precise commit SHA that was fetched by this Task.|
|short-commit|The precise commit SHA that was fetched by this Task.|
|short-commit|The commit SHA that was fetched by this Task shortened to `shortCommitLength` number of characters||
|url|The precise URL that was fetched by this Task.|

## Workspaces
Expand Down
8 changes: 4 additions & 4 deletions task/git-clone/0.1/git-clone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,17 @@ spec:
type: string
description: The name of the key in the ConfigMap that contains the CA bundle data.
default: ca-bundle.crt
- name: short-commit-length
- name: shortCommitLength
description: Length of short commit SHA
type: string
default: 7
results:
- description: The precise commit SHA that was fetched by this Task.
name: commit
- description: The commit SHA that was fetched by this Task limited to params.shortCommitLength number of characters
name: short-commit
- description: The precise URL that was fetched by this Task.
name: url
- description: The commit SHA that was fetched by this Task limited to the params.short-commit-length number of characters
name: short-commit
- description: The commit timestamp of the checkout
name: commit-timestamp
steps:
Expand Down Expand Up @@ -242,7 +242,7 @@ spec:
exit "${EXIT_CODE}"
fi
printf "%s" "${RESULT_SHA}" > "$(results.commit.path)"
printf "%s" "${RESULT_SHA::$(params.short-commit-length)}" > "$(results.short-commit.path)"
printf "%s" "${RESULT_SHA::$(params.shortCommitLength)}" > "$(results.short-commit.path)"
printf "%s" "${PARAM_URL}" > "$(results.url.path)"
printf "%s" "$(git log -1 --pretty=%ct)" > "$(results.commit-timestamp.path)"
Expand Down

0 comments on commit 2d4f493

Please sign in to comment.