Child pipelines override CI status in GitLab CI/CD for Github projects

Summary

For mirrored Github repositories, Gitlab uses the context parameter to show the CI status for a commit on Github. This is a fixed string context: ci/gitlab/gitlab.com.

Unfortunately child pipelines use the same context, which causes the commit status on Github to be overwritten with the child pipline status. Also URLs to Gitlab will point to the child pipeline, not the parent pipeline.

Steps to reproduce

See the example below

Example Project

Here is a Github project with a failing master:

https://github.com/haampie/gitlab-status-issue-example/commit/d08f36428b4f4ac3f7b52accb1c6848a0ddc6634

Here is the mirrored Gitlab project with a succeeding master:

harmen-cscs/gitlab-status-issue-example@d08f3642

You can see all past statuses using Github's API like this:

$ curl -X GET https://api.github.com/repos/haampie/gitlab-status-issue-example/statuses/d08f36428b4f4ac3f7b52accb1c6848a0ddc6634
[
  {
    "url": "https://api.github.com/repos/haampie/gitlab-status-issue-example/statuses/d08f36428b4f4ac3f7b52accb1c6848a0ddc6634",
    "state": "failure",
    "description": "Pipeline failed on GitLab",
    "target_url": "https://gitlab.com/harmen-cscs/gitlab-status-issue-example/pipelines/142933746",
    "context": "ci/gitlab/gitlab.com",
    "created_at": "2020-05-05T19:01:53Z",
  },
  {
    "url": "https://api.github.com/repos/haampie/gitlab-status-issue-example/statuses/d08f36428b4f4ac3f7b52accb1c6848a0ddc6634",
    "state": "pending",
    "description": "Pipeline running on GitLab",
    "target_url": "https://gitlab.com/harmen-cscs/gitlab-status-issue-example/pipelines/142933746",
    "context": "ci/gitlab/gitlab.com",
    "created_at": "2020-05-05T19:01:28Z",
  },
  {
    "url": "https://api.github.com/repos/haampie/gitlab-status-issue-example/statuses/d08f36428b4f4ac3f7b52accb1c6848a0ddc6634",
    "state": "success",
    "description": "Pipeline passed on GitLab",
    "target_url": "https://gitlab.com/harmen-cscs/gitlab-status-issue-example/pipelines/142933743",
    "context": "ci/gitlab/gitlab.com",
    "created_at": "2020-05-05T19:01:27Z",
  },
  {
    "url": "https://api.github.com/repos/haampie/gitlab-status-issue-example/statuses/d08f36428b4f4ac3f7b52accb1c6848a0ddc6634",
    "id": 9566020242,
    "state": "pending",
    "description": "Pipeline pending on GitLab",
    "target_url": "https://gitlab.com/harmen-cscs/gitlab-status-issue-example/pipelines/142933746",
    "context": "ci/gitlab/gitlab.com",
    "created_at": "2020-05-05T19:01:26Z",
  },
  {
    "url": "https://api.github.com/repos/haampie/gitlab-status-issue-example/statuses/d08f36428b4f4ac3f7b52accb1c6848a0ddc6634",
    "state": "pending",
    "description": "Pipeline pending on GitLab",
    "target_url": "https://gitlab.com/harmen-cscs/gitlab-status-issue-example/pipelines/142933743",
    "context": "ci/gitlab/gitlab.com",
    "created_at": "2020-05-05T19:01:26Z",
  }
]

where both the parent and child pipelines are visible, but since they both have "context": "ci/gitlab/gitlab.com", Github chooses to only show the latest result (= failing child pipeline).

What is the current bug behavior?

Github shows the status of the latest child pipeline, but fails to show the status of the parent pipeline (because it is overwritten under the same context):

Screenshot_from_2020-05-05_21-05-08

What is the expected correct behavior?

The expected behaviour is to show all pipelines (parent and children) as separate contexts.

Possible fixes

For the main pipeline use context: ci/gitlab/gitlab.com as currently is the case.

For child pipelines use context: ci/gitlab/gitlab.com/child_pipeline_id such that it can be distinguished from the main pipeline on Github.

Edited by Jason Yavorsky