Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
bddb425e
Commit
bddb425e
authored
Sep 02, 2020
by
Nathan Friend
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add release direct_asset_url to GraphQL
This commit adds the release direct_asset_url field to GraphQL.
parent
4fe0a254
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
44 additions
and
5 deletions
+44
-5
app/graphql/types/release_asset_link_type.rb
app/graphql/types/release_asset_link_type.rb
+12
-0
changelogs/unreleased/nfriend-add-direct-asset-url-to-graphql.yml
...gs/unreleased/nfriend-add-direct-asset-url-to-graphql.yml
+5
-0
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+5
-0
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+14
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+1
-0
spec/graphql/types/release_asset_link_type_spec.rb
spec/graphql/types/release_asset_link_type_spec.rb
+1
-1
spec/requests/api/graphql/project/release_spec.rb
spec/requests/api/graphql/project/release_spec.rb
+6
-4
No files found.
app/graphql/types/release_asset_link_type.rb
View file @
bddb425e
...
@@ -17,5 +17,17 @@ module Types
...
@@ -17,5 +17,17 @@ module Types
description:
'Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`'
description:
'Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`'
field
:external
,
GraphQL
::
BOOLEAN_TYPE
,
null:
true
,
method: :external?
,
field
:external
,
GraphQL
::
BOOLEAN_TYPE
,
null:
true
,
method: :external?
,
description:
'Indicates the link points to an external resource'
description:
'Indicates the link points to an external resource'
field
:direct_asset_url
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Direct asset URL of the link'
def
direct_asset_url
return
object
.
url
unless
object
.
filepath
release
=
object
.
release
project
=
release
.
project
Gitlab
::
Routing
.
url_helpers
.
project_release_url
(
project
,
release
)
<<
object
.
filepath
end
end
end
end
end
changelogs/unreleased/nfriend-add-direct-asset-url-to-graphql.yml
0 → 100644
View file @
bddb425e
---
title
:
Add release direct asset link info to GraphQL endpoint
merge_request
:
41170
author
:
type
:
added
doc/api/graphql/reference/gitlab_schema.graphql
View file @
bddb425e
...
@@ -13351,6 +13351,11 @@ type Release {
...
@@ -13351,6 +13351,11 @@ type Release {
Represents an asset link associated with a release
Represents an asset link associated with a release
"""
"""
type
ReleaseAssetLink
{
type
ReleaseAssetLink
{
"""
Direct
asset
URL
of
the
link
"""
directAssetUrl
:
String
"""
"""
Indicates
the
link
points
to
an
external
resource
Indicates
the
link
points
to
an
external
resource
"""
"""
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
bddb425e
...
@@ -39075,6 +39075,20 @@
...
@@ -39075,6 +39075,20 @@
"name": "ReleaseAssetLink",
"name": "ReleaseAssetLink",
"description": "Represents an asset link associated with a release",
"description": "Represents an asset link associated with a release",
"fields": [
"fields": [
{
"name": "directAssetUrl",
"description": "Direct asset URL of the link",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
{
"name": "external",
"name": "external",
"description": "Indicates the link points to an external resource",
"description": "Indicates the link points to an external resource",
doc/api/graphql/reference/index.md
View file @
bddb425e
...
@@ -1883,6 +1883,7 @@ Represents an asset link associated with a release
...
@@ -1883,6 +1883,7 @@ Represents an asset link associated with a release
| Name | Type | Description |
| Name | Type | Description |
| --- | ---- | ---------- |
| --- | ---- | ---------- |
|
`directAssetUrl`
| String | Direct asset URL of the link |
|
`external`
| Boolean | Indicates the link points to an external resource |
|
`external`
| Boolean | Indicates the link points to an external resource |
|
`id`
| ID! | ID of the link |
|
`id`
| ID! | ID of the link |
|
`linkType`
| ReleaseAssetLinkType | Type of the link:
`other`
,
`runbook`
,
`image`
,
`package`
; defaults to
`other`
|
|
`linkType`
| ReleaseAssetLinkType | Type of the link:
`other`
,
`runbook`
,
`image`
,
`package`
; defaults to
`other`
|
...
...
spec/graphql/types/release_asset_link_type_spec.rb
View file @
bddb425e
...
@@ -7,7 +7,7 @@ RSpec.describe GitlabSchema.types['ReleaseAssetLink'] do
...
@@ -7,7 +7,7 @@ RSpec.describe GitlabSchema.types['ReleaseAssetLink'] do
it
'has the expected fields'
do
it
'has the expected fields'
do
expected_fields
=
%w[
expected_fields
=
%w[
id name url external link_type
id name url external link_type
direct_asset_url
]
]
expect
(
described_class
).
to
include_graphql_fields
(
*
expected_fields
)
expect
(
described_class
).
to
include_graphql_fields
(
*
expected_fields
)
...
...
spec/requests/api/graphql/project/release_spec.rb
View file @
bddb425e
...
@@ -10,6 +10,7 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do
...
@@ -10,6 +10,7 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do
let_it_be
(
:guest
)
{
create
(
:user
)
}
let_it_be
(
:guest
)
{
create
(
:user
)
}
let_it_be
(
:reporter
)
{
create
(
:user
)
}
let_it_be
(
:reporter
)
{
create
(
:user
)
}
let_it_be
(
:stranger
)
{
create
(
:user
)
}
let_it_be
(
:stranger
)
{
create
(
:user
)
}
let_it_be
(
:link_filepath
)
{
'/direct/asset/link/path'
}
let
(
:params_for_issues_and_mrs
)
{
{
scope:
'all'
,
state:
'opened'
,
release_tag:
release
.
tag
}
}
let
(
:params_for_issues_and_mrs
)
{
{
scope:
'all'
,
state:
'opened'
,
release_tag:
release
.
tag
}
}
let
(
:post_query
)
{
post_graphql
(
query
,
current_user:
current_user
)
}
let
(
:post_query
)
{
post_graphql
(
query
,
current_user:
current_user
)
}
...
@@ -127,7 +128,7 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do
...
@@ -127,7 +128,7 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do
let
(
:release_fields
)
do
let
(
:release_fields
)
do
query_graphql_field
(
:assets
,
nil
,
query_graphql_field
(
:assets
,
nil
,
query_graphql_field
(
:links
,
nil
,
'nodes { id name url external }'
))
query_graphql_field
(
:links
,
nil
,
'nodes { id name url external
, directAssetUrl
}'
))
end
end
it
'finds all release links'
do
it
'finds all release links'
do
...
@@ -138,7 +139,8 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do
...
@@ -138,7 +139,8 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do
'id'
=>
global_id_of
(
link
),
'id'
=>
global_id_of
(
link
),
'name'
=>
link
.
name
,
'name'
=>
link
.
name
,
'url'
=>
link
.
url
,
'url'
=>
link
.
url
,
'external'
=>
link
.
external?
'external'
=>
link
.
external?
,
'directAssetUrl'
=>
link
.
filepath
?
Gitlab
::
Routing
.
url_helpers
.
project_release_url
(
project
,
release
)
<<
link
.
filepath
:
link
.
url
}
}
end
end
...
@@ -270,7 +272,7 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do
...
@@ -270,7 +272,7 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do
let_it_be
(
:milestone_2
)
{
create
(
:milestone
,
project:
project
)
}
let_it_be
(
:milestone_2
)
{
create
(
:milestone
,
project:
project
)
}
let_it_be
(
:release
)
{
create
(
:release
,
:with_evidence
,
project:
project
,
milestones:
[
milestone_1
,
milestone_2
])
}
let_it_be
(
:release
)
{
create
(
:release
,
:with_evidence
,
project:
project
,
milestones:
[
milestone_1
,
milestone_2
])
}
let_it_be
(
:release_link_1
)
{
create
(
:release_link
,
release:
release
)
}
let_it_be
(
:release_link_1
)
{
create
(
:release_link
,
release:
release
)
}
let_it_be
(
:release_link_2
)
{
create
(
:release_link
,
release:
release
)
}
let_it_be
(
:release_link_2
)
{
create
(
:release_link
,
release:
release
,
filepath:
link_filepath
)
}
before_all
do
before_all
do
project
.
add_developer
(
developer
)
project
.
add_developer
(
developer
)
...
@@ -311,7 +313,7 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do
...
@@ -311,7 +313,7 @@ RSpec.describe 'Query.project(fullPath).release(tagName)' do
let_it_be
(
:milestone_2
)
{
create
(
:milestone
,
project:
project
)
}
let_it_be
(
:milestone_2
)
{
create
(
:milestone
,
project:
project
)
}
let_it_be
(
:release
)
{
create
(
:release
,
:with_evidence
,
project:
project
,
milestones:
[
milestone_1
,
milestone_2
])
}
let_it_be
(
:release
)
{
create
(
:release
,
:with_evidence
,
project:
project
,
milestones:
[
milestone_1
,
milestone_2
])
}
let_it_be
(
:release_link_1
)
{
create
(
:release_link
,
release:
release
)
}
let_it_be
(
:release_link_1
)
{
create
(
:release_link
,
release:
release
)
}
let_it_be
(
:release_link_2
)
{
create
(
:release_link
,
release:
release
)
}
let_it_be
(
:release_link_2
)
{
create
(
:release_link
,
release:
release
,
filepath:
link_filepath
)
}
before_all
do
before_all
do
project
.
add_developer
(
developer
)
project
.
add_developer
(
developer
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment