Skip to content
Merged
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
2,606 changes: 2,010 additions & 596 deletions charts/tekton-operator/templates/kubernetes-crds.yaml

Large diffs are not rendered by default.

2,782 changes: 2,098 additions & 684 deletions charts/tekton-operator/templates/openshift-crds.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

474 changes: 474 additions & 0 deletions config/base/generated-crds/operator.tekton.dev_tektonchains.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ spec:
type: string
storage.grafeas.projectid:
type: string
storage.oci.encoding-format:
type: string
storage.oci.repository:
type: string
storage.oci.repository.insecure:
Expand Down
472 changes: 472 additions & 0 deletions config/base/generated-crds/operator.tekton.dev_tektonpruners.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/TektonChain.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ spec:
storage.gcs.bucket: #value
storage.oci.repository: #value
storage.oci.repository.insecure: #value (boolean - true/false)
storage.oci.encoding-format: #value (dsse or sigstore-bundle, default: dsse)
storage.docdb.url: #value
storage.docdb.mongo-server-url: #value
storage.docdb.mongo-server-url-dir: #value
Expand Down
1 change: 1 addition & 0 deletions docs/TektonConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ chain:
storage.gcs.bucket: #value
storage.oci.repository: #value
storage.oci.repository.insecure: #value (boolean - true/false)
storage.oci.encoding-format: #value (dsse or sigstore-bundle, default: dsse)
storage.docdb.url: #value
storage.grafeas.projectid: #value
storage.grafeas.noteid: #value
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/operator/v1alpha1/tektonchain_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ type ChainProperties struct {
StorageGCSBucket string `json:"storage.gcs.bucket,omitempty"`
StorageOCIRepository string `json:"storage.oci.repository,omitempty"`
StorageOCIRepositoryInsecure *bool `json:"storage.oci.repository.insecure,omitempty"`
StorageOCIEncodingFormat string `json:"storage.oci.encoding-format,omitempty"`
StorageDocDBURL string `json:"storage.docdb.url,omitempty"`
StorageDocDBMongoServerURL string `json:"storage.docdb.mongo-server-url,omitempty"`
StorageDocDBMongoServerURLDir string `json:"storage.docdb.mongo-server-url-dir,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/operator/v1alpha1/tektonchain_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var (
allowedArtifactsStorage = sets.NewString("", "tekton", "oci", "gcs", "docdb", "grafeas", "kafka")
allowedControllerEnvs = sets.NewString("MONGO_SERVER_URL")
allowedBuildDefinitionType = sets.NewString("", "https://tekton.dev/chains/v2/slsa", "https://tekton.dev/chains/v2/slsa-tekton")
allowedStorageOCIEncodingFormat = sets.NewString("", "dsse", "sigstore-bundle")
)

func (tc *TektonChain) Validate(ctx context.Context) (errs *apis.FieldError) {
Expand Down Expand Up @@ -132,6 +133,10 @@ func (tcs *TektonChainSpec) ValidateChainConfig(path string) (errs *apis.FieldEr
}
}

if !allowedStorageOCIEncodingFormat.Has(tcs.StorageOCIEncodingFormat) {
errs = errs.Also(apis.ErrInvalidValue(tcs.StorageOCIEncodingFormat, path+".storage.oci.encoding-format"))
}

if !allowedX509SignerFulcioProvider.Has(tcs.X509SignerFulcioProvider) {
errs = errs.Also(apis.ErrInvalidValue(tcs.X509SignerFulcioProvider, path+".signers.x509.fulcio.provider"))
}
Expand Down
38 changes: 38 additions & 0 deletions pkg/apis/operator/v1alpha1/tektonchain_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,44 @@ func Test_ValidateTektonChain_ConfigBuildDefinitionType(t *testing.T) {
}
}

func Test_ValidateTektonChain_InvalidStorageOCIEncodingFormat(t *testing.T) {
tc := &TektonChain{
ObjectMeta: metav1.ObjectMeta{
Name: "chain",
Namespace: "namespace",
},
Spec: TektonChainSpec{
CommonSpec: CommonSpec{
TargetNamespace: "namespace",
},
},
}
tc.Spec.Chain.ChainProperties.StorageOCIEncodingFormat = "unknown-format"
err := tc.Validate(context.TODO())
assert.Equal(t, "invalid value: unknown-format: spec.storage.oci.encoding-format", err.Error())
}

func Test_ValidateTektonChain_ValidStorageOCIEncodingFormat(t *testing.T) {
tc := &TektonChain{
ObjectMeta: metav1.ObjectMeta{
Name: "chain",
Namespace: "namespace",
},
Spec: TektonChainSpec{
CommonSpec: CommonSpec{
TargetNamespace: "namespace",
},
},
}
for _, format := range []string{"dsse", "sigstore-bundle"} {
tc.Spec.Chain.ChainProperties.StorageOCIEncodingFormat = format
err := tc.Validate(context.TODO())
if err != nil {
t.Errorf("ValidateTektonChain.Validate() expected no error for encoding-format %q, but got: %v", format, err)
}
}
}

func Test_ValidateTektonChain_InvalidControllerEnv(t *testing.T) {
tc := &TektonChain{
ObjectMeta: metav1.ObjectMeta{
Expand Down
Loading