WIP: POC of Release data in GraphQL
What does this MR do?
Adds all data currently available in our Release API to our GraphQL endpoint.
For now, this MR is just a POC to get feedback and direction.
Tests
This MR does not yet contain tests.
API shape
The shape of the GraphQL response mimics the shape of our existing Release REST API.
Permissions
Permissions line up with the existing project-level Release permissions.
In particular, if the user only has Guest permissions, sources
will return []
and commit
will return null
. (See example response below.)
Feature flag
This new data is hidden behind a graphql_release_data
feature flag, which is disabled by default.
Example query/response
Query:
{
project(fullPath: "root/release-test") {
releases(first: 1) {
nodes {
name
tagName
tagPath
description
descriptionHtml
evidenceSha
createdAt
updatedAt
releasedAt
assets {
assetsCount
sources {
format
url
}
links {
id
name
url
external
}
evidenceFilePath
}
author {
name
username
}
commit {
sha
webUrl
}
milestones {
nodes {
title
}
}
}
}
}
}
Response:
{
"data": {
"project": {
"releases": {
"nodes": [
{
"name": "Version 16.5",
"tagName": "v16.5",
"tagPath": "/root/release-test/-/tags/v16.5",
"description": "This is a small update to version sixteen.\n\nAnd this is an edit!\n\nAnd this is an edit through the API!",
"descriptionHtml": "<p data-sourcepos=\"1:1-1:42\" dir=\"auto\">This is a small update to version sixteen.</p>
<p data-sourcepos=\"3:1-3:20\" dir=\"auto\">And this is an edit!</p>
<p data-sourcepos=\"5:1-5:36\" dir=\"auto\">And this is an edit through the API!</p>",
"evidenceSha": "08f63709250846dc29b9108bcbc90cd3dcecbc9ce02d",
"createdAt": "2019-11-21T18:45:49Z",
"updatedAt": "2020-03-11T15:54:44Z",
"releasedAt": "2020-06-21T18:45:49Z",
"assets": {
"assetsCount": 5,
"sources": [
{
"format": "zip",
"url": "http://0.0.0.0:3001/root/release-test/-/archive/v16.5/release-test-v16.5.zip"
},
{
"format": "tar.gz",
"url": "http://0.0.0.0:3001/root/release-test/-/archive/v16.5/release-test-v16.5.tar.gz"
},
{
"format": "tar.bz2",
"url": "http://0.0.0.0:3001/root/release-test/-/archive/v16.5/release-test-v16.5.tar.bz2"
},
{
"format": "tar",
"url": "http://0.0.0.0:3001/root/release-test/-/archive/v16.5/release-test-v16.5.tar"
}
],
"links": [
{
"id": "gid://gitlab/Releases::Link/7",
"name": "Blog post",
"url": "https://google.com",
"external": true
}
],
"evidenceFilePath": "http://0.0.0.0:3001/root/release-test/-/releases/v16.5/evidence.json"
},
"author": {
"name": "Nathan Friend",
"username": "root"
},
"commit": {
"sha": "87fdf474c9e453a8e9ece1353fe7ff915b1e9ccd",
"webUrl": "http://0.0.0.0:3001/root/release-test/-/commit/87fdf474c9e453a8e9ece1353fe7ff915b1e9ccd"
},
"milestones": {
"nodes": [
{
"title": "13.20"
}
]
}
}
]
}
}
}
}
Related to: #208702 (closed), #208724 (closed)
Edited by Nathan Friend