Skip to content

Commit

Permalink
fix: build single-arch images compatibly with apko CLI
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Hall <jason@chainguard.dev>
  • Loading branch information
imjasonh committed Sep 26, 2023
1 parent 55ea67c commit 2ad17cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
11 changes: 0 additions & 11 deletions internal/provider/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,6 @@ func doBuild(ctx context.Context, data BuildResourceModel) (v1.Hash, coci.Signed
if err := errg.Wait(); err != nil {
return v1.Hash{}, nil, nil, err
}
// If we built a final image, then return that instead of wrapping it in an
// image index.
if len(imgs) == 1 {
for _, img := range imgs {
h, err := img.Digest()
if err != nil {
return v1.Hash{}, nil, nil, err
}
return h, img, sboms, nil
}
}

// generate the index
finalDigest, idx, err := oci.GenerateIndex(ctx, *ic2, imgs)
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/resource_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ resource "apko_build" "foo" {
resource.TestCheckResourceAttr("apko_build.foo", "repo", repostr),
resource.TestCheckResourceAttr("apko_build.foo", "image_ref",
// With pinned packages we should always get this digest.
repo.Digest("sha256:14f90e68f2603e992cc51916cc70113b1037bc2c5c6566ca26fec292753f3360").String()),
repo.Digest("sha256:a753adeb6de448f76e829c3d09deabdc9c183f30242b78e42d4c65ada17aa607").String()),

// Check that the build's amd64 predicate exists, the digest
// matches, and the creation timestamp is what we expect.
Expand Down Expand Up @@ -293,7 +293,7 @@ resource "apko_build" "foo" {
resource.TestCheckResourceAttr("apko_build.foo", "repo", repostr),
resource.TestCheckResourceAttr("apko_build.foo", "image_ref",
// With pinned packages we should always get this digest.
repo.Digest("sha256:7ecfd5ca0cec575e96ff46bf53284950ee80e5d1211cba47a51189debe41c79a").String()),
repo.Digest("sha256:8cee7e4467cc4361cc0754255fb93856eb14a0ecddafc247d1babf79a41d2e1c").String()),

// Check that the build's amd64 predicate exists, the digest
// matches, and the creation timestamp is what we expect.
Expand Down

0 comments on commit 2ad17cb

Please sign in to comment.