gitlab-org--gitlab-foss/app/models/concerns/project_api_compatibility.rb
Mathieu Parent e44167004d Add auto_devops_* to project API
The auto_devops object sometimes doesn't exists. We may need to create
it.
2019-07-03 16:18:05 +02:00

20 lines
547 B
Ruby

# frozen_string_literal: true
# Add methods used by the projects API
module ProjectAPICompatibility
extend ActiveSupport::Concern
def build_git_strategy=(value)
write_attribute(:build_allow_git_fetch, value == 'fetch')
end
def auto_devops_enabled=(value)
self.build_auto_devops if self.auto_devops&.enabled.nil?
self.auto_devops.update! enabled: value
end
def auto_devops_deploy_strategy=(value)
self.build_auto_devops if self.auto_devops&.enabled.nil?
self.auto_devops.update! deploy_strategy: value
end
end