Skip to content

Commit

Permalink
Merge pull request #28172 from zmerlynn/push-alt-ci
Browse files Browse the repository at this point in the history
Build: Add KUBE_GCS_RELEASE_BUCKET_MIRROR option to push-ci-build.sh
  • Loading branch information
j3ffml authored Jun 28, 2016
2 parents 532491a + 4282748 commit 43437e4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
26 changes: 24 additions & 2 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,16 @@ function kube::release::gcs::copy_release_artifacts() {
fi

gsutil ls -lhr "${gcs_destination}" || return 1

if [[ -n "${KUBE_GCS_RELEASE_BUCKET_MIRROR:-}" ]]; then
local -r gcs_mirror="gs://${KUBE_GCS_RELEASE_BUCKET_MIRROR}/${KUBE_GCS_RELEASE_PREFIX}"
kube::log::status "Mirroring build to ${gcs_mirror}"
gsutil -q -m "${gcs_options[@]+${gcs_options[@]}}" rsync -d -r "${gcs_destination}" "${gcs_mirror}" || return 1
if [[ ${KUBE_GCS_MAKE_PUBLIC} =~ ^[yY]$ ]]; then
kube::log::status "Marking all uploaded mirror objects public"
gsutil -q -m acl ch -R -g all:R "${gcs_mirror}" >/dev/null 2>&1 || return 1
fi
fi
}

# Publish a new ci version, (latest,) but only if the release files actually
Expand Down Expand Up @@ -1493,7 +1503,19 @@ function kube::release::gcs::verify_ci_ge() {
# If new version is greater than the GCS version
function kube::release::gcs::publish() {
local -r publish_file="${1-}"
local -r publish_file_dst="gs://${KUBE_GCS_RELEASE_BUCKET}/${publish_file}"

kube::release::gcs::publish_to_bucket "${KUBE_GCS_RELEASE_BUCKET}" "${publish_file}" || return 1

if [[ -n "${KUBE_GCS_RELEASE_BUCKET_MIRROR:-}" ]]; then
kube::release::gcs::publish_to_bucket "${KUBE_GCS_RELEASE_BUCKET_MIRROR}" "${publish_file}" || return 1
fi
}


function kube::release::gcs::publish_to_bucket() {
local -r publish_bucket="${1}"
local -r publish_file="${2}"
local -r publish_file_dst="gs://${publish_bucket}/${publish_file}"

mkdir -p "${RELEASE_STAGE}/upload" || return 1
echo "${KUBE_GCS_PUBLISH_VERSION}" > "${RELEASE_STAGE}/upload/latest" || return 1
Expand All @@ -1506,7 +1528,7 @@ function kube::release::gcs::publish() {
gsutil acl ch -R -g all:R "${publish_file_dst}" >/dev/null 2>&1 || return 1
gsutil setmeta -h "Cache-Control:private, max-age=0" "${publish_file_dst}" >/dev/null 2>&1 || return 1
# If public, validate public link
local -r public_link="https://storage.googleapis.com/${KUBE_GCS_RELEASE_BUCKET}/${publish_file}"
local -r public_link="https://storage.googleapis.com/${publish_bucket}/${publish_file}"
kube::log::status "Validating uploaded version file at ${public_link}"
contents="$(curl -s "${public_link}")"
else
Expand Down
1 change: 1 addition & 0 deletions build/push-ci-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ KUBE_GCS_MAKE_PUBLIC='y'
KUBE_GCS_UPLOAD_RELEASE='y'
KUBE_GCS_DELETE_EXISTING='n'
: ${KUBE_GCS_RELEASE_BUCKET:='kubernetes-release'}
: ${KUBE_GCS_RELEASE_BUCKET_MIRROR:='kubernetes-release-dev'}
KUBE_GCS_RELEASE_PREFIX="ci/${LATEST}"
KUBE_GCS_PUBLISH_VERSION="${LATEST}"

Expand Down

0 comments on commit 43437e4

Please sign in to comment.