Skip to content

Commit

Permalink
fix slsaconfig conflict errors
Browse files Browse the repository at this point in the history
  • Loading branch information
joejstuart committed Aug 7, 2023
1 parent 54c7af9 commit 0c655f0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions pkg/chains/formats/slsa/internal/slsaconfig/slsaconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ package slsaconfig
type SlsaConfig struct {
// BuilderID is the URI of the trusted build platform.
BuilderID string
BuildType string
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
slsa "github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/v1"
"github.com/tektoncd/chains/pkg/chains/formats/slsa/extract"
"github.com/tektoncd/chains/pkg/chains/formats/slsa/internal/slsaconfig"
builddefinitions "github.com/tektoncd/chains/pkg/chains/formats/slsa/v2alpha2/internal/build_definitions"
"github.com/tektoncd/chains/pkg/chains/objects"
)

Expand All @@ -38,7 +39,7 @@ func GenerateAttestation(ctx context.Context, pro *objects.PipelineRunObject, sl
return nil, err
}

bd, err := getBuildDefinition(buildType, pro)
bd, err := getBuildDefinition(slsaconfig.BuildType, pro)
if err != nil {
return nil, err
}
Expand All @@ -56,7 +57,7 @@ func GenerateAttestation(ctx context.Context, pro *objects.PipelineRunObject, sl
},
Predicate: slsa.ProvenancePredicate{
BuildDefinition: slsa.ProvenanceBuildDefinition{
BuildType: buildType,
BuildType: slsaconfig.BuildType,
ExternalParameters: bd.GetExternalParameters(),
InternalParameters: bd.GetInternalParameters(),
ResolvedDependencies: rd,
Expand Down
9 changes: 3 additions & 6 deletions pkg/chains/formats/slsa/v2alpha2/internal/taskrun/taskrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
slsa "github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/v1"
"github.com/tektoncd/chains/pkg/chains/formats/slsa/extract"
"github.com/tektoncd/chains/pkg/chains/formats/slsa/internal/slsaconfig"
builddefinitions "github.com/tektoncd/chains/pkg/chains/formats/slsa/v2alpha2/internal/build_definitions"
"github.com/tektoncd/chains/pkg/chains/formats/slsa/v2alpha2/internal/pipelinerun"
"github.com/tektoncd/chains/pkg/chains/objects"
)
Expand All @@ -30,16 +31,12 @@ const taskRunResults = "taskRunResults/%s"

// GenerateAttestation generates a provenance statement with SLSA v1.0 predicate for a task run.
func GenerateAttestation(ctx context.Context, tro *objects.TaskRunObject, slsaConfig *slsaconfig.SlsaConfig) (interface{}, error) {
rd, err := resolveddependencies.TaskRun(ctx, tro)
if err != nil {
return nil, err
}
bp, err := byproducts(tro)
if err != nil {
return nil, err
}

bd, err := getBuildDefinition(buildType, tro)
bd, err := getBuildDefinition(slsaConfig.BuildType, tro)
if err != nil {
return nil, err
}
Expand All @@ -56,7 +53,7 @@ func GenerateAttestation(ctx context.Context, tro *objects.TaskRunObject, slsaCo
},
Predicate: slsa.ProvenancePredicate{
BuildDefinition: slsa.ProvenanceBuildDefinition{
BuildType: buildType,
BuildType: slsaConfig.BuildType,
ExternalParameters: bd.GetExternalParameters(),
InternalParameters: bd.GetInternalParameters(),
ResolvedDependencies: rd,
Expand Down

0 comments on commit 0c655f0

Please sign in to comment.