From f6fa7975c395f06928de67443b8709f27624904c Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 29 Mar 2024 13:33:21 +0100 Subject: [PATCH] github/actions: Upload image to temporary dir and then move it First upload contents to the temporary dir and once fully uploaded move the directory to the final destination to avoid potential race where simplestream-maintainer can pick the partially uploaded image. Signed-off-by: Din Music --- .github/actions/image-upload/action.yml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/.github/actions/image-upload/action.yml b/.github/actions/image-upload/action.yml index 67c664aea..af4808143 100644 --- a/.github/actions/image-upload/action.yml +++ b/.github/actions/image-upload/action.yml @@ -46,19 +46,14 @@ runs: VERSION=$(cat "${SRC_DIR}/serial") # Create directory structure that will be mirrored on the target server. - PRODUCT_PATH="${SRC_DIR}-upload/${IMG_DIR}" - mkdir -p "${PRODUCT_PATH}/${VERSION}" - - # Move config.yaml file if exists. - if [ -f "${SRC_DIR}/config.yaml" ]; then - mv "${SRC_DIR}/config.yaml" "${PRODUCT_PATH}" - fi - - # Move image content. - mv ${SRC_DIR}/* "${PRODUCT_PATH}/${VERSION}" - - # Use SFTP to upload images to the server. - sftp -P ${SSH_PORT} "${SSH_USER}@${SSH_HOST}" <