mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-10 14:36:58 +02:00
fix(*): Migrate image storage to new buckets
- Automated builds drop SDK and binary packages into gs://builds.developer.core-os.net/ and the new download URL is http://builds.developer.core-os.net/ (COREOS_DEV_BUILDS) - Change default upload path to gs://users.developer.core-os.net/ for misc developer builds. Official builds go elsewhere and will just be configured in buildbot/jenkins so some COREOS_OFFICIAL stuff is gone. - Automated builds of images go to a private bucket, gs://builds.release.core-os.net which later gets copied to gs://alpha.release.core-os.net and friends by core_promote.
This commit is contained in:
parent
7372f9f6e6
commit
2e9911b978
@ -18,10 +18,6 @@ restart_in_chroot_if_needed "$@"
|
|||||||
assert_not_root_user
|
assert_not_root_user
|
||||||
|
|
||||||
DEFAULT_GROUP=developer
|
DEFAULT_GROUP=developer
|
||||||
if [[ ${COREOS_OFFICIAL:-0} -eq 1 ]]; then
|
|
||||||
# TODO: update to beta, and then stable once those actually exist
|
|
||||||
DEFAULT_GROUP=alpha
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Developer-visible flags.
|
# Developer-visible flags.
|
||||||
DEFINE_string board "${DEFAULT_BOARD}" \
|
DEFINE_string board "${DEFAULT_BOARD}" \
|
||||||
|
@ -6,9 +6,12 @@ GSUTIL_OPTS=
|
|||||||
UPLOAD_ROOT=
|
UPLOAD_ROOT=
|
||||||
UPLOAD_PATH=
|
UPLOAD_PATH=
|
||||||
UPLOAD_DEFAULT=${FLAGS_FALSE}
|
UPLOAD_DEFAULT=${FLAGS_FALSE}
|
||||||
if [[ ${COREOS_OFFICIAL:-0} -eq 1 ]]; then
|
|
||||||
UPLOAD_DEFAULT=${FLAGS_TRUE}
|
# Default upload root can be overridden from the environment.
|
||||||
fi
|
_user="${USER}"
|
||||||
|
[[ ${USER} == "root" ]] && _user="${SUDO_USER}"
|
||||||
|
: ${COREOS_UPLOAD_ROOT:=gs://users.developer.core-os.net/${_user}}
|
||||||
|
unset _user
|
||||||
|
|
||||||
IMAGE_ZIPPER="lbzip2 --compress --keep"
|
IMAGE_ZIPPER="lbzip2 --compress --keep"
|
||||||
IMAGE_ZIPEXT=".bz2"
|
IMAGE_ZIPEXT=".bz2"
|
||||||
|
@ -121,9 +121,9 @@ get_board_binhost() {
|
|||||||
|
|
||||||
for ver in "$@"; do
|
for ver in "$@"; do
|
||||||
if [[ $toolchain_only -eq 0 ]]; then
|
if [[ $toolchain_only -eq 0 ]]; then
|
||||||
echo "${COREOS_DOWNLOAD_ROOT}/${board}/${ver}/pkgs/"
|
echo "${COREOS_DEV_BUILDS}/boards/${board}/${ver}/pkgs/"
|
||||||
fi
|
fi
|
||||||
echo "${COREOS_DOWNLOAD_ROOT}/${board}/${ver}/toolchain/"
|
echo "${COREOS_DEV_BUILDS}/boards/${board}/${ver}/toolchain/"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,8 +144,8 @@ get_sdk_binhost() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
for ver in "$@"; do
|
for ver in "$@"; do
|
||||||
echo "${COREOS_DOWNLOAD_ROOT}/sdk/${arch}/${ver}/pkgs/"
|
echo "${COREOS_DEV_BUILDS}/sdk/${arch}/${ver}/pkgs/"
|
||||||
echo "${COREOS_DOWNLOAD_ROOT}/sdk/${arch}/${ver}/toolchain/"
|
echo "${COREOS_DEV_BUILDS}/sdk/${arch}/${ver}/toolchain/"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,12 +335,8 @@ COREOS_VERSION_STRING="${COREOS_VERSION}"
|
|||||||
readonly COREOS_EPOCH=1372636800
|
readonly COREOS_EPOCH=1372636800
|
||||||
TODAYS_VERSION=$(( (`date +%s` - ${COREOS_EPOCH}) / 86400 ))
|
TODAYS_VERSION=$(( (`date +%s` - ${COREOS_EPOCH}) / 86400 ))
|
||||||
|
|
||||||
# Builds are uploaded to our Google Cloud Storage space,
|
# Download URL prefix for SDK and board binary packages
|
||||||
# can be overridden from the environment.
|
: ${COREOS_DEV_BUILDS:=http://builds.developer.core-os.net}
|
||||||
: ${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,
|
# Load developer's custom settings. Default location is in scripts dir,
|
||||||
# since that's available both inside and outside the chroot. By convention,
|
# since that's available both inside and outside the chroot. By convention,
|
||||||
|
30
core_promote
30
core_promote
@ -25,9 +25,9 @@ DEFINE_string api_key "" \
|
|||||||
"API key for roller."
|
"API key for roller."
|
||||||
DEFINE_string endpoint "https://public.update.core-os.net" \
|
DEFINE_string endpoint "https://public.update.core-os.net" \
|
||||||
"Roller endpoint to update."
|
"Roller endpoint to update."
|
||||||
DEFINE_string build_storage "gs://storage.core-os.net/coreos" \
|
DEFINE_string build_storage "gs://builds.release.core-os.net" \
|
||||||
"GS bucket with official build artifacts."
|
"GS bucket with official build artifacts."
|
||||||
DEFINE_string release_storage "gs://storage.core-os.net/coreos" \
|
DEFINE_string release_storage "" \
|
||||||
"GS bucket for release downloads."
|
"GS bucket for release downloads."
|
||||||
|
|
||||||
# Allow toggling the assorted actions.
|
# Allow toggling the assorted actions.
|
||||||
@ -62,10 +62,15 @@ FLAGS_release_storage="${FLAGS_release_storage%%/}"
|
|||||||
roller_channel="${FLAGS_channel^}"
|
roller_channel="${FLAGS_channel^}"
|
||||||
lower_channel="${FLAGS_channel,,}"
|
lower_channel="${FLAGS_channel,,}"
|
||||||
|
|
||||||
gs_build_path="${FLAGS_build_storage}/${FLAGS_board}/${FLAGS_version}"
|
# Full GS URL of the original build
|
||||||
# TODO(marineam): once build_storage and release_storage are different
|
gs_build="${FLAGS_build_storage}/${lower_channel}/${FLAGS_board}/${FLAGS_version}"
|
||||||
# this will become two paths, one for version and the other for channel.
|
|
||||||
gs_release_path="${FLAGS_release_storage}/${FLAGS_board}/${lower_channel}"
|
if [[ -z "${FLAGS_release_storage}" ]]; then
|
||||||
|
FLAGS_release_storage="gs://${lower_channel}.release.core-os.net"
|
||||||
|
fi
|
||||||
|
# Full GS URL of the public release locations
|
||||||
|
gs_release="${FLAGS_release_storage}/${FLAGS_board}/${FLAGS_version}"
|
||||||
|
gs_current="${FLAGS_release_storage}/${FLAGS_board}/current"
|
||||||
|
|
||||||
if [[ ${FLAGS_do_roller} -eq ${FLAGS_TRUE} ]]; then
|
if [[ ${FLAGS_do_roller} -eq ${FLAGS_TRUE} ]]; then
|
||||||
rollerctl \
|
rollerctl \
|
||||||
@ -78,6 +83,10 @@ if [[ ${FLAGS_do_roller} -eq ${FLAGS_TRUE} ]]; then
|
|||||||
"${FLAGS_version}"
|
"${FLAGS_version}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ${FLAGS_do_storage} -eq ${FLAGS_TRUE} ]]; then
|
||||||
|
gsutil -m cp "${gs_build}/*" "${gs_release}/"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ${FLAGS_do_gce} -eq ${FLAGS_TRUE} ]]; then
|
if [[ ${FLAGS_do_gce} -eq ${FLAGS_TRUE} ]]; then
|
||||||
gce_name="coreos-${lower_channel}-${FLAGS_version//./-}-v$(date -u +%Y%m%d)"
|
gce_name="coreos-${lower_channel}-${FLAGS_version//./-}-v$(date -u +%Y%m%d)"
|
||||||
gce_desc="CoreOS ${lower_channel} ${FLAGS_version}"
|
gce_desc="CoreOS ${lower_channel} ${FLAGS_version}"
|
||||||
@ -86,19 +95,16 @@ if [[ ${FLAGS_do_gce} -eq ${FLAGS_TRUE} ]]; then
|
|||||||
addimage \
|
addimage \
|
||||||
--description="${gce_desc}" \
|
--description="${gce_desc}" \
|
||||||
"${gce_name}" \
|
"${gce_name}" \
|
||||||
"${gs_build_path}/coreos_production_gce.tar.gz"
|
"${gs_build}/coreos_production_gce.tar.gz"
|
||||||
gce_path="projects/coreos-cloud/global/images/${gce_name}"
|
gce_path="projects/coreos-cloud/global/images/${gce_name}"
|
||||||
gce_temp=$(mktemp --suffix=.txt)
|
gce_temp=$(mktemp --suffix=.txt)
|
||||||
trap "rm -f '${gce_temp}'" EXIT
|
trap "rm -f '${gce_temp}'" EXIT
|
||||||
echo "${gce_path}" > "${gce_temp}"
|
echo "${gce_path}" > "${gce_temp}"
|
||||||
gsutil cp "${gce_temp}" "${gs_build_path}/coreos_production_gce.txt"
|
gsutil cp "${gce_temp}" "${gs_release}/coreos_production_gce.txt"
|
||||||
rm -f "${gce_temp}"
|
rm -f "${gce_temp}"
|
||||||
trap - EXIT
|
trap - EXIT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${FLAGS_do_storage} -eq ${FLAGS_TRUE} ]]; then
|
if [[ ${FLAGS_do_storage} -eq ${FLAGS_TRUE} ]]; then
|
||||||
gsutil -m cp \
|
gsutil -m cp "${gs_release}/*" "${gs_current}/"
|
||||||
"${gs_build_path}/coreos_production*" \
|
|
||||||
"${gs_build_path}/version.*" \
|
|
||||||
"${gs_release_path}/"
|
|
||||||
fi
|
fi
|
||||||
|
@ -28,7 +28,7 @@ VERSION="master"
|
|||||||
BOARD="amd64-usr"
|
BOARD="amd64-usr"
|
||||||
GROUP="alpha"
|
GROUP="alpha"
|
||||||
IMAGE="coreos_production_ami_image.bin.bz2"
|
IMAGE="coreos_production_ami_image.bin.bz2"
|
||||||
GS_URL="gs://storage.core-os.net/coreos"
|
GS_URL="gs://builds.release.core-os.net"
|
||||||
IMG_URL=""
|
IMG_URL=""
|
||||||
IMG_PATH=""
|
IMG_PATH=""
|
||||||
|
|
||||||
@ -75,13 +75,20 @@ if [[ -n "$IMG_PATH" ]]; then
|
|||||||
IMG_URL=$(basename "$IMG_PATH")
|
IMG_URL=$(basename "$IMG_PATH")
|
||||||
else
|
else
|
||||||
if [[ -z "$IMG_URL" ]]; then
|
if [[ -z "$IMG_URL" ]]; then
|
||||||
IMG_URL="http://${GS_URL#gs://}/$BOARD/$VERSION/$IMAGE"
|
IMG_URL="$GS_URL/$GROUP/$BOARD/$VERSION/$IMAGE"
|
||||||
fi
|
fi
|
||||||
|
if [[ "$IMG_URL" == gs://* ]]; then
|
||||||
|
if ! gsutil -q stat "$IMG_URL"; then
|
||||||
|
echo "$0: Image URL unavailable: $IMG_URL" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
if ! curl --fail -s --head "$IMG_URL" >/dev/null; then
|
if ! curl --fail -s --head "$IMG_URL" >/dev/null; then
|
||||||
echo "$0: Image URL unavailable: $IMG_URL" >&2
|
echo "$0: Image URL unavailable: $IMG_URL" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$VERSION" == "master" ]]; then
|
if [[ "$VERSION" == "master" ]]; then
|
||||||
# Come up with something more descriptive and timestamped
|
# Come up with something more descriptive and timestamped
|
||||||
@ -146,12 +153,14 @@ echo "Writing image from $IMG_URL to $dev"
|
|||||||
# if it is on the local fs, just use it, otherwise try to download it
|
# if it is on the local fs, just use it, otherwise try to download it
|
||||||
if [[ -n "$IMG_PATH" ]]; then
|
if [[ -n "$IMG_PATH" ]]; then
|
||||||
if [[ "$IMG_PATH" =~ \.bz2$ ]]; then
|
if [[ "$IMG_PATH" =~ \.bz2$ ]]; then
|
||||||
bunzip2 -c "$IMG_PATH" | dd of=$dev bs=1M
|
bunzip2 -c "$IMG_PATH" > $dev
|
||||||
else
|
else
|
||||||
dd if="$IMG_PATH" of=$dev bs=1M
|
dd if="$IMG_PATH" of=$dev bs=1M
|
||||||
fi
|
fi
|
||||||
|
elif [[ "$IMG_URL" == gs://* ]]; then
|
||||||
|
gsutil cat "$IMG_URL" | bunzip2 > $dev
|
||||||
else
|
else
|
||||||
curl --fail "$IMG_URL" | bunzip2 | dd of=$dev bs=1M
|
curl --fail "$IMG_URL" | bunzip2 > $dev
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Detaching $volumeid and creating snapshot"
|
echo "Detaching $volumeid and creating snapshot"
|
||||||
|
@ -28,7 +28,7 @@ This script must be run from an ec2 host with the ec2 tools installed.
|
|||||||
"
|
"
|
||||||
|
|
||||||
IMAGE="coreos_production_ami"
|
IMAGE="coreos_production_ami"
|
||||||
GS_URL="gs://storage.core-os.net/coreos"
|
GS_URL="gs://builds.release.core-os.net"
|
||||||
AMI=
|
AMI=
|
||||||
VER=
|
VER=
|
||||||
BOARD="amd64-usr"
|
BOARD="amd64-usr"
|
||||||
@ -72,7 +72,7 @@ done
|
|||||||
|
|
||||||
OUT=
|
OUT=
|
||||||
for r in "${!AMIS[@]}"; do
|
for r in "${!AMIS[@]}"; do
|
||||||
url="$GS_URL/$BOARD/$VER/${IMAGE}_${r}.txt"
|
url="$GS_URL/$GROUP/$BOARD/$VER/${IMAGE}_${r}.txt"
|
||||||
tmp=$(mktemp --suffix=.txt)
|
tmp=$(mktemp --suffix=.txt)
|
||||||
trap "rm -f '$tmp'" EXIT
|
trap "rm -f '$tmp'" EXIT
|
||||||
echo "${AMIS[$r]}" > "$tmp"
|
echo "${AMIS[$r]}" > "$tmp"
|
||||||
@ -84,7 +84,7 @@ for r in "${!AMIS[@]}"; do
|
|||||||
OUT="${OUT}|${r}=${AMIS[$r]}"
|
OUT="${OUT}|${r}=${AMIS[$r]}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
url="$GS_URL/$BOARD/$VER/${IMAGE}_all.txt"
|
url="$GS_URL/$GROUP/$BOARD/$VER/${IMAGE}_all.txt"
|
||||||
tmp=$(mktemp --suffix=.txt)
|
tmp=$(mktemp --suffix=.txt)
|
||||||
trap "rm -f '$tmp'" EXIT
|
trap "rm -f '$tmp'" EXIT
|
||||||
echo "$OUT" > "$tmp"
|
echo "$OUT" > "$tmp"
|
||||||
|
@ -11,7 +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="coreos-sdk-${COREOS_SDK_ARCH}-${COREOS_SDK_VERSION}.tar.bz2"
|
||||||
COREOS_SDK_TARBALL_CACHE="${REPO_CACHE_DIR}/sdks"
|
COREOS_SDK_TARBALL_CACHE="${REPO_CACHE_DIR}/sdks"
|
||||||
COREOS_SDK_TARBALL_PATH="${COREOS_SDK_TARBALL_CACHE}/${COREOS_SDK_TARBALL}"
|
COREOS_SDK_TARBALL_PATH="${COREOS_SDK_TARBALL_CACHE}/${COREOS_SDK_TARBALL}"
|
||||||
COREOS_SDK_URL="${COREOS_DOWNLOAD_ROOT}/sdk/${COREOS_SDK_ARCH}/${COREOS_SDK_VERSION}/${COREOS_SDK_TARBALL}"
|
COREOS_SDK_URL="${COREOS_DEV_BUILDS}/sdk/${COREOS_SDK_ARCH}/${COREOS_SDK_VERSION}/${COREOS_SDK_TARBALL}"
|
||||||
|
|
||||||
# Download the current SDK tarball (if required) and verify digests/sig
|
# Download the current SDK tarball (if required) and verify digests/sig
|
||||||
sdk_download_tarball() {
|
sdk_download_tarball() {
|
||||||
|
Loading…
Reference in New Issue
Block a user