Skip to content

Commit

Permalink
Remove unused --bucket-mirror option.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Hitchman committed Nov 4, 2016
1 parent 887442f commit eff42c3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 40 deletions.
38 changes: 10 additions & 28 deletions lib/releaselib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,12 @@ release::gcs::stage_and_hash() {
# @param version - The version
# @param build_output - build output directory
# @param bucket - GS bucket
# @optparam bucket_mirror - (optional) mirror GS bucket
# @return 1 on failure
release::gcs::copy_release_artifacts() {
local build_type=$1
local version=$2
local build_output=$3
local bucket=$4
local bucket_mirror=$5
local platform
local platforms
local release_stage=$build_output/release-stage
Expand All @@ -428,7 +426,6 @@ release::gcs::copy_release_artifacts() {
local src
local dst
local gcs_destination=gs://$bucket/$build_type/$version
local gcs_mirror=gs://$bucket_mirror/$build_type/$version
local gce_path=$release_stage/full/kubernetes/cluster/gce
local gci_path

Expand Down Expand Up @@ -490,13 +487,6 @@ release::gcs::copy_release_artifacts() {

logecho -n "- Listing final contents to log file: "
logrun -s $GSUTIL ls -lhr "$gcs_destination" || return 1

# Push to mirror if set
if [[ -n "$bucket_mirror" && "$bucket" != "$bucket_mirror" ]]; then
logecho -n "- Mirroring build to $gcs_mirror: "
logrun -s $GSUTIL -q -m rsync -a public_read -d -r "$gcs_destination" "$gcs_mirror" \
|| return 1
fi
}


Expand All @@ -508,25 +498,19 @@ release::gcs::copy_release_artifacts() {
# @param version - The version
# @param build_output - build output directory
# @param bucket - GS bucket
# @optparam bucket_mirror - GS mirror bucket
# @return 1 on failure
release::gcs::publish_version () {
local build_type=$1
local version=$2
local build_output=$3
local bucket=$4
local bucket_mirror=$5
local release_dir="gs://$bucket/$build_type/$version"
local version_major
local version_minor
local publish_file
local -a publish_files
local -a publish_buckets=($bucket)
local type="latest"

# Ensure no duplicate
[[ "$bucket" != "$bucket_mirror" ]] && publish_buckets+=($bucket_mirror)

# For release/ targets, type could be 'stable'
if [[ "$build_type" == release ]]; then
[[ "$version" =~ alpha|beta ]] || type="stable"
Expand All @@ -547,18 +531,16 @@ release::gcs::publish_version () {
$type-$version_major.$version_minor
)

for b in ${publish_buckets[*]}; do
logecho
logecho "Publish official pointer text files to $b..."

for publish_file in ${publish_files[@]}; do
# If there's a version that's above the one we're trying to release, don't
# do anything, and just try the next one.
release::gcs::verify_latest_update $build_type/$publish_file.txt \
$b $version || continue
release::gcs::publish $build_type/$publish_file.txt $build_output \
$b $version || return 1
done
logecho
logecho "Publish official pointer text files to $bucker..."

for publish_file in ${publish_files[@]}; do
# If there's a version that's above the one we're trying to release, don't
# do anything, and just try the next one.
release::gcs::verify_latest_update $build_type/$publish_file.txt \
$bucket $version || continue
release::gcs::publish $build_type/$publish_file.txt $build_output \
$bucket $version || return 1
done
}

Expand Down
16 changes: 4 additions & 12 deletions push-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ PROG=${0##*/}
#+
#+ SYNOPSIS
#+ $PROG [--nomock] [--federation] [--noupdatelatest] [--ci]
#+ [--bucket=<alt GS bucket>] [--bucket-mirror=<mirror GS bucket>]
#+ [--bucket=<GS bucket>]
#+ $PROG [--helpshort|--usage|-?]
#+ $PROG [--help|-man]
#+
Expand All @@ -44,7 +44,6 @@ PROG=${0##*/}
#+ [--federation] - Enable FEDERATION push
#+ [--ci] - Used when called from Jekins (for ci runs)
#+ [--bucket=] - Specify an alternate bucket for pushes
#+ [--bucket-mirror=] - Specify a mirror bucket for pushes
#+ [--gcs-suffix=] - Specify a suffix to append to the upload
#+ destination on GCS.
#+ [--noupdatelatest] - Do not update the latest file
Expand Down Expand Up @@ -93,7 +92,6 @@ common::timestamp begin
# MAIN
###############################################################################
RELEASE_BUCKET=${FLAGS_bucket:-"kubernetes-release-dev"}
RELEASE_BUCKET_MIRROR=$FLAGS_bucket_mirror
# Compatibility with incoming global args
[[ $KUBE_GCS_UPDATE_LATEST == "n" ]] && FLAGS_noupdatelatest=1

Expand All @@ -119,10 +117,6 @@ if ((FLAGS_nomock)); then
else
# Point to a $USER playground
RELEASE_BUCKET+=-$USER
if [[ -n $RELEASE_BUCKET_MIRROR ]]; then
logecho "--bucket-mirror disabled for mock runs..."
unset RELEASE_BUCKET_MIRROR
fi
fi

# This will canonicalize the path
Expand All @@ -139,7 +133,7 @@ if ! common::set_cloud_binaries; then
common::exit 1
fi

for bucket in $RELEASE_BUCKET $RELEASE_BUCKET_MIRROR; do
for bucket in $RELEASE_BUCKET; do
logecho -n "Check/make release bucket $bucket: "
logrun -s release::gcs::ensure_release_bucket $bucket || common::exit 1
done
Expand All @@ -152,8 +146,7 @@ common::stepheader COPY RELEASE ARTIFACTS
attempt=0
while ((attempt<max_attempts)); do
release::gcs::copy_release_artifacts $GCS_DEST $LATEST $KUBE_ROOT/_output \
$RELEASE_BUCKET \
$RELEASE_BUCKET_MIRROR && break
$RELEASE_BUCKET && break
((attempt++))
done
((attempt>=max_attempts)) && common::exit 1 "Exiting..."
Expand All @@ -168,8 +161,7 @@ if ! ((FLAGS_noupdatelatest)); then
attempt=0
while ((attempt<max_attempts)); do
release::gcs::publish_version $GCS_DEST $LATEST $KUBE_ROOT/_output \
$RELEASE_BUCKET \
$RELEASE_BUCKET_MIRROR && break
$RELEASE_BUCKET && break
((attempt++))
done
((attempt>=max_attempts)) && common::exit 1 "Exiting..."
Expand Down

0 comments on commit eff42c3

Please sign in to comment.