Skip to content

Add browseArtifactsPath to GraphQL CiJob

Miranda Fluharty requested to merge 33418-artifacts-view-browse-path into master

What does this MR do and why?

This MR adds a browseArtifactsPath to the GraphQL CiJob type so we can use it in the artifacts management page to link from a job to page where the user can browse the job's artifacts.

Screenshots or screen recordings

Screen_Shot_2022-09-29_at_18.58.40

How to set up and validate locally

  1. run a pipeline in a project that generates artifacts
use this CI yaml to generate some sample artifacts
# .gitlab-ci.yml

potato:
  stage: build
  script:
    - echo 'potato' >> potato.txt
  artifacts:
    expose_as: 'potato'
    paths: ['potato.txt']

tomato:
  stage: build
  script:
    - echo 'tomato' >> tomato.txt
  artifacts:
    expose_as: 'tomato'
    paths: ['tomato.txt']

pineapple:
  stage: build
  script:
    - echo 'pineapple' >> pineapple.txt
  artifacts:
    expose_as: 'pineapple'
    paths: ['pineapple.txt']

apple:
  stage: build
  script:
    - echo 'apple' >> apple.txt
  artifacts:
    expose_as: 'apple'
    paths: ['apple.txt']

toblerone:
  stage: build
  script:
    - echo 'toblerone' >> toblerone.txt
  artifacts:
    expose_as: 'toblerone'
    paths: ['toblerone.txt']
  1. git checkout 33418-artifacts-view-browse-path
  2. use GraphiQL (http://gdk.test:3000/-/graphql-explorer) to query for job artifacts:
query getJobArtifacts {
  project(fullPath: "path/to/project") {
    jobs(statuses: [SUCCESS, FAILED]) {
       nodes {
        __typename
        id
        artifactsBrowsePath
      }
    }
  }
}
  1. check that the browseArtifactsPath for each job looks something like /path/to/project/project-name/-/jobs/123/artifacts/browse

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 #33418 (closed)

Edited by Miranda Fluharty

Merge request reports