-
Notifications
You must be signed in to change notification settings - Fork 61
Run syft directly to collect SBOM #1787
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
Changes from 1 commit
6ab9ab4
d61a6d1
865cb63
8fb672e
90ce77d
3d0b551
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| ARG SYFT_IMAGE_NAME | ||
| ARG TARGET_IMAGE_NAME | ||
|
|
||
| FROM ${SYFT_IMAGE_NAME} AS syft | ||
| FROM ${TARGET_IMAGE_NAME} AS target | ||
|
|
||
| RUN --mount=from=syft,source=/,target=/syft /syft/syft scan / --select-catalogers image -o spdx-json=/manifest.spdx.json | ||
|
|
||
| FROM scratch | ||
| COPY --from=target /manifest.spdx.json /manifest.spdx.json | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/usr/bin/env pwsh | ||
|
|
||
| [cmdletbinding()] | ||
| param( | ||
| [Parameter(Mandatory = $true, Position = 0)] | ||
| [string]$Image, | ||
|
|
||
| [Parameter(Mandatory = $false)] | ||
| [int]$Retries = 2, | ||
|
|
||
| [Parameter(Mandatory = $false)] | ||
| [int]$WaitFactor = 6 | ||
| ) | ||
|
|
||
| Set-StrictMode -Version Latest | ||
| $ErrorActionPreference = 'Stop' | ||
|
|
||
| & "$PSScriptRoot/Invoke-WithRetry.ps1" "docker pull $Image" -Retries $Retries -WaitFactor $WaitFactor |
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,3 +4,4 @@ variables: | |||||
| imageNames.imageBuilder.withrepo: imagebuilder-withrepo:$(Build.BuildId)-$(System.JobId) | ||||||
| imageNames.testRunner: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux3.0-docker-testrunner | ||||||
| imageNames.testRunner.withrepo: testrunner-withrepo:$(Build.BuildId)-$(System.JobId) | ||||||
| imageNames.syft: anchore/syft:v1.26.1 | ||||||
|
||||||
| imageNames.syft: anchore/syft:v1.26.1 | |
| imageNames.syft: anchore/syft:v1.32.0-debug |
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.
Fixed with 865cb63.
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.
Does this work for distroless images? Since it's using shell form and not exec form.
Here's the dotnet-docker test implementation, for reference: https://github.com/dotnet/dotnet-docker/blob/8e0a89c21c0eedc9658c3e4e9019693711869828/tests/Microsoft.DotNet.Docker.Tests/SyftHelper.cs#L138-L150
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.
Indeed it doesn't. I followed your pattern the tests. Fixed with 8fb672e. You should be able to consume this Dockerfile from the tests. I solved the issue of setting the source name by using an environment variable so I don't need to pass it in and have the value resolution problem.