Skip to content

Log GitHub Commit Status API responses

What does this MR do and why?

A recurring support question is around GitHub external pull request pipeline status intermittently not receiving completion updates despite no errors logged within GitLab.com Kibana.

It becomes difficult to answer with certainty if GitLab sent the event to GitHub at the completion of the pipeline, or about the ordering of updates sent to it.

This change adds a log every time we make a Commit Status API call to GitHub REST endpoints and adds parameters to the log to help answer the questions above and also make it easier to find results when searching for a pipeline.

Example customer support ticket: https://gitlab.zendesk.com/agent/tickets/281014

Screenshots or screen recordings

Click to expand example `integrations.log` entry

{
    "severity": "INFO",
    "time": "2022-05-20T09:04:21.759Z",
    "correlation_id": "01G3GBBTN3P2QPJJ3PSJ86E4HM",
    "service_class": "Integrations::Github",
    "project_id": 476,
    "project_path": "user1/external-ci-cd-test",
    "message": "GitHub Commit Status update API call succeeded",
    "github_response": {
        "url": "https://api.github.com/repos/users-/external-ci-cd-test/statuses/bc200c02ebd76b019aea4da327d5beba0e92b6d0",
        "id": 17498561745,
        "node_id": "SC_kwDOFUcTM88AAAAEEv7c0Q",
        "state": "success",
        "description": "Pipeline passed on GitLab",
        "target_url": "https://gitlab.users.io/user1/external-ci-cd-test/-/pipelines/2413",
        "context": "ci/gitlab/gitlab.users.io",
        "created_at": "2022-05-20T09:04:21.000Z",
        "updated_at": "2022-05-20T09:04:21.000Z"
    },
    "github_response_status": 201,
    "pipeline_id": 2413,
    "pipeline_status": "success"
}

How to set up and validate locally

  1. Stand up a publicly accessible instance (to allow GitHub to send us REST API calls requesting pipeline execution for pull requests)
  2. Follow GitHub personal access token based instructions at https://docs.gitlab.com/ee/ci/ci_cd_for_external_repos/github_integration.html to setup project with external pull request pipeline support
  3. Add pipeline config in GitHub on a new branch, and create a merge request
  4. Await arrival of changes on GitLab and the completion of pipeline for external pull requests
  5. Check Sidekiq log of GitLab instance for newly introduced log entries

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Harsh Chouraria

Merge request reports