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