1

We are migrating from tfs to gitlab. Ours is a huge repository with multiple technology stack. And each solution has its own unit tests associated. We are planning to allow merge requests to successfully complete only upon successful build of that particular solution with the changes associated with merge request. As we have multiple solutions, is there a way to tell Gitlab ci yaml to trigger only a particular job if the merge request is associated with specific file changes.

eg.. If I have changes from solution A in the merge request, the pipeline should trigger job A

Currently, we have yaml snippet similar to this. But its getting triggered on all the merge requests while we want it to trigger only for merge requests for files under /docs/UI

  rules:
    - if: $CI_MERGE_REQUEST_IID
    - changes:
      - ./docs/UI

Our Gitlab version: GitLab Enterprise Edition 12.6.6-ee

Any leads would be appreciated. Thanks!!

1 Answers1

0

You are using the keyword rules. Rules are evaluated in order until the first match. When matched, the job is either included or excluded from the pipeline, depending on the configuration.

Use the keyword only instead. For example like this:

  only:
    refs:
      - merge_requests
    changes:
      - docs/UI/**/*
Jenneth
  • 351
  • 1
  • 10