Skip to content

Commit

Permalink
Merge pull request #5543 from nalind/5478-redux
Browse files Browse the repository at this point in the history
build: be more selective about specifying the default OS
  • Loading branch information
openshift-merge-bot[bot] authored May 23, 2024
2 parents 747ff64 + c09e08b commit 9b6b2f1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion imagebuildah/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func BuildDockerfiles(ctx context.Context, store storage.Store, options define.B
systemContext := options.SystemContext
for _, platform := range options.Platforms {
platformContext := *systemContext
if platform.OS == "" {
if platform.OS == "" && platform.Arch != "" {
platform.OS = runtime.GOOS
}
platformSpec := internalUtil.NormalizePlatform(v1.Platform{
Expand Down
14 changes: 14 additions & 0 deletions tests/bud.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6811,3 +6811,17 @@ _EOF
assert "$status" -eq 2 "exit code from ls"
expect_output --substring "No such file or directory"
}

@test "pull policy" {
echo FROM busybox > ${TEST_SCRATCH_DIR}/Containerfile
arch=amd64
if test $(arch) = x86_64 ; then
arch=arm64
fi
# specifying the arch should trigger "just pull it anyway" in containers/common
run_buildah build --pull=missing --arch $arch --iidfile ${TEST_SCRATCH_DIR}/image1.txt ${TEST_SCRATCH_DIR}
# not specifying the arch should trigger "yeah, fine, whatever we already have is fine" in containers/common
run_buildah build --pull=missing --iidfile ${TEST_SCRATCH_DIR}/image2.txt ${TEST_SCRATCH_DIR}
# both of these should have just been the base image's ID, which shouldn't have changed the second time around
cmp ${TEST_SCRATCH_DIR}/image1.txt ${TEST_SCRATCH_DIR}/image2.txt
}

1 comment on commit 9b6b2f1

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.