C_Z_
C_Z_

Reputation: 7796

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

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?

Upvotes: 6

Views: 6989

Answers (2)

Christophe Muller
Christophe Muller

Reputation: 5090

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/pipelines/#skip-a-pipeline

Upvotes: 4

Sascha Frinken
Sascha Frinken

Reputation: 3356

That could be done with rules

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

Upvotes: 3

Related Questions