BigW Consortium Gitlab

auto_devops_helper.rb 1.03 KB
Newer Older
1
module AutoDevopsHelper
2
  def show_auto_devops_callout?(project)
3 4
    Feature.get(:auto_devops_banner_disabled).off? &&
      show_callout?('auto_devops_settings_dismissed') &&
5
      can?(current_user, :admin_pipeline, project) &&
6 7
      project.has_auto_devops_implicitly_disabled? &&
      !project.repository.gitlab_ci_yml &&
8 9 10 11 12
      !project.ci_service
  end

  def auto_devops_warning_message(project)
    missing_domain = !project.auto_devops&.has_domain?
13
    missing_service = !project.deployment_platform&.active?
14 15 16 17 18 19 20

    if missing_service
      params = {
        kubernetes: link_to('Kubernetes service', edit_project_service_path(project, 'kubernetes'))
      }

      if missing_domain
21
        _('Auto Review Apps and Auto Deploy need a domain name and the %{kubernetes} to work correctly.') % params
22
      else
23
        _('Auto Review Apps and Auto Deploy need the %{kubernetes} to work correctly.') % params
24 25 26 27
      end
    elsif missing_domain
      _('Auto Review Apps and Auto Deploy need a domain name to work correctly.')
    end
28 29
  end
end