0

I am having directory structure as below.

Gitlab pipeline to trigger pipeline when any changes done in abc dir or any sub-directory or any of its sub sub directoty inside it.

So If any changes happened in directory or sub directory or sub of sub directory, Gitlab Trigger pipeline should trigger.

Sample paths:

path: abc/hi/hey/get/ok.txt

path: abc/hi/hello/pli/vet.txt

path: abc/xcd.txt

Current .gitlab-ci.yml

only:
        changes:
            - "abc/*"

I want to check any changes in sub directory and sub sub director of all above paths.I made changes as below.Will this work, or any other changes are required?

New .gitlab-ci.yml

only:
        changes:
            - "abc/**/*"
            - "abc/*"

Ref link- https://docs.gitlab.com/ee/ci/yaml/index.html#onlychanges--exceptchanges

https://forum.gitlab.com/t/how-to-trigger-a-child-pipeline-when-changes-to-any-files-in-sub-directories-in-a-specified-branch-alone/48973/2

Divyank
  • 811
  • 2
  • 10
  • 26

1 Answers1

1

If you look at the only/except documentation which you've linked, you'll notice an example on how to trigger a job for changes

a directory and all its subdirectories, for example path/to/directory/**/*.

So in your example, you should only need the one line:

- abc/**/*

Arty-chan
  • 2,572
  • 1
  • 19
  • 25
  • But I have multiple sub directories inside sub directories, if anything changes in sub of sub directories will this work? – Divyank Oct 09 '22 at 09:03
  • it's supposed to work for all subdirectories, I didn't try it yesterday when posting the answer, but I have had it work in the past – Arty-chan Oct 09 '22 at 17:35