2019-08-08 00:50:00 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2020-11-22 03:03:55 +00:00
|
|
|
TYP=$1
|
2019-08-08 00:50:00 +00:00
|
|
|
|
2020-11-22 03:03:55 +00:00
|
|
|
. $(dirname $0)/util
|
2019-08-08 00:50:00 +00:00
|
|
|
set -e
|
|
|
|
|
2020-11-22 03:03:55 +00:00
|
|
|
usage() {
|
2020-11-23 18:27:49 +00:00
|
|
|
echo "usage: ./hack/build_ci_first_pass <binaries|integration-tests>"
|
2020-11-22 03:03:55 +00:00
|
|
|
exit 1
|
|
|
|
}
|
2019-08-08 00:50:00 +00:00
|
|
|
|
2020-11-22 03:03:55 +00:00
|
|
|
if [ -z "$TYP" ]; then
|
|
|
|
usage
|
|
|
|
fi
|
2019-08-21 00:26:48 +00:00
|
|
|
|
2020-11-22 03:03:55 +00:00
|
|
|
importCacheFlags=""
|
2019-08-08 00:50:00 +00:00
|
|
|
exportCacheFlags=""
|
2020-11-26 18:02:04 +00:00
|
|
|
if [ "$GITHUB_ACTIONS" = "true" ]; then
|
2020-11-29 05:45:33 +00:00
|
|
|
if [ -n "$cacheRefFrom" ]; then
|
|
|
|
importCacheFlags="--cache-from=type=local,src=$cacheRefFrom"
|
|
|
|
fi
|
|
|
|
if [ -n "$cacheRefTo" ]; then
|
|
|
|
exportCacheFlags="--cache-to=type=local,dest=$cacheRefTo"
|
2020-11-22 03:03:55 +00:00
|
|
|
fi
|
2019-08-08 00:50:00 +00:00
|
|
|
fi
|
|
|
|
|
2020-11-22 03:03:55 +00:00
|
|
|
case $TYP in
|
|
|
|
"binaries")
|
2020-11-26 18:02:04 +00:00
|
|
|
buildxCmd build $importCacheFlags $exportCacheFlags \
|
2020-11-22 03:03:55 +00:00
|
|
|
--target "binaries" \
|
|
|
|
$currentcontext
|
|
|
|
;;
|
|
|
|
"integration-tests")
|
2020-11-26 18:02:04 +00:00
|
|
|
buildxCmd build $importCacheFlags $exportCacheFlags \
|
2020-11-22 03:03:55 +00:00
|
|
|
--target "integration-tests-base" \
|
|
|
|
$currentcontext
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo >&2 "Unknown type $TYP"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|