hack: use local platform if none defined
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>master
parent
539be17089
commit
cd8c2cb198
|
@ -3,7 +3,7 @@
|
||||||
. $(dirname $0)/../../../../../hack/util
|
. $(dirname $0)/../../../../../hack/util
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
: ${PLATFORMS=linux/amd64}
|
: ${PLATFORMS=}
|
||||||
: ${DAILY_TARGETS=}
|
: ${DAILY_TARGETS=}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
|
@ -60,6 +60,11 @@ TAG=$2
|
||||||
REPO=$3
|
REPO=$3
|
||||||
PUSH=$4
|
PUSH=$4
|
||||||
|
|
||||||
|
platformFlag=""
|
||||||
|
if [ -n "$PLATFORMS" ]; then
|
||||||
|
platformFlag="--platform=$PLATFORMS"
|
||||||
|
fi
|
||||||
|
|
||||||
pushFlag="push=false"
|
pushFlag="push=false"
|
||||||
if [ "$PUSH" = "push" ]; then
|
if [ "$PUSH" = "push" ]; then
|
||||||
pushFlag="push=true"
|
pushFlag="push=true"
|
||||||
|
@ -79,8 +84,7 @@ case $TYP in
|
||||||
pushTag=${pushTag}-$TAG
|
pushTag=${pushTag}-$TAG
|
||||||
fi
|
fi
|
||||||
|
|
||||||
buildxCmd build $cacheFromFlags $cacheToFlags \
|
buildxCmd build $platformFlag $cacheFromFlags $cacheToFlags \
|
||||||
--platform "$PLATFORMS" \
|
|
||||||
--build-arg "CHANNEL=$TAG" \
|
--build-arg "CHANNEL=$TAG" \
|
||||||
--build-arg "BUILDTAGS=$buildTags" \
|
--build-arg "BUILDTAGS=$buildTags" \
|
||||||
--output "type=image,name=$REPO:$pushTag,$pushFlag" \
|
--output "type=image,name=$REPO:$pushTag,$pushFlag" \
|
||||||
|
@ -97,8 +101,7 @@ case $TYP in
|
||||||
fi
|
fi
|
||||||
buildTags=$(cat $tagf)
|
buildTags=$(cat $tagf)
|
||||||
|
|
||||||
buildxCmd build $cacheFromFlags $cacheToFlags \
|
buildxCmd build $platformFlag $cacheFromFlags $cacheToFlags \
|
||||||
--platform "$PLATFORMS" \
|
|
||||||
--build-arg "CHANNEL=$TAG" \
|
--build-arg "CHANNEL=$TAG" \
|
||||||
--build-arg "BUILDTAGS=$buildTags" \
|
--build-arg "BUILDTAGS=$buildTags" \
|
||||||
--output "type=image,\"name=$publishedNames\",$pushFlag" \
|
--output "type=image,\"name=$publishedNames\",$pushFlag" \
|
||||||
|
@ -124,8 +127,7 @@ case $TYP in
|
||||||
|
|
||||||
tmp=$(mktemp -d -t buildid.XXXXXXXXXX)
|
tmp=$(mktemp -d -t buildid.XXXXXXXXXX)
|
||||||
dt=$(date +%Y%m%d)
|
dt=$(date +%Y%m%d)
|
||||||
buildxCmd build $cacheFromFlags $cacheToFlags \
|
buildxCmd build $platformFlag $cacheFromFlags $cacheToFlags \
|
||||||
--platform "$PLATFORMS" \
|
|
||||||
--target "buildid" \
|
--target "buildid" \
|
||||||
--build-arg "CHANNEL=$TAG" \
|
--build-arg "CHANNEL=$TAG" \
|
||||||
--build-arg "BUILDTAGS=$buildTags" \
|
--build-arg "BUILDTAGS=$buildTags" \
|
||||||
|
@ -139,8 +141,7 @@ case $TYP in
|
||||||
buildid=$(cat $tmp/buildid)
|
buildid=$(cat $tmp/buildid)
|
||||||
echo "buildid: $buildid"
|
echo "buildid: $buildid"
|
||||||
|
|
||||||
buildxCmd build $cacheFromFlags $cacheToFlags \
|
buildxCmd build $platformFlag $cacheFromFlags $cacheToFlags \
|
||||||
--platform "$PLATFORMS" \
|
|
||||||
--build-arg "CHANNEL=$TAG" \
|
--build-arg "CHANNEL=$TAG" \
|
||||||
--build-arg "BUILDTAGS=$buildTags" \
|
--build-arg "BUILDTAGS=$buildTags" \
|
||||||
--output "type=image,name=$REPO:$dt-$TAG,$pushFlag" \
|
--output "type=image,name=$REPO:$dt-$TAG,$pushFlag" \
|
||||||
|
|
|
@ -3,19 +3,19 @@
|
||||||
. $(dirname $0)/util
|
. $(dirname $0)/util
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
: ${TARGETPLATFORM=}
|
: ${PLATFORMS=}
|
||||||
: ${BUILDKITD_TAGS=}
|
: ${BUILDKITD_TAGS=}
|
||||||
|
|
||||||
platformFlag="--platform local"
|
|
||||||
if [ -n "$TARGETPLATFORM" ]; then
|
|
||||||
platformFlag="--platform $TARGETPLATFORM"
|
|
||||||
fi
|
|
||||||
|
|
||||||
buildkitdTagsFlags=""
|
buildkitdTagsFlags=""
|
||||||
if [ -n "$BUILDKITD_TAGS" ]; then
|
if [ -n "$BUILDKITD_TAGS" ]; then
|
||||||
buildkitdTagsFlags="--build-arg=BUILDKITD_TAGS=\"$BUILDKITD_TAGS\""
|
buildkitdTagsFlags="--build-arg=BUILDKITD_TAGS=\"$BUILDKITD_TAGS\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
platformFlag=""
|
||||||
|
if [ -n "$PLATFORMS" ]; then
|
||||||
|
platformFlag="--platform=$PLATFORMS"
|
||||||
|
fi
|
||||||
|
|
||||||
buildxCmd build $platformFlag $buildkitdTagsFlags \
|
buildxCmd build $platformFlag $buildkitdTagsFlags \
|
||||||
--target "binaries" \
|
--target "binaries" \
|
||||||
--output "type=local,dest=./bin/" \
|
--output "type=local,dest=./bin/" \
|
||||||
|
|
10
hack/cross
10
hack/cross
|
@ -3,7 +3,12 @@
|
||||||
. $(dirname $0)/util
|
. $(dirname $0)/util
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
: ${PLATFORMS=linux/arm}
|
: ${PLATFORMS=}
|
||||||
|
|
||||||
|
platformFlag=""
|
||||||
|
if [ -n "$PLATFORMS" ]; then
|
||||||
|
platformFlag="--platform=$PLATFORMS"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$RUNC_PLATFORMS" ]; then
|
if [ -n "$RUNC_PLATFORMS" ]; then
|
||||||
buildxCmd build $cacheFromFlags $cacheToFlags \
|
buildxCmd build $cacheFromFlags $cacheToFlags \
|
||||||
|
@ -12,6 +17,5 @@ if [ -n "$RUNC_PLATFORMS" ]; then
|
||||||
$currentcontext
|
$currentcontext
|
||||||
fi
|
fi
|
||||||
|
|
||||||
buildxCmd build $cacheFromFlags \
|
buildxCmd build $platformFlag $cacheFromFlags \
|
||||||
--platform "$PLATFORMS" \
|
|
||||||
$currentcontext
|
$currentcontext
|
||||||
|
|
10
hack/images
10
hack/images
|
@ -7,7 +7,7 @@ PUSH=$3
|
||||||
. $(dirname $0)/util
|
. $(dirname $0)/util
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
: ${PLATFORMS=linux/amd64}
|
: ${PLATFORMS=}
|
||||||
: ${TARGET=}
|
: ${TARGET=}
|
||||||
|
|
||||||
versionTag=$(git describe --always --tags --match "v[0-9]*")
|
versionTag=$(git describe --always --tags --match "v[0-9]*")
|
||||||
|
@ -25,6 +25,11 @@ if [ -z "$TAG" ] || [ -z "$REPO" ]; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
platformFlag=""
|
||||||
|
if [ -n "$PLATFORMS" ]; then
|
||||||
|
platformFlag="--platform=$PLATFORMS"
|
||||||
|
fi
|
||||||
|
|
||||||
localmode=""
|
localmode=""
|
||||||
if [[ "$TAG" == "local" ]]; then
|
if [[ "$TAG" == "local" ]]; then
|
||||||
localmode="1"
|
localmode="1"
|
||||||
|
@ -83,6 +88,5 @@ for tagName in $tagNames; do
|
||||||
tagFlags="$tagFlags--tag=$tagName "
|
tagFlags="$tagFlags--tag=$tagName "
|
||||||
done
|
done
|
||||||
|
|
||||||
buildxCmd build $targetFlag $importCacheFlags $exportCacheFlags $tagFlags $outputFlag \
|
buildxCmd build $platformFlag $targetFlag $importCacheFlags $exportCacheFlags $tagFlags $outputFlag \
|
||||||
--platform "$PLATFORMS" \
|
|
||||||
$currentcontext
|
$currentcontext
|
||||||
|
|
|
@ -6,7 +6,7 @@ OUT=$2
|
||||||
. $(dirname $0)/util
|
. $(dirname $0)/util
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
: ${PLATFORMS=linux/amd64}
|
: ${PLATFORMS=}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "usage: ./hack/release-tar <tag> <out>"
|
echo "usage: ./hack/release-tar <tag> <out>"
|
||||||
|
@ -17,8 +17,12 @@ if [ -z "$TAG" ] || [ -z "$OUT" ]; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
buildxCmd build $cacheFromFlags \
|
platformFlag=""
|
||||||
|
if [ -n "$PLATFORMS" ]; then
|
||||||
|
platformFlag="--platform=$PLATFORMS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
buildxCmd build $platformFlag $cacheFromFlags \
|
||||||
--target release \
|
--target release \
|
||||||
--platform "$PLATFORMS" \
|
|
||||||
--output "type=local,dest=$OUT" \
|
--output "type=local,dest=$OUT" \
|
||||||
$currentcontext
|
$currentcontext
|
||||||
|
|
Loading…
Reference in New Issue