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
No related branches found
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: ...@@ -56,7 +56,8 @@ publish-testing-repository:
script: script:
- apt update && apt install -y sshpass - 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 sshpass -p "$VNF_CATALOG_CREDENTIALS" sftp -o "StrictHostKeyChecking no" -P $SFTP_PORT $SFTP_USER@$SFTP_SERVER << EOF
mkdir Testing-new mkdir Testing-new
put -r vnf-catalog/* Testing-new put -r vnf-catalog/* Testing-new
...@@ -68,9 +69,9 @@ publish-testing-repository: ...@@ -68,9 +69,9 @@ publish-testing-repository:
rename Testing-new Testing rename Testing-new Testing
EOF 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 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 EOF
rules: rules:
- if: '$CI_COMMIT_REF_NAME == "master"' # Only in master - if: '$CI_COMMIT_REF_NAME == "master"' # Only in master
...@@ -89,6 +90,7 @@ publish-ondemand-repository: ...@@ -89,6 +90,7 @@ publish-ondemand-repository:
script: script:
- apt update && apt install -y sshpass - apt update && apt install -y sshpass
- | - |
set -e
DESTINATION_FOLDER="${ONDEMAND_DESTINATION_FOLDER:-Stable}" DESTINATION_FOLDER="${ONDEMAND_DESTINATION_FOLDER:-Stable}"
TEMP_FOLDER="${DESTINATION_FOLDER}-new" TEMP_FOLDER="${DESTINATION_FOLDER}-new"
BACKUP_FOLDER="${DESTINATION_FOLDER}-old" BACKUP_FOLDER="${DESTINATION_FOLDER}-old"
...@@ -105,9 +107,9 @@ publish-ondemand-repository: ...@@ -105,9 +107,9 @@ publish-ondemand-repository:
rename $TEMP_FOLDER $DESTINATION_FOLDER rename $TEMP_FOLDER $DESTINATION_FOLDER
EOF 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 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 EOF
when: manual # This job is run on demand when: manual # This job is run on demand
allow_failure: true 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