Skip to content

Commit

Permalink
feat(HACBS-2405): add a setup script for tekton task testing
Browse files Browse the repository at this point in the history
The new tekton dir will be used for storing init scripts
for tekton task testing in the release-service-bundles
repo.

This change is needed by
konflux-ci/release-service-catalog#159

Signed-off-by: Martin Malina <[email protected]>
  • Loading branch information
mmalina committed Aug 10, 2023
1 parent 34901b1 commit 8c16038
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ RUN update-ca-trust

COPY pyxis /home/pyxis
COPY utils /home/utils
COPY tekton /home/tekton

# Set HOME variable to something else than `/` to avoid 'permission denied' problems when writing files.
ENV HOME=/tekton/home
ENV PATH="$PATH:/home/pyxis:/home/utils"
ENV PATH="$PATH:/home/pyxis:/home/utils:/home/tekton"
24 changes: 24 additions & 0 deletions tekton/test-push-sbom-to-pyxis
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Description: This script is meant to set up mocks at the beginning
# of each step of the push-sbom-to-pyxis task.

function cosign() {
echo Mock cosign called with: $*

if [[ "$*" != "download sbom --output-file myImageID"[12]".json imageurl"[12] ]]
then
echo Error: Unexpected call
exit 1
fi

touch /workdir/sboms/${4}
}

function upload_sbom() {
echo Mock upload_sbom called with: $*

if [[ "$*" != "--retry --sbom-path "*".json" ]]
then
echo Error: Unexpected call
exit 1
fi
}
16 changes: 16 additions & 0 deletions tekton/test-push-sbom-to-pyxis-no-snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Description: This script is meant to set up mocks at the beginning
# of each step of the push-sbom-to-pyxis task.

function cosign() {
echo Mock cosign called with: $*

echo Error: cosign should not be called
exit 1
}

function upload_sbom() {
echo Mock upload_sbom called with: $*

echo Error: upload_sbom should not be called
exit 1
}
16 changes: 16 additions & 0 deletions tekton/test-push-sbom-to-pyxis-urls-ids-mismatch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Description: This script is meant to set up mocks at the beginning
# of each step of the push-sbom-to-pyxis task.

function cosign() {
echo Mock cosign called with: $*

echo Error: cosign should not be called
exit 1
}

function upload_sbom() {
echo Mock upload_sbom called with: $*

echo Error: upload_sbom should not be called
exit 1
}

0 comments on commit 8c16038

Please sign in to comment.