From 6ed490401f49a8941dc7a9e3757ec4012f14ef0b Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Thu, 24 Aug 2017 13:01:33 +0200 Subject: Implement the implied CI/CD config for AutoDevOps Behind an application setting, which defaults to false, this commit implements the implied CI/CD config. Which means that in the case we can't find the `.gitlab-ci.yml` on the commit we want to start a pipeline for, we fall back to an implied configuration. For now the Bash template has been copied to `Auto-Devops.gitlab-ci.yml` so the tests actually work. Fixes #34777 --- app/helpers/application_settings_helper.rb | 1 + app/models/ci/pipeline.rb | 22 ++++++++--- app/models/project.rb | 6 +++ app/models/project_auto_devops.rb | 3 ++ .../admin/application_settings/_form.html.haml | 8 +++- changelogs/unreleased/zj-auto-devops-table.yml | 5 +++ config/initializers/0_inflections.rb | 7 +++- ..._auto_devops_enabled_to_application_settings.rb | 15 ++++++++ .../20170828093725_create_project_auto_dev_ops.rb | 24 ++++++++++++ db/schema.rb | 23 ++++++++--- spec/factories/project_auto_devops.rb | 6 +++ spec/models/application_setting_spec.rb | 1 + spec/models/ci/pipeline_spec.rb | 44 +++++++++++++++++++--- spec/models/project_auto_devops_spec.rb | 12 ++++++ vendor/gitlab-ci-yml/Auto-DevOps.gitlab-ci.yml | 35 +++++++++++++++++ 15 files changed, 194 insertions(+), 18 deletions(-) create mode 100644 app/models/project_auto_devops.rb create mode 100644 changelogs/unreleased/zj-auto-devops-table.yml create mode 100644 db/migrate/20170824101926_add_auto_devops_enabled_to_application_settings.rb create mode 100644 db/migrate/20170828093725_create_project_auto_dev_ops.rb create mode 100644 spec/factories/project_auto_devops.rb create mode 100644 spec/models/project_auto_devops_spec.rb create mode 100644 vendor/gitlab-ci-yml/Auto-DevOps.gitlab-ci.yml diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index 04955ed625e..f97f7199648 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -103,6 +103,7 @@ module ApplicationSettingsHelper :after_sign_up_text, :akismet_api_key, :akismet_enabled, + :auto_devops_enabled, :clientside_sentry_dsn, :clientside_sentry_enabled, :container_registry_token_expire_delay, diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 2d40f8012a3..53ff42c04f4 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -338,12 +338,10 @@ module Ci def ci_yaml_file return @ci_yaml_file if defined?(@ci_yaml_file) - @ci_yaml_file = begin - project.repository.gitlab_ci_yml_for(sha, ci_yaml_file_path) - rescue Rugged::ReferenceError, GRPC::NotFound, GRPC::Internal - self.yaml_errors = - "Failed to load CI/CD config file at #{ci_yaml_file_path}" - nil + @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 end end @@ -430,6 +428,18 @@ module Ci private + def implied_ci_yaml_file + if project.auto_devops_enabled? + Gitlab::Template::GitlabCiYmlTemplate.find('Auto-DevOps').content + end + end + + def ci_yaml_from_repo + project.repository.gitlab_ci_yml_for(sha, ci_yaml_file_path) + rescue GRPC::NotFound, Rugged::ReferenceError, GRPC::Internal + nil + end + def pipeline_data Gitlab::DataBuilder::Pipeline.build(self) end diff --git a/app/models/project.rb b/app/models/project.rb index 5b4904a5c51..56ba2620687 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -186,6 +186,8 @@ class Project < ActiveRecord::Base has_many :active_runners, -> { active }, through: :runner_projects, source: :runner, class_name: 'Ci::Runner' + has_one :auto_devops, class_name: 'ProjectAutoDevops' + accepts_nested_attributes_for :variables, allow_destroy: true accepts_nested_attributes_for :project_feature accepts_nested_attributes_for :import_data @@ -464,6 +466,10 @@ class Project < ActiveRecord::Base self[:lfs_enabled] && Gitlab.config.lfs.enabled end + def auto_devops_enabled? + auto_devops&.enabled? || current_application_settings.auto_devops_enabled? + end + def repository_storage_path Gitlab.config.repositories.storages[repository_storage]['path'] end diff --git a/app/models/project_auto_devops.rb b/app/models/project_auto_devops.rb new file mode 100644 index 00000000000..fe73c6f0a85 --- /dev/null +++ b/app/models/project_auto_devops.rb @@ -0,0 +1,3 @@ +class ProjectAutoDevops < ActiveRecord::Base + belongs_to :project +end diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml index 734a08c61fa..a487f2b6995 100644 --- a/app/views/admin/application_settings/_form.html.haml +++ b/app/views/admin/application_settings/_form.html.haml @@ -217,7 +217,13 @@ .help-block 0 for unlimited %fieldset - %legend Continuous Integration + %legend Continuous Integration and Continuous Deployment + .form-group + .col-sm-offset-2.col-sm-10 + .checkbox + = f.label :auto_devops_enabled do + = f.check_box :auto_devops_enabled + Allow projects to get automaticly configured to use GitLab CI/CD. .form-group .col-sm-offset-2.col-sm-10 .checkbox diff --git a/changelogs/unreleased/zj-auto-devops-table.yml b/changelogs/unreleased/zj-auto-devops-table.yml new file mode 100644 index 00000000000..f1a004ebd19 --- /dev/null +++ b/changelogs/unreleased/zj-auto-devops-table.yml @@ -0,0 +1,5 @@ +--- +title: Allow users and administrator to configure Auto-DevOps +merge_request: 13923 +author: +type: added diff --git a/config/initializers/0_inflections.rb b/config/initializers/0_inflections.rb index f977104ff9d..1ad9ddca877 100644 --- a/config/initializers/0_inflections.rb +++ b/config/initializers/0_inflections.rb @@ -10,5 +10,10 @@ # end # ActiveSupport::Inflector.inflections do |inflect| - inflect.uncountable %w(award_emoji project_statistics system_note_metadata) + inflect.uncountable %w( + award_emoji + project_statistics + system_note_metadata + project_auto_devops + ) end diff --git a/db/migrate/20170824101926_add_auto_devops_enabled_to_application_settings.rb b/db/migrate/20170824101926_add_auto_devops_enabled_to_application_settings.rb new file mode 100644 index 00000000000..da518d8215c --- /dev/null +++ b/db/migrate/20170824101926_add_auto_devops_enabled_to_application_settings.rb @@ -0,0 +1,15 @@ +class AddAutoDevopsEnabledToApplicationSettings < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column_with_default(:application_settings, :auto_devops_enabled, :boolean, default: false) + end + + def down + remove_column(:application_settings, :auto_devops_enabled, :boolean) + end +end diff --git a/db/migrate/20170828093725_create_project_auto_dev_ops.rb b/db/migrate/20170828093725_create_project_auto_dev_ops.rb new file mode 100644 index 00000000000..818fc8ed970 --- /dev/null +++ b/db/migrate/20170828093725_create_project_auto_dev_ops.rb @@ -0,0 +1,24 @@ +class CreateProjectAutoDevOps < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + create_table :project_auto_devops do |t| + t.belongs_to :project, index: true + t.boolean :enabled, default: true + t.string :domain + end + + add_timestamps_with_timezone(:project_auto_devops, null: false) + + # No need to check for violations as its a new table + add_concurrent_foreign_key(:project_auto_devops, :projects, column: :project_id) + end + + def down + drop_table(:project_auto_devops) + end +end diff --git a/db/schema.rb b/db/schema.rb index 0f4b0c0c3b3..66ab6988649 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170824162758) do +ActiveRecord::Schema.define(version: 20170828093725) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -125,10 +125,11 @@ ActiveRecord::Schema.define(version: 20170824162758) do t.boolean "prometheus_metrics_enabled", default: false, null: false t.boolean "help_page_hide_commercial_content", default: false t.string "help_page_support_url" - t.integer "performance_bar_allowed_group_id" t.boolean "password_authentication_enabled" - t.boolean "project_export_enabled", default: true, null: false + t.integer "performance_bar_allowed_group_id" t.boolean "hashed_storage_enabled", default: false, null: false + t.boolean "project_export_enabled", default: true, null: false + t.boolean "auto_devops_enabled", default: false, null: false end create_table "audit_events", force: :cascade do |t| @@ -249,6 +250,7 @@ ActiveRecord::Schema.define(version: 20170824162758) do add_index "ci_builds", ["commit_id", "status", "type"], name: "index_ci_builds_on_commit_id_and_status_and_type", using: :btree add_index "ci_builds", ["commit_id", "type", "name", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_name_and_ref", using: :btree add_index "ci_builds", ["commit_id", "type", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_ref", using: :btree + add_index "ci_builds", ["id"], name: "index_for_ci_builds_retried_migration", where: "(retried IS NULL)", using: :btree, opclasses: {"id)"=>"WHERE"} add_index "ci_builds", ["project_id"], name: "index_ci_builds_on_project_id", using: :btree add_index "ci_builds", ["runner_id"], name: "index_ci_builds_on_runner_id", using: :btree add_index "ci_builds", ["stage_id"], name: "index_ci_builds_on_stage_id", using: :btree @@ -1116,6 +1118,16 @@ ActiveRecord::Schema.define(version: 20170824162758) do add_index "project_authorizations", ["project_id"], name: "index_project_authorizations_on_project_id", using: :btree add_index "project_authorizations", ["user_id", "project_id", "access_level"], name: "index_project_authorizations_on_user_id_project_id_access_level", unique: true, using: :btree + create_table "project_auto_devops", force: :cascade do |t| + t.integer "project_id" + t.boolean "enabled", default: true + t.string "domain" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "project_auto_devops", ["project_id"], name: "index_project_auto_devops_on_project_id", using: :btree + create_table "project_features", force: :cascade do |t| t.integer "project_id" t.integer "merge_requests_access_level" @@ -1199,6 +1211,7 @@ ActiveRecord::Schema.define(version: 20170824162758) do t.string "repository_storage", default: "default", null: false t.boolean "request_access_enabled", default: false, null: false t.boolean "has_external_wiki" + t.string "ci_config_path" t.boolean "lfs_enabled" t.text "description_html" t.boolean "only_allow_merge_if_all_discussions_are_resolved" @@ -1206,9 +1219,8 @@ ActiveRecord::Schema.define(version: 20170824162758) do t.integer "auto_cancel_pending_pipelines", default: 1, null: false t.string "import_jid" t.integer "cached_markdown_version" - t.datetime "last_repository_updated_at" - t.string "ci_config_path" t.text "delete_error" + t.datetime "last_repository_updated_at" t.integer "storage_version", limit: 2 end @@ -1722,6 +1734,7 @@ ActiveRecord::Schema.define(version: 20170824162758) do add_foreign_key "personal_access_tokens", "users" add_foreign_key "project_authorizations", "projects", on_delete: :cascade add_foreign_key "project_authorizations", "users", on_delete: :cascade + add_foreign_key "project_auto_devops", "projects", name: "fk_45436b12b2", on_delete: :cascade add_foreign_key "project_features", "projects", name: "fk_18513d9b92", on_delete: :cascade add_foreign_key "project_group_links", "projects", name: "fk_daa8cee94c", on_delete: :cascade add_foreign_key "project_import_data", "projects", name: "fk_ffb9ee3a10", on_delete: :cascade diff --git a/spec/factories/project_auto_devops.rb b/spec/factories/project_auto_devops.rb new file mode 100644 index 00000000000..2e5a7c805c9 --- /dev/null +++ b/spec/factories/project_auto_devops.rb @@ -0,0 +1,6 @@ +FactoryGirl.define do + factory :project_auto_devops do + project + enabled true + end +end diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index 359753b600e..95ebd016064 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -5,6 +5,7 @@ describe ApplicationSetting do it { expect(setting).to be_valid } it { expect(setting.uuid).to be_present } + it { expect(setting).to have_db_column(:auto_devops_enabled) } describe 'validations' do let(:http) { 'http://example.com' } diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index b84e3ff18e8..a7e0da04f55 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -784,13 +784,47 @@ describe Ci::Pipeline, :mailer do end describe '#ci_yaml_file' do - it 'reports error if the file is not found' do - allow(pipeline.project).to receive(:ci_config_path) { 'custom' } + let(:implied_yml) { Gitlab::Template::GitlabCiYmlTemplate.find('Auto-DevOps').content } - pipeline.ci_yaml_file + context 'when AutoDevops is enabled' do + it 'returns the configuration if found' do + allow(pipeline.project.repository).to receive(:gitlab_ci_yml_for) + .and_return('config') - expect(pipeline.yaml_errors) - .to eq('Failed to load CI/CD config file at custom') + expect(pipeline.ci_yaml_file).to be_a(String) + expect(pipeline.ci_yaml_file).not_to eq(implied_yml) + expect(pipeline.yaml_errors).to be_nil + end + + it 'returns the implied configuration when its not found' do + allow_any_instance_of(ApplicationSetting) + .to receive(:auto_devops_enabled?) { true } + allow(pipeline.project).to receive(:ci_config_path) { 'custom' } + + expect(pipeline.ci_yaml_file).to eq(implied_yml) + end + end + + context 'when AudoDevOps is disabled' do + context 'when an invalid path is given' do + it 'sets the yaml errors' do + allow(pipeline.project).to receive(:ci_config_path) { 'custom' } + + expect(pipeline.ci_yaml_file).to be_nil + expect(pipeline.yaml_errors) + .to start_with('Failed to load CI/CD config file') + end + end + + context 'when the config file can be found' do + it 'has no yaml_errors' do + allow(pipeline.project.repository).to receive(:gitlab_ci_yml_for) + .and_return('config') + + expect(pipeline.ci_yaml_file).to eq('config') + expect(pipeline.yaml_errors).to be_nil + end + end end end diff --git a/spec/models/project_auto_devops_spec.rb b/spec/models/project_auto_devops_spec.rb new file mode 100644 index 00000000000..d534dacf079 --- /dev/null +++ b/spec/models/project_auto_devops_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe ProjectAutoDevops, type: :model do + subject { build_stubbed(:project_auto_devops) } + + it { is_expected.to belong_to(:project) } + + it { is_expected.to respond_to(:created_at) } + it { is_expected.to respond_to(:updated_at) } + + it { is_expected.to be_enabled } +end diff --git a/vendor/gitlab-ci-yml/Auto-DevOps.gitlab-ci.yml b/vendor/gitlab-ci-yml/Auto-DevOps.gitlab-ci.yml new file mode 100644 index 00000000000..27537689b80 --- /dev/null +++ b/vendor/gitlab-ci-yml/Auto-DevOps.gitlab-ci.yml @@ -0,0 +1,35 @@ +# see https://docs.gitlab.com/ce/ci/yaml/README.html for all available options + +# you can delete this line if you're not using Docker +image: busybox:latest + +before_script: + - echo "Before script section" + - echo "For example you might run an update here or install a build dependency" + - echo "Or perhaps you might print out some debugging details" + +after_script: + - echo "After script section" + - echo "For example you might do some cleanup here" + +build1: + stage: build + script: + - echo "Do your build here" + +test1: + stage: test + script: + - echo "Do a test here" + - echo "For example run a test suite" + +test2: + stage: test + script: + - echo "Do another parallel test here" + - echo "For example run a lint test" + +deploy1: + stage: deploy + script: + - echo "Do your deploy here" \ No newline at end of file -- cgit v1.2.1 From 770bcf71bb85c9eff13f4eb14cbd517986da9056 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Wed, 30 Aug 2017 20:39:23 +0200 Subject: Form for setting project auto devops settings --- .../projects/pipelines_settings_controller.rb | 12 +++--- .../projects/settings/ci_cd_controller.rb | 5 +++ app/models/project.rb | 1 + .../admin/application_settings/_form.html.haml | 8 +++- .../projects/pipelines_settings/_show.html.haml | 44 +++++++++++++++++++--- .../20170828093725_create_project_auto_dev_ops.rb | 2 +- db/schema.rb | 5 +-- lib/gitlab/import_export/import_export.yml | 3 +- spec/lib/gitlab/import_export/all_models.yml | 1 + 9 files changed, 62 insertions(+), 19 deletions(-) diff --git a/app/controllers/projects/pipelines_settings_controller.rb b/app/controllers/projects/pipelines_settings_controller.rb index 9d24ebe2138..abab2e2f0c9 100644 --- a/app/controllers/projects/pipelines_settings_controller.rb +++ b/app/controllers/projects/pipelines_settings_controller.rb @@ -6,7 +6,7 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController end def update - if @project.update_attributes(update_params) + if @project.update(update_params) flash[:notice] = "Pipelines settings for '#{@project.name}' were successfully updated." redirect_to project_settings_ci_cd_path(@project) else @@ -16,14 +16,12 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController private - def create_params - params.require(:pipeline).permit(:ref) - end - def update_params params.require(:project).permit( - :runners_token, :builds_enabled, :build_allow_git_fetch, :build_timeout_in_minutes, :build_coverage_regex, - :public_builds, :auto_cancel_pending_pipelines, :ci_config_path + :runners_token, :builds_enabled, :build_allow_git_fetch, + :build_timeout_in_minutes, :build_coverage_regex, :public_builds, + :auto_cancel_pending_pipelines, :ci_config_path, + auto_devops_attributes: [:id, :domain, :enabled] ) end end diff --git a/app/controllers/projects/settings/ci_cd_controller.rb b/app/controllers/projects/settings/ci_cd_controller.rb index 15a2ff56b92..b029b31f9af 100644 --- a/app/controllers/projects/settings/ci_cd_controller.rb +++ b/app/controllers/projects/settings/ci_cd_controller.rb @@ -8,6 +8,7 @@ module Projects define_secret_variables define_triggers_variables define_badges_variables + define_auto_devops_variables end private @@ -42,6 +43,10 @@ module Projects badge.new(@project, @ref).metadata end end + + def define_auto_devops_variables + @auto_devops = @project.auto_devops || ProjectAutoDevops.new + end end end end diff --git a/app/models/project.rb b/app/models/project.rb index 56ba2620687..cc9fd215070 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -191,6 +191,7 @@ class Project < ActiveRecord::Base accepts_nested_attributes_for :variables, allow_destroy: true accepts_nested_attributes_for :project_feature accepts_nested_attributes_for :import_data + accepts_nested_attributes_for :auto_devops delegate :name, to: :owner, allow_nil: true, prefix: true delegate :members, to: :team, prefix: true diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml index a487f2b6995..a00fc978494 100644 --- a/app/views/admin/application_settings/_form.html.haml +++ b/app/views/admin/application_settings/_form.html.haml @@ -217,13 +217,17 @@ .help-block 0 for unlimited %fieldset - %legend Continuous Integration and Continuous Deployment + %legend Continuous Integration and Deployment .form-group .col-sm-offset-2.col-sm-10 .checkbox = f.label :auto_devops_enabled do = f.check_box :auto_devops_enabled - Allow projects to get automaticly configured to use GitLab CI/CD. + Enabled Auto DevOps (Beta) for projects by default + .help-block + It will automatically build, test, and deploy applications based on a predefined CI/CD configuration + - # Fix this link + = link_to icon('question-circle'), help_page_path('user/admin_area/settings/continuous_integration', anchor: 'maximum-artifacts-size') .form-group .col-sm-offset-2.col-sm-10 .checkbox diff --git a/app/views/projects/pipelines_settings/_show.html.haml b/app/views/projects/pipelines_settings/_show.html.haml index 255d7ef38e0..f4a6ecde0a4 100644 --- a/app/views/projects/pipelines_settings/_show.html.haml +++ b/app/views/projects/pipelines_settings/_show.html.haml @@ -5,11 +5,45 @@ .col-lg-8 = form_for @project, url: project_pipelines_settings_path(@project) do |f| %fieldset.builds-feature - - unless @repository.gitlab_ci_yml - .form-group - %p Pipelines need to be configured before you can begin using Continuous Integration. - = link_to 'Get started with Pipelines', help_page_path('ci/quick_start/README'), class: 'btn btn-info' - %hr + .form-group + %p Pipelines need to have AutoDevOps enabled or have a .gitlab-ci.yml configured before you can begin using Continious Integration and Delivery. + = f.label :auto_devops_enabled, 'Auto DevOps (Beta)', class: 'label-light' + %p + Auto DevOps will automatically build, test, and deploy your application based on a predefined CI/CD configuration. + = link_to 'Learn more about Auto DevOps', help_page_path('ci/quick_start/README') #TODO fix the link + = f.fields_for :auto_devops_attributes, @auto_devops do |form| + .radio + = form.radio_button :enabled, true + %strong Enable Auto DevOps + %br + %span.descr + The Auto DevOps pipeline configuration will be used when ther is no .gitlab-ci.yml + in the repository. + .radio + = form.radio_button :enabled, false + %strong Disable Auto DevOps + %br + %span.descr + A specific .gitlab-ci.yml file needs to be specified before you can begin using Continious Integration and Delivery + .radio + = form.radio_button :enabled, nil + %strong + Instance default (status: #{current_application_settings.auto_devops_enabled?}) + %br + %span.descr + Follow the instance default to either have Auto DevOps enabled or disabled when there is no .gitlab-ci.yml file specified + %br + %p + Define a domain used by Auto DevOps to deploy towards, this is required for deploys to succeed. + = link_to 'Learn more about deploying with Auto DevOps', help_page_path('ci/quick_start/README') #TODO fix the link + = form.text_field :domain, class: 'form-control', placeholder: 'domain.com' + %br + %p + %strong Project specific pipeline configuration + Define a project specific pipeline configuration by creating a .gitlab-ci.yml file. + = link_to 'Learn more about pipelines', help_page_path('ci/quick_start/README'), class: 'btn btn-info' + + %hr .form-group.append-bottom-default = f.label :runners_token, "Runner token", class: 'label-light' = f.text_field :runners_token, class: "form-control", placeholder: 'xEeFCaDAB89' diff --git a/db/migrate/20170828093725_create_project_auto_dev_ops.rb b/db/migrate/20170828093725_create_project_auto_dev_ops.rb index 818fc8ed970..a96ad644a2e 100644 --- a/db/migrate/20170828093725_create_project_auto_dev_ops.rb +++ b/db/migrate/20170828093725_create_project_auto_dev_ops.rb @@ -8,7 +8,7 @@ class CreateProjectAutoDevOps < ActiveRecord::Migration def up create_table :project_auto_devops do |t| t.belongs_to :project, index: true - t.boolean :enabled, default: true + t.boolean :enabled, default: nil, null: true t.string :domain end diff --git a/db/schema.rb b/db/schema.rb index 66ab6988649..1bc2a5eddc5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -250,7 +250,6 @@ ActiveRecord::Schema.define(version: 20170828093725) do add_index "ci_builds", ["commit_id", "status", "type"], name: "index_ci_builds_on_commit_id_and_status_and_type", using: :btree add_index "ci_builds", ["commit_id", "type", "name", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_name_and_ref", using: :btree add_index "ci_builds", ["commit_id", "type", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_ref", using: :btree - add_index "ci_builds", ["id"], name: "index_for_ci_builds_retried_migration", where: "(retried IS NULL)", using: :btree, opclasses: {"id)"=>"WHERE"} add_index "ci_builds", ["project_id"], name: "index_ci_builds_on_project_id", using: :btree add_index "ci_builds", ["runner_id"], name: "index_ci_builds_on_runner_id", using: :btree add_index "ci_builds", ["stage_id"], name: "index_ci_builds_on_stage_id", using: :btree @@ -1122,8 +1121,8 @@ ActiveRecord::Schema.define(version: 20170828093725) do t.integer "project_id" t.boolean "enabled", default: true t.string "domain" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false end add_index "project_auto_devops", ["project_id"], name: "index_project_auto_devops_on_project_id", using: :btree diff --git a/lib/gitlab/import_export/import_export.yml b/lib/gitlab/import_export/import_export.yml index 78795dd3d92..d164a9adb2d 100644 --- a/lib/gitlab/import_export/import_export.yml +++ b/lib/gitlab/import_export/import_export.yml @@ -50,6 +50,7 @@ project_tree: - :push_event_payload - :stages - :statuses + - :project_auto_devops - :triggers - :pipeline_schedules - :services @@ -141,4 +142,4 @@ methods: events: - :action push_event_payload: - - :action \ No newline at end of file + - :action diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml index 8da02b0cf00..dbe042adff5 100644 --- a/spec/lib/gitlab/import_export/all_models.yml +++ b/spec/lib/gitlab/import_export/all_models.yml @@ -256,6 +256,7 @@ project: - environments - deployments - project_feature +- auto_devops - pages_domains - authorized_users - project_authorizations -- cgit v1.2.1 From 35b9213cd7e378a732991a11bc8b5fa9e711c52b Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Thu, 31 Aug 2017 13:47:29 +0200 Subject: 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. --- .../pipelines/components/pipeline_url.vue | 7 +++++++ app/models/ci/pipeline.rb | 17 ++++++++++++---- app/serializers/pipeline_entity.rb | 1 + app/views/projects/pipelines/index.html.haml | 2 +- ...0170831092813_add_config_source_to_pipelines.rb | 7 +++++++ db/schema.rb | 22 +++++---------------- spec/models/ci/pipeline_spec.rb | 23 +++++++++++++++++----- spec/serializers/pipeline_entity_spec.rb | 2 +- 8 files changed, 53 insertions(+), 28 deletions(-) create mode 100644 db/migrate/20170831092813_add_config_source_to_pipelines.rb 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 @@ -57,6 +57,13 @@ export default { :title="pipeline.yaml_errors"> yaml invalid + + Auto DevOps + 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') diff --git a/db/migrate/20170831092813_add_config_source_to_pipelines.rb b/db/migrate/20170831092813_add_config_source_to_pipelines.rb new file mode 100644 index 00000000000..ff51e968abd --- /dev/null +++ b/db/migrate/20170831092813_add_config_source_to_pipelines.rb @@ -0,0 +1,7 @@ +class AddConfigSourceToPipelines < ActiveRecord::Migration + DOWNTIME = false + + def change + add_column(:ci_pipelines, :config_source, :integer, allow_null: true) + end +end diff --git a/db/schema.rb b/db/schema.rb index 1bc2a5eddc5..0f4b0c0c3b3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170828093725) do +ActiveRecord::Schema.define(version: 20170824162758) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -125,11 +125,10 @@ ActiveRecord::Schema.define(version: 20170828093725) do t.boolean "prometheus_metrics_enabled", default: false, null: false t.boolean "help_page_hide_commercial_content", default: false t.string "help_page_support_url" - t.boolean "password_authentication_enabled" t.integer "performance_bar_allowed_group_id" - t.boolean "hashed_storage_enabled", default: false, null: false + t.boolean "password_authentication_enabled" t.boolean "project_export_enabled", default: true, null: false - t.boolean "auto_devops_enabled", default: false, null: false + t.boolean "hashed_storage_enabled", default: false, null: false end create_table "audit_events", force: :cascade do |t| @@ -1117,16 +1116,6 @@ ActiveRecord::Schema.define(version: 20170828093725) do add_index "project_authorizations", ["project_id"], name: "index_project_authorizations_on_project_id", using: :btree add_index "project_authorizations", ["user_id", "project_id", "access_level"], name: "index_project_authorizations_on_user_id_project_id_access_level", unique: true, using: :btree - create_table "project_auto_devops", force: :cascade do |t| - t.integer "project_id" - t.boolean "enabled", default: true - t.string "domain" - t.datetime_with_timezone "created_at", null: false - t.datetime_with_timezone "updated_at", null: false - end - - add_index "project_auto_devops", ["project_id"], name: "index_project_auto_devops_on_project_id", using: :btree - create_table "project_features", force: :cascade do |t| t.integer "project_id" t.integer "merge_requests_access_level" @@ -1210,7 +1199,6 @@ ActiveRecord::Schema.define(version: 20170828093725) do t.string "repository_storage", default: "default", null: false t.boolean "request_access_enabled", default: false, null: false t.boolean "has_external_wiki" - t.string "ci_config_path" t.boolean "lfs_enabled" t.text "description_html" t.boolean "only_allow_merge_if_all_discussions_are_resolved" @@ -1218,8 +1206,9 @@ ActiveRecord::Schema.define(version: 20170828093725) do t.integer "auto_cancel_pending_pipelines", default: 1, null: false t.string "import_jid" t.integer "cached_markdown_version" - t.text "delete_error" t.datetime "last_repository_updated_at" + t.string "ci_config_path" + t.text "delete_error" t.integer "storage_version", limit: 2 end @@ -1733,7 +1722,6 @@ ActiveRecord::Schema.define(version: 20170828093725) do add_foreign_key "personal_access_tokens", "users" add_foreign_key "project_authorizations", "projects", on_delete: :cascade add_foreign_key "project_authorizations", "users", on_delete: :cascade - add_foreign_key "project_auto_devops", "projects", name: "fk_45436b12b2", on_delete: :cascade add_foreign_key "project_features", "projects", name: "fk_18513d9b92", on_delete: :cascade add_foreign_key "project_group_links", "projects", name: "fk_daa8cee94c", on_delete: :cascade add_foreign_key "project_import_data", "projects", name: "fk_ffb9ee3a10", on_delete: :cascade diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index a7e0da04f55..80cf872a5fd 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -794,14 +794,27 @@ describe Ci::Pipeline, :mailer do expect(pipeline.ci_yaml_file).to be_a(String) expect(pipeline.ci_yaml_file).not_to eq(implied_yml) expect(pipeline.yaml_errors).to be_nil + expect(pipeline.repository?).to be(true) end - it 'returns the implied configuration when its not found' do - allow_any_instance_of(ApplicationSetting) - .to receive(:auto_devops_enabled?) { true } - allow(pipeline.project).to receive(:ci_config_path) { 'custom' } + context 'when the implied configuration will be used' do + before do + allow_any_instance_of(ApplicationSetting) + .to receive(:auto_devops_enabled?) { true } + end - expect(pipeline.ci_yaml_file).to eq(implied_yml) + it 'returns the implied configuration when its not found' do + allow(pipeline.project).to receive(:ci_config_path) { 'custom' } + + expect(pipeline.ci_yaml_file).to eq(implied_yml) + end + + it 'sets the config source' do + allow(pipeline.project).to receive(:ci_config_path) { 'custom' } + + expect(pipeline.ci_yaml_file).to eq(implied_yml) + expect(pipeline.auto_devops?).to be(true) + end end end diff --git a/spec/serializers/pipeline_entity_spec.rb b/spec/serializers/pipeline_entity_spec.rb index 881f2b6bfd8..f8df461bc81 100644 --- a/spec/serializers/pipeline_entity_spec.rb +++ b/spec/serializers/pipeline_entity_spec.rb @@ -36,7 +36,7 @@ describe PipelineEntity do it 'contains flags' do expect(subject).to include :flags expect(subject[:flags]) - .to include :latest, :stuck, + .to include :latest, :stuck, :auto_devops, :yaml_errors, :retryable, :cancelable end end -- cgit v1.2.1 From 6c021a9a8bec3cd36d6e8cf1c6c1acbd1ed00a99 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Thu, 31 Aug 2017 22:24:54 +0200 Subject: Fix db/schema.rb not being up to date --- db/schema.rb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 0f4b0c0c3b3..b791f947bbb 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170824162758) do +ActiveRecord::Schema.define(version: 20170831092813) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -125,10 +125,11 @@ ActiveRecord::Schema.define(version: 20170824162758) do t.boolean "prometheus_metrics_enabled", default: false, null: false t.boolean "help_page_hide_commercial_content", default: false t.string "help_page_support_url" - t.integer "performance_bar_allowed_group_id" t.boolean "password_authentication_enabled" - t.boolean "project_export_enabled", default: true, null: false + t.integer "performance_bar_allowed_group_id" t.boolean "hashed_storage_enabled", default: false, null: false + t.boolean "project_export_enabled", default: true, null: false + t.boolean "auto_devops_enabled", default: false, null: false end create_table "audit_events", force: :cascade do |t| @@ -332,6 +333,7 @@ ActiveRecord::Schema.define(version: 20170824162758) do t.integer "auto_canceled_by_id" t.integer "pipeline_schedule_id" t.integer "source" + t.integer "config_source" end add_index "ci_pipelines", ["auto_canceled_by_id"], name: "index_ci_pipelines_on_auto_canceled_by_id", using: :btree @@ -1116,6 +1118,16 @@ ActiveRecord::Schema.define(version: 20170824162758) do add_index "project_authorizations", ["project_id"], name: "index_project_authorizations_on_project_id", using: :btree add_index "project_authorizations", ["user_id", "project_id", "access_level"], name: "index_project_authorizations_on_user_id_project_id_access_level", unique: true, using: :btree + create_table "project_auto_devops", force: :cascade do |t| + t.integer "project_id" + t.boolean "enabled" + t.string "domain" + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false + end + + add_index "project_auto_devops", ["project_id"], name: "index_project_auto_devops_on_project_id", using: :btree + create_table "project_features", force: :cascade do |t| t.integer "project_id" t.integer "merge_requests_access_level" @@ -1722,6 +1734,7 @@ ActiveRecord::Schema.define(version: 20170824162758) do add_foreign_key "personal_access_tokens", "users" add_foreign_key "project_authorizations", "projects", on_delete: :cascade add_foreign_key "project_authorizations", "users", on_delete: :cascade + add_foreign_key "project_auto_devops", "projects", name: "fk_45436b12b2", on_delete: :cascade add_foreign_key "project_features", "projects", name: "fk_18513d9b92", on_delete: :cascade add_foreign_key "project_group_links", "projects", name: "fk_daa8cee94c", on_delete: :cascade add_foreign_key "project_import_data", "projects", name: "fk_ffb9ee3a10", on_delete: :cascade -- cgit v1.2.1 From 1fb2c1ca4ec6bb8b66a4cd06ea5c8374572c525b Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Fri, 1 Sep 2017 10:46:08 +0100 Subject: Adds tooltip for Auto DevOps badge in pipeline table --- .../pipelines/components/pipeline_url.vue | 61 +++++++++++++--------- .../javascripts/vue_shared/directives/popover.js | 24 +++++++++ app/assets/stylesheets/pages/commits.scss | 2 +- app/assets/stylesheets/pages/pipelines.scss | 9 ++++ spec/javascripts/pipelines/pipeline_url_spec.js | 21 ++++++++ 5 files changed, 92 insertions(+), 25 deletions(-) create mode 100644 app/assets/javascripts/vue_shared/directives/popover.js diff --git a/app/assets/javascripts/pipelines/components/pipeline_url.vue b/app/assets/javascripts/pipelines/components/pipeline_url.vue index 3cab411d321..6988417bd39 100644 --- a/app/assets/javascripts/pipelines/components/pipeline_url.vue +++ b/app/assets/javascripts/pipelines/components/pipeline_url.vue @@ -1,26 +1,34 @@ diff --git a/app/assets/javascripts/pipelines/components/pipelines_table_row.vue b/app/assets/javascripts/pipelines/components/pipelines_table_row.vue index c3f1c426d8a..5b9bb6c3750 100644 --- a/app/assets/javascripts/pipelines/components/pipelines_table_row.vue +++ b/app/assets/javascripts/pipelines/components/pipelines_table_row.vue @@ -25,6 +25,10 @@ export default { required: false, default: false, }, + autoDevopsHelpPath: { + type: String, + required: true, + }, }, components: { asyncButtonComponent, @@ -218,7 +222,10 @@ export default { - +
help_page_path('ci/quick_start/README'), + "help-auto-devops-path" => help_page_path('topics/autodevops/index.md'), } } - content_for :page_specific_javascripts do diff --git a/app/views/projects/pipelines/index.html.haml b/app/views/projects/pipelines/index.html.haml index 93c3e016cba..3ce20378038 100644 --- a/app/views/projects/pipelines/index.html.haml +++ b/app/views/projects/pipelines/index.html.haml @@ -5,6 +5,7 @@ #pipelines-list-vue{ data: { endpoint: project_pipelines_path(@project, format: :json), "css-class" => container_class, "help-page-path" => help_page_path('ci/quick_start/README'), + "help-auto-devops-path" => help_page_path('topics/autodevops/index.md'), "new-pipeline-path" => new_project_pipeline_path(@project), "can-create-pipeline" => can?(current_user, :create_pipeline, @project).to_s, "all-path" => project_pipelines_path(@project), diff --git a/spec/javascripts/commit/pipelines/pipelines_spec.js b/spec/javascripts/commit/pipelines/pipelines_spec.js index a34cadec0ab..454f187ccbc 100644 --- a/spec/javascripts/commit/pipelines/pipelines_spec.js +++ b/spec/javascripts/commit/pipelines/pipelines_spec.js @@ -29,6 +29,7 @@ describe('Pipelines table in Commits and Merge requests', () => { propsData: { endpoint: 'endpoint', helpPagePath: 'foo', + autoDevopsHelpPath: 'foo', }, }).$mount(); }); @@ -64,6 +65,7 @@ describe('Pipelines table in Commits and Merge requests', () => { propsData: { endpoint: 'endpoint', helpPagePath: 'foo', + autoDevopsHelpPath: 'foo', }, }).$mount(); }); @@ -115,6 +117,7 @@ describe('Pipelines table in Commits and Merge requests', () => { propsData: { endpoint: 'endpoint', helpPagePath: 'foo', + autoDevopsHelpPath: 'foo', }, }).$mount(); element.appendChild(this.component.$el); @@ -136,6 +139,7 @@ describe('Pipelines table in Commits and Merge requests', () => { propsData: { endpoint: 'endpoint', helpPagePath: 'foo', + autoDevopsHelpPath: 'foo', }, }).$mount(); }); diff --git a/spec/javascripts/pipelines/pipeline_url_spec.js b/spec/javascripts/pipelines/pipeline_url_spec.js index 48b6a7cc7eb..256fdbe743c 100644 --- a/spec/javascripts/pipelines/pipeline_url_spec.js +++ b/spec/javascripts/pipelines/pipeline_url_spec.js @@ -16,6 +16,7 @@ describe('Pipeline Url Component', () => { path: 'foo', flags: {}, }, + autoDevopsHelpPath: 'foo', }, }).$mount(); @@ -30,6 +31,7 @@ describe('Pipeline Url Component', () => { path: 'foo', flags: {}, }, + autoDevopsHelpPath: 'foo', }, }).$mount(); @@ -50,6 +52,7 @@ describe('Pipeline Url Component', () => { path: '/', }, }, + autoDevopsHelpPath: 'foo', }; const component = new PipelineUrlComponent({ @@ -73,6 +76,7 @@ describe('Pipeline Url Component', () => { path: 'foo', flags: {}, }, + autoDevopsHelpPath: 'foo', }, }).$mount(); @@ -91,6 +95,7 @@ describe('Pipeline Url Component', () => { stuck: true, }, }, + autoDevopsHelpPath: 'foo', }, }).$mount(); @@ -112,6 +117,7 @@ describe('Pipeline Url Component', () => { auto_devops: true, }, }, + autoDevopsHelpPath: 'foo', }, }).$mount(); diff --git a/spec/javascripts/pipelines/pipelines_table_row_spec.js b/spec/javascripts/pipelines/pipelines_table_row_spec.js index 7ce39dca112..d7456a48bc1 100644 --- a/spec/javascripts/pipelines/pipelines_table_row_spec.js +++ b/spec/javascripts/pipelines/pipelines_table_row_spec.js @@ -9,7 +9,7 @@ describe('Pipelines Table Row', () => { el: document.querySelector('.test-dom-element'), propsData: { pipeline, - service: {}, + autoDevopsHelpPath: 'foo', }, }).$mount(); }; diff --git a/spec/javascripts/pipelines/pipelines_table_spec.js b/spec/javascripts/pipelines/pipelines_table_spec.js index 3afe89c8db4..4f5eb42eb35 100644 --- a/spec/javascripts/pipelines/pipelines_table_spec.js +++ b/spec/javascripts/pipelines/pipelines_table_spec.js @@ -22,6 +22,7 @@ describe('Pipelines Table', () => { component = new PipelinesTableComponent({ propsData: { pipelines: [], + autoDevopsHelpPath: 'foo', }, }).$mount(); }); @@ -47,6 +48,7 @@ describe('Pipelines Table', () => { const component = new PipelinesTableComponent({ propsData: { pipelines: [], + autoDevopsHelpPath: 'foo', }, }).$mount(); expect(component.$el.querySelectorAll('.commit.gl-responsive-table-row').length).toEqual(0); @@ -58,6 +60,7 @@ describe('Pipelines Table', () => { const component = new PipelinesTableComponent({ propsData: { pipelines: [pipeline], + autoDevopsHelpPath: 'foo', }, }).$mount(); -- cgit v1.2.1 From 1c4d39c16940795054a886fbc59fc13a00ebfe40 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Fri, 1 Sep 2017 12:24:49 +0100 Subject: Fix documention path --- app/assets/javascripts/pipelines/components/pipelines.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/pipelines/components/pipelines.vue b/app/assets/javascripts/pipelines/components/pipelines.vue index 75e40da6d28..5ce4fe58e55 100644 --- a/app/assets/javascripts/pipelines/components/pipelines.vue +++ b/app/assets/javascripts/pipelines/components/pipelines.vue @@ -27,7 +27,7 @@ endpoint: pipelinesData.endpoint, cssClass: pipelinesData.cssClass, helpPagePath: pipelinesData.helpPagePath, - autoDevopsPath: pipelinesData.helpautoDevopsPath, + autoDevopsPath: pipelinesData.helpAutoDevopsPath, newPipelinePath: pipelinesData.newPipelinePath, canCreatePipeline: pipelinesData.canCreatePipeline, allPath: pipelinesData.allPath, -- cgit v1.2.1 From 64e23d75406188ab318c3727a38582bc496687c8 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Fri, 1 Sep 2017 14:25:15 +0100 Subject: Improves popover to show on focus CSS improvements after review --- .../pipelines/components/pipeline_url.vue | 25 +++++++++++----------- .../javascripts/vue_shared/directives/popover.js | 8 ++----- app/assets/stylesheets/pages/commits.scss | 2 +- app/assets/stylesheets/pages/pipelines.scss | 4 ---- 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/app/assets/javascripts/pipelines/components/pipeline_url.vue b/app/assets/javascripts/pipelines/components/pipeline_url.vue index b4a7fbec5f9..db10abdae83 100644 --- a/app/assets/javascripts/pipelines/components/pipeline_url.vue +++ b/app/assets/javascripts/pipelines/components/pipeline_url.vue @@ -25,11 +25,15 @@ user() { return this.pipeline.user; }, - autoDevOpsTitle() { - return '
This pipeline makes use of a predefined CI/CD configuration enabled by Auto DevOps.
'; - }, - autoDevOpsContent() { - return `Learn more about Auto DevOps`; + popoverOptions() { + return { + html: true, + delay: { hide: 600 }, + trigger: 'hover', + placement: 'top', + title: '
This pipeline makes use of a predefined CI/CD configuration enabled by Auto DevOps.
', + content: `Learn more about Auto DevOps`, + }; }, }, }; @@ -71,14 +75,9 @@ + class="js-pipeline-url-autodevops label label-info autodevops-link" + v-popover="popoverOptions" + role="button"> Auto DevOps popover + * popover */ export default { bind(el, binding) { - const renderHTML = binding.arg === 'html'; - - $(el).popover({ - html: renderHTML, - }); + $(el).popover(binding.value); }, unbind(el) { diff --git a/app/assets/stylesheets/pages/commits.scss b/app/assets/stylesheets/pages/commits.scss index 525e1d57fee..1fa815970eb 100644 --- a/app/assets/stylesheets/pages/commits.scss +++ b/app/assets/stylesheets/pages/commits.scss @@ -220,7 +220,7 @@ .commit, .generic_commit_status { - a:not(.label):not(.autodevops-link), + a:not(.autodevops-link), button { color: $gl-text-color; vertical-align: baseline; diff --git a/app/assets/stylesheets/pages/pipelines.scss b/app/assets/stylesheets/pages/pipelines.scss index 9071e1ca0c8..aaa0b344af5 100644 --- a/app/assets/stylesheets/pages/pipelines.scss +++ b/app/assets/stylesheets/pages/pipelines.scss @@ -936,7 +936,3 @@ button.mini-pipeline-graph-dropdown-toggle { font-weight: $gl-font-weight-normal; line-height: 1.5; } - -.autodevops-link { - color: $gl-link-color; -} -- cgit v1.2.1 From 74cd4d76e45c1e830aec3c8145afbe0dce765e4b Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Fri, 1 Sep 2017 14:46:02 +0100 Subject: Accomodate several tags in one cell --- app/assets/javascripts/pipelines/components/pipeline_url.vue | 4 ++-- app/assets/stylesheets/pages/commits.scss | 10 +++++++++- app/assets/stylesheets/pages/pipelines.scss | 4 ++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/pipelines/components/pipeline_url.vue b/app/assets/javascripts/pipelines/components/pipeline_url.vue index db10abdae83..f0b44dfa6d8 100644 --- a/app/assets/javascripts/pipelines/components/pipeline_url.vue +++ b/app/assets/javascripts/pipelines/components/pipeline_url.vue @@ -39,7 +39,7 @@ };