summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMathieu Parent <math.parent@gmail.com>2019-05-15 16:27:54 +0200
committerMathieu Parent <math.parent@gmail.com>2019-07-03 16:18:05 +0200
commite44167004dd44cf727829d0fc9df59fe3404bb49 (patch)
treecdc94639756dc8cfbb996bd84c26540205a75ae9 /lib
parent5028f5d73d8fa69f72ac8d2b1cc493d82cf6f3e4 (diff)
downloadgitlab-ce-e44167004dd44cf727829d0fc9df59fe3404bb49.tar.gz
Add auto_devops_* to project API
The auto_devops object sometimes doesn't exists. We may need to create it.
Diffstat (limited to 'lib')
-rw-r--r--lib/api/entities.rb4
-rw-r--r--lib/api/helpers/projects_helpers.rb4
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index c6c7023042f..7bf66589616 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -294,6 +294,10 @@ module API
options[:statistics] && Ability.allowed?(options[:current_user], :read_statistics, project)
}
expose :external_authorization_classification_label
+ expose :auto_devops_enabled?, as: :auto_devops_enabled
+ expose :auto_devops_deploy_strategy do |project, options|
+ project.auto_devops.nil? ? 'continuous' : project.auto_devops.deploy_strategy
+ end
# rubocop: disable CodeReuse/ActiveRecord
def self.preload_relation(projects_relation, options = {})
diff --git a/lib/api/helpers/projects_helpers.rb b/lib/api/helpers/projects_helpers.rb
index 390c694e21b..0e21a7a66fd 100644
--- a/lib/api/helpers/projects_helpers.rb
+++ b/lib/api/helpers/projects_helpers.rb
@@ -44,6 +44,8 @@ module API
optional :initialize_with_readme, type: Boolean, desc: "Initialize a project with a README.md"
optional :external_authorization_classification_label, type: String, desc: 'The classification label for the project'
optional :ci_default_git_depth, type: Integer, desc: 'Default number of revisions for shallow cloning'
+ optional :auto_devops_enabled, type: Boolean, desc: 'Flag indication if Auto DevOps is enabled'
+ optional :auto_devops_deploy_strategy, type: String, values: %w(continuous manual timed_incremental), desc: 'Auto Deploy strategy'
end
params :optional_project_params_ee do
@@ -62,6 +64,8 @@ module API
def self.update_params_at_least_one_of
[
+ :auto_devops_enabled,
+ :auto_devops_deploy_strategy,
:auto_cancel_pending_pipelines,
:build_coverage_regex,
:build_git_strategy,