I am running compliance scans against directories where a commit is done on a terragrunt.hcl
file.
I would like the pipeline from my . gitlab-ci.yaml
to be triggered if and only if a commit to this specific file “terragrunt.hcl
” within a directory and its sub-directories have changed. Is there a way to do this with gitlab's ci/cd tooling or would it be easier just to run a custom build script?
This one-liner bash below does what I want but the issue with that is that it still triggers the pipeline with any commits when I just want the build on that specific terragrunt.hcl
only.
for i in $(git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHA | xargs -n 1 dirname | uniq); do cd /scripts && ./run.sh /path/to/$i; done
I found this resource: GitLab CI/CD: Run jobs only when files in a specific directory have changed and still running some test on it but I would appreciate any additional help please!!! I am very close !!