From 42da4faca442b4fcc0af2f66b1f2ad13d9d13b66 Mon Sep 17 00:00:00 2001 From: James Fargher Date: Tue, 20 Aug 2019 12:38:23 +1200 Subject: Auto-DevOps pipeline skipped banner Small banner to show the user why their pipeline was skipped --- app/models/ci/pipeline.rb | 4 ++++ app/views/projects/pipelines/_info.html.haml | 6 +++++ locale/gitlab.pot | 3 +++ spec/models/ci/pipeline_spec.rb | 34 ++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+) diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 255ae64a3fd..c891cff4632 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -810,6 +810,10 @@ module Ci errors ? errors.full_messages.to_sentence : "" end + def auto_devops_unsupported? + !auto_devops_buildable.nil? && !auto_devops_buildable? + end + private def ci_yaml_from_repo diff --git a/app/views/projects/pipelines/_info.html.haml b/app/views/projects/pipelines/_info.html.haml index 2b56ada8b73..6e226c15970 100644 --- a/app/views/projects/pipelines/_info.html.haml +++ b/app/views/projects/pipelines/_info.html.haml @@ -5,6 +5,12 @@ %pre.commit-description< = preserve(markdown(commit.description, pipeline: :single_line)) +- if @pipeline.auto_devops_unsupported? + .flash-container + .flash-warning + .flash-text + = s_('This pipeline was skipped because this project is not compatible with Auto DevOps. To run Auto DevOps pipelines, ensure your project has a Dockerfile or matching buildpack.').html_safe + .info-well .well-segment.pipeline-info .icon-container diff --git a/locale/gitlab.pot b/locale/gitlab.pot index e8d27360395..7506fe22c6a 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -11649,6 +11649,9 @@ msgstr "" msgid "This pipeline makes use of a predefined CI/CD configuration enabled by Auto DevOps." msgstr "" +msgid "This pipeline was skipped because this project is not compatible with Auto DevOps. To run Auto DevOps pipelines, ensure your project has a Dockerfile or matching buildpack." +msgstr "" + msgid "This project" msgstr "" diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 76ff31221fe..a141e56c0c7 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -3082,4 +3082,38 @@ describe Ci::Pipeline, :mailer do end end end + + describe '#auto_devops_unsupported?' do + subject { pipeline } + + context 'buildable' do + before do + pipeline.auto_devops_buildable = true + end + + it 'is supported' do + is_expected.not_to be_auto_devops_unsupported + end + end + + context 'not buildable' do + before do + pipeline.auto_devops_buildable = false + end + + it 'is unsupported' do + is_expected.to be_auto_devops_unsupported + end + end + + context 'unknown buildable' do + before do + pipeline.auto_devops_buildable = nil + end + + it 'is supported' do + is_expected.not_to be_auto_devops_unsupported + end + end + end end -- cgit v1.2.1