Q:

gitlab ci pipeline failed deploy ftp

I try to build and push my react build folder with gitlab-ci.yml
Build and test passes but deploy failed with this error :
If I do the same script in my locale file, it works !  

    lftp -e "mirror -R build/ ./test ; quit" -u $USERNAME,$PASSWORD $HOST
mirror: Access failed: /builds/myGitLab/myGitlabProjectName/build: No such file or directory
lftp: MirrorJob.cc:242: void MirrorJob::JobFinished(Job*): Assertion `transfer_count>0' failed. 
/bin/bash: line 97:   275 Aborted                 (core dumped) lftp -e "mirror -R build/ ./test ; quit" -u $USERNAME,$PASSWORD $HOST
ERROR: Job failed: exit code 1

Here is my all yml file :

image: node:13.8

stages:
  - build
  - test
  - deploy

build:
  stage: build
  script:
    - npm install
    - npm run build

test:
  stage: test
  script:
    - yarn
    - yarn test

deploy:
  script:
    - apt-get update && apt-get install -y lftp
    - lftp -e "mirror -R build/ ./test ; quit" -u $USERNAME,$PASSWORD $HOST
    
enter code here

A:

I 've got it !  i was started from a docker image (node) to perform those 3 stages: the build, the test and the deploy but without success but i tried doing an ls-a in the stage deploy I realized that I didn't have the build folder.  Because the docker image was recreated each time, so I added artifacts to keep the buid file! 
Once the job in the build stage is "done".it keep in a variable buid readable for next job also the deploy ! 
image: node:13.8

stages:
  - build
  - test
  - deploy

build:
  stage: build
  script:
    - npm install
    - npm run build
  only:
    - master
  artifacts:
    paths:
      - build

test:
  stage: test
  script:
    - yarn
    - yarn test

deploy:
  stage: deploy
  before_script:
    - apt-get update -qq
  script:
    - apt-get install -y -qq lftp
    - ls -a
    - lftp -e "set ssl:verify-certificate false; mirror --reverse --verbose --delete build/ ./test2 ; quit" -u $USERNAME,$PASSWORD $HOST
  only:
    - master

