-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEP 0122: complete build instuctions: adding taskspec to buildConfig
This PR introduces a new format `slsa/v2` which contains the complete build instructions as designed in TEP0122. Note that we are currently surfacing it for the users as `slsa/v2alpha1` since it is WIP and will undergo updates until we make it available for pipelineruns as well.
1 parent
05232aa
commit a808702
Showing
21 changed files
with
1,209 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,4 +62,4 @@ spec: | |
type: image | ||
params: | ||
- name: url | ||
value: gcr.io/foo/bar | ||
value: gcr.io/foo/bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
131 changes: 0 additions & 131 deletions
131
pkg/chains/formats/slsa/v1/internal/material/material_test.go
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
Copyright 2021 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 v2 | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/tektoncd/chains/pkg/chains/formats" | ||
"github.com/tektoncd/chains/pkg/chains/formats/slsa/v2/taskrun" | ||
"github.com/tektoncd/chains/pkg/chains/objects" | ||
"github.com/tektoncd/chains/pkg/config" | ||
) | ||
|
||
const ( | ||
PayloadTypeSlsav2 = formats.PayloadTypeSlsav2 | ||
) | ||
|
||
func init() { | ||
formats.RegisterPayloader(PayloadTypeSlsav2, NewFormatter) | ||
} | ||
|
||
type SlsaV2 struct { | ||
builderID string | ||
} | ||
|
||
func NewFormatter(cfg config.Config) (formats.Payloader, error) { | ||
return &SlsaV2{ | ||
builderID: cfg.Builder.ID, | ||
}, nil | ||
} | ||
|
||
func (s *SlsaV2) Wrap() bool { | ||
return true | ||
} | ||
|
||
func (s *SlsaV2) CreatePayload(ctx context.Context, obj interface{}) (interface{}, error) { | ||
switch v := obj.(type) { | ||
case *objects.TaskRunObject: | ||
return taskrun.GenerateAttestation(s.builderID, s.Type(), v, ctx) | ||
default: | ||
return nil, fmt.Errorf("intoto does not support type: %s", v) | ||
} | ||
} | ||
|
||
func (s *SlsaV2) Type() config.PayloadType { | ||
return formats.PayloadTypeSlsav2 | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
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 taskrun | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"reflect" | ||
|
||
intoto "github.com/in-toto/in-toto-golang/in_toto" | ||
slsa "github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/v0.2" | ||
"github.com/tektoncd/chains/pkg/chains/formats/slsa/extract" | ||
"github.com/tektoncd/chains/pkg/chains/formats/slsa/internal/material" | ||
slsav1 "github.com/tektoncd/chains/pkg/chains/formats/slsa/v1/taskrun" | ||
"github.com/tektoncd/chains/pkg/chains/objects" | ||
"github.com/tektoncd/chains/pkg/config" | ||
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" | ||
"k8s.io/apimachinery/pkg/util/sets" | ||
"knative.dev/pkg/logging" | ||
) | ||
|
||
// BuildConfig is the custom Chains format to fill out the | ||
// "buildConfig" section of the slsa-provenance predicate | ||
type BuildConfig struct { | ||
TaskSpec *v1beta1.TaskSpec `json:"taskSpec"` | ||
TaskRunResults []v1beta1.TaskRunResult `json:"taskRunResults"` | ||
} | ||
|
||
func GenerateAttestation(builderID string, payloadType config.PayloadType, tro *objects.TaskRunObject, ctx context.Context) (interface{}, error) { | ||
logger := logging.FromContext(ctx) | ||
subjects := extract.SubjectDigests(tro, logger) | ||
|
||
mat, err := material.Materials(tro, logger) | ||
if err != nil { | ||
return nil, err | ||
} | ||
att := intoto.ProvenanceStatement{ | ||
StatementHeader: intoto.StatementHeader{ | ||
Type: intoto.StatementInTotoV01, | ||
PredicateType: slsa.PredicateSLSAProvenance, | ||
Subject: subjects, | ||
}, | ||
Predicate: slsa.ProvenancePredicate{ | ||
Builder: slsa.ProvenanceBuilder{ | ||
ID: builderID, | ||
}, | ||
BuildType: fmt.Sprintf("https://chains.tekton.dev/format/%v/type/%s", payloadType, tro.GetGVK()), | ||
Invocation: invocation(tro), | ||
BuildConfig: BuildConfig{TaskSpec: tro.Status.TaskSpec, TaskRunResults: tro.Status.TaskRunResults}, | ||
Metadata: slsav1.Metadata(tro), | ||
Materials: mat, | ||
}, | ||
} | ||
return att, nil | ||
} | ||
|
||
// invocation describes the event that kicked off the build | ||
// we currently don't set ConfigSource because we don't know | ||
// which material the Task definition came from | ||
func invocation(tro *objects.TaskRunObject) slsa.ProvenanceInvocation { | ||
i := slsa.ProvenanceInvocation{} | ||
if p := tro.Status.Provenance; p != nil { | ||
i.ConfigSource = slsa.ConfigSource{ | ||
URI: p.ConfigSource.URI, | ||
Digest: p.ConfigSource.Digest, | ||
EntryPoint: p.ConfigSource.EntryPoint, | ||
} | ||
} | ||
i.Parameters = invocationParams(tro) | ||
return i | ||
} | ||
|
||
// invocationParams adds all fields from the task run object except | ||
// TaskRef or TaskSpec since they are in the ConfigSource or buildConfig. | ||
func invocationParams(tro *objects.TaskRunObject) map[string]any { | ||
var iParams map[string]any = make(map[string]any) | ||
skipFields := sets.NewString("TaskRef", "TaskSpec") | ||
v := reflect.ValueOf(tro.Spec) | ||
for i := 0; i < v.NumField(); i++ { | ||
fieldName := v.Type().Field(i).Name | ||
if !skipFields.Has(v.Type().Field(i).Name) { | ||
iParams[fieldName] = v.Field(i).Interface() | ||
} | ||
} | ||
return iParams | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,344 @@ | ||
/* | ||
Copyright 2021 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 taskrun | ||
|
||
import ( | ||
"reflect" | ||
"strings" | ||
"testing" | ||
"time" | ||
|
||
slsa "github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/v0.2" | ||
|
||
"github.com/ghodss/yaml" | ||
"github.com/google/go-cmp/cmp" | ||
"github.com/in-toto/in-toto-golang/in_toto" | ||
"github.com/tektoncd/chains/pkg/artifacts" | ||
"github.com/tektoncd/chains/pkg/chains/formats/slsa/extract" | ||
slsav1 "github.com/tektoncd/chains/pkg/chains/formats/slsa/v1/taskrun" | ||
"github.com/tektoncd/chains/pkg/chains/objects" | ||
"github.com/tektoncd/pipeline/pkg/apis/pipeline/pod" | ||
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" | ||
"github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1" | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
logtesting "knative.dev/pkg/logging/testing" | ||
) | ||
|
||
const ( | ||
digest1 = "sha256:05f95b26ed10668b7183c1e2da98610e91372fa9f510046d4ce5812addad86b5" | ||
digest2 = "sha256:05f95b26ed10668b7183c1e2da98610e91372fa9f510046d4ce5812addad86b6" | ||
digest3 = "sha256:05f95b26ed10668b7183c1e2da98610e91372fa9f510046d4ce5812addad86b7" | ||
digest4 = "sha256:05f95b26ed10668b7183c1e2da98610e91372fa9f510046d4ce5812addad86b8" | ||
digest5 = "sha256:05f95b26ed10668b7183c1e2da98610e91372fa9f510046d4ce5812addad86b9" | ||
) | ||
|
||
func TestMetadata(t *testing.T) { | ||
tr := &v1beta1.TaskRun{ | ||
ObjectMeta: v1.ObjectMeta{ | ||
Name: "my-taskrun", | ||
Namespace: "my-namespace", | ||
Annotations: map[string]string{ | ||
"chains.tekton.dev/reproducible": "true", | ||
}, | ||
}, | ||
Status: v1beta1.TaskRunStatus{ | ||
TaskRunStatusFields: v1beta1.TaskRunStatusFields{ | ||
StartTime: &v1.Time{Time: time.Date(1995, time.December, 24, 6, 12, 12, 12, time.UTC)}, | ||
CompletionTime: &v1.Time{Time: time.Date(1995, time.December, 24, 6, 12, 12, 24, time.UTC)}, | ||
}, | ||
}, | ||
} | ||
start := time.Date(1995, time.December, 24, 6, 12, 12, 12, time.UTC) | ||
end := time.Date(1995, time.December, 24, 6, 12, 12, 24, time.UTC) | ||
expected := &slsa.ProvenanceMetadata{ | ||
BuildStartedOn: &start, | ||
BuildFinishedOn: &end, | ||
} | ||
got := slsav1.Metadata(objects.NewTaskRunObject(tr)) | ||
if !reflect.DeepEqual(expected, got) { | ||
t.Fatalf("expected %v got %v", expected, got) | ||
} | ||
} | ||
|
||
func TestMetadataInTimeZone(t *testing.T) { | ||
tz := time.FixedZone("Test Time", int((12 * time.Hour).Seconds())) | ||
tr := &v1beta1.TaskRun{ | ||
ObjectMeta: v1.ObjectMeta{ | ||
Name: "my-taskrun", | ||
Namespace: "my-namespace", | ||
Annotations: map[string]string{ | ||
"chains.tekton.dev/reproducible": "true", | ||
}, | ||
}, | ||
Status: v1beta1.TaskRunStatus{ | ||
TaskRunStatusFields: v1beta1.TaskRunStatusFields{ | ||
StartTime: &v1.Time{Time: time.Date(1995, time.December, 24, 6, 12, 12, 12, tz)}, | ||
CompletionTime: &v1.Time{Time: time.Date(1995, time.December, 24, 6, 12, 12, 24, tz)}, | ||
}, | ||
}, | ||
} | ||
start := time.Date(1995, time.December, 24, 6, 12, 12, 12, tz).UTC() | ||
end := time.Date(1995, time.December, 24, 6, 12, 12, 24, tz).UTC() | ||
expected := &slsa.ProvenanceMetadata{ | ||
BuildStartedOn: &start, | ||
BuildFinishedOn: &end, | ||
} | ||
got := slsav1.Metadata(objects.NewTaskRunObject(tr)) | ||
if !reflect.DeepEqual(expected, got) { | ||
t.Fatalf("expected %v got %v", expected, got) | ||
} | ||
} | ||
|
||
func TestInvocation(t *testing.T) { | ||
taskrun := `apiVersion: tekton.dev/v1beta1 | ||
kind: TaskRun | ||
metadata: | ||
uid: my-uid | ||
spec: | ||
params: | ||
- name: my-param | ||
value: string-param | ||
- name: my-array-param | ||
value: | ||
- "my" | ||
- "array" | ||
- name: my-empty-string-param | ||
value: "" | ||
- name: my-empty-array-param | ||
value: [] | ||
status: | ||
taskSpec: | ||
params: | ||
- name: my-param | ||
default: ignored | ||
- name: my-array-param | ||
type: array | ||
default: | ||
- "also" | ||
- "ignored" | ||
- name: my-default-param | ||
default: string-default-param | ||
- name: my-default-array-param | ||
type: array | ||
default: | ||
- "array" | ||
- "default" | ||
- "param" | ||
- name: my-empty-string-param | ||
default: "ignored" | ||
- name: my-empty-array-param | ||
type: array | ||
default: | ||
- "also" | ||
- "ignored" | ||
- name: my-default-empty-string-param | ||
default: "" | ||
- name: my-default-empty-array-param | ||
type: array | ||
default: [] | ||
` | ||
|
||
var taskRun *v1beta1.TaskRun | ||
if err := yaml.Unmarshal([]byte(taskrun), &taskRun); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
expected := slsa.ProvenanceInvocation{ | ||
Parameters: map[string]any{ | ||
"Params": []v1beta1.Param{ | ||
{ | ||
Name: "my-param", | ||
Value: v1beta1.ParamValue{Type: "string", StringVal: "string-param"}, | ||
}, | ||
{ | ||
Name: "my-array-param", | ||
Value: v1beta1.ParamValue{Type: "array", ArrayVal: []string{"my", "array"}}, | ||
}, | ||
{Name: "my-empty-string-param", Value: v1beta1.ParamValue{Type: "string"}}, | ||
{ | ||
Name: "my-empty-array-param", | ||
Value: v1beta1.ParamValue{Type: "array", ArrayVal: []string{}}, | ||
}, | ||
}, | ||
"ComputeResources": (*corev1.ResourceRequirements)(nil), | ||
"Debug": (*v1beta1.TaskRunDebug)(nil), | ||
"PodTemplate": (*pod.Template)(nil), | ||
"Resources": (*v1beta1.TaskRunResources)(nil), | ||
"Retries": 0, | ||
"ServiceAccountName": "", | ||
"SidecarOverrides": []v1beta1.TaskRunSidecarOverride(nil), | ||
"Status": v1beta1.TaskRunSpecStatus(""), | ||
"StatusMessage": v1beta1.TaskRunSpecStatusMessage(""), | ||
"StepOverrides": []v1beta1.TaskRunStepOverride(nil), | ||
"Timeout": (*metav1.Duration)(nil), | ||
"Workspaces": []v1beta1.WorkspaceBinding(nil), | ||
}, | ||
} | ||
got := invocation(objects.NewTaskRunObject(taskRun)) | ||
if !reflect.DeepEqual(expected, got) { | ||
if d := cmp.Diff(expected, got); d != "" { | ||
t.Log(d) | ||
} | ||
t.Fatalf("expected \n%v\n got \n%v\n", expected, got) | ||
} | ||
} | ||
|
||
func TestGetSubjectDigests(t *testing.T) { | ||
tr := &v1beta1.TaskRun{ | ||
Spec: v1beta1.TaskRunSpec{ | ||
Resources: &v1beta1.TaskRunResources{ | ||
Outputs: []v1beta1.TaskResourceBinding{ | ||
{ | ||
PipelineResourceBinding: v1beta1.PipelineResourceBinding{ | ||
Name: "nil-check", | ||
}, | ||
}, { | ||
PipelineResourceBinding: v1beta1.PipelineResourceBinding{ | ||
Name: "built-image", | ||
ResourceSpec: &v1alpha1.PipelineResourceSpec{ | ||
Type: v1alpha1.PipelineResourceTypeImage, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
Status: v1beta1.TaskRunStatus{ | ||
TaskRunStatusFields: v1beta1.TaskRunStatusFields{ | ||
TaskRunResults: []v1beta1.TaskRunResult{ | ||
{ | ||
Name: "IMAGE_URL", | ||
Value: *v1beta1.NewArrayOrString("registry/myimage"), | ||
}, | ||
{ | ||
Name: "IMAGE_DIGEST", | ||
Value: *v1beta1.NewArrayOrString(digest1), | ||
}, | ||
{ | ||
Name: "mvn1_ARTIFACT_URI", | ||
Value: *v1beta1.NewArrayOrString("maven-test-0.1.1.jar"), | ||
}, | ||
{ | ||
Name: "mvn1_ARTIFACT_DIGEST", | ||
Value: *v1beta1.NewArrayOrString(digest3), | ||
}, | ||
{ | ||
Name: "mvn1_pom_ARTIFACT_URI", | ||
Value: *v1beta1.NewArrayOrString("maven-test-0.1.1.pom"), | ||
}, | ||
{ | ||
Name: "mvn1_pom_ARTIFACT_DIGEST", | ||
Value: *v1beta1.NewArrayOrString(digest4), | ||
}, | ||
{ | ||
Name: "mvn1_src_ARTIFACT_URI", | ||
Value: *v1beta1.NewArrayOrString("maven-test-0.1.1-sources.jar"), | ||
}, | ||
{ | ||
Name: "mvn1_src_ARTIFACT_DIGEST", | ||
Value: *v1beta1.NewArrayOrString(digest5), | ||
}, | ||
{ | ||
Name: "invalid_ARTIFACT_DIGEST", | ||
Value: *v1beta1.NewArrayOrString(digest5), | ||
}, | ||
{ | ||
Name: "mvn1_pkg" + "-" + artifacts.ArtifactsOutputsResultName, | ||
Value: *v1beta1.NewObject(map[string]string{ | ||
"uri": "projects/test-project-1/locations/us-west4/repositories/test-repo/mavenArtifacts/com.google.guava:guava:31.0-jre", | ||
"digest": digest1, | ||
}), | ||
}, | ||
{ | ||
Name: "mvn1_pom_sha512" + "-" + artifacts.ArtifactsOutputsResultName, | ||
Value: *v1beta1.NewObject(map[string]string{ | ||
"uri": "com.google.guava:guava:1.0-jre.pom", | ||
"digest": digest2, | ||
}), | ||
}, | ||
{ | ||
Name: "img1_input" + "-" + artifacts.ArtifactsInputsResultName, | ||
Value: *v1beta1.NewObject(map[string]string{ | ||
"uri": "gcr.io/foo/bar", | ||
"digest": digest3, | ||
}), | ||
}, | ||
}, | ||
ResourcesResult: []v1beta1.PipelineResourceResult{ | ||
{ | ||
ResourceName: "built-image", | ||
Key: "url", | ||
Value: "registry/resource-image", | ||
}, { | ||
ResourceName: "built-image", | ||
Key: "digest", | ||
Value: digest2, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
expected := []in_toto.Subject{ | ||
{ | ||
Name: "com.google.guava:guava:1.0-jre.pom", | ||
Digest: slsa.DigestSet{ | ||
"sha256": strings.TrimPrefix(digest2, "sha256:"), | ||
}, | ||
}, { | ||
Name: "index.docker.io/registry/myimage", | ||
Digest: slsa.DigestSet{ | ||
"sha256": strings.TrimPrefix(digest1, "sha256:"), | ||
}, | ||
}, { | ||
Name: "maven-test-0.1.1-sources.jar", | ||
Digest: slsa.DigestSet{ | ||
"sha256": strings.TrimPrefix(digest5, "sha256:"), | ||
}, | ||
}, { | ||
Name: "maven-test-0.1.1.jar", | ||
Digest: slsa.DigestSet{ | ||
"sha256": strings.TrimPrefix(digest3, "sha256:"), | ||
}, | ||
}, { | ||
Name: "maven-test-0.1.1.pom", | ||
Digest: slsa.DigestSet{ | ||
"sha256": strings.TrimPrefix(digest4, "sha256:"), | ||
}, | ||
}, { | ||
Name: "projects/test-project-1/locations/us-west4/repositories/test-repo/mavenArtifacts/com.google.guava:guava:31.0-jre", | ||
Digest: slsa.DigestSet{ | ||
"sha256": strings.TrimPrefix(digest1, "sha256:"), | ||
}, | ||
}, { | ||
Name: "registry/resource-image", | ||
Digest: slsa.DigestSet{ | ||
"sha256": strings.TrimPrefix(digest2, "sha256:"), | ||
}, | ||
}, | ||
} | ||
tro := objects.NewTaskRunObject(tr) | ||
got := extract.SubjectDigests(tro, logtesting.TestLogger(t)) | ||
if !reflect.DeepEqual(expected, got) { | ||
if d := cmp.Diff(expected, got); d != "" { | ||
t.Log(d) | ||
} | ||
t.Fatalf("expected \n%v\n got \n%v\n", expected, got) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
{ | ||
"_type": "https://in-toto.io/Statement/v0.1", | ||
"predicateType": "https://slsa.dev/provenance/v0.2", | ||
"subject": [ | ||
{ | ||
"name": "gcr.io/foo/bar", | ||
"digest": { | ||
"sha256": "05f95b26ed10668b7183c1e2da98610e91372fa9f510046d4ce5812addad86b5" | ||
} | ||
} | ||
], | ||
"predicate": { | ||
"builder": { | ||
"id": "https://tekton.dev/chains/v2" | ||
}, | ||
"buildType": "https://chains.tekton.dev/format/slsa/v2alpha1/type/tekton.dev/v1beta1/TaskRun", | ||
"invocation": { | ||
"configSource": {}, | ||
"parameters": { | ||
"ComputeResources": null, | ||
"Debug": null, | ||
"Params": null, | ||
"PodTemplate": null, | ||
"Resources": { | ||
"inputs": [{ | ||
"name": "sourcerepo", | ||
"resourceSpec": { | ||
"params": [ | ||
{"name": "revision", "value": "v0.32.0"}, | ||
{ | ||
"name": "url", | ||
"value": "https://github.com/GoogleContainerTools/skaffold" | ||
} | ||
], | ||
"type": "git" | ||
} | ||
}], | ||
"outputs": [{ | ||
"name": "builtImage", | ||
"resourceSpec": { | ||
"params": [{"name": "url", "value": "gcr.io/foo/bar"}], | ||
"type": "image" | ||
} | ||
}] | ||
}, | ||
"Retries": 0, | ||
"ServiceAccountName": "default", | ||
"SidecarOverrides": null, | ||
"Status": "", | ||
"StatusMessage": "", | ||
"StepOverrides": null, | ||
"Timeout": "1h0m0s", | ||
"Workspaces": null | ||
} | ||
}, | ||
"buildConfig": { | ||
"taskSpec": { | ||
"resources": { | ||
"inputs": [{ | ||
"name": "sourcerepo", | ||
"type": "git" | ||
}], | ||
"outputs": [{ | ||
"name": "builtImage", | ||
"type": "image", | ||
"targetPath": "/workspace/sourcerepo" | ||
}] | ||
}, | ||
"steps": [ | ||
{ | ||
"name": "build-and-push", | ||
"image": "busybox", | ||
"resources": {}, | ||
"script": "set -e\ncat \u003c\u003cEOF > $(inputs.resources.sourcerepo.path)/index.json\n{\n\"schemaVersion\": 2,\n\"manifests\": [\n {\n \"mediaType\": \"application/vnd.oci.image.index.v1+json\",\n \"size\": 314,\n \"digest\": \"sha256:05f95b26ed10668b7183c1e2da98610e91372fa9f510046d4ce5812addad86b5\"\n }\n]\n}\n" | ||
},{ | ||
"name": "echo", | ||
"image": "busybox", | ||
"resources": {}, | ||
"script": "cat $(inputs.resources.sourcerepo.path)/index.json" | ||
} | ||
] | ||
} | ||
}, | ||
"metadata": { | ||
"buildStartedOn": "{{index .BuildStartTimes 0}}", | ||
"buildFinishedOn": "{{index .BuildFinishedTimes 0}}", | ||
"completeness": { | ||
"parameters": false, | ||
"environment": false, | ||
"materials": false | ||
}, | ||
"reproducible": false | ||
}, | ||
"materials": [ | ||
{{range .URIDigest}} | ||
{ | ||
"uri": "{{.URI}}", | ||
"digest": { | ||
"sha256": "{{.Digest}}" | ||
} | ||
}, | ||
{{end}} | ||
{ | ||
"uri": "git+https://github.com/GoogleContainerTools/skaffold@v0.32.0", | ||
"digest": { | ||
"sha1": "6ed7aad5e8a36052ee5f6079fc91368e362121f7" | ||
} | ||
} | ||
] | ||
} | ||
} |