mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-04 19:56:32 +02:00
fix(release_util): Move default upload root to common, add --upload_root
Make it possible for other scripts to share the same value for our release repository and equally easy to override with a custom value. Also allow setting the root from the command line in addition to the environment. Usually --upload_root is better to use than --upload_path.
This commit is contained in:
parent
d0e9240747
commit
50e54cea85
@ -3,7 +3,7 @@
|
||||
# found in the LICENSE file.
|
||||
|
||||
GSUTIL_OPTS=
|
||||
UPLOAD_ROOT="${COREOS_UPLOAD_ROOT:-gs://storage.core-os.net/coreos}"
|
||||
UPLOAD_ROOT=
|
||||
UPLOAD_PATH=
|
||||
UPLOAD_DEFAULT=${FLAGS_FALSE}
|
||||
if [[ ${COREOS_OFFICIAL:-0} -eq 1 ]]; then
|
||||
@ -17,8 +17,10 @@ DEFINE_boolean parallel ${FLAGS_TRUE} \
|
||||
"Enable parallelism in gsutil."
|
||||
DEFINE_boolean upload ${UPLOAD_DEFAULT} \
|
||||
"Upload all packages/images via gsutil."
|
||||
DEFINE_string upload_root "${COREOS_UPLOAD_ROOT}" \
|
||||
"Upload prefix, board/version/etc will be appended. Must be a gs:// URL."
|
||||
DEFINE_string upload_path "" \
|
||||
"Upload files to an alternative location. Must be a full gs:// URL."
|
||||
"Full upload path, overrides --upload_root. Must be a full gs:// URL."
|
||||
DEFINE_string sign_digests "" \
|
||||
"Sign image DIGESTS files with the given GPG key."
|
||||
|
||||
@ -29,7 +31,18 @@ check_gsutil_opts() {
|
||||
GSUTIL_OPTS="-m"
|
||||
fi
|
||||
|
||||
if [[ -n "${FLAGS_upload_root}" ]]; then
|
||||
if [[ "${FLAGS_upload_root}" != gs://* ]]; then
|
||||
die_notrace "--upload_root must be a gs:// URL"
|
||||
fi
|
||||
# Make sure the path doesn't end with a slash
|
||||
UPLOAD_ROOT="${FLAGS_upload_root%%/}"
|
||||
fi
|
||||
|
||||
if [[ -n "${FLAGS_upload_path}" ]]; then
|
||||
if [[ "${FLAGS_upload_path}" != gs://* ]]; then
|
||||
die_notrace "--upload_path must be a gs:// URL"
|
||||
fi
|
||||
# Make sure the path doesn't end with a slash
|
||||
UPLOAD_PATH="${FLAGS_upload_path%%/}"
|
||||
fi
|
||||
|
||||
@ -328,6 +328,13 @@ COREOS_VERSION_STRING="${COREOS_BUILD}.${COREOS_BRANCH}.${COREOS_PATCH}"
|
||||
readonly COREOS_EPOCH=1372636800
|
||||
TODAYS_VERSION=$(( (`date +%s` - ${COREOS_EPOCH}) / 86400 ))
|
||||
|
||||
# Builds are uploaded to our Google Cloud Storage space,
|
||||
# can be overridden from the environment.
|
||||
: ${COREOS_UPLOAD_ROOT:=gs://storage.core-os.net/coreos}
|
||||
|
||||
# And the corresponding http download url
|
||||
: ${COREOS_DOWNLOAD_ROOT:=http://storage.core-os.net/coreos}
|
||||
|
||||
# Load developer's custom settings. Default location is in scripts dir,
|
||||
# since that's available both inside and outside the chroot. By convention,
|
||||
# settings from this file are variables starting with 'CHROMEOS_'
|
||||
|
||||
@ -77,5 +77,5 @@ core-admin new-version \
|
||||
|
||||
# Copy the vagrant boxes and pre-built images over to the track mirror
|
||||
gsutil cp \
|
||||
"gs://storage.core-os.net/coreos/amd64-generic/${FLAGS_version}/*" \
|
||||
"gs://storage.core-os.net/coreos/amd64-generic/${FLAGS_track}/"
|
||||
"${COREOS_UPLOAD_ROOT}/amd64-generic/${FLAGS_version}/*" \
|
||||
"${COREOS_UPLOAD_ROOT}/amd64-generic/${FLAGS_track}/"
|
||||
|
||||
@ -11,8 +11,7 @@ COREOS_SDK_ARCH="amd64" # We are unlikely to support anything else.
|
||||
COREOS_SDK_TARBALL="coreos-sdk-${COREOS_SDK_ARCH}-${COREOS_SDK_VERSION}.tar.bz2"
|
||||
COREOS_SDK_TARBALL_CACHE="${REPO_CACHE_DIR}/sdks"
|
||||
COREOS_SDK_TARBALL_PATH="${COREOS_SDK_TARBALL_CACHE}/${COREOS_SDK_TARBALL}"
|
||||
COREOS_SDK_URL_PREFIX="http://storage.core-os.net/coreos/sdk"
|
||||
COREOS_SDK_URL="${COREOS_SDK_URL_PREFIX}/${COREOS_SDK_ARCH}/${COREOS_SDK_VERSION}/${COREOS_SDK_TARBALL}"
|
||||
COREOS_SDK_URL="${COREOS_DOWNLOAD_ROOT}/sdk/${COREOS_SDK_ARCH}/${COREOS_SDK_VERSION}/${COREOS_SDK_TARBALL}"
|
||||
|
||||
# Download the current SDK tarball (if required) and verify digests/sig
|
||||
sdk_download_tarball() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user