xxxxxxxxxx
stages:
- build
- deploy
variables:
DIR_PATH: "${CI_COMMIT_REF_NAME}_PATH"
before_script:
- cp $SSH_KEY ~/.ssh/id_rsa
- chmod 700 ~/.ssh
- chmod 600 ~/.ssh/id_rsa
- DIR=${!DIR_PATH}
Pull repository:
stage: build
script:
- ssh $SSH_HOST bash $DIR/git.sh
only:
- development
- production
- pre-production
Fix Coding Standards:
stage: build
script:
- ssh $SSH_HOST bash $DIR/cs_fix.sh
only:
- development
- production
- pre-production
Install dependencies:
stage: build
script:
- ssh $SSH_HOST bash $DIR/dependency.sh
only:
- development
- production
- pre-production
Deploy changes:
stage: deploy
script:
- ssh $SSH_HOST bash $DIR/deploy.sh
only:
- development
- production
- pre-production
xxxxxxxxxx
Step 1:
Create .gitlab-ci.yml file (root folder)
Step 2:
Open .gitlab-ci.yml file: fill something below
--------------------
image: ubuntu:18.04
before_script:
- apt-get update -qy
- apt-get install -y lftp
build:
script:
# Sync to FTP
- lftp -e "set ftp:ssl-allow no; open xxx.yyy.zzz.uuu; user ftp_account ftp_password; mirror -X .* -X .*/ --reverse --verbose ./ ./; bye"
--------------------
NOTE:
ftp_account: MUST set here
ftp_password: MUST set here
link ref
https://savjee.be/2019/04/gitlab-ci-deploy-to-ftp-with-lftp/
xxxxxxxxxx
# .gitlab-ci.yml
include:
- project: 'group/project1'
ref: 'master'
file: 'shared/jobs.yml'
- project: 'group/project2'
file: 'shared/stages.yml'