2017-09-05 09:39:19 -04:00
|
|
|
module AutoDevopsHelper
|
2017-09-05 07:35:31 -04:00
|
|
|
def show_auto_devops_callout?(project)
|
2017-09-12 08:00:50 -04:00
|
|
|
Feature.get(:auto_devops_banner_disabled).off? &&
|
|
|
|
show_callout?('auto_devops_settings_dismissed') &&
|
2017-09-07 07:23:05 -04:00
|
|
|
can?(current_user, :admin_pipeline, project) &&
|
2017-09-12 03:21:47 -04:00
|
|
|
project.has_auto_devops_implicitly_disabled? &&
|
|
|
|
!project.repository.gitlab_ci_yml &&
|
2017-09-16 09:02:37 -04:00
|
|
|
!project.ci_service
|
|
|
|
end
|
|
|
|
|
|
|
|
def auto_devops_warning_message(project)
|
|
|
|
missing_domain = !project.auto_devops&.has_domain?
|
2017-11-27 08:35:16 -05:00
|
|
|
missing_service = !project.deployment_platform&.active?
|
2017-09-16 09:02:37 -04:00
|
|
|
|
|
|
|
if missing_service
|
|
|
|
params = {
|
2018-01-25 04:27:10 -05:00
|
|
|
kubernetes: link_to('Kubernetes cluster', project_clusters_path(project))
|
2017-09-16 09:02:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if missing_domain
|
2018-01-25 04:27:10 -05:00
|
|
|
_('Auto Review Apps and Auto Deploy need a domain name and a %{kubernetes} to work correctly.') % params
|
2017-09-16 09:02:37 -04:00
|
|
|
else
|
2018-01-25 04:27:10 -05:00
|
|
|
_('Auto Review Apps and Auto Deploy need a %{kubernetes} to work correctly.') % params
|
2017-09-16 09:02:37 -04:00
|
|
|
end
|
|
|
|
elsif missing_domain
|
|
|
|
_('Auto Review Apps and Auto Deploy need a domain name to work correctly.')
|
|
|
|
end
|
2017-09-05 07:35:31 -04:00
|
|
|
end
|
|
|
|
end
|