fix: Trivy download into dapper container is skipped#12219
fix: Trivy download into dapper container is skipped#12219dereknola merged 5 commits intok3s-io:masterfrom
Conversation
|
This works just fine on |
|
@dereknola This came up while trying to compile for i386 on a amd64 host even after adding I added a However while investigating it looks like there is another bug that causes trivy scans to get skipped for everything except Some additional inspection for I inspected the Dapper image that gets generated with Empirical test: # check env
go env GOARCH
docker build -t k3s-dapper:latest -f Dockerfile.dapper .
docker run -it --rm --entrypoint "" k3s-dapper:latest /bin/sh
# check for trivy inside container
docker run -it --rm --entrypoint "" k3s-dapper:latest which trivy
docker run -it --rm --entrypoint "" k3s-dapper:latest /usr/local/bin/trivy |
Signed-off-by: holysoles <holysoles97@gmail.com>
Signed-off-by: holysoles <holysoles97@gmail.com>
|
Excellent points. The Trivy download inside the Dockerfile.dapper is from legacy build systems that are not being exercised in our CI today. We don't call |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #12219 +/- ##
===========================================
- Coverage 40.58% 19.92% -20.67%
===========================================
Files 187 184 -3
Lines 19286 19221 -65
===========================================
- Hits 7827 3829 -3998
- Misses 10272 14961 +4689
+ Partials 1187 431 -756
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Pretty sure the CI jobs are failing since now trivy doesnt exist on the GHA runners.. Want me to instead just go ahead and do the work now to remove trivy references from Dapper and Otherwise this is probably just best closed, doesnt seem worth altering the |
|
I'm not sure when the trivy removal will happen, so lets just take an easy way out for you and change the image_scan.sh to check if trivy command is found first before calling it. That way if it is still being used "somewhere" in the Drone CI, it doesn't break that. |
Signed-off-by: holysoles <holysoles97@gmail.com>
|
@dereknola should be set, let me know if you have any feedback! |
Signed-off-by: Derek Nola <derek.nola@suse.com>
Signed-off-by: Derek Nola <derek.nola@suse.com>
* only run trivy if executable is available Signed-off-by: holysoles <holysoles97@gmail.com> Signed-off-by: Derek Nola <derek.nola@suse.com> Co-authored-by: Derek Nola <derek.nola@suse.com> (cherry picked from commit 412a21e) Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
* only run trivy if executable is available Signed-off-by: holysoles <holysoles97@gmail.com> Signed-off-by: Derek Nola <derek.nola@suse.com> Co-authored-by: Derek Nola <derek.nola@suse.com> (cherry picked from commit 412a21e) Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
* only run trivy if executable is available Signed-off-by: holysoles <holysoles97@gmail.com> Signed-off-by: Derek Nola <derek.nola@suse.com> Co-authored-by: Derek Nola <derek.nola@suse.com> (cherry picked from commit 412a21e) Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
* only run trivy if executable is available Signed-off-by: holysoles <holysoles97@gmail.com> Signed-off-by: Derek Nola <derek.nola@suse.com> Co-authored-by: Derek Nola <derek.nola@suse.com> (cherry picked from commit 412a21e) Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
* only run trivy if executable is available Signed-off-by: holysoles <holysoles97@gmail.com> Signed-off-by: Derek Nola <derek.nola@suse.com> Co-authored-by: Derek Nola <derek.nola@suse.com> (cherry picked from commit 412a21e) Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
* only run trivy if executable is available Signed-off-by: holysoles <holysoles97@gmail.com> Signed-off-by: Derek Nola <derek.nola@suse.com> Co-authored-by: Derek Nola <derek.nola@suse.com> (cherry picked from commit 412a21e) Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
* only run trivy if executable is available Signed-off-by: holysoles <holysoles97@gmail.com> Signed-off-by: Derek Nola <derek.nola@suse.com> Co-authored-by: Derek Nola <derek.nola@suse.com> (cherry picked from commit 412a21e) Signed-off-by: Brad Davidson <brad.davidson@rancher.com>

Proposed Changes
When building k3s from source using dapper, trivy is not downloaded and the build fails when trivy attempts to be executed.
Each
RUNstatement is executed in its own shell environment, soTRIVY_ARCHis empty when checked in the followingRUN.Types of Changes
Bugfix for Dapper Dockerfile
Verification
Check that your go architecture (
go env GOARCH) is one of the following:arm64,amd64,s390xThen, follow the instructions in BUILDING.md:
Testing
This change is not covered by tests, as it is a build workflow.
Linked Issues
N/A
User-Facing Change
Further Comments