diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2017-08-31 13:47:29 +0200 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2017-08-31 22:25:26 +0200 |
commit | 35b9213cd7e378a732991a11bc8b5fa9e711c52b (patch) | |
tree | 1264d29ec30665db944dffa3ea8d0fb9a7480c0a /app | |
parent | 770bcf71bb85c9eff13f4eb14cbd517986da9056 (diff) | |
download | gitlab-ce-35b9213cd7e378a732991a11bc8b5fa9e711c52b.tar.gz |
Add config_source to ci_pipelines
Given the user can soon have multiple config sources for CI, we now store
what type at the time of the pipeline run we chose. This will give us
insight into what triggered the new pipeline so we can display it to the
enduser.
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/pipelines/components/pipeline_url.vue | 7 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 17 | ||||
-rw-r--r-- | app/serializers/pipeline_entity.rb | 1 | ||||
-rw-r--r-- | app/views/projects/pipelines/index.html.haml | 2 |
4 files changed, 22 insertions, 5 deletions
diff --git a/app/assets/javascripts/pipelines/components/pipeline_url.vue b/app/assets/javascripts/pipelines/components/pipeline_url.vue index 2ca5ac2912f..3cab411d321 100644 --- a/app/assets/javascripts/pipelines/components/pipeline_url.vue +++ b/app/assets/javascripts/pipelines/components/pipeline_url.vue @@ -58,6 +58,13 @@ export default { yaml invalid </span> <span + v-if="pipeline.flags.auto_devops" + v-tooltip + class="label label-info" + title="Pipeline was configured by Auto DevOps"> + Auto DevOps + </span> + <span v-if="pipeline.flags.stuck" class="js-pipeline-url-stuck label label-warning"> stuck diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 53ff42c04f4..5587b19fd69 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -50,6 +50,11 @@ module Ci external: 6 } + enum config_source: { + repository: nil, + auto_devops: 1 + } + state_machine :status, initial: :created do event :enqueue do transition created: :pending @@ -338,10 +343,14 @@ module Ci def ci_yaml_file return @ci_yaml_file if defined?(@ci_yaml_file) - @ci_yaml_file = (ci_yaml_from_repo || implied_ci_yaml_file).tap do |config| - unless config - self.yaml_errors = "Failed to load CI/CD config file for #{sha}" - end + @ci_yaml_file = ci_yaml_from_repo + @ci_yaml_file ||= implied_ci_yaml_file&.tap { self.auto_devops! } + + if @ci_yaml_file + @ci_yaml_file + else + self.yaml_errors = "Failed to load CI/CD config file for #{sha}" + nil end end diff --git a/app/serializers/pipeline_entity.rb b/app/serializers/pipeline_entity.rb index c4f000b0ca3..767f33e11e1 100644 --- a/app/serializers/pipeline_entity.rb +++ b/app/serializers/pipeline_entity.rb @@ -16,6 +16,7 @@ class PipelineEntity < Grape::Entity expose :flags do expose :latest?, as: :latest expose :stuck?, as: :stuck + expose :auto_devops?, as: :auto_devops expose :has_yaml_errors?, as: :yaml_errors expose :can_retry?, as: :retryable expose :can_cancel?, as: :cancelable diff --git a/app/views/projects/pipelines/index.html.haml b/app/views/projects/pipelines/index.html.haml index c1729850cf4..93c3e016cba 100644 --- a/app/views/projects/pipelines/index.html.haml +++ b/app/views/projects/pipelines/index.html.haml @@ -13,7 +13,7 @@ "finished-path" => project_pipelines_path(@project, scope: :finished), "branches-path" => project_pipelines_path(@project, scope: :branches), "tags-path" => project_pipelines_path(@project, scope: :tags), - "has-ci" => @repository.gitlab_ci_yml, + "has-ci" => @repository.gitlab_ci_yml || @project.auto_devops_enabled?, "ci-lint-path" => ci_lint_path } } = page_specific_javascript_bundle_tag('common_vue') |