diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-25 21:08:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-25 21:08:55 +0300 |
commit | 1e3f5ab634699e9d50779f05d2ae8dfc8a3ab9b3 (patch) | |
tree | c96727e136f4dc4fdbc1190895439d41e0b07fc5 /app/graphql/types | |
parent | ba8e92f7c9938d7dba333d2396cdd14bfa0de726 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/graphql/types')
-rw-r--r-- | app/graphql/types/ci/runner_type.rb | 6 | ||||
-rw-r--r-- | app/graphql/types/query_type.rb | 16 |
2 files changed, 22 insertions, 0 deletions
diff --git a/app/graphql/types/ci/runner_type.rb b/app/graphql/types/ci/runner_type.rb index 20e8b506a3f..6367847a5a5 100644 --- a/app/graphql/types/ci/runner_type.rb +++ b/app/graphql/types/ci/runner_type.rb @@ -158,6 +158,8 @@ module Types Gitlab::Routing.url_helpers.register_admin_runner_url(runner) when 'group_type' Gitlab::Routing.url_helpers.register_group_runner_url(runner.groups[0], runner) + when 'project_type' + Gitlab::Routing.url_helpers.register_project_runner_url(runner.projects[0], runner) end end @@ -212,6 +214,10 @@ module Types group = runner.groups[0] group && context[:current_user]&.can?(:register_group_runners, group) + when 'project_type' + project = runner.projects[0] + + project && context[:current_user]&.can?(:register_project_runners, project) end end end diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index fb906759ba4..20dce54d740 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -14,6 +14,13 @@ module Types null: true, description: 'CI related settings that apply to the entire instance.' field :ci_config, resolver: Resolvers::Ci::ConfigResolver, complexity: 126 # AUTHENTICATED_MAX_COMPLEXITY / 2 + 1 + + field :ci_pipeline_stage, ::Types::Ci::StageType, + null: true, description: 'Stage belonging to a CI pipeline.' do + argument :id, type: ::Types::GlobalIDType[::Ci::Stage], + required: true, description: 'Global ID of the CI stage.' + end + field :ci_variables, Types::Ci::InstanceVariableType.connection_type, null: true, @@ -202,6 +209,15 @@ module Types def query_complexity context.query end + + def ci_pipeline_stage(id:) + stage = ::Gitlab::Graphql::Lazy.force(GitlabSchema.find_by_gid(id)) + authorized = Ability.allowed?(current_user, :read_build, stage.project) + + return unless authorized + + stage + end end end |