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

RHOAIENG-16076: tests(gha): pre-pull trivy vulnerabilities db to prevent failures to download later #777

Merged

Conversation

jiridanek
Copy link
Member

@jiridanek jiridanek commented Nov 22, 2024

https://issues.redhat.com/browse/RHOAIENG-16076

Description

Another chunk of the

changes to be reviewed and merged.

Turns out that Trivy does not fail to pull the db if the pull happens soon enough after the GHA starts.

How Has This Been Tested?

GHA

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

@jiridanek jiridanek added the trivy-scan This label that allows trivy to create a security report on the pull requests label Nov 22, 2024
@jiridanek jiridanek changed the title wip: see if I can help trivy RHOAIENG-16076: tests(gha): pre-pull trivy vulnerabilities db to prevent failures to download later Nov 24, 2024
@jiridanek jiridanek added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Nov 24, 2024
Copy link
Contributor

openshift-ci bot commented Nov 24, 2024

@jiridanek: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/notebooks-ubi9-e2e-tests 9a09c37 link true /test notebooks-ubi9-e2e-tests

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.

@jstourac
Copy link
Member

/lgtm

@jiridanek
Copy link
Member Author

/cc @caponetto

@openshift-ci openshift-ci bot requested a review from caponetto November 25, 2024 12:38
@@ -114,6 +115,26 @@ jobs:
systemctl --user start homebrew.podman.service
echo "PODMAN_SOCK=/run/user/${UID}/podman/podman.sock" >> $GITHUB_ENV

# only one db can be downloaded in one call https://github.com/aquasecurity/trivy/issues/3616
- name: Pre-pull Trivy vulnerabilities DB
if: ${{ contains(fromJson(inputs.github).event.pull_request.labels.*.name, 'trivy-scan') }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of having a dedicated step for this code, can it be run as part of the Run Trivy vulnerability scanner step? Besides PR+Label, the Trivy scan also runs through the schedule trigger.

Copy link
Member Author

Choose a reason for hiding this comment

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

the whole idea of this PR is to have this as a separate step; trivy likes to fail the db download very often if I don't pre-pull

It prevents problems like skupperproject/skupper-router#1642 (my previous project) has been experiencing recently. They fixed it by deleting the trivy scan from their gha; I think my fix is more nuanced ;P

thanks for catching the missing case with scheduled scans, I'll add that to the step run condition

Copy link
Member Author

Choose a reason for hiding this comment

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

when there are long-ish running tests that make the trivy run even later in the job, it fails even more

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@openshift-ci openshift-ci bot removed the lgtm label Nov 25, 2024
@caponetto
Copy link
Contributor

/lgtm

@jiridanek
Copy link
Member Author

/override ci/prow/images
/approve

@jstourac
Copy link
Member

/lgtm

Copy link
Contributor

openshift-ci bot commented Nov 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jiridanek

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

Copy link
Contributor

openshift-ci bot commented Nov 25, 2024

@jiridanek: Overrode contexts on behalf of jiridanek: ci/prow/images

In response to this:

/override ci/prow/images
/approve

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.

@openshift-merge-bot openshift-merge-bot bot merged commit 6477ed4 into opendatahub-io:main Nov 25, 2024
7 checks passed
@jiridanek jiridanek linked an issue Nov 25, 2024 that may be closed by this pull request
jiridanek added a commit to jiridanek/notebooks that referenced this pull request Dec 18, 2024
…ent failures to download later (opendatahub-io#777)

* RHOAIENG-16076: tests(gha): pre-pull trivy vulnerabilities db to prevent failures to download later

* fix from review; use the only true condition to check if trivy should run

(cherry picked from commit 6477ed4)
jiridanek added a commit to jiridanek/notebooks that referenced this pull request Dec 19, 2024
…ent failures to download later (opendatahub-io#777)

* RHOAIENG-16076: tests(gha): pre-pull trivy vulnerabilities db to prevent failures to download later

* fix from review; use the only true condition to check if trivy should run

(cherry picked from commit 6477ed4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. trivy-scan This label that allows trivy to create a security report on the pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trivy failed to download vulnerability DB
3 participants