diff options
author | jerasmus <jerasmus@gitlab.com> | 2019-08-27 11:52:51 +0200 |
---|---|---|
committer | jerasmus <jerasmus@gitlab.com> | 2019-08-29 10:42:39 +0200 |
commit | 4df2940912432697d9e01bb5957948a7818a6b3b (patch) | |
tree | ecf9f7d4c624c0c6945893b0aca7b9eb4e6d457f | |
parent | 42537bb12bccefb2258a15ef78362805147fac62 (diff) | |
download | gitlab-ce-je-add-cluster-domain-warning.tar.gz |
Add cluster domain warningje-add-cluster-domain-warning
Added a cluster domain wanring if no domain is defined
4 files changed, 31 insertions, 5 deletions
diff --git a/app/views/projects/settings/ci_cd/_autodevops_form.html.haml b/app/views/projects/settings/ci_cd/_autodevops_form.html.haml index 04b77fb987a..1d5d90593ae 100644 --- a/app/views/projects/settings/ci_cd/_autodevops_form.html.haml +++ b/app/views/projects/settings/ci_cd/_autodevops_form.html.haml @@ -1,3 +1,14 @@ +- 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/index', anchor: 'base-domain') +- base_domain_link_start = link_start % { url: base_domain_path } + .row .col-lg-12 = form_for @project, url: project_settings_ci_cd_path(@project, anchor: 'autodevops-settings') do |f| @@ -19,9 +30,10 @@ .card-footer.js-extra-settings{ class: auto_devops_enabled || 'hidden' } - if @project.all_clusters.empty? %p.settings-message.text-center - - kubernetes_cluster_link = help_page_path('user/project/clusters/index') - - kubernetes_cluster_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: kubernetes_cluster_link } - = s_('CICD|You must add a %{kubernetes_cluster_start}Kubernetes cluster integration%{kubernetes_cluster_end} to this project with a domain in order for your deployment strategy to work correctly.').html_safe % { kubernetes_cluster_start: kubernetes_cluster_start, kubernetes_cluster_end: '</a>'.html_safe } + = s_('CICD|You must add a %{kubernetes_cluster_link_start}Kubernetes cluster integration%{link_end} to this project with a domain in order for your deployment strategy to work correctly.').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|You must add a %{base_domain_link_start}base domain%{link_end} to your %{kubernetes_cluster_link_start}Kubernetes cluster%{link_end} in order 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.prepend-top-10 %strong= s_('CICD|Deployment strategy') .form-check diff --git a/changelogs/unreleased/je-add-cluster-domain-warning.yml b/changelogs/unreleased/je-add-cluster-domain-warning.yml new file mode 100644 index 00000000000..e7d244f730f --- /dev/null +++ b/changelogs/unreleased/je-add-cluster-domain-warning.yml @@ -0,0 +1,5 @@ +--- +title: Add cluster domain warning +merge_request: 32260 +author: +type: changed diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 12138d2db3a..3ded7d96094 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -1951,7 +1951,10 @@ msgstr "" msgid "CICD|The Auto DevOps pipeline will run if no alternative CI configuration file is found." msgstr "" -msgid "CICD|You must add a %{kubernetes_cluster_start}Kubernetes cluster integration%{kubernetes_cluster_end} to this project with a domain in order for your deployment strategy to work correctly." +msgid "CICD|You must add a %{base_domain_link_start}base domain%{link_end} to your %{kubernetes_cluster_link_start}Kubernetes cluster%{link_end} in order for your deployment strategy to work." +msgstr "" + +msgid "CICD|You must add a %{kubernetes_cluster_link_start}Kubernetes cluster integration%{link_end} to this project with a domain in order for your deployment strategy to work correctly." msgstr "" msgid "CICD|group enabled" diff --git a/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb b/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb index ff2d491539b..697e44be065 100644 --- a/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb +++ b/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb @@ -17,10 +17,16 @@ describe 'projects/settings/ci_cd/_autodevops_form' do context 'when the project has an available kubernetes cluster' do let!(:cluster) { create(:cluster, cluster_type: :project_type, projects: [project]) } - it 'does not show a warning message' do + it 'does not show a warning message about Kubernetes cluster' do render expect(rendered).not_to have_text('You must add a Kubernetes cluster') end + + it 'shows a warning message about base domain' do + render + + expect(rendered).to have_text('You must add a base domain to your Kubernetes cluster in order for your deployment strategy to work.') + end end end |