]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
[ceph-windows-image-build] Backup existing image file 1995/head
authorIonut Balutoiu <ibalutoiu@cloudbasesolutions.com>
Fri, 29 Apr 2022 16:54:15 +0000 (19:54 +0300)
committerIonut Balutoiu <ibalutoiu@cloudbasesolutions.com>
Fri, 29 Apr 2022 16:54:34 +0000 (19:54 +0300)
ceph-windows-image-build/build/build

index 6f17c51023612fa308ff0cfe0ec0a713e5688087..9231e132848241eac4af2e0a4008a532feb58e87 100755 (executable)
@@ -173,8 +173,20 @@ ${BUILD_DIR}/cleanup
 
 echo "Image successfully built at: ${WORKSPACE}/ceph-win-ltsc2019-ci-image.qcow2"
 
+ssh-keyscan -H drop.front.sepia.ceph.com &>> $SSH_KNOWN_HOSTS_FILE
+
+export SSH_USER="${FILEDUMP_USER}"
+export SSH_KEY="${FILEDUMP_SSH_KEY}"
+export SSH_ADDRESS="drop.front.sepia.ceph.com"
+for FILE in ceph-win-ltsc2019-ci-image.qcow2 ceph-win-ltsc2019-ci-image.qcow2.sha256; do
+    FILE_PATH="/ceph/filedump.ceph.com/windows/${FILE}"
+    if ssh_exec test -f ${FILE_PATH}; then
+        echo "Backup existing image file https://filedump.ceph.com/windows/${FILE}"
+        ssh_exec sudo mv ${FILE_PATH} ${FILE_PATH}.old
+    fi
+done
+
 echo "Uploading the image to https://filedump.ceph.com/windows/"
 cd ${WORKSPACE}
 sha256sum ceph-win-ltsc2019-ci-image.qcow2 > ceph-win-ltsc2019-ci-image.qcow2.sha256
-ssh-keyscan -H drop.front.sepia.ceph.com &>> $SSH_KNOWN_HOSTS_FILE
 rsync -azvP ceph-win-ltsc2019-ci-image.qcow2 ceph-win-ltsc2019-ci-image.qcow2.sha256 --rsync-path="sudo rsync" -e "ssh -i ${FILEDUMP_SSH_KEY} -o UserKnownHostsFile=${SSH_KNOWN_HOSTS_FILE}" ${FILEDUMP_USER}@drop.front.sepia.ceph.com:/ceph/filedump.ceph.com/windows/