BigW Consortium Gitlab

Move CI services to project settings area

parent 1e06cabf
...@@ -33,6 +33,7 @@ v 8.1.0 (unreleased) ...@@ -33,6 +33,7 @@ v 8.1.0 (unreleased)
- Add user preference to change layout width (Peter Göbel) - Add user preference to change layout width (Peter Göbel)
- Use commit status in merge request widget as preffered source of CI status - Use commit status in merge request widget as preffered source of CI status
- Integrate CI commit and build pages into project pages - Integrate CI commit and build pages into project pages
- Move CI services page to project settings area
v 8.0.4 v 8.0.4
- Fix Message-ID header to be RFC 2111-compliant to prevent e-mails being dropped (Stan Hu) - Fix Message-ID header to be RFC 2111-compliant to prevent e-mails being dropped (Stan Hu)
......
module Ci class Projects::CiServicesController < Projects::ApplicationController
class ServicesController < Ci::ApplicationController before_action :ci_project
before_action :authenticate_user! before_action :authorize_admin_project!
before_action :project
before_action :authorize_access_project!
before_action :authorize_manage_project!
before_action :service, only: [:edit, :update, :test]
respond_to :html layout "project_settings"
layout 'ci/project'
def index def index
@project.build_missing_services @ci_project.build_missing_services
@services = @project.services.reload @services = @ci_project.services.reload
end end
def edit def edit
service
end end
def update def update
if @service.update_attributes(service_params) if @service.update_attributes(service_params)
redirect_to edit_ci_project_service_path(@project, @service.to_param) redirect_to edit_namespace_project_ci_service_path(@project, @project.namespace, @service.to_param)
else else
render 'edit' render 'edit'
end end
...@@ -40,12 +35,8 @@ module Ci ...@@ -40,12 +35,8 @@ module Ci
private private
def project
@project = Ci::Project.find(params[:project_id])
end
def service def service
@service ||= @project.services.find { |service| service.to_param == params[:id] } @service ||= @ci_project.services.find { |service| service.to_param == params[:id] }
end end
def service_params def service_params
...@@ -55,5 +46,4 @@ module Ci ...@@ -55,5 +46,4 @@ module Ci
:hipchat_token, :hipchat_room, :hipchat_server :hipchat_token, :hipchat_room, :hipchat_server
) )
end end
end
end end
...@@ -5,11 +5,6 @@ ...@@ -5,11 +5,6 @@
%span %span
Back to project Back to project
%li.separate-item %li.separate-item
= nav_link path: ['services#index', 'services#edit'] do
= link_to ci_project_services_path(@project) do
= icon('share fw')
%span
Services
= nav_link path: 'events#index' do = nav_link path: 'events#index' do
= link_to ci_project_events_path(@project) do = link_to ci_project_events_path(@project) do
= icon('book fw') = icon('book fw')
......
...@@ -60,8 +60,8 @@ ...@@ -60,8 +60,8 @@
= icon('building fw') = icon('building fw')
%span %span
CI Settings CI Settings
= nav_link path: ['ci/services#index', 'ci/services#edit'] do = nav_link controller: 'ci_services' do
= link_to ci_project_services_path(@project.gitlab_ci_project) do = link_to namespace_project_ci_services_path(@project.namespace, @project) do
= icon('share fw') = icon('share fw')
%span %span
CI Services CI Services
......
...@@ -4,13 +4,10 @@ ...@@ -4,13 +4,10 @@
%p= @service.description %p= @service.description
.back-link
= link_to ci_project_services_path(@project) do
&larr; to services
%hr %hr
= form_for(@service, as: :service, url: ci_project_service_path(@project, @service.to_param), method: :put, html: { class: 'form-horizontal' }) do |f| = form_for(@service, as: :service, url: namespace_project_ci_service_path(@project.namespace, @project, @service.to_param), method: :put, html: { class: 'form-horizontal' }) do |f|
- if @service.errors.any? - if @service.errors.any?
.alert.alert-danger .alert.alert-danger
%ul %ul
...@@ -54,4 +51,4 @@ ...@@ -54,4 +51,4 @@
= f.submit 'Save', class: 'btn btn-save' = f.submit 'Save', class: 'btn btn-save'
&nbsp; &nbsp;
- if @service.valid? && @service.activated? && @service.can_test? - if @service.valid? && @service.activated? && @service.can_test?
= link_to 'Test settings', test_ci_project_service_path(@project, @service.to_param), class: 'btn' = link_to 'Test settings', test_namespace_project_ci_service_path(@project.namespace, @project, @service.to_param), class: 'btn'
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
%td %td
= boolean_to_icon service.activated? = boolean_to_icon service.activated?
%td %td
= link_to edit_ci_project_service_path(@project, service.to_param) do = link_to edit_namespace_project_ci_service_path(@project.namespace, @project, service.to_param) do
%strong= service.title %strong= service.title
%td %td
= service.description = service.description
......
...@@ -22,12 +22,6 @@ Gitlab::Application.routes.draw do ...@@ -22,12 +22,6 @@ Gitlab::Application.routes.draw do
get :dumped_yaml get :dumped_yaml
end end
resources :services, only: [:index, :edit, :update] do
member do
get :test
end
end
resources :runner_projects, only: [:create, :destroy] resources :runner_projects, only: [:create, :destroy]
resources :events, only: [:index] resources :events, only: [:index]
...@@ -576,6 +570,12 @@ Gitlab::Application.routes.draw do ...@@ -576,6 +570,12 @@ Gitlab::Application.routes.draw do
end end
end end
resources :ci_services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do
member do
get :test
end
end
resources :builds, only: [:show] do resources :builds, only: [:show] do
member do member do
get :cancel get :cancel
......
require "spec_helper"
describe Ci::CommitsController do
describe "GET /status" do
it "returns status of commit" do
commit = FactoryGirl.create :ci_commit
get :status, id: commit.sha, ref_id: commit.ref, project_id: commit.project.id
expect(response).to be_success
expect(response.code).to eq('200')
JSON.parse(response.body)["status"] == "pending"
end
it "returns not_found status" do
commit = FactoryGirl.create :ci_commit
get :status, id: commit.sha, ref_id: "deploy", project_id: commit.project.id
expect(response).to be_success
expect(response.code).to eq('200')
JSON.parse(response.body)["status"] == "not_found"
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment