Fix handling of platform flag (#3880)

* Update of buildkit to the last version

Commit contains the version of buildkit from output of
`go list -m -json github.com/moby/buildkit@c0ac5e8b9b51603c5a93795fcf1373d6d44d3a85`:

go get -u github.com/moby/buildkit@v0.11.0-rc1.0.20221213132957-c0ac5e8b9b51
go mod tidy
go mod vendor

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>

* Fix handling of platform flag

In case of 'FROM --platform' defined I can see 'ERROR: no match for
platform in manifest: not found'. The problem was fixed on buildkit side

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
This commit is contained in:
Petr Fedchenkov
2022-12-13 22:04:29 +03:00
committed by GitHub
parent d1452385cc
commit c3b4a588c9
691 changed files with 47628 additions and 13134 deletions

View File

@@ -0,0 +1,4 @@
FROM alpine:3.15
COPY foo /foo
RUN uname -m >/uname_m && uname -s >/uname_s

View File

@@ -0,0 +1,4 @@
image: chained-build-platform-image1-test-does-not-exist-anywhere-else-123456789 # this must be used as FROM in the chained image
network: true
arches:
- amd64

View File

@@ -0,0 +1 @@
bar

View File

@@ -0,0 +1,9 @@
# this FROM *must* be updated when changing ../build1; just run `lkt pkg show-tag ../build1` and place it here
FROM --platform=linux/amd64 linuxkit/chained-build-platform-image1-test-does-not-exist-anywhere-else-123456789:8764ad5a2481b9c6b213a0cea6abaa30085481be as src
FROM --platform=linux/amd64 alpine:3.15
COPY --from=src /foo /foo
RUN cat /foo
# copy output of uname commands from first build and compare with current
COPY --from=src /uname* /
RUN uname -m >/uname_m_current && uname -s >/uname_s_current && cat /uname_m_current && cat /uname_s_current
RUN diff /uname_m /uname_m_current && diff /uname_s /uname_s_current

View File

@@ -0,0 +1,4 @@
image: chained-build-test-second
network: true
arches:
- arm64

View File

@@ -0,0 +1,19 @@
#!/bin/sh
# SUMMARY: Check that chained builds get the output of one for the next with --platform defined
# LABELS:
# REPEAT:
set -ex
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
# Test code goes here
echo linuxkit is "$(which linuxkit)"
# build the first, use it to build the second
linuxkit pkg build --force ./build1
linuxkit pkg build --force ./build2
exit 0