D
D
deeand2018-10-24 18:57:08
git
deeand, 2018-10-24 18:57:08

And how to properly configure git-ftp in .gitlab-ci.yml?

For deployment to test and production servers in .gitlab-ci.yml I use lftp.

stages:
- deploy

deploy_staging:
  stage: deploy
  script:
    - echo "Deploy to staging server"
    - apt-get update -qq && apt-get install -y -qq lftp
    - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rnev ./ /domains/www/private_html/staging/ --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/ --exclude staging/ --exclude /sitemap.xml"
  only:
    - develop-production
    
deploy_prod:
  stage: deploy
  script:
    - echo "Deploy to production server"
    - apt-get update -qq && apt-get install -y -qq lftp
    - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rnev ./ /domains/www/private_html/ --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/ --exclude staging/ --exclude /sitemap.xml"
  when: manual
  only:
  - master

And everything works, but at the same time, if the production server has its own files that are not in the Git project, lftp also deletes them, which should not be.
And how to properly configure git-ftp in .gitlab-ci.yml?
In this form, gitlab does not accept:
deploy_prod:
  stage: deploy
  script:
    - echo "Deploy to production server"
    - apt-get update -qq && apt-get install -y -qq git-ftp
    - git ftp init --user $USERNAME --password $PASSWORD ftp://***.com

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aol-nnov, 2018-10-24
@aol-nnov

https://git-ftp.github.io
Compare your example with the official documentation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question