During release, only remove the latest dir if it exists
@@ -64,9 +64,12 @@ function publish_yamls() {
echo "Publishing [$@] to ${DEST}"
gsutil -m cp $@ ${DEST}
}
- # Before publishing the YAML files, cleanup the `latest` dir.
- echo "Cleaning up the 'latest' directory first"
- gsutil -m rm gs://${RELEASE_GCS_BUCKET}/latest/**
+ # Before publishing the YAML files, cleanup the `latest` dir if it exists.
+ local latest_dir="gs://${RELEASE_GCS_BUCKET}/latest"
+ if [[ -n "$(gsutil ls ${latest_dir} 2> /dev/null)" ]]; then
+ echo "Cleaning up '${latest_dir}' first"
+ gsutil -m rm ${latest_dir}/**
+ fi
verbose_gsutil_cp latest $@
[[ -n ${TAG} ]] && verbose_gsutil_cp previous/${TAG} $@
}
