Skip to content

Commit

Permalink
fix(prefetch): fail step when error happen
Browse files Browse the repository at this point in the history
Task were failing silently causing harder to debug errors or misleding
users that different step failed. Ensure that steps aren't failing
silently and we don't run unnecessary steps after failure.

Signed-off-by: Martin Basti <[email protected]>
  • Loading branch information
MartinBasti committed Dec 13, 2024
1 parent 60665bd commit a97c1e4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ spec:
- name: sanitize-cachi2-config-file-with-yq
image: quay.io/konflux-ci/yq:latest@sha256:343c2ca0a347ae87fe43750ee0873e1fe813f77eff56e9722c840bb75d97fef2
script: |
set -euo pipefail
if [ -n "${CONFIG_FILE_CONTENT}" ]; then
# we need to drop 'goproxy_url' for safety reasons until cachi2 decides what the SBOM
# impact of this configuration option will be:
Expand All @@ -163,6 +165,8 @@ spec:
- name: INPUT
value: $(params.input)
script: |
set -euo pipefail
if [ -z "${INPUT}" ]; then
# Confirm input was provided though it's likely the whole task would be skipped if it wasn't
echo "No prefetch will be performed because no input was provided for cachi2 fetch-deps"
Expand All @@ -183,6 +187,9 @@ spec:
value: $(params.ACTIVATION_KEY)
script: |
#!/bin/bash
set -euo pipefail
if [ -f /shared/skip ]; then
echo "Skipping."
exit 0
Expand Down Expand Up @@ -325,6 +332,8 @@ spec:
script: |
#!/bin/bash
set -euo pipefail
if [ -f /shared/skip ]; then
echo "Skipping."
exit 0
Expand Down Expand Up @@ -398,6 +407,9 @@ spec:
image: quay.io/redhat-appstudio/cachi2:0.15.0@sha256:b141cb5cf4d98e6c5f668f1fe172e1d68f2a44ac1027403fbcff94ce1e68185d
script: |
#!/bin/bash
set -euo pipefail
if [ -f /shared/skip ]; then
echo "Skipping."
exit 0
Expand Down
14 changes: 14 additions & 0 deletions task/prefetch-dependencies/0.1/prefetch-dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ spec:
- name: sanitize-cachi2-config-file-with-yq
image: quay.io/konflux-ci/yq:latest@sha256:343c2ca0a347ae87fe43750ee0873e1fe813f77eff56e9722c840bb75d97fef2
script: |
set -euo pipefail
if [ -n "${CONFIG_FILE_CONTENT}" ]
then
# we need to drop 'goproxy_url' for safety reasons until cachi2 decides what the SBOM
Expand All @@ -87,6 +90,9 @@ spec:
- name: INPUT
value: $(params.input)
script: |
set -euo pipefail
if [ -z "${INPUT}" ]
then
# Confirm input was provided though it's likely the whole task would be skipped if it wasn't
Expand All @@ -109,6 +115,9 @@ spec:
type: string
script: |
#!/bin/bash
set -euo pipefail
if [ -f /shared/skip ]; then
echo "Skipping."
exit 0
Expand Down Expand Up @@ -258,6 +267,8 @@ spec:
script: |
#!/bin/bash
set -euo pipefail
if [ -f /shared/skip ]; then
echo "Skipping."
exit 0
Expand Down Expand Up @@ -334,6 +345,9 @@ spec:
# the cluster will set imagePullPolicy to IfNotPresent
script: |
#!/bin/bash
set -euo pipefail
if [ -f /shared/skip ]; then
echo "Skipping."
exit 0
Expand Down

0 comments on commit a97c1e4

Please sign in to comment.