0

I am writing a CI task to copy our build to our deployment server, which is configured by a 3rd party to only support FTP. I've put together the following:

deploy:
  stage: deploy
  only:
    refs:
      - master
  script:
      - apk add lftp
      - lftp --version
      - lftp -c "set ftp:ssl-force true; set ssl:verify-certificate false; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOSTNAME; mirror -Rnv ./build ./public"
  environment: production
  cache:
    key: "$CI_COMMIT_REF_NAME"
    policy: pull
    paths:
      - build

lftp successfully deletes the previous build on the deployment server and copies over the new version, but then exits with the following error:

Removing old file `build-1.0-SNAPSHOT.jar'
Transferring file `build-1.0-SNAPSHOT.jar'
chmod: Access failed: 550 Not enough privileges. (./build-1.0-SNAPSHOT.jar)
Cleaning up project directory and file based variables 00:01
ERROR: Job failed: exit code 1

The build directory currently only contains one file, but this will change in the near future.

I'm not comfortable with disabling errors for the task - I want to be notified when deployment fails. Why does lftp throw an error after the transfer completes successfully and is there a way to eliminate it (and if not, to mask it)?

otoomey
  • 939
  • 1
  • 14
  • 31

0 Answers0