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