DEV Community

Cover image for Why isn't coverage badge in GitLab updating?
Denis Anikin
Denis Anikin

Posted on

Why isn't coverage badge in GitLab updating?

Sometimes coverage badge is not updating at all and remains at the same value as it was in the past.
Earlier this was an old bug in Gitlab that lead you to this situation. But these days are gone and the bug was fixed. And all articles on the whole internet show you mainly this irrelevant information. So I wrote this article in hopes of adding a piece of valuable information.

If you search in your setup of Gitlab and find a «blocked» pipeline — exactly this type of pipeline is the main reason for coverage score staling.
In earlier versions of Gitlab, it was easy to get stuck in this situation. A single job with the following configuration in your pipeline and your coverage gets pinned at one value:

my-job:
    when: manual
Enter fullscreen mode Exit fullscreen mode

To fix this you need to add only one line:

my-job:
    when: manual
    allow_failure: true
Enter fullscreen mode Exit fullscreen mode

And poof, you get lucky, your coverage badge is free of the evil witch curse and updates as it should.

Recently Gitlab guys fixed that behavior. How exactly? Just added default value allow_failure: true for manual pipelines automatically. This is a very good decision, because otherwise, a single manual step may ruin the whole CI/CD prosperity of your project.
But if your think that you are now completely free of this trouble, I may change your opinion.
Just write anything like this:

my-job:
    when: manual
    allow_failure: false
Enter fullscreen mode Exit fullscreen mode

and poof once again — you are stuck with never-ever updating coverage badge. The fix is obvious — add «true» for allow_failure or strip this line. But I have no answer to a simple question: what we should do if we need manual pipelines with disabled failure option and updatable coverage badge? Probably, this question should be addressed directly to Gitlab.

This may not be so easy to grasp from official documentation, so I decided to write this article. I hope it helped.

Top comments (0)