diff options
author | James Edwards-Jones <jedwardsjones@gitlab.com> | 2018-02-19 02:47:37 +0300 |
---|---|---|
committer | James Edwards-Jones <jedwardsjones@gitlab.com> | 2018-03-07 20:50:10 +0300 |
commit | 6253d4456a98613b419d766a03af7ff9b9fcf2af (patch) | |
tree | 6776fed77ca12bd4da5f8efec3301df124e08bd8 | |
parent | d9ca76559f740bdeac78bcd9a7cfe60df5ef9795 (diff) |
Backport changes from EE's GithubService integration
Adds detailed_status to pipeline hook data
Adds detailed_description option for Services
Integration edit page renders 404 if a service is disabled
-rw-r--r-- | app/controllers/projects/services_controller.rb | 5 | ||||
-rw-r--r-- | app/views/projects/services/_form.html.haml | 3 | ||||
-rw-r--r-- | changelogs/unreleased/ce-jej-github-project-service-for-ci.yml | 5 | ||||
-rw-r--r-- | lib/gitlab/data_builder/pipeline.rb | 1 | ||||
-rw-r--r-- | spec/lib/gitlab/data_builder/pipeline_spec.rb | 1 |
5 files changed, 15 insertions, 0 deletions
diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb index daa5c88aae0..b0da0d4dac5 100644 --- a/app/controllers/projects/services_controller.rb +++ b/app/controllers/projects/services_controller.rb @@ -3,6 +3,7 @@ class Projects::ServicesController < Projects::ApplicationController # Authorize before_action :authorize_admin_project! + before_action :ensure_service_enabled before_action :service, only: [:edit, :update, :test] respond_to :html @@ -54,4 +55,8 @@ class Projects::ServicesController < Projects::ApplicationController def service @service ||= @project.find_or_initialize_service(params[:id]) end + + def ensure_service_enabled + render_404 unless service + end end diff --git a/app/views/projects/services/_form.html.haml b/app/views/projects/services/_form.html.haml index 17e804d682b..053ea24b848 100644 --- a/app/views/projects/services/_form.html.haml +++ b/app/views/projects/services/_form.html.haml @@ -5,6 +5,9 @@ = boolean_to_icon @service.activated? %p= @service.description + + - if @service.respond_to?(:detailed_description) + %p= @service.detailed_description .col-lg-9 = form_for(@service, as: :service, url: project_service_path(@project, @service.to_param), method: :put, html: { class: 'gl-show-field-errors form-horizontal integration-settings-form js-integration-settings-form', data: { 'can-test' => @service.can_test?, 'test-url' => test_project_service_path(@project, @service) } }) do |form| = render 'shared/service_settings', form: form, subject: @service diff --git a/changelogs/unreleased/ce-jej-github-project-service-for-ci.yml b/changelogs/unreleased/ce-jej-github-project-service-for-ci.yml new file mode 100644 index 00000000000..6102b7ecd93 --- /dev/null +++ b/changelogs/unreleased/ce-jej-github-project-service-for-ci.yml @@ -0,0 +1,5 @@ +--- +title: Hook data for pipelines includes detailed_status +merge_request: 17607 +author: +type: changed diff --git a/lib/gitlab/data_builder/pipeline.rb b/lib/gitlab/data_builder/pipeline.rb index e47fb85b5ee..1e283cc092b 100644 --- a/lib/gitlab/data_builder/pipeline.rb +++ b/lib/gitlab/data_builder/pipeline.rb @@ -22,6 +22,7 @@ module Gitlab sha: pipeline.sha, before_sha: pipeline.before_sha, status: pipeline.status, + detailed_status: pipeline.detailed_status(nil).label, stages: pipeline.stages_names, created_at: pipeline.created_at, finished_at: pipeline.finished_at, diff --git a/spec/lib/gitlab/data_builder/pipeline_spec.rb b/spec/lib/gitlab/data_builder/pipeline_spec.rb index f13041e498c..9ca960502c8 100644 --- a/spec/lib/gitlab/data_builder/pipeline_spec.rb +++ b/spec/lib/gitlab/data_builder/pipeline_spec.rb @@ -26,6 +26,7 @@ describe Gitlab::DataBuilder::Pipeline do it { expect(attributes[:tag]).to eq(pipeline.tag) } it { expect(attributes[:id]).to eq(pipeline.id) } it { expect(attributes[:status]).to eq(pipeline.status) } + it { expect(attributes[:detailed_status]).to eq('passed') } it { expect(build_data).to be_a(Hash) } it { expect(build_data[:id]).to eq(build.id) } |