-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes value for storage.oci.repository
Previously while providing repo url value for storage oci repository, chains controller was giving an error as `a digest must contain exactly one '@' separator (e.g. registry/repository@digest)` because, it was not able to add digest Hence this patch fixes it, by formatting the value provided by the user and thus storing the attestations/signatures in the provided location Signed-off-by: PuneetPunamiya <ppunamiy@redhat.com>
- Loading branch information
1 parent
1c918c9
commit 7066899
Showing
2 changed files
with
62 additions
and
17 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package oci | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/tektoncd/chains/pkg/config" | ||
) | ||
|
||
func TestStorageOCIRepo(t *testing.T) { | ||
cfg := config.Config{} | ||
cfg.Storage.OCI.Repository = "quay.io/concaf" | ||
tests := []struct { | ||
testImageName string | ||
expectedImageName string | ||
}{ | ||
{ | ||
testImageName: "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init@sha256:bc4f7468f87486e3835b09098c74cd7f54db2cf697cbb9b824271b95a2d0871e", | ||
expectedImageName: "quay.io/concaf@sha256:bc4f7468f87486e3835b09098c74cd7f54db2cf697cbb9b824271b95a2d0871e", | ||
}, | ||
{ | ||
testImageName: "docker.io/puneet2147/kaniko-chains@sha256:bc4f7468f87486e3835b09098c74cd7f54db2cf697cbb9b824271b95a2d0871e", | ||
expectedImageName: "quay.io/concaf@sha256:bc4f7468f87486e3835b09098c74cd7f54db2cf697cbb9b824271b95a2d0871e", | ||
}, | ||
{ | ||
testImageName: "registry.com/spam/spam/spam/spam/spam/spam@sha256:bc4f7468f87486e3835b09098c74cd7f54db2cf697cbb9b824271b95a2d0871e", | ||
expectedImageName: "quay.io/concaf@sha256:bc4f7468f87486e3835b09098c74cd7f54db2cf697cbb9b824271b95a2d0871e", | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
digest, err := newDigest(cfg, test.testImageName) | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
assert.Equal(t, digest.Name(), test.expectedImageName) | ||
} | ||
} |