Skip to content
Snippets Groups Projects
Commit 6bf70b99 authored by garciadeblas's avatar garciadeblas
Browse files

Fix gitlab-ci.yml to exit if any step in the copy to the FTP fails


Signed-off-by: default avatargarciadeblas <gerardo.garciadeblas@telefonica.com>
parent c79b513a
Branches master
No related tags found
No related merge requests found
Pipeline #18602 passed with stages
in 1 minute and 46 seconds
......@@ -56,7 +56,8 @@ publish-testing-repository:
script:
- apt update && apt install -y sshpass
- |
echo "Uploading new files to Testing-new..."
set -e
echo "Uploading new files to temporary folder Testing-new..."
sshpass -p "$VNF_CATALOG_CREDENTIALS" sftp -o "StrictHostKeyChecking no" -P $SFTP_PORT $SFTP_USER@$SFTP_SERVER << EOF
mkdir Testing-new
put -r vnf-catalog/* Testing-new
......@@ -68,9 +69,9 @@ publish-testing-repository:
rename Testing-new Testing
EOF
echo "Cleaning up old files..."
echo "Cleaning up temporary folder Testing-new..."
sshpass -p "$VNF_CATALOG_CREDENTIALS" sftp -o "StrictHostKeyChecking no" -P $SFTP_PORT $SFTP_USER@$SFTP_SERVER << EOF
rm -rf Testing-old
rmdir Testing-new
EOF
rules:
- if: '$CI_COMMIT_REF_NAME == "master"' # Only in master
......@@ -89,6 +90,7 @@ publish-ondemand-repository:
script:
- apt update && apt install -y sshpass
- |
set -e
DESTINATION_FOLDER="${ONDEMAND_DESTINATION_FOLDER:-Stable}"
TEMP_FOLDER="${DESTINATION_FOLDER}-new"
BACKUP_FOLDER="${DESTINATION_FOLDER}-old"
......@@ -105,9 +107,9 @@ publish-ondemand-repository:
rename $TEMP_FOLDER $DESTINATION_FOLDER
EOF
echo "Cleaning up old files..."
echo "Cleaning up temporary folder $TEMP_FOLDER..."
sshpass -p "$VNF_CATALOG_CREDENTIALS" sftp -o "StrictHostKeyChecking no" -P $SFTP_PORT $SFTP_USER@$SFTP_SERVER << EOF
rm -rf $BACKUP_FOLDER
rmdir $TEMP_FOLDER
EOF
when: manual # This job is run on demand
allow_failure: true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment