diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-12 03:08:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-12 03:08:51 +0300 |
commit | 92ab5f89fe0935677ca8b0c78099228f1da192ac (patch) | |
tree | 4b0afa1911e9d1aaefad658f4fbc8e504f20d5c5 /app/graphql/types | |
parent | d5012fff67191be53070d024a89195a666a581ed (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/graphql/types')
-rw-r--r-- | app/graphql/types/ci/job_trace_type.rb | 19 | ||||
-rw-r--r-- | app/graphql/types/ci/job_type.rb | 6 |
2 files changed, 25 insertions, 0 deletions
diff --git a/app/graphql/types/ci/job_trace_type.rb b/app/graphql/types/ci/job_trace_type.rb new file mode 100644 index 00000000000..a68e26106b8 --- /dev/null +++ b/app/graphql/types/ci/job_trace_type.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# rubocop: disable Graphql/AuthorizeTypes +module Types + module Ci + class JobTraceType < BaseObject + graphql_name 'CiJobTrace' + + field :html_summary, GraphQL::Types::String, null: false, + alpha: { milestone: '15.11' }, # As we want the option to change from 10 if needed + description: "HTML summary containing the last 10 lines of the trace." + + def html_summary + object.html(last_lines: 10).html_safe + end + end + end +end +# rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/ci/job_type.rb b/app/graphql/types/ci/job_type.rb index 61f2d0cdb51..1d12c296b2e 100644 --- a/app/graphql/types/ci/job_type.rb +++ b/app/graphql/types/ci/job_type.rb @@ -101,6 +101,8 @@ module Types description: 'Short SHA1 ID of the commit.' field :stuck, GraphQL::Types::Boolean, null: false, method: :stuck?, description: 'Indicates the job is stuck.' + field :trace, Types::Ci::JobTraceType, null: true, + description: 'Trace generated by the job.' field :triggered, GraphQL::Types::Boolean, null: true, description: 'Whether the job was triggered.' field :web_path, GraphQL::Types::String, null: true, @@ -144,6 +146,10 @@ module Types end end + def trace + object.trace if object.has_trace? + end + def previous_stage_jobs_or_needs if object.scheduling_type == 'stage' Gitlab::Graphql::Lazy.with_value(previous_stage_jobs) do |jobs| |