Skip to content
代码片段 群组 项目
提交 18f264a7 编辑于 作者: Lee Tickett's avatar Lee Tickett 提交者: Savas Vedova
浏览文件

Add id, size and expiry to GraphQL Job Artifact

Changelog: added
上级 9a87cca4
No related branches found
No related tags found
无相关合并请求
......@@ -12,6 +12,7 @@ query getJobs($fullPath: ID!, $after: String, $first: Int = 30, $statuses: [CiJo
nodes {
artifacts {
nodes {
id
downloadPath
fileType
}
......
......@@ -12,6 +12,7 @@ query getPipelineJobs($fullPath: ID!, $iid: ID!, $after: String) {
nodes {
artifacts {
nodes {
id
downloadPath
fileType
}
......
......@@ -6,6 +6,7 @@ fragment JobArtifacts on Pipeline {
name
artifacts {
nodes {
id
downloadPath
fileType
}
......
......@@ -15,6 +15,7 @@ query securityReportDownloadPaths(
name
artifacts {
nodes {
id
downloadPath
fileType
}
......
......@@ -6,6 +6,9 @@ module Ci
class JobArtifactType < BaseObject
graphql_name 'CiJobArtifact'
field :id, Types::GlobalIDType[::Ci::JobArtifact], null: false,
description: 'ID of the artifact.'
field :download_path, GraphQL::Types::String, null: true,
description: "URL for downloading the artifact's file."
......@@ -16,6 +19,12 @@ class JobArtifactType < BaseObject
description: 'File name of the artifact.',
method: :filename
field :size, GraphQL::Types::Int, null: false,
description: 'Size of the artifact in bytes.'
field :expire_at, Types::TimeType, null: true,
description: 'Expiry date of the artifact.'
def download_path
::Gitlab::Routing.url_helpers.download_project_job_artifacts_path(
object.project,
......
......@@ -10245,8 +10245,11 @@ CI/CD variables for a GitLab instance.
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="cijobartifactdownloadpath"></a>`downloadPath` | [`String`](#string) | URL for downloading the artifact's file. |
| <a id="cijobartifactexpireat"></a>`expireAt` | [`Time`](#time) | Expiry date of the artifact. |
| <a id="cijobartifactfiletype"></a>`fileType` | [`JobArtifactFileType`](#jobartifactfiletype) | File type of the artifact. |
| <a id="cijobartifactid"></a>`id` | [`CiJobArtifactID!`](#cijobartifactid) | ID of the artifact. |
| <a id="cijobartifactname"></a>`name` | [`String`](#string) | File name of the artifact. |
| <a id="cijobartifactsize"></a>`size` | [`Int!`](#int) | Size of the artifact in bytes. |
 
### `CiJobTokenScopeType`
 
......@@ -21246,6 +21249,12 @@ A `CiBuildID` is a global ID. It is encoded as a string.
 
An example `CiBuildID` is: `"gid://gitlab/Ci::Build/1"`.
 
### `CiJobArtifactID`
A `CiJobArtifactID` is a global ID. It is encoded as a string.
An example `CiJobArtifactID` is: `"gid://gitlab/Ci::JobArtifact/1"`.
### `CiPipelineID`
 
A `CiPipelineID` is a global ID. It is encoded as a string.
......@@ -528,6 +528,7 @@ export const mockPipelineJobsQueryResponse = {
artifacts: {
nodes: [
{
id: 'gid://gitlab/Ci::JobArtifact/101',
downloadPath: '/root/ci-project/-/jobs/620/artifacts/download?file_type=trace',
fileType: 'TRACE',
__typename: 'CiJobArtifact',
......@@ -580,6 +581,7 @@ export const mockPipelineJobsQueryResponse = {
artifacts: {
nodes: [
{
id: 'gid://gitlab/Ci::JobArtifact/102',
downloadPath: '/root/ci-project/-/jobs/619/artifacts/download?file_type=trace',
fileType: 'TRACE',
__typename: 'CiJobArtifact',
......
......@@ -356,12 +356,14 @@ export const securityReportMergeRequestDownloadPathsQueryResponse = {
artifacts: {
nodes: [
{
id: 'gid://gitlab/Ci::JobArtifact/101',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1399/artifacts/download?file_type=trace',
fileType: 'TRACE',
__typename: 'CiJobArtifact',
},
{
id: 'gid://gitlab/Ci::JobArtifact/102',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1399/artifacts/download?file_type=secret_detection',
fileType: 'SECRET_DETECTION',
......@@ -378,12 +380,14 @@ export const securityReportMergeRequestDownloadPathsQueryResponse = {
artifacts: {
nodes: [
{
id: 'gid://gitlab/Ci::JobArtifact/103',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1400/artifacts/download?file_type=trace',
fileType: 'TRACE',
__typename: 'CiJobArtifact',
},
{
id: 'gid://gitlab/Ci::JobArtifact/104',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1400/artifacts/download?file_type=sast',
fileType: 'SAST',
......@@ -400,12 +404,14 @@ export const securityReportMergeRequestDownloadPathsQueryResponse = {
artifacts: {
nodes: [
{
id: 'gid://gitlab/Ci::JobArtifact/105',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1401/artifacts/download?file_type=trace',
fileType: 'TRACE',
__typename: 'CiJobArtifact',
},
{
id: 'gid://gitlab/Ci::JobArtifact/106',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1401/artifacts/download?file_type=sast',
fileType: 'SAST',
......@@ -422,18 +428,21 @@ export const securityReportMergeRequestDownloadPathsQueryResponse = {
artifacts: {
nodes: [
{
id: 'gid://gitlab/Ci::JobArtifact/107',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1402/artifacts/download?file_type=archive',
fileType: 'ARCHIVE',
__typename: 'CiJobArtifact',
},
{
id: 'gid://gitlab/Ci::JobArtifact/108',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1402/artifacts/download?file_type=trace',
fileType: 'TRACE',
__typename: 'CiJobArtifact',
},
{
id: 'gid://gitlab/Ci::JobArtifact/109',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1402/artifacts/download?file_type=metadata',
fileType: 'METADATA',
......@@ -468,12 +477,14 @@ export const securityReportPipelineDownloadPathsQueryResponse = {
artifacts: {
nodes: [
{
id: 'gid://gitlab/Ci::JobArtifact/110',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1399/artifacts/download?file_type=trace',
fileType: 'TRACE',
__typename: 'CiJobArtifact',
},
{
id: 'gid://gitlab/Ci::JobArtifact/111',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1399/artifacts/download?file_type=secret_detection',
fileType: 'SECRET_DETECTION',
......@@ -490,12 +501,14 @@ export const securityReportPipelineDownloadPathsQueryResponse = {
artifacts: {
nodes: [
{
id: 'gid://gitlab/Ci::JobArtifact/112',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1400/artifacts/download?file_type=trace',
fileType: 'TRACE',
__typename: 'CiJobArtifact',
},
{
id: 'gid://gitlab/Ci::JobArtifact/113',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1400/artifacts/download?file_type=sast',
fileType: 'SAST',
......@@ -512,12 +525,14 @@ export const securityReportPipelineDownloadPathsQueryResponse = {
artifacts: {
nodes: [
{
id: 'gid://gitlab/Ci::JobArtifact/114',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1401/artifacts/download?file_type=trace',
fileType: 'TRACE',
__typename: 'CiJobArtifact',
},
{
id: 'gid://gitlab/Ci::JobArtifact/115',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1401/artifacts/download?file_type=sast',
fileType: 'SAST',
......@@ -534,18 +549,21 @@ export const securityReportPipelineDownloadPathsQueryResponse = {
artifacts: {
nodes: [
{
id: 'gid://gitlab/Ci::JobArtifact/116',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1402/artifacts/download?file_type=archive',
fileType: 'ARCHIVE',
__typename: 'CiJobArtifact',
},
{
id: 'gid://gitlab/Ci::JobArtifact/117',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1402/artifacts/download?file_type=trace',
fileType: 'TRACE',
__typename: 'CiJobArtifact',
},
{
id: 'gid://gitlab/Ci::JobArtifact/118',
downloadPath:
'/gitlab-org/secrets-detection-test/-/jobs/1402/artifacts/download?file_type=metadata',
fileType: 'METADATA',
......
......@@ -4,7 +4,7 @@
RSpec.describe GitlabSchema.types['CiJobArtifact'] do
it 'has the correct fields' do
expected_fields = [:download_path, :file_type, :name]
expected_fields = [:id, :download_path, :file_type, :name, :size, :expire_at]
expect(described_class).to have_graphql_fields(*expected_fields)
end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册