mvisonneau / gitlab-ci-pipelines-exporter

Prometheus / OpenMetrics exporter for GitLab CI pipelines insights
Apache License 2.0
1.25k stars 237 forks source link

Handle specific ref name during api calls for mr pipelines from project with merge results/trains enabled #679

Open tidalf opened 1 year ago

tidalf commented 1 year ago

This fixes this issue https://github.com/mvisonneau/gitlab-ci-pipelines-exporter/issues/280 for our setup.

Not sure it's fine as is, or if it'd be better to try to retrieve the settings of the project.

Art3mK commented 10 months ago

@mvisonneau any chance for this to be merged? 🙏 I have the same problem, latest gcpe image can't find MR pipeline for the repo with merge trains enabled. Works fine for repos without merge trains.

kalw commented 9 months ago

Yes ! Would be lovely if @mvisonneau can have a look :)

mj3c commented 8 months ago

I've just been battling with this issue for quite a while and stumbled into this PR. So this proposal would work for all MRs that have at least 1 regular MR pipeline and 1 MR results pipeline. There's a regex which filters the discovered refs before execution ever reaches the changes in this proposal. Here it is: https://github.com/mvisonneau/gitlab-ci-pipelines-exporter/blob/0687efd1075d33283c3762a135aa24de94ffe21c/pkg/schemas/ref.go#L13

This means that only MR refs with /head (regular MR pipelines) are considered. Meaning that if you have enabled MR result pipelines, all the refs will be /merge (with the exception of when there are conflicts, as stated in gitlab docs, search for "conflict").

Here's a git patch in another thread that works for us. This one ensures that both the regular MR pipelines and MR results pipelines are gathered and exported: https://github.com/mvisonneau/gitlab-ci-pipelines-exporter/issues/534#issuecomment-1870465381