Skip to content

Running marge in separate jobs for different projects in a group does not work

Hello ,

We are currently setting up marge for handling MRs in some of our projects . But marge doesnot seem to consider project_regexp and fails with error

Project does not match project_regexp: project-of-other-job

Here is my configuration in `gitlab-ci.yml`

stages:
  - merge

.marge-bot-template:
  image:
    name: our-registry/marge-org/marge-bot:0.15.3
    entrypoint: [""]
  stage: merge
  variables:
    MARGE_CLI: "true"
    MARGE_GITLAB_URL: "$CI_SERVER_URL"
    MARGE_AUTH_TOKEN: "$MARGE_AUTH_TOKEN"
    MARGE_BRANCH_REGEXP: "main"
    MARGE_USE_HTTPS: "true"
    MARGE_CI_TIMEOUT: "60min"
    MARGE_DEBUG: "true"
  script: marge.app
  rules:
   - if: '$CI_PIPELINE_SOURCE == "schedule"'
   - if: $CI_PIPELINE_SOURCE == "merge_request_event"
     when: manual

marge-bot-project1:
  extends: .marge-bot-template
  variables:
    MARGE_PROJECT_REGEXP: "my-group/project1"
  
marge-bot-project2:
  extends: .marge-bot-template
  variables:
    MARGE_PROJECT_REGEXP: "my-group/project2"

The job marge-bot-project2 fails with error DEBUG Project does not match project_regexp: my-group/project1 even though the variable value refers to project2 (when I print it) but the GET call with project ID is made to project1 in project2 job. I am not sure how this error is occurring. Is this not the intended way to configure this? Any suggestions ?

Edited by Gowri LN