GitLab deployment job selects changes from git

In my project, the deployment script uses the results of the build job, but I see that in my deployment job, GitLab CI repeats all the changes from the last commit, and also deletes all the files created by the build job. I am using Shell Executor.

Is there a way to prevent GitLab CI from being used in the deployment task so that my deployment can simply continue from where my build task stopped?

I tried:

cache:
    untracked: true

in my deployment task, but it didn't seem to make any difference.

my full .gitlab-ci.yml:

before_script:
  - sudo apt-get -y install default-jdk
  - sudo add-apt-repository -y ppa:cwchien/gradle
  - sudo apt-get -y update
  - sudo apt-get -y install gradle
  - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
  - sudo apt-get install -y nodejs
  - sudo npm install -g pm2

stages:
  - build
  - test
  - deploy

after_script:

jobBuild:
  stage: build
  script:
    - ( cd my-lib; gradle build assemble)
  only:
    - master

jobDeploy:
  before_script:

  stage: deploy
  cache:
    untracked: true

  script:
    - <some shell scripts>
  only:
    - master
+1
source share
1 answer

Learn more about Gitlab CI cache.

-, , , jobBuild. , .

, , .

, , . , , GitLab.

-, 100% , artifcats.

artifacts

Gitlab CI / . , .

git , GIT_STRATEGY none. .

.gitlab-ci.yml, :

before_script:
  - sudo apt-get -y install default-jdk
  - sudo add-apt-repository -y ppa:cwchien/gradle
  - sudo apt-get -y update
  - sudo apt-get -y install gradle
  - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
  - sudo apt-get install -y nodejs
  - sudo npm install -g pm2

stages:
  - build
  - test
  - deploy

after_script:

jobBuild:
  stage: build
  script:
    - ( cd my-lib; gradle build assemble)
  only:
    - master
  artifacts:
    paths:
      - path/to/folder/containing/build/files # for example my-lib

jobDeploy:
  before_script:
  stage: deploy
  variables:
    GIT_STRATEGY: none
  dependencies:
    - jobBuild
  script:
    - cd path/to/folder/containing/build/files # for example my-lib
    - <some shell scripts>
  only:
    - master
+1

Source: https://habr.com/ru/post/1676215/


All Articles