CI: fixing cdash links on forks
The cdash links are a bit tricky when doing MR between a fork and the official repo:
- normally, the statuses API should be used on the target project (because it is the one carrying the MR)
- however, the personal API token of the contributor may not allow to use Gitlab API on the official repository.
- but, it appears that using the fork ID and the default
CI_COMMIT_REF_NAME
as theref
parameter ofstatuses
will send the links to the MR pipeline, maybe because in this particular case it also has the taglatest
...
Anyway, to illustrate this obscure issue, some example with different id
and ref
parameters for the statuses
API:
-
https://gitlab.orfeo-toolbox.org/atalon/otb/commit/64d95abbffc94732908588436e4636bbd9a78708/pipelines : pipeline 2090 with
id
= fork's ID andref = refs/merge-requests/541/head
: the MR is unknown in the fork project, so a blank pipeline is created (n° 2092) and received all the CDash links from pipeline 2090. -
https://gitlab.orfeo-toolbox.org/atalon/otb/commit/a15d589d8e4d438360874c89476e6f61f8d5632e/pipelines : pipeline 2262 with
id
= main repo ID andref = refs/merge-requests/555/head
: I get a HTTP Error 403, the user can't post statuses on the main repo. I manually ran the pipeline 2261 (id
= fork's ID andref= $CI_COMMIT_REF_NAME
) to see where the cdash link would go, and it went into pipeline 2262. -
https://gitlab.orfeo-toolbox.org/atalon/otb/commit/b77b5d957aa01f14ceb6af89211390097f46f2ff/pipelines : pipeline 2264 with
id
= fork's ID andref= $CI_COMMIT_REF_NAME
, the links are posted in the right pipeline.