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
include FindsProject
graphql_name 'CiCdSettingsUpdate'
authorize :admin_project
argument :full_path, GraphQL::ID_TYPE,
required: true,
description: 'Full Path of the project the settings belong to.'
argument :keep_latest_artifact, GraphQL::BOOLEAN_TYPE,
required: false,
description: 'Indicates if the latest artifact should be kept for this project.'
2021-09-04 01:27:46 +05:30
argument :job_token_scope_enabled, GraphQL::BOOLEAN_TYPE,
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,
description: 'The CI/CD settings after mutation.'
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')