From 51aac23dc8701fe1e256cf1cbd1b34db7365c59b Mon Sep 17 00:00:00 2001 From: Thilo Fromm Date: Tue, 5 Oct 2021 12:15:14 +0200 Subject: [PATCH] setup_board, update_chroot, dev container: use new bincache mirror This updates the default settings in build scripts to use https://mirror.release.flatcar-linux.net/ instead of the google storage bucket if no binhost or FLATCAR_DEV_BUILDS is specified. Defaults are updated for * update_chroot (runs at SDK initialisation time) * setup_board (creates /boards/[ARCH]/) chroots * the development container * set_version --- build_library/dev_container_util.sh | 4 ++-- common.sh | 2 +- set_version | 22 +++++++++++++++++++++- setup_board | 2 +- update_chroot | 5 ++--- 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/build_library/dev_container_util.sh b/build_library/dev_container_util.sh index 740ef10f46..2d9fa71d53 100755 --- a/build_library/dev_container_util.sh +++ b/build_library/dev_container_util.sh @@ -6,9 +6,9 @@ get_binhost_url() { local image_group=$1 local image_path=$2 if [ "${image_group}" == "developer" ]; then - echo "https://storage.googleapis.com/flatcar-jenkins/${image_group}/boards/${BOARD}/${FLATCAR_VERSION}/${image_path}" + echo "${FLATCAR_DEV_BUILDS}/${image_group}/boards/${BOARD}/${FLATCAR_VERSION}/${image_path}" else - echo "https://storage.googleapis.com/flatcar-jenkins/boards/${BOARD}/${FLATCAR_VERSION_ID}/${image_path}" + echo "${FLATCAR_DEV_BUILDS}/boards/${BOARD}/${FLATCAR_VERSION_ID}/${image_path}" fi } diff --git a/common.sh b/common.sh index f194361fff..1f155004e4 100644 --- a/common.sh +++ b/common.sh @@ -337,7 +337,7 @@ readonly COREOS_EPOCH=1372636800 TODAYS_VERSION=$(( (`date +%s` - ${COREOS_EPOCH}) / 86400 )) # Download URL prefix for SDK and board binary packages -: ${FLATCAR_DEV_BUILDS:=https://storage.googleapis.com/flatcar-jenkins} +: ${FLATCAR_DEV_BUILDS:=https://mirror.release.flatcar-linux.net} # Load developer's custom settings. Default location is in scripts dir, # since that's available both inside and outside the chroot. By convention, diff --git a/set_version b/set_version index 3a6df8d239..81e05af491 100755 --- a/set_version +++ b/set_version @@ -2,7 +2,7 @@ set -euo pipefail -DEFAULT_BASE_URL="https://storage.googleapis.com/flatcar-jenkins" +DEFAULT_BASE_URL="https://mirror.release.flatcar-linux.net" DEV_BOARD_URL="${DEFAULT_BASE_URL}/developer" DEFAULT_SDK_URL="${DEFAULT_BASE_URL}/sdk" DEV_SDK_URL="${DEFAULT_BASE_URL}/developer/sdk" @@ -41,14 +41,34 @@ Usage: $0 FLAGS... --file FILE: Modify another file than ${FILE}, useful if run outside of the SDK chroot. If /dev/stdout or /dev/stderr is used, only new values are printed. + --binhost Use a custom binhost (defaults to '${DEFAULT_BASE_URL}'). + This will update BOARD and SDK URLs accordingly. " exit 1 fi +# --binhost needs to be evaluated first since it impacts other variables set below +custom_binhost="false" +for arg in ${@} ; do + if $custom_binhost; then + echo "Using custom binhost '${arg}'" + DEFAULT_BASE_URL="${arg}" + DEV_BOARD_URL="${DEFAULT_BASE_URL}/developer" + DEFAULT_SDK_URL="${DEFAULT_BASE_URL}/sdk" + DEV_SDK_URL="${DEFAULT_BASE_URL}/developer/sdk" + break + fi + if [ "$arg" = "--binhost" ] ; then + custom_binhost="true" + fi +done + while [[ $# -gt 0 ]]; do ARG="$1" shift case "${ARG}" in + --binhost) # handled separately above, pass + shift;; --board-version) VAL="$1" shift diff --git a/setup_board b/setup_board index 678ee3ddd0..6649b8f039 100755 --- a/setup_board +++ b/setup_board @@ -28,7 +28,7 @@ DEFINE_boolean getbinpkg "${FLAGS_TRUE}" \ DEFINE_string getbinpkgver "" \ "Use binary packages from a specific version." DEFINE_string binhost "" \ - "Use binary packages from a specific location (e.g. https://storage.googleapis.com/flatcar-jenkins/sdk/amd64/2000.0.0/pkgs)" + "Use binary packages from a specific location instead of $FLATCAR_DEV_BUILDS/... " DEFINE_boolean toolchainpkgonly "${FLAGS_FALSE}" \ "Use binary packages only for the board toolchain." DEFINE_boolean skip_toolchain_update "${FLAGS_FALSE}" \ diff --git a/update_chroot b/update_chroot index d921cea126..0045f7be0b 100755 --- a/update_chroot +++ b/update_chroot @@ -6,6 +6,7 @@ . "$(dirname "$0")/common.sh" || exit 1 +. "${BUILD_LIBRARY_DIR}/toolchain_util.sh" # Script must run inside the chroot assert_inside_chroot "$@" @@ -28,7 +29,7 @@ DEFINE_string toolchain_boards "" \ DEFINE_string dev_builds_sdk "" \ "Set FLATCAR_DEV_BUILDS_SDK which defaults to FLATCAR_DEV_BUILDS/sdk" DEFINE_string binhost "" \ - "Use binary packages from a specific location (e.g. https://storage.googleapis.com/flatcar-jenkins/sdk/amd64/2000.0.0/pkgs)" + "Use binary packages from a specific location (like $(get_sdk_binhost | tr '\n' ' '}))" FLAGS_HELP="usage: $(basename $0) [flags] Performs an update of the chroot. This script is called as part of @@ -57,8 +58,6 @@ if [[ -n "${FLAGS_dev_builds_sdk}" ]]; then FLATCAR_DEV_BUILDS_SDK="${FLAGS_dev_builds_sdk}" fi -. "${BUILD_LIBRARY_DIR}/toolchain_util.sh" - PORTAGE_STABLE_OVERLAY="${REPO_ROOT}/src/third_party/portage-stable" CROSSDEV_OVERLAY="/usr/local/portage/crossdev" COREOS_OVERLAY="${REPO_ROOT}/src/third_party/coreos-overlay"