File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -102,18 +102,25 @@ func (m *Ci) Test(ctx context.Context, dir *dagger.Directory) *dagger.Container
102102 WithExec ([]string {"bundle" , "exec" , "rails" , "test" })
103103}
104104
105+ // Creates an SBOM for the container
105106func (m * Ci ) Sbom (ctx context.Context , container * dagger.Container ) * dagger.File {
106- trivy := dag .Trivy (dagger.TrivyOpts {
107- DatabaseRepository : "public.ecr.aws/aquasecurity/trivy-db" ,
108- })
107+ trivy := dag .Trivy ()
109108
110109 sbom := trivy .Container (container ).
111- Report ("spdx-json " ).
112- WithName ("spdx .json" )
110+ Report ("cyclonedx " ).
111+ WithName ("cyclonedx .json" )
113112
114113 return sbom
115114}
116115
116+ // Builds the container and creates an SBOM for it
117+ func (m * Ci ) SbomBuild (ctx context.Context , dir * dagger.Directory ) * dagger.File {
118+ container := m .Build (ctx , dir )
119+
120+ return m .Sbom (ctx , container )
121+ }
122+
123+ // Scans the SBOM for vulnerabilities
117124func (m * Ci ) Vulnscan (ctx context.Context , sbom * dagger.File ) * dagger.File {
118125 trivy := dag .Trivy (dagger.TrivyOpts {
119126 DatabaseRepository : "public.ecr.aws/aquasecurity/trivy-db" ,
You can’t perform that action at this time.
0 commit comments