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

parent c79b513a
Loading
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -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