mirror of
https://github.com/docker/buildx.git
synced 2024-11-22 15:37:16 +08:00
Merge pull request #1268 from crazy-max/hack-output
hack: use single output dir
This commit is contained in:
commit
29f2c49374
@ -1,3 +1 @@
|
|||||||
bin/
|
bin/
|
||||||
cross-out/
|
|
||||||
release-out/
|
|
||||||
|
14
.github/workflows/build.yml
vendored
14
.github/workflows/build.yml
vendored
@ -22,7 +22,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
REPO_SLUG: "docker/buildx-bin"
|
REPO_SLUG: "docker/buildx-bin"
|
||||||
RELEASE_OUT: "./release-out"
|
DESTDIR: "./bin"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@ -48,7 +48,7 @@ jobs:
|
|||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v3
|
||||||
with:
|
with:
|
||||||
file: ./coverage/coverage.txt
|
directory: ${{ env.DESTDIR }}/coverage
|
||||||
|
|
||||||
prepare:
|
prepare:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -107,7 +107,7 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: buildx
|
name: buildx
|
||||||
path: ${{ env.RELEASE_OUT }}/*
|
path: ${{ env.DESTDIR }}/release/*
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
bin-image:
|
bin-image:
|
||||||
@ -170,18 +170,18 @@ jobs:
|
|||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: buildx
|
name: buildx
|
||||||
path: ${{ env.RELEASE_OUT }}
|
path: ${{ env.DESTDIR }}
|
||||||
-
|
-
|
||||||
name: Create checksums
|
name: Create checksums
|
||||||
run: ./hack/hash-files
|
run: ./hack/hash-files
|
||||||
-
|
-
|
||||||
name: List artifacts
|
name: List artifacts
|
||||||
run: |
|
run: |
|
||||||
tree -nh ${{ env.RELEASE_OUT }}
|
tree -nh ${{ env.DESTDIR }}
|
||||||
-
|
-
|
||||||
name: Check artifacts
|
name: Check artifacts
|
||||||
run: |
|
run: |
|
||||||
find ${{ env.RELEASE_OUT }} -type f -exec file -e ascii -- {} +
|
find ${{ env.DESTDIR }} -type f -exec file -e ascii -- {} +
|
||||||
-
|
-
|
||||||
name: GitHub Release
|
name: GitHub Release
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
@ -190,7 +190,7 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
draft: true
|
draft: true
|
||||||
files: ${{ env.RELEASE_OUT }}/*
|
files: ${{ env.DESTDIR }}/*
|
||||||
|
|
||||||
buildkit-edge:
|
buildkit-edge:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
9
.github/workflows/e2e.yml
vendored
9
.github/workflows/e2e.yml
vendored
@ -18,11 +18,12 @@ on:
|
|||||||
- 'README.md'
|
- 'README.md'
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
|
|
||||||
|
env:
|
||||||
|
DESTDIR: "./bin"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
env:
|
|
||||||
BIN_OUT: ./bin
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@ -43,13 +44,13 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Rename binary
|
name: Rename binary
|
||||||
run: |
|
run: |
|
||||||
mv ${{ env.BIN_OUT }}/buildx ${{ env.BIN_OUT }}/docker-buildx
|
mv ${{ env.DESTDIR }}/build/buildx ${{ env.DESTDIR }}/build/docker-buildx
|
||||||
-
|
-
|
||||||
name: Upload artifacts
|
name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: binary
|
name: binary
|
||||||
path: ${{ env.BIN_OUT }}
|
path: ${{ env.DESTDIR }}/build
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,4 +1 @@
|
|||||||
bin
|
/bin
|
||||||
coverage
|
|
||||||
cross-out
|
|
||||||
release-out
|
|
||||||
|
5
Makefile
5
Makefile
@ -8,9 +8,6 @@ else
|
|||||||
$(error "Buildx is required: https://github.com/docker/buildx#installing")
|
$(error "Buildx is required: https://github.com/docker/buildx#installing")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
export BIN_OUT = ./bin
|
|
||||||
export RELEASE_OUT = ./release-out
|
|
||||||
|
|
||||||
shell:
|
shell:
|
||||||
./hack/shell
|
./hack/shell
|
||||||
|
|
||||||
@ -22,7 +19,7 @@ binaries-cross:
|
|||||||
|
|
||||||
install: binaries
|
install: binaries
|
||||||
mkdir -p ~/.docker/cli-plugins
|
mkdir -p ~/.docker/cli-plugins
|
||||||
install bin/buildx ~/.docker/cli-plugins/docker-buildx
|
install bin/build/buildx ~/.docker/cli-plugins/docker-buildx
|
||||||
|
|
||||||
release:
|
release:
|
||||||
./hack/release
|
./hack/release
|
||||||
|
@ -1,17 +1,14 @@
|
|||||||
variable "GO_VERSION" {
|
variable "GO_VERSION" {
|
||||||
default = "1.19"
|
default = "1.19"
|
||||||
}
|
}
|
||||||
variable "BIN_OUT" {
|
|
||||||
default = "./bin"
|
|
||||||
}
|
|
||||||
variable "RELEASE_OUT" {
|
|
||||||
default = "./release-out"
|
|
||||||
}
|
|
||||||
variable "DOCS_FORMATS" {
|
variable "DOCS_FORMATS" {
|
||||||
default = "md"
|
default = "md"
|
||||||
}
|
}
|
||||||
|
variable "DESTDIR" {
|
||||||
|
default = "./bin"
|
||||||
|
}
|
||||||
|
|
||||||
// Special target: https://github.com/docker/metadata-action#bake-definition
|
# Special target: https://github.com/docker/metadata-action#bake-definition
|
||||||
target "meta-helper" {
|
target "meta-helper" {
|
||||||
tags = ["docker/buildx-bin:local"]
|
tags = ["docker/buildx-bin:local"]
|
||||||
}
|
}
|
||||||
@ -97,13 +94,13 @@ target "mod-outdated" {
|
|||||||
target "test" {
|
target "test" {
|
||||||
inherits = ["_common"]
|
inherits = ["_common"]
|
||||||
target = "test-coverage"
|
target = "test-coverage"
|
||||||
output = ["./coverage"]
|
output = ["${DESTDIR}/coverage"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "binaries" {
|
target "binaries" {
|
||||||
inherits = ["_common"]
|
inherits = ["_common"]
|
||||||
target = "binaries"
|
target = "binaries"
|
||||||
output = [BIN_OUT]
|
output = ["${DESTDIR}/build"]
|
||||||
platforms = ["local"]
|
platforms = ["local"]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +124,7 @@ target "binaries-cross" {
|
|||||||
target "release" {
|
target "release" {
|
||||||
inherits = ["binaries-cross"]
|
inherits = ["binaries-cross"]
|
||||||
target = "release"
|
target = "release"
|
||||||
output = [RELEASE_OUT]
|
output = ["${DESTDIR}/release"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "image" {
|
target "image" {
|
||||||
|
@ -2,17 +2,21 @@
|
|||||||
|
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
: ${RELEASE_OUT=./release-out}
|
: "${DESTDIR=./bin/release}"
|
||||||
|
|
||||||
|
if [ ! -d "$DESTDIR" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# checksums
|
# checksums
|
||||||
if ! type shasum > /dev/null 2>&1; then
|
if ! command shasum > /dev/null 2>&1; then
|
||||||
echo >&2 "ERROR: shasum is required"
|
echo >&2 "ERROR: shasum is required"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
find ./${RELEASE_OUT}/ -type f \( -iname "buildx-*" ! -iname "*darwin*" \) -print0 | sort -z | xargs -r0 shasum -a 256 -b | sed 's# .*/# #' > ./${RELEASE_OUT}/checksums.txt
|
find ./${DESTDIR}/ -type f \( -iname "buildx-*" ! -iname "*darwin*" \) -print0 | sort -z | xargs -r0 shasum -a 256 -b | sed 's# .*/# #' > ./${DESTDIR}/checksums.txt
|
||||||
|
|
||||||
# verify
|
# verify
|
||||||
(
|
(
|
||||||
cd ./${RELEASE_OUT}
|
cd ./${DESTDIR}
|
||||||
shasum -a 256 -U -c checksums.txt
|
shasum -a 256 -U -c checksums.txt
|
||||||
)
|
)
|
||||||
|
14
hack/release
14
hack/release
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
: ${BUILDX_CMD=docker buildx}
|
: "${BUILDX_CMD=docker buildx}"
|
||||||
: ${RELEASE_OUT=./release-out}
|
: "${DESTDIR=./bin/release}"
|
||||||
: ${CACHE_FROM=}
|
: "${CACHE_FROM=}"
|
||||||
: ${CACHE_TO=}
|
: "${CACHE_TO=}"
|
||||||
|
|
||||||
if [ -n "$CACHE_FROM" ]; then
|
if [ -n "$CACHE_FROM" ]; then
|
||||||
for cfrom in $CACHE_FROM; do
|
for cfrom in $CACHE_FROM; do
|
||||||
@ -19,10 +19,10 @@ if [ -n "$CACHE_TO" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# release
|
# release
|
||||||
(set -x ; ${BUILDX_CMD} bake "${cacheFlags[@]}" --set "*.output=$RELEASE_OUT" release)
|
(set -x ; ${BUILDX_CMD} bake "${cacheFlags[@]}" --set "*.output=$DESTDIR" release)
|
||||||
|
|
||||||
# wrap binaries
|
# wrap binaries
|
||||||
mv -f ./${RELEASE_OUT}/**/* ./${RELEASE_OUT}/
|
mv -f ./${DESTDIR}/**/* ./${DESTDIR}/
|
||||||
find ./${RELEASE_OUT} -type d -empty -delete
|
find ./${DESTDIR} -type d -empty -delete
|
||||||
|
|
||||||
source ./hack/hash-files
|
source ./hack/hash-files
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
: ${BUILDX_CMD=docker buildx}
|
: "${BUILDX_CMD=docker buildx}"
|
||||||
: ${TMUX=}
|
: "${TMUX=}"
|
||||||
|
|
||||||
function clean {
|
function clean {
|
||||||
docker rmi $iid
|
docker rmi $iid
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
: ${BUILDX_CMD=docker buildx}
|
: "${BUILDX_CMD=docker buildx}"
|
||||||
: ${BUILDKIT_IMAGE=moby/buildkit:buildx-stable-1}
|
: "${BUILDKIT_IMAGE=moby/buildkit:buildx-stable-1}"
|
||||||
: ${BUILDKIT_CFG=}
|
: "${BUILDKIT_CFG=}"
|
||||||
: ${DRIVER=docker-container}
|
: "${DRIVER=docker-container}"
|
||||||
: ${DRIVER_OPT=}
|
: "${DRIVER_OPT=}"
|
||||||
: ${ENDPOINT=}
|
: "${ENDPOINT=}"
|
||||||
: ${MULTI_NODE=0}
|
: "${MULTI_NODE=0}"
|
||||||
: ${PLATFORMS=linux/amd64,linux/arm64}
|
: "${PLATFORMS=linux/amd64,linux/arm64}"
|
||||||
|
|
||||||
function buildxCmd {
|
function buildxCmd {
|
||||||
(set -x ; $BUILDX_CMD "$@")
|
(set -x ; $BUILDX_CMD "$@")
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
: ${BUILDX_CMD=docker buildx}
|
: "${BUILDX_CMD=docker buildx}"
|
||||||
: ${FORMATS=md}
|
: "${FORMATS=md}"
|
||||||
|
|
||||||
output=$(mktemp -d -t buildx-output.XXXXXXXXXX)
|
output=$(mktemp -d -t buildx-output.XXXXXXXXXX)
|
||||||
(set -x ; DOCS_FORMATS=$FORMATS ${BUILDX_CMD} bake --set "*.output=$output" update-docs)
|
(set -x ; DOCS_FORMATS=$FORMATS ${BUILDX_CMD} bake --set "*.output=$output" update-docs)
|
||||||
rm -rf ./docs/reference/*
|
rm -rf ./docs/reference/*
|
||||||
cp -R "$output"/out/* ./docs/
|
cp -R "$output"/out/* ./docs/
|
||||||
rm -rf $output
|
rm -rf "$output"
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
: ${BUILDX_CMD=docker buildx}
|
: "${BUILDX_CMD=docker buildx}"
|
||||||
|
|
||||||
output=$(mktemp -d -t buildx-output.XXXXXXXXXX)
|
output=$(mktemp -d -t buildx-output.XXXXXXXXXX)
|
||||||
(set -x ; ${BUILDX_CMD} bake --set "*.output=$output" update-vendor)
|
(set -x ; ${BUILDX_CMD} bake --set "*.output=$output" update-vendor)
|
||||||
rm -rf ./vendor
|
rm -rf ./vendor
|
||||||
cp -R "$output"/out/* .
|
cp -R "$output"/out/* .
|
||||||
rm -rf $output
|
rm -rf "$output"
|
||||||
|
Loading…
Reference in New Issue
Block a user