Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions pkg/compose/build_bake.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ type bakeTarget struct {
Entitlements []string `json:"entitlements,omitempty"`
ExtraHosts map[string]string `json:"extra-hosts,omitempty"`
Outputs []string `json:"output,omitempty"`
Attest []string `json:"attest,omitempty"`
}

type bakeMetadata map[string]buildStatus
Expand Down Expand Up @@ -255,6 +256,7 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project

Outputs: outputs,
Call: call,
Attest: toBakeAttest(build),
}
}

Expand Down Expand Up @@ -308,6 +310,12 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
args = append(args, "--allow", "security.insecure")
}
}
if options.SBOM != "" {
args = append(args, "--sbom="+options.SBOM)
}
if options.Provenance != "" {
args = append(args, "--provenance="+options.Provenance)
}

if options.Builder != "" {
args = append(args, "--builder", options.Builder)
Expand Down Expand Up @@ -458,6 +466,30 @@ func toBakeSecrets(project *types.Project, secrets []types.ServiceSecretConfig)
return s
}

func toBakeAttest(build types.BuildConfig) []string {
var attests []string

// Handle per-service provenance configuration (only from build config, not global options)
if build.Provenance != "" {
if build.Provenance == "true" {
attests = append(attests, "type=provenance")
} else if build.Provenance != "false" {
attests = append(attests, fmt.Sprintf("type=provenance,%s", build.Provenance))
}
}

// Handle per-service SBOM configuration (only from build config, not global options)
if build.SBOM != "" {
if build.SBOM == "true" {
attests = append(attests, "type=sbom")
} else if build.SBOM != "false" {
attests = append(attests, fmt.Sprintf("type=sbom,%s", build.SBOM))
}
}

return attests
}

func dockerFilePath(ctxName string, dockerfile string) string {
if dockerfile == "" {
return ""
Expand Down