debian-mirror-gitlab/app/graphql/mutations/ci/ci_cd_settings_update.rb

44 lines
1.2 KiB
Ruby
Raw Normal View History

2021-03-08 18:12:59 +05:30
# frozen_string_literal: true
module Mutations
module Ci
class CiCdSettingsUpdate < BaseMutation
graphql_name 'CiCdSettingsUpdate'
2022-04-04 11:22:00 +05:30
include FindsProject
2021-03-08 18:12:59 +05:30
authorize :admin_project
2021-10-27 15:23:28 +05:30
argument :full_path, GraphQL::Types::ID,
2021-03-08 18:12:59 +05:30
required: true,
description: 'Full Path of the project the settings belong to.'
2021-10-27 15:23:28 +05:30
argument :keep_latest_artifact, GraphQL::Types::Boolean,
2021-03-08 18:12:59 +05:30
required: false,
description: 'Indicates if the latest artifact should be kept for this project.'
2021-10-27 15:23:28 +05:30
argument :job_token_scope_enabled, GraphQL::Types::Boolean,
2021-09-04 01:27:46 +05:30
required: false,
description: 'Indicates CI job tokens generated in this project have restricted access to resources.'
2021-04-29 21:17:54 +05:30
field :ci_cd_settings,
Types::Ci::CiCdSettingType,
null: false,
2021-10-27 15:23:28 +05:30
description: 'CI/CD settings after mutation.'
2021-04-29 21:17:54 +05:30
2021-03-08 18:12:59 +05:30
def resolve(full_path:, **args)
project = authorized_find!(full_path)
settings = project.ci_cd_settings
settings.update(args)
2021-04-29 21:17:54 +05:30
{
ci_cd_settings: settings,
errors: errors_on_object(settings)
}
2021-03-08 18:12:59 +05:30
end
end
end
end
2021-04-29 21:17:54 +05:30
2021-06-08 01:23:25 +05:30
Mutations::Ci::CiCdSettingsUpdate.prepend_mod_with('Mutations::Ci::CiCdSettingsUpdate')