Spice
Spice

Reputation: 256

GitLab CI - Keep last pipeline status

In GitLab CI, is it possible to keep the last pipeline status when no jobs are queued upon a push? I have a changes rule setup like this in my .gitlab-ci.yml:

changes: 
  - Assets/*
  - Packages/*
  - ProjectSettings/*
  - .gitlab-ci.yml

which applies to all jobs in the pipeline (these are build jobs for Unity, though irrelevant). NOTE: I only wanted to run a build job if there are any actual files changes that would require a rebuild. changes to README.md and CONTRIBUTING.md are not changes that require a rebuild so this is why I have such a rule.

Problem is I require successful pipeline to merge branches and when I try to merge a branch that modified README.md there obviously is no pipeline. Checking pipeline status stuck

Is there a way to just "reuse" the result of a previous pipeline or to have a "dummy" job that succeeds instantly upon any push, so as to be able to merge this branch without requiring an expensive rebuild of the whole project?

Upvotes: 0

Views: 882

Answers (1)

Patrick
Patrick

Reputation: 3230

As you mentioned in your last paragraph, the only way to work around this would be to inject a dummy job that always succeed; something like echo "hello world" in the script.

However, depending on how long your tests run, your best bet may be to just have your tests run every time regardless of changes. Any sort of partial pipeline run using the changes keyword leaves you open to merging changes that break your pipeline. It essentially tightly couples your logic in your pipeline to the component structure of your code, which isn't always a good thing since one of the points of your pipeline is to catch those kinds of cross-component breakages.

Upvotes: 1

Related Questions