I have a very simple GitLab CICD pipeline with build
and deploy
stages. However, the build artifact
is not being retained for deploy, and I cannot figure out how to get the dist
directoty to be reatined. YAML is shown below:
stages: # List of stages for jobs, and their order of execution
- build
- test
- deploy
build:
image: node
script:
- npm install
- npm run build
- pwd; ls -latrR dist
artifacts:
paths:
- "dist/"
expire_in: 1 week
deploy:
dependencies:
- "build"
script:
- pwd; ls -latrR
- apt-get update -qq && apt-get install -y -qq lftp
- if [ -d 'dist' ] ; then lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; mirror -v dist/ $FTP_DESTINATION --reverse --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"; else echo "No dist directory"; fi;
environment:
name: production
only:
- main
The recursive listing and pwd
command shows that the dist
directory is absent from the deploy
stage. This can be shown below from the pipeline output:
$ apt-get update -qq && apt-get install -y -qq lftp
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package lftp.
(Reading database ... 23248 files and directories currently installed.)
Preparing to unpack .../lftp_4.9.2-2+b1_amd64.deb ...
Unpacking lftp (4.9.2-2+b1) ...
Setting up lftp (4.9.2-2+b1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
$ if [ -d 'dist' ] ; then lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; mirror -v dist/ $FTP_DESTINATION --reverse --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"; else echo "No dist directory"; fi;
No dist directory
Cleaning up project directory and file based variables
00:00
Job succeeded
Any assistance would be gratefully received,
Cheers
Andrew