diff --git a/pkg/artifacts/signable.go b/pkg/artifacts/signable.go index 4f4389e8ec..7ebcf95845 100644 --- a/pkg/artifacts/signable.go +++ b/pkg/artifacts/signable.go @@ -21,7 +21,6 @@ import ( "github.com/google/go-containerregistry/pkg/name" slsa "github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/v0.2" "github.com/opencontainers/go-digest" - "github.com/tektoncd/chains/pkg/chains/formats" "github.com/tektoncd/chains/pkg/chains/objects" "github.com/tektoncd/chains/pkg/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" @@ -38,7 +37,7 @@ type Signable interface { ExtractObjects(obj objects.TektonObject) []interface{} StorageBackend(cfg config.Config) sets.String Signer(cfg config.Config) string - PayloadFormat(cfg config.Config) formats.PayloadType + PayloadFormat(cfg config.Config) config.PayloadType // FullKey returns the full identifier for a signable artifact. // - For OCI artifact, it is the full representation in the format of `@sha256:`. // - For TaskRun/PipelineRun artifact, it is `---` @@ -80,8 +79,8 @@ func (ta *TaskRunArtifact) StorageBackend(cfg config.Config) sets.String { return cfg.Artifacts.TaskRuns.StorageBackend } -func (ta *TaskRunArtifact) PayloadFormat(cfg config.Config) formats.PayloadType { - return formats.PayloadType(cfg.Artifacts.TaskRuns.Format) +func (ta *TaskRunArtifact) PayloadFormat(cfg config.Config) config.PayloadType { + return config.PayloadType(cfg.Artifacts.TaskRuns.Format) } func (ta *TaskRunArtifact) Signer(cfg config.Config) string { @@ -122,8 +121,8 @@ func (pa *PipelineRunArtifact) StorageBackend(cfg config.Config) sets.String { return cfg.Artifacts.PipelineRuns.StorageBackend } -func (pa *PipelineRunArtifact) PayloadFormat(cfg config.Config) formats.PayloadType { - return formats.PayloadType(cfg.Artifacts.PipelineRuns.Format) +func (pa *PipelineRunArtifact) PayloadFormat(cfg config.Config) config.PayloadType { + return config.PayloadType(cfg.Artifacts.PipelineRuns.Format) } func (pa *PipelineRunArtifact) Signer(cfg config.Config) string { @@ -392,8 +391,8 @@ func (oa *OCIArtifact) StorageBackend(cfg config.Config) sets.String { return cfg.Artifacts.OCI.StorageBackend } -func (oa *OCIArtifact) PayloadFormat(cfg config.Config) formats.PayloadType { - return formats.PayloadType(cfg.Artifacts.OCI.Format) +func (oa *OCIArtifact) PayloadFormat(cfg config.Config) config.PayloadType { + return config.PayloadType(cfg.Artifacts.OCI.Format) } func (oa *OCIArtifact) Signer(cfg config.Config) string { diff --git a/pkg/chains/formats/all/all.go b/pkg/chains/formats/all/all.go new file mode 100644 index 0000000000..82247f6363 --- /dev/null +++ b/pkg/chains/formats/all/all.go @@ -0,0 +1,21 @@ +// Copyright 2022 The Tekton Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package all + +import ( + _ "github.com/tektoncd/chains/pkg/chains/formats/intotoite6" + _ "github.com/tektoncd/chains/pkg/chains/formats/simple" + _ "github.com/tektoncd/chains/pkg/chains/formats/tekton" +) diff --git a/pkg/chains/formats/format.go b/pkg/chains/formats/format.go index 4709c27f76..3cd3cda427 100644 --- a/pkg/chains/formats/format.go +++ b/pkg/chains/formats/format.go @@ -13,20 +13,45 @@ limitations under the License. package formats +import ( + "context" + "fmt" + + "github.com/tektoncd/chains/pkg/config" +) + // Payloader is an interface to generate a chains Payload from a TaskRun type Payloader interface { - CreatePayload(obj interface{}) (interface{}, error) - Type() PayloadType + CreatePayload(ctx context.Context, obj interface{}) (interface{}, error) + Type() config.PayloadType Wrap() bool } -type PayloadType string - -// If you update this, remember to update AllFormatters const ( - PayloadTypeTekton PayloadType = "tekton" - PayloadTypeSimpleSigning PayloadType = "simplesigning" - PayloadTypeInTotoIte6 PayloadType = "in-toto" + PayloadTypeTekton config.PayloadType = "tekton" + PayloadTypeSimpleSigning config.PayloadType = "simplesigning" + PayloadTypeInTotoIte6 config.PayloadType = "in-toto" +) + +var ( + payloaderMap = map[config.PayloadType]PayloaderInit{} ) -var AllFormatters = []PayloadType{PayloadTypeTekton, PayloadTypeSimpleSigning, PayloadTypeInTotoIte6} +// PayloaderInit initializes a new Payloader instance for the given config. +type PayloaderInit func(config.Config) (Payloader, error) + +// RegisterPayloader registers the PayloaderInit func for the given type. +// This is suitable to be calling during init() to register Payloader types. +func RegisterPayloader(key config.PayloadType, init PayloaderInit) { + payloaderMap[key] = init +} + +// GetPayloader returns a new Payloader of the given type. +// If no Payloader is registered for the type, an error is returned. +func GetPayloader(key config.PayloadType, cfg config.Config) (Payloader, error) { + fn, ok := payloaderMap[key] + if !ok { + return nil, fmt.Errorf("payloader %q not found", key) + } + return fn(cfg) +} diff --git a/pkg/chains/formats/intotoite6/intotoite6.go b/pkg/chains/formats/intotoite6/intotoite6.go index c1fbb38a69..d4936cfca9 100644 --- a/pkg/chains/formats/intotoite6/intotoite6.go +++ b/pkg/chains/formats/intotoite6/intotoite6.go @@ -17,6 +17,7 @@ limitations under the License. package intotoite6 import ( + "context" "fmt" "github.com/tektoncd/chains/pkg/chains/formats" @@ -24,18 +25,24 @@ import ( "github.com/tektoncd/chains/pkg/chains/formats/intotoite6/taskrun" "github.com/tektoncd/chains/pkg/chains/objects" "github.com/tektoncd/chains/pkg/config" - "go.uber.org/zap" + "knative.dev/pkg/logging" ) +const ( + PayloadTypeInTotoIte6 = formats.PayloadTypeInTotoIte6 +) + +func init() { + formats.RegisterPayloader(PayloadTypeInTotoIte6, NewFormatter) +} + type InTotoIte6 struct { builderID string - logger *zap.SugaredLogger } -func NewFormatter(cfg config.Config, logger *zap.SugaredLogger) (formats.Payloader, error) { +func NewFormatter(cfg config.Config) (formats.Payloader, error) { return &InTotoIte6{ builderID: cfg.Builder.ID, - logger: logger, }, nil } @@ -43,17 +50,18 @@ func (i *InTotoIte6) Wrap() bool { return true } -func (i *InTotoIte6) CreatePayload(obj interface{}) (interface{}, error) { +func (i *InTotoIte6) CreatePayload(ctx context.Context, obj interface{}) (interface{}, error) { + logger := logging.FromContext(ctx) switch v := obj.(type) { case *objects.TaskRunObject: - return taskrun.GenerateAttestation(i.builderID, v, i.logger) + return taskrun.GenerateAttestation(i.builderID, v, logger) case *objects.PipelineRunObject: - return pipelinerun.GenerateAttestation(i.builderID, v, i.logger) + return pipelinerun.GenerateAttestation(i.builderID, v, logger) default: return nil, fmt.Errorf("intoto does not support type: %s", v) } } -func (i *InTotoIte6) Type() formats.PayloadType { +func (i *InTotoIte6) Type() config.PayloadType { return formats.PayloadTypeInTotoIte6 } diff --git a/pkg/chains/formats/intotoite6/intotoite6_test.go b/pkg/chains/formats/intotoite6/intotoite6_test.go index 479258a11e..ccfbc3484b 100644 --- a/pkg/chains/formats/intotoite6/intotoite6_test.go +++ b/pkg/chains/formats/intotoite6/intotoite6_test.go @@ -39,6 +39,8 @@ var e1BuildStart = time.Unix(1617011400, 0) var e1BuildFinished = time.Unix(1617011415, 0) func TestTaskRunCreatePayload1(t *testing.T) { + ctx := logtesting.TestContextWithLogger(t) + tr, err := objectloader.TaskRunFromFile("testdata/taskrun1.json") if err != nil { t.Fatal(err) @@ -113,9 +115,9 @@ func TestTaskRunCreatePayload1(t *testing.T) { }, }, } - i, _ := NewFormatter(cfg, logtesting.TestLogger(t)) + i, _ := NewFormatter(cfg) - got, err := i.CreatePayload(objects.NewTaskRunObject(tr)) + got, err := i.CreatePayload(ctx, objects.NewTaskRunObject(tr)) if err != nil { t.Errorf("unexpected error: %s", err.Error()) @@ -126,6 +128,7 @@ func TestTaskRunCreatePayload1(t *testing.T) { } func TestPipelineRunCreatePayload(t *testing.T) { + ctx := logtesting.TestContextWithLogger(t) pr, err := objectloader.PipelineRunFromFile("testdata/pipelinerun1.json") if err != nil { t.Fatal(err) @@ -316,9 +319,9 @@ func TestPipelineRunCreatePayload(t *testing.T) { pro.AppendTaskRun(tr1) pro.AppendTaskRun(tr2) - i, _ := NewFormatter(cfg, logtesting.TestLogger(t)) + i, _ := NewFormatter(cfg) - got, err := i.CreatePayload(pro) + got, err := i.CreatePayload(ctx, pro) if err != nil { t.Errorf("unexpected error: %s", err.Error()) } @@ -327,6 +330,7 @@ func TestPipelineRunCreatePayload(t *testing.T) { } } func TestPipelineRunCreatePayloadChildRefs(t *testing.T) { + ctx := logtesting.TestContextWithLogger(t) pr, err := objectloader.PipelineRunFromFile("testdata/pipelinerun-childrefs.json") if err != nil { t.Fatal(err) @@ -512,8 +516,8 @@ func TestPipelineRunCreatePayloadChildRefs(t *testing.T) { pro.AppendTaskRun(tr1) pro.AppendTaskRun(tr2) - i, _ := NewFormatter(cfg, logtesting.TestLogger(t)) - got, err := i.CreatePayload(pro) + i, _ := NewFormatter(cfg) + got, err := i.CreatePayload(ctx, pro) if err != nil { t.Errorf("unexpected error: %s", err.Error()) } @@ -523,6 +527,7 @@ func TestPipelineRunCreatePayloadChildRefs(t *testing.T) { } func TestTaskRunCreatePayload2(t *testing.T) { + ctx := logtesting.TestContextWithLogger(t) tr, err := objectloader.TaskRunFromFile("testdata/taskrun2.json") if err != nil { t.Fatal(err) @@ -578,8 +583,8 @@ func TestTaskRunCreatePayload2(t *testing.T) { }, }, } - i, _ := NewFormatter(cfg, logtesting.TestLogger(t)) - got, err := i.CreatePayload(objects.NewTaskRunObject(tr)) + i, _ := NewFormatter(cfg) + got, err := i.CreatePayload(ctx, objects.NewTaskRunObject(tr)) if err != nil { t.Errorf("unexpected error: %s", err.Error()) @@ -590,6 +595,8 @@ func TestTaskRunCreatePayload2(t *testing.T) { } func TestMultipleSubjects(t *testing.T) { + ctx := logtesting.TestContextWithLogger(t) + tr, err := objectloader.TaskRunFromFile("testdata/taskrun-multiple-subjects.json") if err != nil { t.Fatal(err) @@ -641,8 +648,8 @@ func TestMultipleSubjects(t *testing.T) { }, } - i, _ := NewFormatter(cfg, logtesting.TestLogger(t)) - got, err := i.CreatePayload(objects.NewTaskRunObject(tr)) + i, _ := NewFormatter(cfg) + got, err := i.CreatePayload(ctx, objects.NewTaskRunObject(tr)) if err != nil { t.Errorf("unexpected error: %s", err.Error()) } @@ -658,7 +665,7 @@ func TestNewFormatter(t *testing.T) { ID: "testid", }, } - f, err := NewFormatter(cfg, logtesting.TestLogger(t)) + f, err := NewFormatter(cfg) if f == nil { t.Error("Failed to create formatter") } @@ -669,15 +676,17 @@ func TestNewFormatter(t *testing.T) { } func TestCreatePayloadError(t *testing.T) { + ctx := logtesting.TestContextWithLogger(t) + cfg := config.Config{ Builder: config.BuilderConfig{ ID: "testid", }, } - f, _ := NewFormatter(cfg, logtesting.TestLogger(t)) + f, _ := NewFormatter(cfg) t.Run("Invalid type", func(t *testing.T) { - p, err := f.CreatePayload("not a task ref") + p, err := f.CreatePayload(ctx, "not a task ref") if p != nil { t.Errorf("Unexpected payload") diff --git a/pkg/chains/formats/simple/simple.go b/pkg/chains/formats/simple/simple.go index cc45573f79..10c464f96a 100644 --- a/pkg/chains/formats/simple/simple.go +++ b/pkg/chains/formats/simple/simple.go @@ -14,23 +14,32 @@ limitations under the License. package simple import ( + "context" "fmt" "github.com/sigstore/sigstore/pkg/signature/payload" "github.com/tektoncd/chains/pkg/chains/formats" + "github.com/tektoncd/chains/pkg/config" "github.com/google/go-containerregistry/pkg/name" ) +const ( + PayloadTypeSimpleSigning = formats.PayloadTypeSimpleSigning +) + +func init() { + formats.RegisterPayloader(PayloadTypeSimpleSigning, NewFormatter) +} + // SimpleSigning is a formatter that uses the RedHat simple signing format // https://www.redhat.com/en/blog/container-image-signing -type SimpleSigning struct { -} +type SimpleSigning struct{} type SimpleContainerImage payload.SimpleContainerImage // CreatePayload implements the Payloader interface. -func (i *SimpleSigning) CreatePayload(obj interface{}) (interface{}, error) { +func (i *SimpleSigning) CreatePayload(ctx context.Context, obj interface{}) (interface{}, error) { switch v := obj.(type) { case name.Digest: format := NewSimpleStruct(v) @@ -44,7 +53,7 @@ func (i *SimpleSigning) Wrap() bool { return false } -func NewFormatter() (formats.Payloader, error) { +func NewFormatter(config.Config) (formats.Payloader, error) { return &SimpleSigning{}, nil } @@ -57,6 +66,6 @@ func (i SimpleContainerImage) ImageName() string { return fmt.Sprintf("%s@%s", i.Critical.Identity.DockerReference, i.Critical.Image.DockerManifestDigest) } -func (i *SimpleSigning) Type() formats.PayloadType { +func (i *SimpleSigning) Type() config.PayloadType { return formats.PayloadTypeSimpleSigning } diff --git a/pkg/chains/formats/simple/simple_test.go b/pkg/chains/formats/simple/simple_test.go index efcbfd8480..a3be8461a0 100644 --- a/pkg/chains/formats/simple/simple_test.go +++ b/pkg/chains/formats/simple/simple_test.go @@ -14,6 +14,7 @@ limitations under the License. package simple import ( + "context" "reflect" "testing" @@ -61,7 +62,7 @@ func TestSimpleSigning_CreatePayload(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { i := &SimpleSigning{} - got, err := i.CreatePayload(tt.obj) + got, err := i.CreatePayload(context.Background(), tt.obj) if (err != nil) != tt.wantErr { t.Errorf("SimpleSigning.CreatePayload() error = %v, wantErr %v", err, tt.wantErr) return @@ -81,7 +82,7 @@ func TestImageName(t *testing.T) { obj := makeDigest(t, img) i := &SimpleSigning{} - format, err := i.CreatePayload(obj) + format, err := i.CreatePayload(context.Background(), obj) if err != nil { t.Fatal(err) } diff --git a/pkg/chains/formats/tekton/tekton.go b/pkg/chains/formats/tekton/tekton.go index 9b7903cc8c..7b7e60ed22 100644 --- a/pkg/chains/formats/tekton/tekton.go +++ b/pkg/chains/formats/tekton/tekton.go @@ -14,22 +14,32 @@ limitations under the License. package tekton import ( + "context" "fmt" "github.com/tektoncd/chains/pkg/chains/formats" "github.com/tektoncd/chains/pkg/chains/objects" + "github.com/tektoncd/chains/pkg/config" ) +const ( + PayloadTypeTekton = formats.PayloadTypeTekton +) + +func init() { + formats.RegisterPayloader(PayloadTypeTekton, NewFormatter) +} + // Tekton is a formatter that just captures the TaskRun Status with no modifications. type Tekton struct { } -func NewFormatter() (formats.Payloader, error) { +func NewFormatter(config.Config) (formats.Payloader, error) { return &Tekton{}, nil } // CreatePayload implements the Payloader interface. -func (i *Tekton) CreatePayload(obj interface{}) (interface{}, error) { +func (i *Tekton) CreatePayload(ctx context.Context, obj interface{}) (interface{}, error) { switch v := obj.(type) { case *objects.TaskRunObject: return v.Status, nil @@ -40,7 +50,7 @@ func (i *Tekton) CreatePayload(obj interface{}) (interface{}, error) { } } -func (i *Tekton) Type() formats.PayloadType { +func (i *Tekton) Type() config.PayloadType { return formats.PayloadTypeTekton } diff --git a/pkg/chains/formats/tekton/tekton_test.go b/pkg/chains/formats/tekton/tekton_test.go index afd763ffb6..a10c3f9818 100644 --- a/pkg/chains/formats/tekton/tekton_test.go +++ b/pkg/chains/formats/tekton/tekton_test.go @@ -14,6 +14,7 @@ limitations under the License. package tekton import ( + "context" "reflect" "testing" @@ -36,7 +37,7 @@ func TestTekton_CreatePayload(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { i := &Tekton{} - got, err := i.CreatePayload(objects.NewTaskRunObject(tt.tr)) + got, err := i.CreatePayload(context.Background(), objects.NewTaskRunObject(tt.tr)) if err != nil { t.Errorf("Tekton.CreatePayload() error = %v", err) return diff --git a/pkg/chains/signing.go b/pkg/chains/signing.go index 53daa3a465..ecbd0d8ac5 100644 --- a/pkg/chains/signing.go +++ b/pkg/chains/signing.go @@ -22,9 +22,6 @@ import ( "github.com/hashicorp/go-multierror" "github.com/tektoncd/chains/pkg/artifacts" "github.com/tektoncd/chains/pkg/chains/formats" - "github.com/tektoncd/chains/pkg/chains/formats/intotoite6" - "github.com/tektoncd/chains/pkg/chains/formats/simple" - "github.com/tektoncd/chains/pkg/chains/formats/tekton" "github.com/tektoncd/chains/pkg/chains/objects" "github.com/tektoncd/chains/pkg/chains/signing" "github.com/tektoncd/chains/pkg/chains/signing/kms" @@ -42,11 +39,6 @@ type Signer interface { } type ObjectSigner struct { - // Formatters: format payload - // The keys are the names of different formatters {tekton, in-toto, simplesigning}. The first two are for TaskRun artifact, and simplesigning is for OCI artifact. - // The values are actual `Payloader` interfaces that can generate payload in different format from taskrun. - Formatters map[formats.PayloadType]formats.Payloader - // Backends: store payload and signature // The keys are different storage option's name. {docdb, gcs, grafeas, oci, tekton} // The values are the actual storage backends that will be used to store and retrieve provenance. @@ -90,35 +82,6 @@ func allSigners(ctx context.Context, sp string, cfg config.Config, l *zap.Sugare return all } -func AllFormatters(cfg config.Config, l *zap.SugaredLogger) map[formats.PayloadType]formats.Payloader { - all := map[formats.PayloadType]formats.Payloader{} - - for _, f := range formats.AllFormatters { - switch f { - case formats.PayloadTypeTekton: - formatter, err := tekton.NewFormatter() - if err != nil { - l.Warnf("error configuring tekton formatter: %s", err) - } - all[f] = formatter - case formats.PayloadTypeSimpleSigning: - formatter, err := simple.NewFormatter() - if err != nil { - l.Warnf("error configuring simplesigning formatter: %s", err) - } - all[f] = formatter - case formats.PayloadTypeInTotoIte6: - formatter, err := intotoite6.NewFormatter(cfg, l) - if err != nil { - l.Warnf("error configuring intoto formatter: %s", err) - } - all[f] = formatter - } - } - - return all -} - // TODO: Hook this up to config. func getSignableTypes(obj objects.TektonObject, logger *zap.SugaredLogger) ([]artifacts.Signable, error) { switch v := obj.GetObject().(type) { @@ -162,9 +125,8 @@ func (o *ObjectSigner) Sign(ctx context.Context, tektonObj objects.TektonObject) } payloadFormat := signableType.PayloadFormat(cfg) // Find the right payload format and format the object - payloader, ok := o.Formatters[payloadFormat] - - if !ok { + payloader, err := formats.GetPayloader(payloadFormat, cfg) + if err != nil { logger.Warnf("Format %s configured for %s: %v was not found", payloadFormat, tektonObj.GetGVK(), signableType.Type()) continue } @@ -176,7 +138,7 @@ func (o *ObjectSigner) Sign(ctx context.Context, tektonObj objects.TektonObject) // Go through each object one at a time. for _, obj := range objects { - payload, err := payloader.CreatePayload(obj) + payload, err := payloader.CreatePayload(ctx, obj) if err != nil { logger.Error(err) continue diff --git a/pkg/chains/signing_test.go b/pkg/chains/signing_test.go index 50924f6838..95738aa87b 100644 --- a/pkg/chains/signing_test.go +++ b/pkg/chains/signing_test.go @@ -33,6 +33,8 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "knative.dev/pkg/logging" rtesting "knative.dev/pkg/reconciler/testing" + + _ "github.com/tektoncd/chains/pkg/chains/formats/all" ) func TestSigner_Sign(t *testing.T) { @@ -144,9 +146,7 @@ func TestSigner_Sign(t *testing.T) { ctx = config.ToContext(ctx, tt.config.DeepCopy()) - logger := logging.FromContext(ctx) ts := &ObjectSigner{ - Formatters: AllFormatters(*tt.config, logger), Backends: fakeAllBackends(tt.backends), SecretPath: "./signing/x509/testdata/", Pipelineclientset: ps, @@ -302,9 +302,7 @@ func TestSigner_Transparency(t *testing.T) { ctx = config.ToContext(ctx, tt.cfg.DeepCopy()) - logger := logging.FromContext(ctx) os := &ObjectSigner{ - Formatters: AllFormatters(*tt.cfg, logger), Backends: fakeAllBackends(backends), SecretPath: "./signing/x509/testdata/", Pipelineclientset: ps, diff --git a/pkg/config/options.go b/pkg/config/options.go index f08adea5d3..8460db6f9a 100644 --- a/pkg/config/options.go +++ b/pkg/config/options.go @@ -16,7 +16,10 @@ limitations under the License. package config -import "github.com/tektoncd/chains/pkg/chains/formats" +// PayloadType specifies the format to store payload in. +// - For OCI artifact, Chains only supports `simplesigning` format. https://www.redhat.com/en/blog/container-image-signing +// - For Tekton artifacts, Chains supports `tekton` and `in-toto` format. https://slsa.dev/provenance/v0.2 +type PayloadType string // StorageOpts contains additional information required when storing signatures type StorageOpts struct { @@ -43,7 +46,5 @@ type StorageOpts struct { Chain string // PayloadFormat is the format to store payload in. - // - For OCI artifact, Chains only supports `simplesigning` format. https://www.redhat.com/en/blog/container-image-signing - // - For TaskRun artifact, Chains supports `tekton` and `in-toto` format. https://slsa.dev/provenance/v0.2 - PayloadFormat formats.PayloadType + PayloadFormat PayloadType } diff --git a/pkg/reconciler/pipelinerun/controller.go b/pkg/reconciler/pipelinerun/controller.go index 6836931122..8813314770 100644 --- a/pkg/reconciler/pipelinerun/controller.go +++ b/pkg/reconciler/pipelinerun/controller.go @@ -29,6 +29,8 @@ import ( "knative.dev/pkg/configmap" "knative.dev/pkg/controller" "knative.dev/pkg/logging" + + _ "github.com/tektoncd/chains/pkg/chains/formats/all" ) func NewController(ctx context.Context, cmw configmap.Watcher) *controller.Impl { @@ -54,9 +56,6 @@ func NewController(ctx context.Context, cmw configmap.Watcher) *controller.Impl // get updated config cfg := *value.(*config.Config) - // get all formatters for formatting payload - psSigner.Formatters = chains.AllFormatters(cfg, logger) - // get all backends for storing provenance backends, err := storage.InitializeBackends(ctx, pipelineClient, kubeClient, logger, cfg) if err != nil { diff --git a/pkg/reconciler/taskrun/controller.go b/pkg/reconciler/taskrun/controller.go index e92c2a0917..460965f0ac 100644 --- a/pkg/reconciler/taskrun/controller.go +++ b/pkg/reconciler/taskrun/controller.go @@ -26,6 +26,8 @@ import ( "knative.dev/pkg/configmap" "knative.dev/pkg/controller" "knative.dev/pkg/logging" + + _ "github.com/tektoncd/chains/pkg/chains/formats/all" ) func NewController(ctx context.Context, cmw configmap.Watcher) *controller.Impl { @@ -48,9 +50,6 @@ func NewController(ctx context.Context, cmw configmap.Watcher) *controller.Impl // get updated config cfg := *value.(*config.Config) - // get all formatters for formatting payload - tsSigner.Formatters = chains.AllFormatters(cfg, logger) - // get all backends for storing provenance backends, err := storage.InitializeBackends(ctx, pipelineClient, kubeClient, logger, cfg) if err != nil {