How to make a stage depend on another stage?

Hi all,

I’m using “only/changes” to look for changes in files and execute a stage. Now I have a different and later stage, which should run only if before mentioned stage ran. E.g.

  • StageA runs because the file a/foobar changed
  • StageB runs if StageA ran and/or the file b/blubb changed

How can I accomplish this? Any help would be much appreciated.

Cheers, Shorty

Hey Shorty,

You would have to have two stages and then set stageB to run if a/foobar changes.

stages:
  - stage1
  - stage2

StageA:
  stage: stage1
  only:changes:
    - a/foobar
  ...

StageB:
  stage: stage2
  only:changes:
    - a/foobar
    - b/blubb
  ...

Hi @bytesnz,

Thanks for your answer.

I had that idea too. But when you have five stages (and more) and more than 10 folders and files to “watch” it gets pretty messy. I’d like to avoid this. Even more when you have dependencies like these:

  1
 / \
2   3
|  /|
|/  |
4   5

Cheers, Shorty