Merge pull request #1268 from crazy-max/hack-output

hack: use single output dir
This commit is contained in:
CrazyMax 2022-11-29 12:16:38 +01:00 committed by GitHub
commit 29f2c49374
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 51 additions and 57 deletions

View File

@ -1,3 +1 @@
bin/ bin/
cross-out/
release-out/

View File

@ -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

View File

@ -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
View File

@ -1,4 +1 @@
bin /bin
coverage
cross-out
release-out

View File

@ -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

View File

@ -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" {

View File

@ -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
) )

View File

@ -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

View File

@ -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

View File

@ -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 "$@")

View File

@ -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"

View File

@ -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"