Skip to content
Draft
Show file tree
Hide file tree
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
31 changes: 31 additions & 0 deletions api/v1alpha1/imagebuild_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,32 @@ type DiskExport struct {
// PVC *PVCExport `json:"pvc,omitempty"`
}

// ArtifactRef captures the supply-chain traceability metadata for a build artifact.
// Registry and Digest are populated for any successful registry push.
// SBOMRef, SignatureRef, and ProvenanceRef are populated when their respective
// features (SBOM generation, Sigstore signing, Tekton Chains provenance) are active.
type ArtifactRef struct {
// Registry is the OCI registry URL where the artifact was pushed (IMAGE_URL)
// +optional
Registry string `json:"registry,omitempty"`

// Digest is the content-addressable digest of the pushed artifact (sha256:...)
// +optional
Digest string `json:"digest,omitempty"`

// SBOMRef is the OCI reference to the attached SBOM artifact
// +optional
SBOMRef string `json:"sbomRef,omitempty"`

// SignatureRef is the OCI reference to the cosign/Sigstore signature
// +optional
SignatureRef string `json:"signatureRef,omitempty"`

// ProvenanceRef is the OCI reference to the SLSA provenance attestation
// +optional
ProvenanceRef string `json:"provenanceRef,omitempty"`
}
Comment on lines +181 to +205

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Update the API docs to match the controller behavior.

These comments say artifact metadata is populated only when compliance is enabled, but the controller fills status.artifact.registry and status.artifact.digest for any successful registry push. That will mislead users of the new status field.

Also applies to: 257-260

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@api/v1alpha1/imagebuild_types.go` around lines 181 - 205, The doc comments
for ArtifactRef incorrectly state that registry/digest are populated only when
"compliance is enabled"; update the comments for ArtifactRef and the other
occurrence referencing the same behavior so they match controller behavior:
state that status.artifact.registry and status.artifact.digest are set for any
successful registry push, while SBOMRef, SignatureRef, and ProvenanceRef are
populated when their respective features (SBOM, signing/Sigstore,
provenance/Tekton Chains) are produced; reference ArtifactRef and the fields
Registry, Digest, SBOMRef, SignatureRef, ProvenanceRef and status.artifact to
locate the comments and change the wording accordingly.


// ImageBuildStatus defines the observed state of ImageBuild
type ImageBuildStatus struct {
// ObservedGeneration is the most recent generation observed by the controller.
Expand Down Expand Up @@ -227,6 +253,11 @@ type ImageBuildStatus struct {
// LeaseID is the Jumpstarter lease ID acquired during flash
// +optional
LeaseID string `json:"leaseId,omitempty"`

// Artifact captures supply-chain traceability metadata (digest, SBOM, signature, provenance)
// for the build output. Populated from PipelineRun results after a successful registry push.
// +optional
Artifact *ArtifactRef `json:"artifact,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
59 changes: 59 additions & 0 deletions api/v1alpha1/operatorconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,59 @@ func (c *WorkspacesConfig) GetAutoPauseTimeoutMinutes() int32 {
return DefaultAutoPauseTimeoutMinutes
}

// DefaultSyftImage is the default Syft container image for SBOM generation
const DefaultSyftImage = "docker.io/anchore/syft:v1.22.0"

// DefaultSBOMFormat is the default SBOM output format
const DefaultSBOMFormat = "spdx-json"

// ComplianceConfig configures supply-chain compliance features (SBOM, signing, policy).
// When Enabled, the operator appends an sbom-generate task to every build pipeline
// and populates ArtifactRef in the build status.
type ComplianceConfig struct {
// Enabled activates supply-chain compliance for build pipelines
// +kubebuilder:default=false
Enabled bool `json:"enabled"`

// SBOMFormat is the SBOM output format (spdx-json or cyclonedx-json)
// +kubebuilder:validation:Enum="spdx-json";"cyclonedx-json"
// +kubebuilder:default="spdx-json"
// +optional
SBOMFormat string `json:"sbomFormat,omitempty"`

// SyftImage is the container image for SBOM generation (Syft)
// +optional
SyftImage string `json:"syftImage,omitempty"`

// ECPolicyRef references an Enterprise Contract policy for optional gate enforcement
// +optional
ECPolicyRef string `json:"ecPolicyRef,omitempty"`

// RekorURL is the Rekor transparency log URL for Tekton Chains configuration
// +optional
RekorURL string `json:"rekorURL,omitempty"`

// FulcioURL is the Fulcio CA URL for keyless signing via Tekton Chains
// +optional
FulcioURL string `json:"fulcioURL,omitempty"`
}

// GetSBOMFormat returns the SBOM format, falling back to the default
func (c *ComplianceConfig) GetSBOMFormat() string {
if c != nil && c.SBOMFormat != "" {
return c.SBOMFormat
}
return DefaultSBOMFormat
}

// GetSyftImage returns the Syft image, falling back to the default
func (c *ComplianceConfig) GetSyftImage() string {
if c != nil && c.SyftImage != "" {
return c.SyftImage
}
return DefaultSyftImage
}

// OperatorConfigSpec defines the desired state of OperatorConfig
type OperatorConfigSpec struct {
// OSBuilds defines the configuration for OS build operations
Expand All @@ -455,6 +508,12 @@ type OperatorConfigSpec struct {
// Workspaces defines configuration for developer workspaces
// +optional
Workspaces *WorkspacesConfig `json:"workspaces,omitempty"`

// Compliance configures supply-chain compliance features (SBOM generation,
// signing endpoints, policy enforcement). When enabled, build pipelines
// gain SBOM generation and emit results for Tekton Chains.
// +optional
Compliance *ComplianceConfig `json:"compliance,omitempty"`
}

// OSBuildsConfig defines configuration for OS build operations
Expand Down
40 changes: 40 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions config/crd/bases/automotive.sdv.cloud.redhat.com_imagebuilds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,32 @@ spec:
description: AIBImageUsed is the automotive-image-builder container
image that was used for the build
type: string
artifact:
description: |-
Artifact captures supply-chain traceability metadata (digest, SBOM, signature, provenance)
for the build output. Populated from PipelineRun results after a successful registry push.
properties:
digest:
description: Digest is the content-addressable digest of the pushed
artifact (sha256:...)
type: string
provenanceRef:
description: ProvenanceRef is the OCI reference to the SLSA provenance
attestation
type: string
registry:
description: Registry is the OCI registry URL where the artifact
was pushed (IMAGE_URL)
type: string
sbomRef:
description: SBOMRef is the OCI reference to the attached SBOM
artifact
type: string
signatureRef:
description: SignatureRef is the OCI reference to the cosign/Sigstore
signature
type: string
type: object
builderImageUsed:
description: |-
BuilderImageUsed is the osbuild builder container image that was used for the build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,44 @@ spec:
type: object
type: object
type: object
compliance:
description: |-
Compliance configures supply-chain compliance features (SBOM generation,
signing endpoints, policy enforcement). When enabled, build pipelines
gain SBOM generation and emit results for Tekton Chains.
properties:
ecPolicyRef:
description: ECPolicyRef references an Enterprise Contract policy
for optional gate enforcement
type: string
enabled:
default: false
description: Enabled activates supply-chain compliance for build
pipelines
type: boolean
fulcioURL:
description: FulcioURL is the Fulcio CA URL for keyless signing
via Tekton Chains
type: string
rekorURL:
description: RekorURL is the Rekor transparency log URL for Tekton
Chains configuration
type: string
sbomFormat:
default: spdx-json
description: SBOMFormat is the SBOM output format (spdx-json or
cyclonedx-json)
enum:
- spdx-json
- cyclonedx-json
type: string
syftImage:
description: SyftImage is the container image for SBOM generation
(Syft)
type: string
required:
- enabled
type: object
containerBuilds:
description: ContainerBuilds defines configuration for container build
operations
Expand Down
12 changes: 12 additions & 0 deletions config/samples/automotive_v1_operatorconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ spec:
# value: "automotive"
# effect: "NoExecute"

# Compliance configuration for supply-chain security (SBOM, signing, policy)
# When enabled, pipelines gain SBOM generation and emit Tekton Chains results
# compliance:
# enabled: true
# sbomFormat: "spdx-json" # or "cyclonedx-json"
# syftImage: "docker.io/anchore/syft:v1.22.0"
# # RHTAS endpoints for Tekton Chains keyless signing
# rekorURL: "https://rekor.example.com"
# fulcioURL: "https://fulcio.example.com"
# # Enterprise Contract policy ref (stretch goal)
# ecPolicyRef: ""

# BuildAPI configuration for the Build API server
buildAPI:
# Optional: Authentication configuration for OIDC/JWT providers
Expand Down
Loading