summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2017-08-24 13:01:33 +0200
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2017-08-31 22:25:25 +0200
commit6ed490401f49a8941dc7a9e3757ec4012f14ef0b (patch)
tree058ba4c324208c486d2a8bd7326bcf0e292b32a7 /app/models/project.rb
parente58428382265f02639a7fc8c1bfcc6311564c0d0 (diff)
downloadgitlab-ce-6ed490401f49a8941dc7a9e3757ec4012f14ef0b.tar.gz
Implement the implied CI/CD config for AutoDevOps
Behind an application setting, which defaults to false, this commit implements the implied CI/CD config. Which means that in the case we can't find the `.gitlab-ci.yml` on the commit we want to start a pipeline for, we fall back to an implied configuration. For now the Bash template has been copied to `Auto-Devops.gitlab-ci.yml` so the tests actually work. Fixes #34777
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 5b4904a5c51..56ba2620687 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -186,6 +186,8 @@ class Project < ActiveRecord::Base
has_many :active_runners, -> { active }, through: :runner_projects, source: :runner, class_name: 'Ci::Runner'
+ has_one :auto_devops, class_name: 'ProjectAutoDevops'
+
accepts_nested_attributes_for :variables, allow_destroy: true
accepts_nested_attributes_for :project_feature
accepts_nested_attributes_for :import_data
@@ -464,6 +466,10 @@ class Project < ActiveRecord::Base
self[:lfs_enabled] && Gitlab.config.lfs.enabled
end
+ def auto_devops_enabled?
+ auto_devops&.enabled? || current_application_settings.auto_devops_enabled?
+ end
+
def repository_storage_path
Gitlab.config.repositories.storages[repository_storage]['path']
end