Fix backup archive directory structure. 10/32010/2
authorDave Wallace <[email protected]>
Fri, 16 Apr 2021 14:06:36 +0000 (10:06 -0400)
committerDave Wallace <[email protected]>
Fri, 16 Apr 2021 14:11:38 +0000 (10:11 -0400)
Change-Id: I9fd1194bdb68239df2a6e2c4432ec1849ca12aac
Signed-off-by: Dave Wallace <[email protected]>
jjb/scripts/backup_upload_archives.sh

index 0599c96..8d6a8f4 100755 (executable)
@@ -159,30 +159,19 @@ if __name__ == u"__main__":
 END_OF_PYTHON_SCRIPT
 
 WS_ARCHIVES_DIR="$WORKSPACE/archives"
-ARCHIVES_DIR="$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER"
-ARCHIVES_ZIP_FILE="$WORKSPACE/.archives/archives.zip"
+JENKINS_BUILD_ARCHIVE_DIR="$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER"
 
 TMP_ARCHIVES_DIR="/tmp/archives"
 mkdir -p $TMP_ARCHIVES_DIR
 pushd $TMP_ARCHIVES_DIR
 
-if [ -f "$ARCHIVES_ZIP_FILE" ]; then
-       # FIXME: this branch to be removed upon full transition to lftools:
-       # we are include_raw from fdio-infra-shiplogs publisher, and
-       # it already packed everything into archives.zip and removed
-       # the original archives directory. So just unpack and use that.
-       echo "Detected existing archives.zip, uploading the contents of it"
-       unzip "$ARCHIVES_ZIP_FILE"
+mkdir -p $JENKINS_BUILD_ARCHIVE_DIR
+if [ -e "$WS_ARCHIVES_DIR" ]; then
+    echo "Found $WS_ARCHIVES_DIR, uploading its contents"
+    cp -r $WS_ARCHIVES_DIR/* $JENKINS_BUILD_ARCHIVE_DIR
 else
-       # the include_raw is done from fdio-infra-publish publisher
-       mkdir -p "$ARCHIVES_DIR"
-       if [ -e "$WS_ARCHIVES_DIR" ]; then
-               echo "Found $WS_ARCHIVES_DIR, uploading its contents"
-               cp -r "$WS_ARCHIVES_DIR" .
-       else
-               echo "No $WS_ARCHIVES_DIR found. Creating a dummy file."
-               echo "No archives found while doing backup upload" > "$ARCHIVES_DIR/no-archives-found.txt"
-       fi
+    echo "No $WS_ARCHIVES_DIR found. Creating a dummy file."
+    echo "No archives found while doing backup upload" > "$JENKINS_BUILD_ARCHIVE_DIR/no-archives-found.txt"
 fi
 
 echo "Contents of the archives dir:"