From 5938170b84ddeea6030873b4558574b49b65003c Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Fri, 18 Oct 2019 16:36:14 +0900 Subject: [PATCH] hack: rename Dockerfiles Fix https://github.com/moby/buildkit/issues/1208 Signed-off-by: Akihiro Suda --- .../test.buildkit.Dockerfile => Dockerfile | 0 docs/rootless.md | 2 +- hack/binaries | 3 +-- hack/build_ci_first_pass | 2 -- hack/cross | 3 +-- ...uildkit.Dockerfile => generated-files.Dockerfile} | 0 .../{lint.buildkit.Dockerfile => lint.Dockerfile} | 0 ...{vendor.buildkit.Dockerfile => vendor.Dockerfile} | 0 hack/images | 12 +++--------- hack/lint | 4 ++-- hack/release-tar | 1 - hack/test | 3 +-- hack/update-generated-files | 4 ++-- hack/update-vendor | 4 ++-- hack/validate-generated-files | 4 ++-- hack/validate-vendor | 4 ++-- util/testutil/integration/containerd.go | 2 +- util/testutil/integration/oci.go | 2 +- 18 files changed, 19 insertions(+), 31 deletions(-) rename hack/dockerfiles/test.buildkit.Dockerfile => Dockerfile (100%) rename hack/dockerfiles/{generated-files.buildkit.Dockerfile => generated-files.Dockerfile} (100%) rename hack/dockerfiles/{lint.buildkit.Dockerfile => lint.Dockerfile} (100%) rename hack/dockerfiles/{vendor.buildkit.Dockerfile => vendor.Dockerfile} (100%) diff --git a/hack/dockerfiles/test.buildkit.Dockerfile b/Dockerfile similarity index 100% rename from hack/dockerfiles/test.buildkit.Dockerfile rename to Dockerfile diff --git a/docs/rootless.md b/docs/rootless.md index 08ed4e7f..c9dc7e34 100644 --- a/docs/rootless.md +++ b/docs/rootless.md @@ -97,7 +97,7 @@ user:100000:65536 To change the UID/GID configuration, you need to modify and build the BuildKit image manually. ``` -$ vi hack/dockerfiles/test.buildkit.Dockerfile +$ vi Dockerfile $ make images $ docker run ... moby/buildkit:local-rootless ... ``` diff --git a/hack/binaries b/hack/binaries index ee787240..85ea4a3d 100755 --- a/hack/binaries +++ b/hack/binaries @@ -24,7 +24,7 @@ binariesDocker() { target="linux" fi - docker build $platformFlag --build-arg BUILDKITD_TAGS="${BUILDKITD_TAGS}" --target binaries-$target --iidfile $iidfile -f ./hack/dockerfiles/test.buildkit.Dockerfile --force-rm . + docker build $platformFlag --build-arg BUILDKITD_TAGS="${BUILDKITD_TAGS}" --target binaries-$target --iidfile $iidfile --force-rm . iid=$(cat $iidfile) containerID=$(docker create $iid copy) docker cp $containerID:/ bin/tmp @@ -42,7 +42,6 @@ binaries() { fi buildctl build $progressFlag --frontend=dockerfile.v0 \ --local context=. --local dockerfile=. \ - --opt filename=./hack/dockerfiles/test.buildkit.Dockerfile \ $buildkitdTagsFlags --opt target=binaries $platformFlag \ --output type=local,dest=./bin/ } diff --git a/hack/build_ci_first_pass b/hack/build_ci_first_pass index 7d61c7e7..097d2894 100755 --- a/hack/build_ci_first_pass +++ b/hack/build_ci_first_pass @@ -23,7 +23,6 @@ fi set -x buildctl build $progressFlag --frontend=dockerfile.v0 \ $currentcontextBuildctl \ - --opt filename=./hack/dockerfiles/test.buildkit.Dockerfile \ --opt target=binaries \ --import-cache type=registry,ref=cicache.buildk.it/moby/buildkit/master:binaries \ --import-cache type=registry,ref=cicache.buildk.it/moby/buildkit/master:integration-tests \ @@ -31,7 +30,6 @@ buildctl build $progressFlag --frontend=dockerfile.v0 \ buildctl build $progressFlag --frontend=dockerfile.v0 \ $currentcontextBuildctl \ - --opt filename=./hack/dockerfiles/test.buildkit.Dockerfile \ --opt target=integration-tests-base \ --import-cache cicache.buildk.it/moby/buildkit/master:integration-tests \ $exportCacheFlags $exportFlags:integration-tests diff --git a/hack/cross b/hack/cross index 93ede51d..d79d7141 100755 --- a/hack/cross +++ b/hack/cross @@ -16,7 +16,6 @@ repo="cicache.buildk.it/moby/buildkit/master" $(dirname $0)/login_ci_cache buildctl build $progressFlag --frontend=dockerfile.v0 \ $currentcontextBuildctl \ - --opt filename=./hack/dockerfiles/test.buildkit.Dockerfile \ --opt target=binaries-linux-helper \ --opt platform=$RUNC_PLATFORMS \ --import-cache cicache.buildk.it/moby/buildkit/master:binaries-cross-helper \ @@ -24,6 +23,6 @@ buildctl build $progressFlag --frontend=dockerfile.v0 \ fi buildctl build --progress=plain --frontend=dockerfile.v0 \ - $currentcontextBuildctl --opt filename=./hack/dockerfiles/test.buildkit.Dockerfile \ + $currentcontextBuildctl \ --opt platform=$PLATFORMS \ --import-cache cicache.buildk.it/moby/buildkit/master:binaries-cross-helper diff --git a/hack/dockerfiles/generated-files.buildkit.Dockerfile b/hack/dockerfiles/generated-files.Dockerfile similarity index 100% rename from hack/dockerfiles/generated-files.buildkit.Dockerfile rename to hack/dockerfiles/generated-files.Dockerfile diff --git a/hack/dockerfiles/lint.buildkit.Dockerfile b/hack/dockerfiles/lint.Dockerfile similarity index 100% rename from hack/dockerfiles/lint.buildkit.Dockerfile rename to hack/dockerfiles/lint.Dockerfile diff --git a/hack/dockerfiles/vendor.buildkit.Dockerfile b/hack/dockerfiles/vendor.Dockerfile similarity index 100% rename from hack/dockerfiles/vendor.buildkit.Dockerfile rename to hack/dockerfiles/vendor.Dockerfile diff --git a/hack/images b/hack/images index 73cd55d4..dc1d210c 100755 --- a/hack/images +++ b/hack/images @@ -25,14 +25,14 @@ if [ -z "$TAG" ] || [ -z "$REPO" ]; then usage fi -imageDockerCommon() { +imageDocker() { if echo $PLATFORMS | grep , >/dev/null; then echo "PREFER_BUILDCTL=1 needs to be set to build images for $PLATFORMS" exit 1 fi set -x - docker build $@ --platform=$PLATFORMS -t $REPO:$TAG . - docker build $@ --platform=$PLATFORMS -t $REPO:$TAG-rootless --target rootless . + docker build $progressFlag --platform=$PLATFORMS -t $REPO:$TAG . + docker build $progressFlag --platform=$PLATFORMS -t $REPO:$TAG-rootless --target rootless . set +x if [ "$PUSH" = "push" ]; then @@ -55,10 +55,6 @@ imageDockerCommon() { fi } -imageDocker() { - imageDockerCommon $progressFlag -f ./hack/dockerfiles/test.buildkit.Dockerfile -} - image() { pushFlag="" if [ "$PUSH" = "push" ]; then @@ -76,7 +72,6 @@ image() { buildctl build $progressFlag --frontend=dockerfile.v0 \ --local context=. --local dockerfile=. \ - --opt filename=./hack/dockerfiles/test.buildkit.Dockerfile \ --opt platform=$PLATFORMS \ --export-cache type=inline \ --output type=image,\"name=$REPO:$TAG$tagLatest\",$pushFlag @@ -84,7 +79,6 @@ image() { buildctl build $progressFlag --frontend=dockerfile.v0 \ --local context=. --local dockerfile=. \ --opt target=rootless \ - --opt filename=./hack/dockerfiles/test.buildkit.Dockerfile \ --opt platform=$PLATFORMS \ --export-cache type=inline \ --output type=image,\"name=$REPO:$TAG-rootless$tagLatestRootless\",$pushFlag diff --git a/hack/lint b/hack/lint index b62f64ea..8a6b6993 100755 --- a/hack/lint +++ b/hack/lint @@ -11,7 +11,7 @@ if [ "$CONTINUOUS_INTEGRATION" == "true" ]; then progressFlag="--progress=plain" lintDocker() { export DOCKER_BUILDKIT=1 iidfile=$(mktemp -t docker-iidfile.XXXXXXXXXX) - docker build --iidfile $iidfile -f ./hack/dockerfiles/lint.buildkit.Dockerfile --force-rm . + docker build --iidfile $iidfile -f ./hack/dockerfiles/lint.Dockerfile --force-rm . iid=$(cat $iidfile) docker rmi $iid rm -f $iidfile @@ -20,7 +20,7 @@ lintDocker() { lint() { buildctl build $progressFlag --frontend=dockerfile.v0 \ --local context=. --local dockerfile=. \ - --opt filename=./hack/dockerfiles/lint.buildkit.Dockerfile + --opt filename=./hack/dockerfiles/lint.Dockerfile } case $buildmode in diff --git a/hack/release-tar b/hack/release-tar index abc7e8e1..e287723f 100755 --- a/hack/release-tar +++ b/hack/release-tar @@ -26,7 +26,6 @@ set -x buildctl build $progressFlag --frontend=dockerfile.v0 \ --local context=. --local dockerfile=. \ - --opt filename=./hack/dockerfiles/test.buildkit.Dockerfile \ --opt target=release \ --opt platform=$PLATFORMS \ --exporter local \ diff --git a/hack/test b/hack/test index 72a5800a..9cc0b220 100755 --- a/hack/test +++ b/hack/test @@ -48,7 +48,6 @@ case $buildmode in tmpfile=$(mktemp -t docker-iidfile.XXXXXXXXXX) buildctl build $progressFlag --frontend=dockerfile.v0 $currentcontextBuildctl \ --opt target=integration-tests \ - --opt filename=./hack/dockerfiles/test.buildkit.Dockerfile \ --output type=docker,name=$iid,dest=$tmpfile \ --import-cache type=registry,ref=cicache.buildk.it/moby/buildkit/master:integration-tests $importCacheFlags docker load -i $tmpfile @@ -56,7 +55,7 @@ case $buildmode in ;; "docker-buildkit") export DOCKER_BUILDKIT=1 - docker build --iidfile $iidfile -f ./hack/dockerfiles/test.buildkit.Dockerfile --target integration-tests --force-rm . + docker build --iidfile $iidfile --target integration-tests --force-rm . iid=$(cat $iidfile) ;; *) diff --git a/hack/update-generated-files b/hack/update-generated-files index bfea0b29..7d25d808 100755 --- a/hack/update-generated-files +++ b/hack/update-generated-files @@ -15,7 +15,7 @@ case $buildmode in buildctl build $progressFlag --frontend=dockerfile.v0 --local context=. --local dockerfile=. \ --opt build-arg:GOGO_VERSION=$gogo_version \ --opt target=update \ - --opt filename=./hack/dockerfiles/generated-files.buildkit.Dockerfile \ + --opt filename=./hack/dockerfiles/generated-files.Dockerfile \ --output type=local,dest=$output cp -R "$output/generated-files/" . rm -rf $output @@ -23,7 +23,7 @@ case $buildmode in "docker-buildkt") iidfile=$(mktemp -t docker-iidfile.XXXXXXXXXX) export DOCKER_BUILDKIT=1 - docker build --build-arg GOGO_VERSION=$gogo_version --iidfile $iidfile -f ./hack/dockerfiles/generated-files.buildkit.Dockerfile --target update --force-rm . + docker build --build-arg GOGO_VERSION=$gogo_version --iidfile $iidfile -f ./hack/dockerfiles/generated-files.Dockerfile --target update --force-rm . iid=$(cat $iidfile) cid=$(docker create $iid noop) diff --git a/hack/update-vendor b/hack/update-vendor index 99ae5dc5..e551bc06 100755 --- a/hack/update-vendor +++ b/hack/update-vendor @@ -13,7 +13,7 @@ case $buildmode in output=$(mktemp -d -t buildctl-output.XXXXXXXXXX) buildctl build $progressFlag --frontend=dockerfile.v0 --local context=. --local dockerfile=. \ --opt target=update \ - --opt filename=./hack/dockerfiles/vendor.buildkit.Dockerfile \ + --opt filename=./hack/dockerfiles/vendor.Dockerfile \ --output type=local,dest=$output rm -rf ./vendor cp -R "$output"/out/* . @@ -22,7 +22,7 @@ case $buildmode in "docker-buildkit") iidfile=$(mktemp -t docker-iidfile.XXXXXXXXXX) export DOCKER_BUILDKIT=1 - docker build --iidfile $iidfile -f ./hack/dockerfiles/vendor.buildkit.Dockerfile --target update --force-rm . + docker build --iidfile $iidfile -f ./hack/dockerfiles/vendor.Dockerfile --target update --force-rm . iid=$(cat $iidfile) cid=$(docker create $iid noop) rm -rf ./vendor diff --git a/hack/validate-generated-files b/hack/validate-generated-files index c351aeff..ee1b99b5 100755 --- a/hack/validate-generated-files +++ b/hack/validate-generated-files @@ -11,12 +11,12 @@ case ${1:-} in gogo_version=$(awk '$1 == "github.com/gogo/protobuf" { print $2 }' go.mod) case $buildmode in "buildkit") - buildctl build $progressFlag --frontend=dockerfile.v0 --local context=. --local dockerfile=. --opt build-arg:GOGO_VERSION=$gogo_version --opt target=validate --opt filename=./hack/dockerfiles/generated-files.buildkit.Dockerfile + buildctl build $progressFlag --frontend=dockerfile.v0 --local context=. --local dockerfile=. --opt build-arg:GOGO_VERSION=$gogo_version --opt target=validate --opt filename=./hack/dockerfiles/generated-files.Dockerfile ;; "docker-buildkit") export DOCKER_BUILDKIT=1 iidfile=$(mktemp -t docker-iidfile.XXXXXXXXXX) - docker build --iidfile $iidfile --build-arg GOGO_VERSION=$gogo_version -f ./hack/dockerfiles/generated-files.buildkit.Dockerfile --target validate --force-rm . || exit 1 + docker build --iidfile $iidfile --build-arg GOGO_VERSION=$gogo_version -f ./hack/dockerfiles/generated-files.Dockerfile --target validate --force-rm . || exit 1 iid=$(cat $iidfile) docker rmi $iid rm -f $iidfile diff --git a/hack/validate-vendor b/hack/validate-vendor index 6ddcf637..3c7885cc 100755 --- a/hack/validate-vendor +++ b/hack/validate-vendor @@ -13,12 +13,12 @@ case ${1:-} in . $(dirname $0)/util case $buildmode in "buildkit") - buildctl build $progressFlag --frontend=dockerfile.v0 --local context=. --local dockerfile=. --opt filename=./hack/dockerfiles/vendor.buildkit.Dockerfile --opt target=validate + buildctl build $progressFlag --frontend=dockerfile.v0 --local context=. --local dockerfile=. --opt filename=./hack/dockerfiles/vendor.Dockerfile --opt target=validate ;; "docker-buildkit") export DOCKER_BUILDKIT=1 iidfile=$(mktemp -t docker-iidfile.XXXXXXXXXX) - docker build --iidfile $iidfile -f ./hack/dockerfiles/vendor.buildkit.Dockerfile --target validate --force-rm . || exit 1 + docker build --iidfile $iidfile -f ./hack/dockerfiles/vendor.Dockerfile --target validate --force-rm . || exit 1 iid=$(cat $iidfile) docker rmi $iid rm -f $iidfile diff --git a/util/testutil/integration/containerd.go b/util/testutil/integration/containerd.go index 1da19ac9..808e85b8 100644 --- a/util/testutil/integration/containerd.go +++ b/util/testutil/integration/containerd.go @@ -20,7 +20,7 @@ func InitContainerdWorker() { containerd: "containerd", containerdShim: "containerd-shim", }) - // defined in hack/dockerfiles/test.buildkit.Dockerfile. + // defined in Dockerfile // e.g. `containerd-1.1=/opt/containerd-1.1/bin,containerd-42.0=/opt/containerd-42.0/bin` if s := os.Getenv("BUILDKIT_INTEGRATION_CONTAINERD_EXTRA"); s != "" { entries := strings.Split(s, ",") diff --git a/util/testutil/integration/oci.go b/util/testutil/integration/oci.go index 0088b50b..c4d3820c 100644 --- a/util/testutil/integration/oci.go +++ b/util/testutil/integration/oci.go @@ -14,7 +14,7 @@ import ( func InitOCIWorker() { Register(&oci{}) - // the rootless uid is defined in hack/dockerfiles/test.buildkit.Dockerfile + // the rootless uid is defined in Dockerfile if s := os.Getenv("BUILDKIT_INTEGRATION_ROOTLESS_IDPAIR"); s != "" { var uid, gid int if _, err := fmt.Sscanf(s, "%d:%d", &uid, &gid); err != nil {