Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(prefetch): fail step when error happen #1756

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ spec:
- name: sanitize-cachi2-config-file-with-yq
image: quay.io/konflux-ci/yq:latest@sha256:343c2ca0a347ae87fe43750ee0873e1fe813f77eff56e9722c840bb75d97fef2
script: |
#!/bin/bash

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 +167,10 @@ spec:
- name: INPUT
value: $(params.input)
script: |
#!/bin/bash

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 +191,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 +336,8 @@ spec:
script: |
#!/bin/bash

set -euo pipefail

if [ -f /shared/skip ]; then
echo "Skipping."
exit 0
Expand Down Expand Up @@ -398,6 +411,9 @@ spec:
image: quay.io/redhat-appstudio/cachi2:0.15.0@sha256:b141cb5cf4d98e6c5f668f1fe172e1d68f2a44ac1027403fbcff94ce1e68185d
script: |
#!/bin/bash

set -euo pipefail
Comment on lines 411 to +415
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof, I just saw the unregister-rhsm step at the end. This means the prefetch task will only unregister itself if it succeeds, otherwise it will leave a registration hanging around in the system.

But exiting on failure properly probably doesn't make that problem much worse than it already was

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

questionable is, how much of hanging are we talking about in ephemeral tasks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can rework it to hard way using an internal state

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by hard way I mean to trap errror, record it and skip all tasks except unregister


if [ -f /shared/skip ]; then
echo "Skipping."
exit 0
Expand Down
16 changes: 16 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,10 @@ spec:
- name: sanitize-cachi2-config-file-with-yq
image: quay.io/konflux-ci/yq:latest@sha256:343c2ca0a347ae87fe43750ee0873e1fe813f77eff56e9722c840bb75d97fef2
script: |
#!/bin/bash

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 +91,10 @@ spec:
- name: INPUT
value: $(params.input)
script: |
#!/bin/bash

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 +117,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 +269,8 @@ spec:
script: |
#!/bin/bash

set -euo pipefail

if [ -f /shared/skip ]; then
echo "Skipping."
exit 0
Expand Down Expand Up @@ -334,6 +347,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
Loading