mirror of
https://github.com/containers/podman.git
synced 2025-12-01 10:38:05 +08:00
Bumps to Buildah v1.40.0 and adds the `--inherits-labels` option to build and farm build man pages. Also turn off the inherit-labels option test for now as it seems to be rathr unhappy. Issue for inherit-labels test failure: https://github.com/containers/podman/issues/25938 Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
68 lines
2.4 KiB
Go
68 lines
2.4 KiB
Go
package sbom
|
|
|
|
import (
|
|
"slices"
|
|
|
|
"github.com/containers/buildah/define"
|
|
)
|
|
|
|
// Preset returns a predefined SBOMScanOptions structure that has the passed-in
|
|
// name as one of its "Type" values.
|
|
func Preset(name string) (preset *define.SBOMScanOptions, err error) {
|
|
// If you change these, make sure you update references in
|
|
// buildah-commit.1.md and buildah-build.1.md to match!
|
|
presets := []define.SBOMScanOptions{
|
|
{
|
|
Type: []string{"", "syft", "syft-cyclonedx"},
|
|
Image: "ghcr.io/anchore/syft",
|
|
Commands: []string{
|
|
"/syft scan -q dir:{ROOTFS} --output cyclonedx-json={OUTPUT}",
|
|
"/syft scan -q dir:{CONTEXT} --output cyclonedx-json={OUTPUT}",
|
|
},
|
|
// ImageSBOMOutput: "/root/buildinfo/content_manifests/sbom-cyclonedx.json",
|
|
// ImagePURLOutput: "/root/buildinfo/content_manifests/sbom-purl.json",
|
|
MergeStrategy: define.SBOMMergeStrategyCycloneDXByComponentNameAndVersion,
|
|
},
|
|
{
|
|
Type: []string{"syft-spdx"},
|
|
Image: "ghcr.io/anchore/syft",
|
|
Commands: []string{
|
|
"/syft scan -q dir:{ROOTFS} --output spdx-json={OUTPUT}",
|
|
"/syft scan -q dir:{CONTEXT} --output spdx-json={OUTPUT}",
|
|
},
|
|
// ImageSBOMOutput: "/root/buildinfo/content_manifests/sbom-spdx.json",
|
|
// ImagePURLOutput: "/root/buildinfo/content_manifests/sbom-purl.json",
|
|
MergeStrategy: define.SBOMMergeStrategySPDXByPackageNameAndVersionInfo,
|
|
},
|
|
|
|
{
|
|
Type: []string{"trivy", "trivy-cyclonedx"},
|
|
Image: "ghcr.io/aquasecurity/trivy",
|
|
Commands: []string{
|
|
"trivy filesystem -q {ROOTFS} --format cyclonedx --output {OUTPUT}",
|
|
"trivy filesystem -q {CONTEXT} --format cyclonedx --output {OUTPUT}",
|
|
},
|
|
// ImageSBOMOutput: "/root/buildinfo/content_manifests/sbom-cyclonedx.json",
|
|
// ImagePURLOutput: "/root/buildinfo/content_manifests/sbom-purl.json",
|
|
MergeStrategy: define.SBOMMergeStrategyCycloneDXByComponentNameAndVersion,
|
|
},
|
|
{
|
|
Type: []string{"trivy-spdx"},
|
|
Image: "ghcr.io/aquasecurity/trivy",
|
|
Commands: []string{
|
|
"trivy filesystem -q {ROOTFS} --format spdx-json --output {OUTPUT}",
|
|
"trivy filesystem -q {CONTEXT} --format spdx-json --output {OUTPUT}",
|
|
},
|
|
// ImageSBOMOutput: "/root/buildinfo/content_manifests/sbom-spdx.json",
|
|
// ImagePURLOutput: "/root/buildinfo/content_manifests/sbom-purl.json",
|
|
MergeStrategy: define.SBOMMergeStrategySPDXByPackageNameAndVersionInfo,
|
|
},
|
|
}
|
|
for _, preset := range presets {
|
|
if slices.Contains(preset.Type, name) {
|
|
return &preset, nil
|
|
}
|
|
}
|
|
return nil, nil
|
|
}
|