From eaa3bf1e623d12afc449a1cba96a9262bc463308 Mon Sep 17 00:00:00 2001 From: Ionut Balutoiu Date: Fri, 29 Apr 2022 19:54:15 +0300 Subject: [PATCH] [ceph-windows-image-build] Backup existing image file --- ceph-windows-image-build/build/build | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ceph-windows-image-build/build/build b/ceph-windows-image-build/build/build index 6f17c510..9231e132 100755 --- a/ceph-windows-image-build/build/build +++ b/ceph-windows-image-build/build/build @@ -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/ -- 2.47.3