Skip to content

Commit

Permalink
update goldens and tests, since digests changed
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Hall <[email protected]>
  • Loading branch information
imjasonh committed Oct 25, 2024
1 parent 0c00447 commit 3e7125e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions internal/cli/publish_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func TestPublish(t *testing.T) {

// This test will fail if we ever make a change in apko that changes the image.
// Sometimes, this is intentional, and we need to change this and bump the version.
want := "sha256:f09e60c2dabb44047225149ccc4a6cdffac23aabf50352931ddd618705e82f2d"
want := "sha256:80fafe63b2c370069deaabffd2d4505ffe7ef0b3a47032686c31dbcab5be25fd"
require.Equal(t, want, digest.String())

sdst := fmt.Sprintf("%s:%s.sbom", dst, strings.ReplaceAll(want, ":", "-"))
Expand All @@ -109,7 +109,7 @@ func TestPublish(t *testing.T) {

// This test will fail if we ever make a change in apko that changes the SBOM.
// Sometimes, this is intentional, and we need to change this and bump the version.
swant := "sha256:194bbad4bd7a37e206126b24d63fd0146434b1abbad9afa567fab364c0d5e608"
swant := "sha256:6d7ae8bf9f5f7a34553cda2dccb8a270db21770de545e87d14c27c992daf9b02"
require.Equal(t, swant, got)

im, err := idx.IndexManifest()
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/testdata/golden/index.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"schemaVersion":2,"mediaType":"application/vnd.oci.image.index.v1+json","manifests":[{"mediaType":"application/vnd.oci.image.manifest.v1+json","size":476,"digest":"sha256:a87baa16c787394589606e2519134a8e23d9323f475cc3e1a6f63731e8579675","platform":{"architecture":"amd64","os":"linux"}},{"mediaType":"application/vnd.oci.image.manifest.v1+json","size":476,"digest":"sha256:f5e87ab7f4eba7d7a649cd3fcb969b4fcb9c72784c9cbe7ed3f0f60e84933972","platform":{"architecture":"arm64","os":"linux"}}],"annotations":{"org.opencontainers.image.created":"1970-01-01T00:00:00Z"}}
{"schemaVersion":2,"mediaType":"application/vnd.oci.image.index.v1+json","manifests":[{"mediaType":"application/vnd.oci.image.manifest.v1+json","size":476,"digest":"sha256:a87baa16c787394589606e2519134a8e23d9323f475cc3e1a6f63731e8579675","platform":{"architecture":"amd64","os":"linux"}},{"mediaType":"application/vnd.oci.image.manifest.v1+json","size":476,"digest":"sha256:f5e87ab7f4eba7d7a649cd3fcb969b4fcb9c72784c9cbe7ed3f0f60e84933972","platform":{"architecture":"arm64","os":"linux"}}],"annotations":{"created":"1970-01-01T00:00:00Z"}}
18 changes: 9 additions & 9 deletions internal/cli/testdata/golden/sboms/sbom-index.spdx.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"SPDXID": "SPDXRef-DOCUMENT",
"name": "sbom-sha256:d558b9114f2eaf11b1a3d9720cdcff3b12f087e741377d04f93bd5dc53f36227",
"name": "sbom-sha256:8ee3652bfeecfcf3548eac1f0f1bfdf04ba0849e37979f83ffd5edc87d83ca39",
"spdxVersion": "SPDX-2.3",
"creationInfo": {
"created": "1970-01-01T00:00:00Z",
Expand All @@ -13,13 +13,13 @@
"dataLicense": "CC0-1.0",
"documentNamespace": "https://spdx.org/spdxdocs/apko/",
"documentDescribes": [
"SPDXRef-Package-sha256-d558b9114f2eaf11b1a3d9720cdcff3b12f087e741377d04f93bd5dc53f36227"
"SPDXRef-Package-sha256-8ee3652bfeecfcf3548eac1f0f1bfdf04ba0849e37979f83ffd5edc87d83ca39"
],
"packages": [
{
"SPDXID": "SPDXRef-Package-sha256-d558b9114f2eaf11b1a3d9720cdcff3b12f087e741377d04f93bd5dc53f36227",
"name": "sha256:d558b9114f2eaf11b1a3d9720cdcff3b12f087e741377d04f93bd5dc53f36227",
"versionInfo": "sha256:d558b9114f2eaf11b1a3d9720cdcff3b12f087e741377d04f93bd5dc53f36227",
"SPDXID": "SPDXRef-Package-sha256-8ee3652bfeecfcf3548eac1f0f1bfdf04ba0849e37979f83ffd5edc87d83ca39",
"name": "sha256:8ee3652bfeecfcf3548eac1f0f1bfdf04ba0849e37979f83ffd5edc87d83ca39",
"versionInfo": "sha256:8ee3652bfeecfcf3548eac1f0f1bfdf04ba0849e37979f83ffd5edc87d83ca39",
"filesAnalyzed": false,
"description": "Multi-arch image index",
"downloadLocation": "NOASSERTION",
Expand All @@ -29,13 +29,13 @@
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "d558b9114f2eaf11b1a3d9720cdcff3b12f087e741377d04f93bd5dc53f36227"
"checksumValue": "8ee3652bfeecfcf3548eac1f0f1bfdf04ba0849e37979f83ffd5edc87d83ca39"
}
],
"externalRefs": [
{
"referenceCategory": "PACKAGE-MANAGER",
"referenceLocator": "pkg:oci/golden@sha256%3Ad558b9114f2eaf11b1a3d9720cdcff3b12f087e741377d04f93bd5dc53f36227?mediaType=application%2Fvnd.oci.image.index.v1%2Bjson",
"referenceLocator": "pkg:oci/golden@sha256%3A8ee3652bfeecfcf3548eac1f0f1bfdf04ba0849e37979f83ffd5edc87d83ca39?mediaType=application%2Fvnd.oci.image.index.v1%2Bjson",
"referenceType": "purl"
}
]
Expand Down Expand Up @@ -87,12 +87,12 @@
],
"relationships": [
{
"spdxElementId": "SPDXRef-Package-sha256-d558b9114f2eaf11b1a3d9720cdcff3b12f087e741377d04f93bd5dc53f36227",
"spdxElementId": "SPDXRef-Package-sha256-8ee3652bfeecfcf3548eac1f0f1bfdf04ba0849e37979f83ffd5edc87d83ca39",
"relationshipType": "VARIANT_OF",
"relatedSpdxElement": "SPDXRef-Package-sha256-a87baa16c787394589606e2519134a8e23d9323f475cc3e1a6f63731e8579675"
},
{
"spdxElementId": "SPDXRef-Package-sha256-d558b9114f2eaf11b1a3d9720cdcff3b12f087e741377d04f93bd5dc53f36227",
"spdxElementId": "SPDXRef-Package-sha256-8ee3652bfeecfcf3548eac1f0f1bfdf04ba0849e37979f83ffd5edc87d83ca39",
"relationshipType": "VARIANT_OF",
"relatedSpdxElement": "SPDXRef-Package-sha256-f5e87ab7f4eba7d7a649cd3fcb969b4fcb9c72784c9cbe7ed3f0f60e84933972"
}
Expand Down
5 changes: 1 addition & 4 deletions pkg/baseimg/base_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (

v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/google/go-containerregistry/pkg/v1/layout"
ocitypes "github.com/google/go-containerregistry/pkg/v1/types"

"chainguard.dev/apko/pkg/apk/apk"
"chainguard.dev/apko/pkg/build/types"
Expand All @@ -50,9 +49,7 @@ func getUnnestedImageIndex(imgPath string) (v1.ImageIndex, error) {
return nil, err
}
for _, m := range indexManifest.Manifests {
if m.MediaType == ocitypes.OCIImageIndex {
return index.ImageIndex(m.Digest)
}
return index.ImageIndex(m.Digest)
}
return index, nil
}
Expand Down

0 comments on commit 3e7125e

Please sign in to comment.