Gitlab CI: do not trigger pipeline when commit done by certain user

Viewed 2797

We have an automated process that commits a status file at the end of every merge request. We would like to configure a pipeline that runs on every commit except for commits by this user. Currently the pipeline is configured like so:

test:
  stage: test
  script:
    - make test
  except:
    changes:
      - "the_status_file"

However, sometimes the status file doesn't change at all. In that case, the pipeline runs.

Instead, we would like to configure the pipeline to ignore commits by a certain user (this user being the automated one we created). Is this possible in gitlab ci?

2 Answers

I am not aware of such feature in Gitlab CI. However if your user is a script creating and pushing commits and you have control over it, you could decide whether to trigger the CI pipeline or not by inserting (or not) [ci skip] or [skip ci] in your commit message.

See: https://docs.gitlab.com/ee/ci/yaml/#skip-pipeline

That could be done with rules

rules:
    - if: '$GITLAB_USER_LOGIN == "username"'
      when: never
    - when: on_success
Related