Skip to content

Commit

Permalink
fix(RELEASE-1086): fix linting issues
Browse files Browse the repository at this point in the history
- fix linting issues in rh-sign-image-cosign

Signed-off-by: Scott Hebert <[email protected]>
  • Loading branch information
scoheb committed Dec 19, 2024
1 parent 1a5b02e commit b08aba5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
3 changes: 3 additions & 0 deletions tasks/rh-sign-image-cosign/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Tekton task to sign container images in snapshot by cosign.
| signRegistryAccessPath | The relative path in the workspace to a text file that contains a list of repositories that needs registry.access.redhat.com image references to be signed (i.e. requires_terms=true), one repository string per line, e.g. "rhtas/cosign-rhel9". | No | - |
| retries | Retry cosign N times | Yes | 3 |

## Changes in 1.2.1
* fix linting issues

## Changes in 1.2.0
* Retry failed cosign

Expand Down
17 changes: 13 additions & 4 deletions tasks/rh-sign-image-cosign/rh-sign-image-cosign.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Task
metadata:
name: rh-sign-image-cosign
labels:
app.kubernetes.io/version: "1.2.0"
app.kubernetes.io/version: "1.2.1"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: release
Expand Down Expand Up @@ -77,15 +77,24 @@ spec:
run_cosign () { # Expected arguments are [digest_reference, tag_reference]
# Upload transparency log when rekor url is specified
if [ -v REKOR_URL ]; then
COSIGN_COMMON_ARGS="-y --rekor-url=$REKOR_URL --key $SIGN_KEY"
COSIGN_COMMON_ARGS=(
-y
--rekor-url="$REKOR_URL"
--key
"$SIGN_KEY"
)
else
COSIGN_COMMON_ARGS="--tlog-upload=false --key $SIGN_KEY"
COSIGN_COMMON_ARGS=(
-tlog-upload=false
--key
"$SIGN_KEY"
)
fi
echo "Signing manifest $1 ($2)"
attempt=0
until [ "$attempt" -gt "$(params.retries)" ] ; do # 3 retries by default
cosign -t 3m0s sign\
${COSIGN_COMMON_ARGS}\
"${COSIGN_COMMON_ARGS[@]}" \
--sign-container-identity "$2"\
"$1" && break
attempt=$((attempt+1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
_TEST_MANIFEST_LIST_OCI_REFERENCE="quay.io/redhat-pending/test-product----test-image0@sha256:0000"
_TEST_REPO="quay.io/redhat-pending/test-product----test-image0"
cat > $(workspaces.data.path)/snapshot_spec.json << EOF
cat > "$(workspaces.data.path)/snapshot_spec.json" << EOF
{
"application": "myapp",
"components": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
script: |
#!/usr/bin/env bash
set -eux
cat > $(workspaces.data.path)/snapshot_spec.json << EOF
cat > "$(workspaces.data.path)/snapshot_spec.json" << EOF
{
"application": "myapp",
"components": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
script: |
#!/usr/bin/env bash
set -eux
cat > $(workspaces.data.path)/snapshot_spec.json << EOF
cat > "$(workspaces.data.path)/snapshot_spec.json" << EOF
{
"application": "myapp",
"components": [
Expand Down

0 comments on commit b08aba5

Please sign in to comment.