From c1bb3c8bac036681da809c54c4e64e694f151a18 Mon Sep 17 00:00:00 2001 From: Scott Zawalski Date: Fri, 25 Mar 2011 16:56:32 -0700 Subject: [PATCH] Add in a gsutil_append_latest bool option to avoid appending ChromeOS-Hash-B# to the output of images uploaded to Google Storage. This is a stop gap solution until I migrate all builders to uploading with the new structure. BUG=NA TEST=Ran on a finished buildbot to ensure the proper behaviour Review URL: http://codereview.chromium.org/6749018 --- archive_build.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/archive_build.sh b/archive_build.sh index 075444f420..63224a6378 100755 --- a/archive_build.sh +++ b/archive_build.sh @@ -60,6 +60,8 @@ DEFINE_string acl "private" \ "ACL to set on GSD archives" DEFINE_string gsutil_archive "" \ "Optional datastore archive location" +DEFINE_boolean gsutil_append_last_change $FLAGS_TRUE \ + "Optional Whether to append build # and chrome os hash to GS uploads" DEFINE_integer keep_max 0 "Maximum builds to keep in archive (0=all)" DEFINE_boolean official_build $FLAGS_FALSE \ "Set CHROMEOS_OFFICIAL=1 for release builds." @@ -254,6 +256,10 @@ cp -f "${FLAGS_from}/au-generator.zip" "${OUTDIR}/" function gsutil_archive() { IN_PATH="$1" OUT_PATH="$2" + if [ ${FLAGS_gsutil_append_last_change} -eq ${FLAGS_TRUE} ]; then + OUT_PATH="${LAST_CHANGE}/${OUT_PATH}" + fi + echo "Using gsutil to archive to ${OUT_PATH}..." if [ -z "$FLAGS_gsutil_archive" -o ${FLAGS_debug} -eq ${FLAGS_TRUE} ]; then echo -n "In debug mode. Would have run: " @@ -280,7 +286,7 @@ then "${SCRIPTS_DIR}/archive_hwqual" --from "${OUTDIR}" \ --output_tag "${HWQUAL_NAME}" gsutil_archive "${OUTDIR}/${HWQUAL_NAME}.tar.bz2" \ - "${LAST_CHANGE}/${HWQUAL_NAME}.tar.bz2" + "${HWQUAL_NAME}.tar.bz2" fi @@ -304,7 +310,7 @@ if [ $FLAGS_prebuilt_upload -eq $FLAGS_TRUE ]; then fi fi -gsutil_archive "${ZIPFILE}" "${LAST_CHANGE}/${FLAGS_zipname}" +gsutil_archive "${ZIPFILE}" "${FLAGS_zipname}" if [ $FLAGS_archive_debug -eq $FLAGS_TRUE ]; then echo "Generating Breakpad symbols" @@ -316,26 +322,30 @@ if [ $FLAGS_archive_debug -eq $FLAGS_TRUE ]; then CMD="chown \${SUDO_UID}:\${SUDO_GID} ${OUTDIR}/debug.tgz" sudo sh -c "${CMD}" popd - gsutil_archive "${OUTDIR}/debug.tgz" "${LAST_CHANGE}/debug.tgz" + gsutil_archive "${OUTDIR}/debug.tgz" "debug.tgz" fi if [ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ] || \ [ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ]; then gsutil_archive "${FACTORY_ZIPFILE}" \ - "${LAST_CHANGE}/factory_${FLAGS_zipname}" + "factory_${FLAGS_zipname}" fi gsutil_archive "${FLAGS_to}/LATEST" "LATEST" if [ -n "${FLAGS_gsutil_archive}" ]; then - FULL_INDEX_PATH="${FLAGS_gsutil_archive}/${LAST_CHANGE}/_index.html" + if [ ${FLAGS_gsutil_append_last_change} -eq ${FLAGS_TRUE} ]; then + FULL_INDEX_PATH="${FLAGS_gsutil_archive}/${LAST_CHANGE}/_index.html" + else + FULL_INDEX_PATH="${FLAGS_gsutil_archive}/_index.html" + fi RELATIVE_ARCHIVE_URL_PATH="${FULL_INDEX_PATH#gs://}" echo "CROS_ARCHIVE_URL=\ https://sandbox.google.com/storage/${RELATIVE_ARCHIVE_URL_PATH}" fi if [ -n "${FLAGS_test_tarball}" ]; then - gsutil_archive "${FLAGS_test_tarball}" "${LAST_CHANGE}/test_results.tgz" + gsutil_archive "${FLAGS_test_tarball}" "test_results.tgz" fi # Purge old builds if necessary