Skip to content

Commit

Permalink
Add latest changes from gitlab-org/gitlab@master
Browse files Browse the repository at this point in the history
  • Loading branch information
GitLab Bot committed Nov 25, 2020
1 parent 4fc6f62 commit af9ff2b
Show file tree
Hide file tree
Showing 13 changed files with 737 additions and 36 deletions.
13 changes: 13 additions & 0 deletions app/graphql/types/ci/job_artifact_file_type_enum.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Types
module Ci
class JobArtifactFileTypeEnum < BaseEnum
graphql_name 'JobArtifactFileType'

::Ci::JobArtifact::TYPE_AND_FORMAT_PAIRS.keys.each do |file_type|
value file_type.to_s.upcase, value: file_type.to_s
end
end
end
end
24 changes: 24 additions & 0 deletions app/graphql/types/ci/job_artifact_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

module Types
module Ci
# rubocop: disable Graphql/AuthorizeTypes
class JobArtifactType < BaseObject
graphql_name 'CiJobArtifact'

field :download_path, GraphQL::STRING_TYPE, null: true,
description: "URL for downloading the artifact's file"

field :file_type, ::Types::Ci::JobArtifactFileTypeEnum, null: true,
description: 'File type of the artifact'

def download_path
::Gitlab::Routing.url_helpers.download_project_job_artifacts_path(
object.project,
object.job,
file_type: object.file_type
)
end
end
end
end
13 changes: 13 additions & 0 deletions app/graphql/types/ci/job_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,28 @@ class JobType < BaseObject
field :pipeline, Types::Ci::PipelineType, null: false,
description: 'Pipeline the job belongs to',
resolve: -> (build, _, _) { Gitlab::Graphql::Loaders::BatchModelLoader.new(::Ci::Pipeline, build.pipeline_id).find }

field :name, GraphQL::STRING_TYPE, null: true,
description: 'Name of the job'

field :needs, JobType.connection_type, null: true,
description: 'Builds that must complete before the jobs run'

field :detailed_status, Types::Ci::DetailedStatusType, null: true,
description: 'Detailed status of the job',
resolve: -> (obj, _args, ctx) { obj.detailed_status(ctx[:current_user]) }

field :scheduled_at, Types::TimeType, null: true,
description: 'Schedule for the build'

field :artifacts, Types::Ci::JobArtifactType.connection_type, null: true,
description: 'Artifacts generated by the job'

def artifacts
if object.is_a?(::Ci::Build)
object.job_artifacts
end
end
end
end
end
5 changes: 5 additions & 0 deletions changelogs/unreleased/251015-artifact-download.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Add artifacts field to JobType
merge_request: 48207
author:
type: added
102 changes: 102 additions & 0 deletions doc/api/graphql/reference/gitlab_schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2315,6 +2315,31 @@ type CiGroupEdge {
}

type CiJob {
"""
Artifacts generated by the job
"""
artifacts(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String

"""
Returns the elements in the list that come before the specified cursor.
"""
before: String

"""
Returns the first _n_ elements from the list.
"""
first: Int

"""
Returns the last _n_ elements from the list.
"""
last: Int
): CiJobArtifactConnection

"""
Detailed status of the job
"""
Expand Down Expand Up @@ -2361,6 +2386,53 @@ type CiJob {
scheduledAt: Time
}

type CiJobArtifact {
"""
URL for downloading the artifact's file
"""
downloadPath: String

"""
File type of the artifact
"""
fileType: JobArtifactFileType
}

"""
The connection type for CiJobArtifact.
"""
type CiJobArtifactConnection {
"""
A list of edges.
"""
edges: [CiJobArtifactEdge]

"""
A list of nodes.
"""
nodes: [CiJobArtifact]

"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
}

"""
An edge in a connection.
"""
type CiJobArtifactEdge {
"""
A cursor for use in pagination.
"""
cursor: String!

"""
The item at the end of the edge.
"""
node: CiJobArtifact
}

"""
The connection type for CiJob.
"""
Expand Down Expand Up @@ -12038,6 +12110,36 @@ input JiraUsersMappingInputType {
jiraAccountId: String!
}

enum JobArtifactFileType {
ACCESSIBILITY
API_FUZZING
ARCHIVE
BROWSER_PERFORMANCE
CLUSTER_APPLICATIONS
COBERTURA
CODEQUALITY
CONTAINER_SCANNING
COVERAGE_FUZZING
DAST
DEPENDENCY_SCANNING
DOTENV
JUNIT
LICENSE_MANAGEMENT
LICENSE_SCANNING
LOAD_PERFORMANCE
LSIF
METADATA
METRICS
METRICS_REFEREE
NETWORK_REFEREE
PERFORMANCE
REQUIREMENTS
SAST
SECRET_DETECTION
TERRAFORM
TRACE
}

type Label {
"""
Background color of the label
Expand Down
Loading

0 comments on commit af9ff2b

Please sign in to comment.