Skip to content

CI: only:changes glob doesn't work as expected

Summary

Hello! 👋 We have CI job with this only setting:

only:
  refs:
    - master
  changes:
    - src/**/*.{js,json}
    - Dockerfile
    - yarn.lock

However, seems like this job gets executed on master only for Dockerfile and yarn.lock but it doesn't get executed for these paths for example:

  • src/apps/location/queries/Location.js
  • src/packages/environment/src/__flowtests__/index.js
  • src/apps/customerSupport/dataloaders/__tests__/CustomerSupportNumber.test.js

I checked this file and seems like it should work.

I am going to change it to src/**/* only for now. Thank you very much for your help.

See: https://docs.gitlab.com/ee/ci/yaml/#onlychanges-and-exceptchanges

Steps to reproduce

Create a job with a pattern similar to src/**/*.{js,json} and try to change some JS files deep in the directory structure. The related job should get started but it doesn't.

What is the current bug behavior?

nothing happens - job is not being started

What is the expected correct behavior?

job should get started when these JS files change

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)

https://gitlab.com/gitlab-org/gitlab-ce/blob/518a751c1a5eb78065bcbd7b9623bd5ab9822141/lib/gitlab/ci/build/policy/changes.rb (?)