Skip to content

Conversation

@tabbysable
Copy link
Member

For logging of errors, propagate python script return code through shell to Prow.

This should allow an email to be sent to job maintainers even in the case where the python script continued through a recoverable error.

(Per discussions during SIG Security Tooling working session)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 15, 2025
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 15, 2025
@tabbysable
Copy link
Member Author

/hold until #151 merges

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 15, 2025
Copy link
Member

@mtardy mtardy left a comment

Choose a reason for hiding this comment

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

/lgtm

only a few nits but I'm not sure those are even relevant.

python3 fetch-official-cve-feed.py | tee $OUTPUT_FILE
python3 fetch-official-cve-feed.py > "${OUTPUT_FILE}"
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
Copy link
Member

Choose a reason for hiding this comment

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

we've been using double brackets in the rest of the script, should we use it everywhere, do we care?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a very good question!

The existence of [ and [[ in bash is a historical accident (the former comes from historical bourne shell, the latter from historical korn shell) and they "should" be identical unless you're doing something inappropriately clever. :-D

I'll go ahead and make everything [[ for the sake of uniformity.


# python returns 7 to indicate recoverable errors
# Exit bash script now if unrecoverable python error
if [ $EXIT_CODE -ne 0 ] && [ $EXIT_CODE -ne 7 ]; then
Copy link
Member

Choose a reason for hiding this comment

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

again not expert in bash, but should we double quote all those vars?

python3 fetch-official-cve-feed.py > "${OUTPUT_FILE}"
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
RETURN_VALUE=$EXIT_CODE
Copy link
Member

Choose a reason for hiding this comment

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

or even this "$EXIT_CODE"?

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 15, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mtardy, tabbysable

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mtardy
Copy link
Member

mtardy commented Aug 15, 2025

I'll let you unhold this when you think it's ready :) I think it looks fine but you are the bash expert here

@tabbysable
Copy link
Member Author

Honestly, it would be good practice to run it through shellcheck and do all the things the linter suggests. I'll plan to do that ><

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 15, 2025
@mtardy
Copy link
Member

mtardy commented Aug 15, 2025

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 15, 2025
@tabbysable
Copy link
Member Author

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 15, 2025
@k8s-ci-robot k8s-ci-robot merged commit d71c617 into kubernetes:main Aug 15, 2025
2 checks passed
@tabbysable tabbysable deleted the check-return branch August 15, 2025 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants