Skip to content

Commit

Permalink
Fixes for v0.21.1 (#1134)
Browse files Browse the repository at this point in the history
* Fix field names in generated json statement (#1129)

To keep backwards compatibility with previous struct versions (e.g, github.com/in-toto/in-toto-golang/in_toto) we have to use protojson.Marshal function to transform the struct to its json representation so the tags defined in the intoto.Statement are follow and applied to the resulting string.

(cherry picked from commit 3bf8cac)

* Fix no repeated subjects for v2alpha4 pipelineruns (#1130)

Change the pipelinerun v2alpha4 method that calculates the subjects to use `artifact.AppendSubjects` instead of `append` to avoid duplicated subjects.

(cherry picked from commit badc734)

* Calculate subjects per formatter (#1132)

* Calculate subjects per formatter

* Tests for new retrieve full uris in grafeas

(cherry picked from commit 750a98e)
  • Loading branch information
renzodavid9 authored Jun 10, 2024
1 parent 9a67b0f commit 4cb5c50
Show file tree
Hide file tree
Showing 26 changed files with 1,528 additions and 47 deletions.
64 changes: 64 additions & 0 deletions examples/v2alpha4/pipeline-with-repeated-results.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: pipeline-test-run
spec:
pipelineSpec:
results:
- name: output1-ARTIFACT_OUTPUTS
value: $(tasks.t1.results.output1-ARTIFACT_OUTPUTS)
- name: output2-ARTIFACT_OUTPUTS
value: $(tasks.t1.results.output2)
- name: output3-ARTIFACT_OUTPUTS
value: $(tasks.t2.results.output3-ARTIFACT_OUTPUTS)
tasks:
- name: t1
taskSpec:
results:
- name: output1-ARTIFACT_OUTPUTS
type: object
properties:
uri: {}
digest: {}
isBuildArtifact: {}

- name: output2
type: object
properties:
uri: {}
digest: {}

steps:
- name: step1
image: busybox:glibc
script: |
echo -n "Hello!"
echo -n "{\"uri\":\"gcr.io/foo/img1\", \"digest\":\"sha256:586789aa031fafc7d78a5393cdc772e0b55107ea54bb8bcf3f2cdac6c6da51ee\", \"isBuildArtifact\": \"true\" }" > $(results.output1-ARTIFACT_OUTPUTS.path)
echo -n "{\"uri\":\"gcr.io/foo/img2\", \"digest\":\"sha256:586789aa031fafc7d78a5393cdc772e0b55107ea54bb8bcf3f2cdac6c6da51ee\"}" > $(results.output2.path)
- name: t2
taskSpec:
results:
- name: output3-ARTIFACT_OUTPUTS
type: object
properties:
uri: {}
digest: {}
isBuildArtifact: {}
steps:
- name: step1
image: busybox:glibc
script: |
echo -n "Hello!"
echo -n "{\"uri\":\"gcr.io/foo/img1\", \"digest\":\"sha256:586789aa031fafc7d78a5393cdc772e0b55107ea54bb8bcf3f2cdac6c6da51ee\", \"isBuildArtifact\": \"true\" }" > $(results.output3-ARTIFACT_OUTPUTS.path)
- name: t3
taskSpec:
results:
- name: IMAGES
type: string
steps:
- name: step1
image: busybox:glibc
script: |
echo -n "gcr.io/foo/img1@sha256:586789aa031fafc7d78a5393cdc772e0b55107ea54bb8bcf3f2cdac6c6da51ee" > $(results.IMAGES.path)
1 change: 1 addition & 0 deletions pkg/chains/formats/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type Payloader interface {
CreatePayload(ctx context.Context, obj interface{}) (interface{}, error)
Type() config.PayloadType
Wrap() bool
RetrieveAllArtifactURIs(ctx context.Context, obj interface{}) ([]string, error)
}

const (
Expand Down
5 changes: 5 additions & 0 deletions pkg/chains/formats/simple/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,8 @@ func (i SimpleContainerImage) ImageName() string {
func (i *SimpleSigning) Type() config.PayloadType {
return formats.PayloadTypeSimpleSigning
}

// RetrieveAllArtifactURIs returns always an error, feature not available for simplesigning formatter.
func (i *SimpleSigning) RetrieveAllArtifactURIs(_ context.Context, _ interface{}) ([]string, error) {
return nil, fmt.Errorf("RetrieveAllArtifactURIs not supported for simeplesining formatter")
}
Loading

0 comments on commit 4cb5c50

Please sign in to comment.