2

i trying gitlab pipeline. now i make some changes & code pushed in master branch pipeline showing already update to date but i have changes in code enter image description here

I try to pull in three phase but still same issue .gitlab-ci.yml

before_script:
  - echo "Before script"
building:
  stage: build
  script:
    - git pull origin master
testing:
  stage: test
  script:
    - git pull origin master
deploying:
  stage: deploy
  script:
    - git pull origin master
Pirta Matharu
  • 267
  • 1
  • 5
  • 22

2 Answers2

0

If the gitlab-ci workflow starts by cloning your repository, no amount of git pull will change the fact you already have the full history, and, at the time of the workflow, this is "already up to date".

In other words, a git pull would not be needed in your gitlab-ci.yml file.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I pushed changes in master branch & deploy manually . But pipeline showing `already up to date` again and again – Pirta Matharu Jul 15 '21 at 07:14
  • @PirtaMatharu Yes, because it *clones* your repository, thereby getting the very latest of what you have just pushed. – VonC Jul 15 '21 at 07:19
  • Can you give me any reference to solve this? – Pirta Matharu Jul 15 '21 at 08:35
  • @PirtaMatharu, in other words, in your screen shot the line 11, has already done the git pull origin master. You do not need to do it again. Think when running the CI, you are in a full clean docker, one of the first step included by gitlab-ci is to clone the repo. Most of time you never need to do any git command in your CI. You can focus on QA / test / deploy. Don't worry about sources there are here. Try a ls -l to check it. – Romain TAILLANDIER Jul 15 '21 at 08:42
  • @PirtaMatharu Considering a pull just after a clone would almost always give you a "Already up to date", there is no real issue to solve here. – VonC Jul 15 '21 at 09:03
0

If your pipeline is running on the same repo that you changed, there is no need to use git pull. Although, if your pipeline triggers (on repo A) another pipeline on another repository (repo B), to access files in repo A, you have to pull repo A in repo B pipeline.