Skip to content

Commit

Permalink
fix(RELEASE-1071): linting issues in extract-index-image (#740)
Browse files Browse the repository at this point in the history
Signed-off-by: Johnny Bieren <[email protected]>
  • Loading branch information
johnbieren authored Dec 16, 2024
1 parent cef8d58 commit 7f9f26d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
3 changes: 3 additions & 0 deletions tasks/extract-index-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ the workspace name for this task *must* be input.
| inputDataFile | File to read json data from | No | - |
| resultsDirPath | Path to results directory in the data workspace | No | - |

## Changes in 1.1.1
* Fix shellcheck/checkton linting issues in the task and tests

## Changes in 1.1.0
* Updated the base image used in this task

Expand Down
16 changes: 8 additions & 8 deletions tasks/extract-index-image/extract-index-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Task
metadata:
name: extract-index-image
labels:
app.kubernetes.io/version: "1.1.0"
app.kubernetes.io/version: "1.1.1"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: release
Expand All @@ -30,18 +30,18 @@ spec:
image: >-
quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f
script: |
#!/usr/bin/env sh
#!/usr/bin/env bash
set -ex
RESULTS_FILE="$(workspaces.data.path)/$(params.resultsDirPath)/extract-index-image-results.json"
jsonBuildInfo=`jq -cr .jsonBuildInfo $(params.inputDataFile)`
jsonBuildInfo=$(jq -cr .jsonBuildInfo "$(params.inputDataFile)")
indexImage=`echo $jsonBuildInfo | jq -cr .index_image`
echo -n $indexImage > $(results.indexImage.path)
indexImage=$(echo "$jsonBuildInfo" | jq -cr .index_image)
echo -n "$indexImage" > "$(results.indexImage.path)"
indexImageResolved=`echo $jsonBuildInfo | jq -cr .index_image_resolved`
echo -n $indexImageResolved > $(results.indexImageResolved.path)
indexImageResolved=$(echo "$jsonBuildInfo" | jq -cr .index_image_resolved)
echo -n "$indexImageResolved" > "$(results.indexImageResolved.path)"
jq -n --arg image "$indexImage" --arg resolved "$indexImageResolved" \
'{"index_image": {"index_image": $image, "index_image_resolved": $resolved}}' | tee $RESULTS_FILE
'{"index_image": {"index_image": $image, "index_image_resolved": $resolved}}' | tee "$RESULTS_FILE"
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
#!/usr/bin/env sh
set -eux
mkdir $(workspaces.data.path)/results
mkdir "$(workspaces.data.path)/results"
- name: run-task
taskRef:
name: extract-index-image
Expand Down
18 changes: 9 additions & 9 deletions tasks/extract-index-image/tests/test-extract-index-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ spec:
#!/usr/bin/env sh
set -eux
mkdir $(workspaces.data.path)/results
cat > $(workspaces.data.path)/file.json << EOF
mkdir "$(workspaces.data.path)/results"
cat > "$(workspaces.data.path)/file.json" << EOF
{
"jsonBuildInfo": {
"arches": [
Expand Down Expand Up @@ -93,21 +93,21 @@ spec:
- name: check-result
image: quay.io/konflux-ci/release-service-utils:e633d51cd41d73e4b3310face21bb980af7a662f
script: |
#!/usr/bin/env sh
#!/usr/bin/env bash
set -eux
echo Test the indexImage result was properly set
test $(echo $(params.indexImage)) == "redhat.com/rh-stage/iib:01"
test "$(params.indexImage)" == "redhat.com/rh-stage/iib:01"
echo Test the indexImageResolved result was properly set
test $(echo $(params.indexImageResolved)) == "redhat.com/rh-stage/iib@sha256:abcdefghijk"
test "$(params.indexImageResolved)" == "redhat.com/rh-stage/iib@sha256:abcdefghijk"
echo Check the results file
test $(jq -r '.index_image.index_image' \
$(workspaces.data.path)/results/extract-index-image-results.json) == \
test "$(jq -r '.index_image.index_image' \
"$(workspaces.data.path)/results/extract-index-image-results.json")" == \
"redhat.com/rh-stage/iib:01"
test $(jq -r '.index_image.index_image_resolved' \
$(workspaces.data.path)/results/extract-index-image-results.json) == \
test "$(jq -r '.index_image.index_image_resolved' \
"$(workspaces.data.path)/results/extract-index-image-results.json")" == \
"redhat.com/rh-stage/iib@sha256:abcdefghijk"
runAfter:
- run-task

0 comments on commit 7f9f26d

Please sign in to comment.