Skip to content

GraphQL: Create `project` property in `CiJob` type

What does this MR do and why?

Describe in detail what your merge request does and why.

This MR adds the field projects to the CiJob type. This prevents the unnecessary of the pipeline object (since previously projects were access through job.pipeline.project).

Screenshots or screen recordings

The Graphql Explorer shows the new field project on the CiJob type: graphql_explorer with new field

How to set up and validate locally

  1. Use rake task to setup runners
    bin/rake gitlab:seed:runner_fleet
  2. Navigate to the CI/CD jobs page
    http://gdk.test:3000/admin/jobs
  3. Visit any runner from the jobs list by clicking on the runner name in the Runner column
  4. Click the Jobs tab. You should be on a page with an address similar to:
    http://gdk.test:3000/admin/runners/41#/jobs
  5. Click on a project link in the table. You should be taken to the project page.
  6. Alternatively, visit http://gdk.test:3000/-/graphql-explorer and run this query:
query getRunnerJobs($id: CiRunnerID!) {
  runner(id: $id) {
    id
    projectCount
    jobs {
      nodes {
        id
        detailedStatus {
          id
          detailsPath
          group
          icon
          text
          __typename
        }
        project {
          id
          name
          webUrl
          __typename
        }
        shortSha
        commitPath
        finishedAt
        duration
        queuedDuration
        tags
        __typename
      }
      __typename
    }
  }
}

Variables

{
  "id": "gid://gitlab/Ci::Runner/4"
}

MR acceptance checklist

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

related to: #385851 (closed)

Edited by Tymm Schmitke

Merge request reports

Loading