Commit 6eca6a1e authored by garciadeblas's avatar garciadeblas
Browse files

Fix gitlab-ci.yml to remove non-working exits during copy to the FTP

parent 0d6b1b23
Loading
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -56,21 +56,25 @@ publish-testing-repository:
  script:
    - apt update && apt install -y sshpass
    - |
        set -e
        echo "Testing permissions"
        sshpass -p "$VNF_CATALOG_CREDENTIALS" sftp -o "StrictHostKeyChecking no" -P $SFTP_PORT $SFTP_USER@$SFTP_SERVER << EOF
          pwd
          ls -l
        EOF
        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 || exit 1
        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
        EOF
        
        echo "Switching directories..."
        sshpass -p "$VNF_CATALOG_CREDENTIALS" sftp -o "StrictHostKeyChecking no" -P $SFTP_PORT $SFTP_USER@$SFTP_SERVER << EOF || exit 1
        sshpass -p "$VNF_CATALOG_CREDENTIALS" sftp -o "StrictHostKeyChecking no" -P $SFTP_PORT $SFTP_USER@$SFTP_SERVER << EOF
          rename Testing Testing-old
          rename Testing-new Testing
        EOF
        
        echo "Cleaning up temporary folder Testing-new..."
        sshpass -p "$VNF_CATALOG_CREDENTIALS" sftp -o "StrictHostKeyChecking no" -P $SFTP_PORT $SFTP_USER@$SFTP_SERVER << EOF || exit 1
        sshpass -p "$VNF_CATALOG_CREDENTIALS" sftp -o "StrictHostKeyChecking no" -P $SFTP_PORT $SFTP_USER@$SFTP_SERVER << EOF
          rmdir Testing-new
        EOF
  when: manual  # This job is run on demand
@@ -92,19 +96,18 @@ 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"
        
        echo "Uploading files to temporary folder $TEMP_FOLDER in FTP ..."
        sshpass -p "$VNF_CATALOG_CREDENTIALS" sftp -o "StrictHostKeyChecking no" -P $SFTP_PORT $SFTP_USER@$SFTP_SERVER << EOF || exit 1
        sshpass -p "$VNF_CATALOG_CREDENTIALS" sftp -o "StrictHostKeyChecking no" -P $SFTP_PORT $SFTP_USER@$SFTP_SERVER << EOF
          mkdir $TEMP_FOLDER
          put -r vnf-catalog/* $TEMP_FOLDER
        EOF
        
        echo "Switching directories..."
        sshpass -p "$VNF_CATALOG_CREDENTIALS" sftp -o "StrictHostKeyChecking no" -P $SFTP_PORT $SFTP_USER@$SFTP_SERVER << EOF || exit 1
        sshpass -p "$VNF_CATALOG_CREDENTIALS" sftp -o "StrictHostKeyChecking no" -P $SFTP_PORT $SFTP_USER@$SFTP_SERVER << EOF
          rename $DESTINATION_FOLDER $BACKUP_FOLDER
          rename $TEMP_FOLDER $DESTINATION_FOLDER
        EOF