Before I start, here is my .gitlab-ci.yml
…
deploy_staging:
stage: deploy
environment:
name: staging
url: http://www.example.com/beta
only:
- develop
script:
- apt-get update -qq && apt-get install -y -qq lftp
- lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rnev site/ ./public_html/beta --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
deploy_production:
stage: deploy
environment:
name: production
url: http://www.example.com/
only:
- master
script:
- apt-get update -qq && apt-get install -y -qq lftp
- lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rnev -x beta/ site/ ./public_html --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
The only thing that’s been changed from what I’m actually testing is the url.
So, I push to master
, and all works as expected, but if I push to the develop
branch the correct job starts but I get left with an error…
$ lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rnev site/ ./public_html/beta --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
mirror: Not connected
ERROR: Job failed: exit code 1
I have no idea why, things I’ve tried include:
- Changing the environment name.
- Using the exact same script as
deploy_production
. - Testing to see if it I can deploy to
./public_html/beta
from master, I can. - Removing the
deploy_production
job and testing thedeploy_staging
job on master, it works. - Seeing if I can deploy directly to
./public_html
from develop, I can’t
I can’t for the life of me figure out why it can’t connect to the mirror from the develop branch. Have I got a fundamental misunderstanding of how this is working or am I missing something small?