Skip to content

except: merge_requests does NOT work as expected

# Builds for all - except snapshots (branches) - as we would otherwise have 2x build run on merge_requests
build:
  stage: build
  only:
    refs:
      - merge_requests
      - tags
  artifacts:
    paths:
      - build/
  script:
    - ./build/build.sh ${CI_JOB_ID}

#EXACT copy of above - ONLY for snapshot builds
build-snapshot:
  stage: build
  only:
    - branches
  except:
    - merge_requests
    - test
  artifacts:
    paths:
      - build/
  script:
    - ./build/build.sh ${CI_JOB_ID}

I would expect this to run build-snapshot stage on all branch push'es - EXCEPT when there is a merge_request or its on test branch.

However both branches get kicked off - even though gitlab can easily see that its the same commit ref for both branch and merge_request pipeline - so it should adhere to the "except merge_requests" - and NOT kick off the branches pipeline in that case.

Edited by 🤖 GitLab Bot 🤖