summaryrefslogtreecommitdiff
path: root/app/views/projects/settings/ci_cd/_autodevops_form.html.haml
blob: 7783e83b88f9da34bf1bd66851e9a072154c15c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
- has_base_domain = @project.all_clusters.any? { |cluster| cluster.base_domain && !cluster.base_domain.empty? }

- link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe
- link_end = '</a>'.html_safe

- kubernetes_cluster_path = help_page_path('user/project/clusters/index')
- kubernetes_cluster_link_start = link_start % { url: kubernetes_cluster_path }

- base_domain_path = help_page_path('user/project/clusters/gitlab_managed_clusters', anchor: 'base-domain')
- base_domain_link_start = link_start % { url: base_domain_path }

.row
  .col-lg-12
    = gitlab_ui_form_for @project, url: project_settings_ci_cd_path(@project, anchor: 'autodevops-settings') do |f|
      = form_errors(@project)
      %fieldset.builds-feature.js-auto-devops-settings
        .form-group
          = f.fields_for :auto_devops_attributes, @auto_devops do |form|
            .card.auto-devops-card
              .card-body
                - autodevops_help_link = link_to _('Learn more.'), help_page_path('topics/autodevops/index.md'), target: '_blank', rel: 'noopener noreferrer'
                - auto_devops_badge = auto_devops_enabled ? (gl_badge_tag badge_for_auto_devops_scope(@project), { variant: :info }, { class: 'js-instance-default-badge gl-ml-3 gl-mt-n1'}) : ''
                = form.gitlab_ui_checkbox_component :enabled,
                  (s_('CICD|Default to Auto DevOps pipeline') + auto_devops_badge).html_safe,
                  checkbox_options: { class: 'js-toggle-extra-settings', checked: auto_devops_enabled, data: { qa_selector: 'enable_autodevops_checkbox' } },
                  help_text: (s_('CICD|The Auto DevOps pipeline runs if no alternative CI configuration file is found.') + ' ' + autodevops_help_link).html_safe
              .card-footer.js-extra-settings{ class: auto_devops_enabled || 'hidden' }
                - if @project.all_clusters.empty?
                  %p.settings-message.text-center
                    = s_('CICD|Add a %{kubernetes_cluster_link_start}Kubernetes cluster integration%{link_end} with a domain, or create an AUTO_DEVOPS_PLATFORM_TARGET CI variable.').html_safe % { kubernetes_cluster_link_start: kubernetes_cluster_link_start, link_end: link_end }
                - elsif !has_base_domain
                  %p.settings-message.text-center
                    = s_('CICD|Add a %{base_domain_link_start}base domain%{link_end} to your %{kubernetes_cluster_link_start}Kubernetes cluster%{link_end} for your deployment strategy to work.').html_safe % { base_domain_link_start: base_domain_link_start, kubernetes_cluster_link_start: kubernetes_cluster_link_start, link_end: link_end }
                %label.gl-mt-3
                  %strong= s_('CICD|Deployment strategy')
                .form-check
                  = form.radio_button :deploy_strategy, 'continuous', class: 'form-check-input'
                  = form.label :deploy_strategy_continuous, class: 'form-check-label' do
                    = s_('CICD|Continuous deployment to production')
                    = link_to sprite_icon('question-o'), help_page_path('topics/autodevops/stages.md', anchor: 'auto-deploy'), target: '_blank', rel: 'noopener noreferrer'

                .form-check
                  = form.radio_button :deploy_strategy, 'timed_incremental', class: 'form-check-input'
                  = form.label :deploy_strategy_timed_incremental, class: 'form-check-label' do
                    = s_('CICD|Continuous deployment to production using timed incremental rollout')
                    = link_to sprite_icon('question-o'), help_page_path('topics/autodevops/customize.md', anchor: 'timed-incremental-rollout-to-production'), target: '_blank', rel: 'noopener noreferrer'

                .form-check
                  = form.radio_button :deploy_strategy, 'manual', class: 'form-check-input'
                  = form.label :deploy_strategy_manual, class: 'form-check-label' do
                    = s_('CICD|Automatic deployment to staging, manual deployment to production')
                    = link_to sprite_icon('question-o'), help_page_path('topics/autodevops/customize.md', anchor: 'incremental-rollout-to-production'), target: '_blank', rel: 'noopener noreferrer'

          = f.submit _('Save changes'), class: "btn gl-button btn-confirm gl-mt-5", data: { qa_selector: 'save_changes_button' }