Shaddow
Shaddow

Reputation: 3215

GitLab FTP deploy - Job failed: execution took longer than 1h0m0s seconds

Im new to GitLab and CI but I want deploy from GitLab repo to FTP via lftp

its goes to lftp and still running 1 hour and then return:

ERROR: Job failed: execution took longer than 1h0m0s seconds


.gitlab-ci.yml

...

deploy:
  stage: deploy
  image: mwienk/docker-lftp:latest
  only:
    - dev
  script:
    - lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD -p $FTP_PORT $FTP_HOST; mirror -Rev ./ gitlab  --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"

...

also tried

script:
  - apt-get update -qq && apt-get install -y -qq lftp

Its SFTP protocol, maybe lftp is asking for something on background and not continue? Its not upload anything on FTP. Any advice?

Upvotes: 3

Views: 2514

Answers (1)

Michael Schober
Michael Schober

Reputation: 371

Using SFTP you should try with port 22 and prefix your host like so: sftp://example.com

A very useful tool is also the lftp debug command and --verbose flag for the mirror command. Just include it in your script like so:

lftp -c "set ftp:ssl-allow no; debug; open -u $FTP_USERNAME,$FTP_PASSWORD -p $FTP_PORT $FTP_HOST; mirror -Rev ./ gitlab --verbose --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"

Also you should try to install lftp with: apt-get update -qq && apt-get install -y -qq lftp since this version includes the library libgnutls for supporting secure connections.

This is the configuration which worked on my setup deploying with FTP:

.gitlab-ci.yml

...

deploy:
  stage: deploy
  script:
    - apt-get update -qq && apt-get install -y -qq lftp
    - lftp -u $FTP_USER,$FTP_PASS $HOST -e "mirror -e -R -p ./dist/ new/ ; quit" 
    - echo "deployment complete"
  # specify environment this job is using
  environment:
    name: staging
    url: http://example.com/new/
  # needs artifacts from previous build
  dependencies:
    - build

lftp documentation: https://lftp.yar.ru/lftp-man.html

Upvotes: 2

Related Questions