mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
Add environment variable to delete existing release on GCS
This commit is contained in:
parent
c37c4ed73d
commit
1289165aeb
@ -43,6 +43,7 @@ readonly KUBE_GCS_RELEASE_PREFIX=${KUBE_GCS_RELEASE_PREFIX-devel}/
|
||||
readonly KUBE_GCS_DOCKER_REG_PREFIX=${KUBE_GCS_DOCKER_REG_PREFIX-docker-reg}/
|
||||
readonly KUBE_GCS_LATEST_FILE=${KUBE_GCS_LATEST_FILE:-}
|
||||
readonly KUBE_GCS_LATEST_CONTENTS=${KUBE_GCS_LATEST_CONTENTS:-}
|
||||
readonly KUBE_GCS_DELETE_EXISTING="${KUBE_GCS_DELETE_EXISTING:-n}"
|
||||
|
||||
# Constants
|
||||
readonly KUBE_BUILD_IMAGE_REPO=kube-build
|
||||
@ -908,13 +909,15 @@ function kube::release::gcs::copy_release_artifacts() {
|
||||
# First delete all objects at the destination
|
||||
if gsutil ls "${gcs_destination}" >/dev/null 2>&1; then
|
||||
kube::log::error "${gcs_destination} not empty."
|
||||
read -p "Delete everything under ${gcs_destination}? [y/n] " -r || {
|
||||
echo "EOF on prompt. Skipping upload"
|
||||
return
|
||||
}
|
||||
[[ $REPLY =~ ^[yY]$ ]] || {
|
||||
echo "Skipping upload"
|
||||
return
|
||||
[[ ${KUBE_GCS_DELETE_EXISTING} =~ ^[yY]$ ]] || {
|
||||
read -p "Delete everything under ${gcs_destination}? [y/n] " -r || {
|
||||
echo "EOF on prompt. Skipping upload"
|
||||
return
|
||||
}
|
||||
[[ $REPLY =~ ^[yY]$ ]] || {
|
||||
echo "Skipping upload"
|
||||
return
|
||||
}
|
||||
}
|
||||
gsutil -q -m rm -f -R "${gcs_destination}"
|
||||
fi
|
||||
|
@ -24,6 +24,7 @@ LATEST=$(git describe)
|
||||
KUBE_GCS_NO_CACHING=n
|
||||
KUBE_GCS_MAKE_PUBLIC=y
|
||||
KUBE_GCS_UPLOAD_RELEASE=y
|
||||
KUBE_GCS_DELETE_EXISTING=y
|
||||
KUBE_GCS_RELEASE_BUCKET=kubernetes-release
|
||||
KUBE_GCS_RELEASE_PREFIX="ci/${LATEST}"
|
||||
KUBE_GCS_LATEST_FILE="ci/latest.txt"
|
||||
|
Loading…
Reference in New Issue
Block a user