Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4a74798a
Commit
4a74798a
authored
Jul 19, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Pipelines settings under `gitlab.com/gitlab-org/gitlab-ce/pipelines/settings`
parent
22be5aed
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
73 additions
and
15 deletions
+73
-15
app/controllers/projects/builds_controller.rb
app/controllers/projects/builds_controller.rb
+1
-6
app/controllers/projects/pipelines_controller.rb
app/controllers/projects/pipelines_controller.rb
+32
-1
app/controllers/projects/refs_controller.rb
app/controllers/projects/refs_controller.rb
+1
-1
app/services/projects/update_service.rb
app/services/projects/update_service.rb
+1
-0
app/views/layouts/nav/_project_settings.html.haml
app/views/layouts/nav/_project_settings.html.haml
+2
-2
app/views/projects/pipelines/settings.html.haml
app/views/projects/pipelines/settings.html.haml
+1
-1
config/routes.rb
config/routes.rb
+5
-1
spec/features/pipelines_spec.rb
spec/features/pipelines_spec.rb
+29
-2
spec/features/projects/badges/list_spec.rb
spec/features/projects/badges/list_spec.rb
+1
-1
No files found.
app/controllers/projects/builds_controller.rb
View file @
4a74798a
class
Projects::BuildsController
<
Projects
::
ApplicationController
class
Projects::BuildsController
<
Projects
::
ApplicationController
before_action
:build
,
except:
[
:index
,
:cancel_all
,
:settings
]
before_action
:build
,
except:
[
:index
,
:cancel_all
]
before_action
:authorize_read_build!
,
except:
[
:cancel
,
:cancel_all
,
:retry
]
before_action
:authorize_read_build!
,
except:
[
:cancel
,
:cancel_all
,
:retry
]
before_action
:authorize_update_build!
,
except:
[
:index
,
:show
,
:status
,
:raw
]
before_action
:authorize_update_build!
,
except:
[
:index
,
:show
,
:status
,
:raw
]
layout
'project'
layout
'project'
...
@@ -27,11 +27,6 @@ class Projects::BuildsController < Projects::ApplicationController
...
@@ -27,11 +27,6 @@ class Projects::BuildsController < Projects::ApplicationController
redirect_to
namespace_project_builds_path
(
project
.
namespace
,
project
)
redirect_to
namespace_project_builds_path
(
project
.
namespace
,
project
)
end
end
def
settings
@ref
=
params
[
:ref
]
||
@project
.
default_branch
||
'master'
@build_badge
=
Gitlab
::
Badge
::
Build
.
new
(
@project
,
@ref
)
end
def
show
def
show
@builds
=
@project
.
pipelines
.
find_by_sha
(
@build
.
sha
).
builds
.
order
(
'id DESC'
)
@builds
=
@project
.
pipelines
.
find_by_sha
(
@build
.
sha
).
builds
.
order
(
'id DESC'
)
@builds
=
@builds
.
where
(
"id not in (?)"
,
@build
.
id
)
@builds
=
@builds
.
where
(
"id not in (?)"
,
@build
.
id
)
...
...
app/controllers/projects/pipelines_controller.rb
View file @
4a74798a
class
Projects::PipelinesController
<
Projects
::
ApplicationController
class
Projects::PipelinesController
<
Projects
::
ApplicationController
before_action
:pipeline
,
except:
[
:index
,
:new
,
:create
]
before_action
:pipeline
,
except:
[
:index
,
:new
,
:create
,
:settings
,
:update_settings
]
before_action
:commit
,
only:
[
:show
]
before_action
:commit
,
only:
[
:show
]
before_action
:authorize_read_pipeline!
before_action
:authorize_read_pipeline!
before_action
:authorize_create_pipeline!
,
only:
[
:new
,
:create
]
before_action
:authorize_create_pipeline!
,
only:
[
:new
,
:create
]
before_action
:authorize_update_pipeline!
,
only:
[
:retry
,
:cancel
]
before_action
:authorize_update_pipeline!
,
only:
[
:retry
,
:cancel
]
before_action
:authorize_admin_pipeline!
,
only:
[
:settings
,
:update_settings
]
def
index
def
index
@scope
=
params
[
:scope
]
@scope
=
params
[
:scope
]
...
@@ -43,12 +44,42 @@ class Projects::PipelinesController < Projects::ApplicationController
...
@@ -43,12 +44,42 @@ class Projects::PipelinesController < Projects::ApplicationController
redirect_back_or_default
default:
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
redirect_back_or_default
default:
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
end
end
def
settings
@ref
=
params
[
:ref
]
||
@project
.
default_branch
||
'master'
@build_badge
=
Gitlab
::
Badge
::
Build
.
new
(
@project
,
@ref
)
end
def
update_settings
status
=
::
Projects
::
UpdateService
.
new
(
@project
,
current_user
,
pipelines_settings_params
).
execute
respond_to
do
|
format
|
if
status
flash
[
:notice
]
=
"CI/CD Pipelines settings for '
#{
@project
.
name
}
' was successfully updated."
format
.
html
do
redirect_to
(
settings_namespace_project_pipelines_path
(
@project
.
namespace
,
@project
),
notice:
"CI/CD Pipelines settings for '
#{
@project
.
name
}
' was successfully updated."
)
end
else
format
.
html
{
render
'settings'
}
end
end
end
private
private
def
create_params
def
create_params
params
.
require
(
:pipeline
).
permit
(
:ref
)
params
.
require
(
:pipeline
).
permit
(
:ref
)
end
end
def
pipelines_settings_params
params
.
require
(
:project
).
permit
(
:runners_token
,
:builds_enabled
,
:build_allow_git_fetch
,
:build_timeout_in_minutes
,
:build_coverage_regex
,
:public_builds
)
end
def
pipeline
def
pipeline
@pipeline
||=
project
.
pipelines
.
find_by!
(
id:
params
[
:id
])
@pipeline
||=
project
.
pipelines
.
find_by!
(
id:
params
[
:id
])
end
end
...
...
app/controllers/projects/refs_controller.rb
View file @
4a74798a
...
@@ -25,7 +25,7 @@ class Projects::RefsController < Projects::ApplicationController
...
@@ -25,7 +25,7 @@ class Projects::RefsController < Projects::ApplicationController
when
"graphs_commits"
when
"graphs_commits"
commits_namespace_project_graph_path
(
@project
.
namespace
,
@project
,
@id
)
commits_namespace_project_graph_path
(
@project
.
namespace
,
@project
,
@id
)
when
"badges"
when
"badges"
settings_namespace_project_
build
s_path
(
@project
.
namespace
,
@project
,
ref:
@id
)
settings_namespace_project_
pipeline
s_path
(
@project
.
namespace
,
@project
,
ref:
@id
)
else
else
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@id
)
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@id
)
end
end
...
...
app/services/projects/update_service.rb
View file @
4a74798a
...
@@ -23,6 +23,7 @@ module Projects
...
@@ -23,6 +23,7 @@ module Projects
if
project
.
previous_changes
.
include?
(
'path'
)
if
project
.
previous_changes
.
include?
(
'path'
)
project
.
rename_repo
project
.
rename_repo
end
end
true
end
end
end
end
end
end
...
...
app/views/layouts/nav/_project_settings.html.haml
View file @
4a74798a
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
=
link_to
namespace_project_triggers_path
(
@project
.
namespace
,
@project
),
title:
'Triggers'
do
=
link_to
namespace_project_triggers_path
(
@project
.
namespace
,
@project
),
title:
'Triggers'
do
%span
%span
Triggers
Triggers
=
nav_link
(
controller: :
build
s
)
do
=
nav_link
(
controller: :
pipeline
s
)
do
=
link_to
settings_namespace_project_
build
s_path
(
@project
.
namespace
,
@project
),
title:
'CI/CD Pipelines'
do
=
link_to
settings_namespace_project_
pipeline
s_path
(
@project
.
namespace
,
@project
),
title:
'CI/CD Pipelines'
do
%span
%span
CI/CD Pipelines
CI/CD Pipelines
app/views/projects/
build
s/settings.html.haml
→
app/views/projects/
pipeline
s/settings.html.haml
View file @
4a74798a
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
.col-lg-9
.col-lg-9
%h5
.prepend-top-0
%h5
.prepend-top-0
Pipelines
Pipelines
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
]
,
remote:
true
,
authenticity_token:
true
do
|
f
|
=
form_for
@project
,
url:
settings_namespace_project_pipelines_path
(
@project
.
namespace
.
becomes
(
Namespace
),
@project
)
,
remote:
true
,
authenticity_token:
true
do
|
f
|
%fieldset
.builds-feature
%fieldset
.builds-feature
-
unless
@repository
.
gitlab_ci_yml
-
unless
@repository
.
gitlab_ci_yml
.form-group
.form-group
...
...
config/routes.rb
View file @
4a74798a
...
@@ -733,6 +733,11 @@ Rails.application.routes.draw do
...
@@ -733,6 +733,11 @@ Rails.application.routes.draw do
resources
:triggers
,
only:
[
:index
,
:create
,
:destroy
]
resources
:triggers
,
only:
[
:index
,
:create
,
:destroy
]
resources
:pipelines
,
only:
[
:index
,
:new
,
:create
,
:show
]
do
resources
:pipelines
,
only:
[
:index
,
:new
,
:create
,
:show
]
do
collection
do
get
:settings
patch
:settings
,
to:
'pipelines#update_settings'
end
member
do
member
do
post
:cancel
post
:cancel
post
:retry
post
:retry
...
@@ -744,7 +749,6 @@ Rails.application.routes.draw do
...
@@ -744,7 +749,6 @@ Rails.application.routes.draw do
resources
:builds
,
only:
[
:index
,
:show
],
constraints:
{
id:
/\d+/
}
do
resources
:builds
,
only:
[
:index
,
:show
],
constraints:
{
id:
/\d+/
}
do
collection
do
collection
do
post
:cancel_all
post
:cancel_all
get
:settings
end
end
member
do
member
do
...
...
spec/features/pipelines_spec.rb
View file @
4a74798a
require
'spec_helper'
require
'spec_helper'
describe
"Pipelines"
do
feature
"Pipelines"
,
feature:
true
do
include
GitlabRoutingHelper
include
GitlabRoutingHelper
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:role
)
{
:developer
}
before
do
before
do
login_as
(
user
)
login_as
(
user
)
project
.
team
<<
[
user
,
:developer
]
project
.
team
<<
[
user
,
role
]
end
end
describe
'GET /:project/pipelines'
do
describe
'GET /:project/pipelines'
do
...
@@ -186,4 +187,30 @@ describe "Pipelines" do
...
@@ -186,4 +187,30 @@ describe "Pipelines" do
it
{
expect
(
page
).
to
have_content
(
'Reference not found'
)
}
it
{
expect
(
page
).
to
have_content
(
'Reference not found'
)
}
end
end
end
end
describe
'Pipelines settings'
do
background
do
visit
settings_namespace_project_pipelines_path
(
project
.
namespace
,
project
)
end
context
'for developer'
do
given
(
:role
)
{
:developer
}
scenario
'to be disallowed to view'
do
expect
(
page
.
status_code
).
to
eq
(
404
)
end
end
context
'for master'
do
given
(
:role
)
{
:master
}
scenario
'be allowed to change'
do
fill_in
(
'Test coverage parsing'
,
with:
'coverage_regex'
)
click_on
'Save changes'
expect
(
page
.
status_code
).
to
eq
(
200
)
expect
(
page
).
to
have_field
(
'Test coverage parsing'
,
with:
'coverage_regex'
)
end
end
end
end
end
spec/features/projects/badges/list_spec.rb
View file @
4a74798a
...
@@ -6,7 +6,7 @@ feature 'list of badges' do
...
@@ -6,7 +6,7 @@ feature 'list of badges' do
project
=
create
(
:project
)
project
=
create
(
:project
)
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
login_as
(
user
)
visit
settings_namespace_project_
build
s_path
(
project
.
namespace
,
project
)
visit
settings_namespace_project_
pipeline
s_path
(
project
.
namespace
,
project
)
end
end
scenario
'user displays list of badges'
do
scenario
'user displays list of badges'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment