-
Notifications
You must be signed in to change notification settings - Fork 42
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(KFLUXBUGS-1581): force releaseNotes.type when cves defined #619
base: development
Are you sure you want to change the base?
Conversation
Skipping CI for Draft Pull Request. |
c01d208
to
30d70b4
Compare
This commit modifies the create-advisory task to fail when releaseNotes.type is RHSA but there are no CVEs listed as fixed. Also, if there are CVEs fixed, the type is forced to be RHSA regardless of what type the user provides. Signed-off-by: Johnny Bieren <[email protected]>
30d70b4
to
9b3c6ae
Compare
@johnbieren: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
@@ -55,10 +55,10 @@ spec: | |||
RESULTS_FILE="$(workspaces.data.path)/$(params.resultsDirPath)/create-advisory-results.json" | |||
# Obtain application from snapshot | |||
application=$(jq -rc .application "$(workspaces.data.path)/$(params.snapshotPath)") | |||
application=$(jq -r .application "$(workspaces.data.path)/$(params.snapshotPath)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-r
doesn't make sense here - it's an object, not just a string. So if anything, I would change it to -c
.
# Obtain origin workspace from releasePlanAdmission | ||
origin=$(jq -rc '.spec.origin' "$(workspaces.data.path)/$(params.releasePlanAdmissionPath)") | ||
origin=$(jq -r '.spec.origin' "$(workspaces.data.path)/$(params.releasePlanAdmissionPath)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this is a string, right? So yeah, I agree. But how did this work before? There must have been redundant ""
in the string passed to the IR...
NUM_CVES=$(jq '.content.images[]?.cves.fixed // 0 | length' <<< "$advisoryData" \ | ||
| awk '{sum=sum+$0} END{print sum}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do the sum directly with jq
. Also, while it works with the default 0
, you're expecting an array, so defaulting to []
seems more correct.
NUM_CVES=$(jq '.content.images[]?.cves.fixed // 0 | length' <<< "$advisoryData" \ | |
| awk '{sum=sum+$0} END{print sum}') | |
NUM_CVES=$(jq '[.content.images[]?.cves.fixed // [] | length] | add' <<< "$advisoryData") |
But if you prefer awk, that's fine with me.
This commit modifies the create-advisory task to fail when releaseNotes.type is RHSA but there are no CVEs listed as fixed. Also, if there are CVEs fixed, the type is forced to be RHSA regardless of what type the user provides.