Job with when:manual runs every time

Problem to solve

I have a CI job defined mostly like this:

  stage: test
  image: "some-image:latest"
    - validate-metainfo data/metainfo.xml
  needs: ["build@x86_64"]
    - changes:
        - data/metainfo.xml
      when: always
    - when: manual
      allow_failure: true

The idea is to always validate the file if it has been changed, but also to be able to trigger the change manually if we ant. For example, if we know that the validation criteria changed in the binary included in the image.

The problem we are having is that even if the file is not changed, the job always runs. We expect that it should not run unless we trigger it manually.

Removing the allow_failure: true in the last line makes the job not run unless it is triggered manually, but then the pipeline is blocked until the job is ran because it is considered a blocking manual job.


  • Self-managed
  • SaaS
  • Self-hosted Runners


  • GitLab: GitLab Community Edition v16.9.1
  • GitLab Runner, if self-hosted: 16.9.1

We found out why. The problem was that we are using branch pipelines, so the job always runs when the branch is created.