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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
89d3fcd1
Commit
89d3fcd1
authored
Dec 04, 2017
by
bikebilly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Auto DevOps checkboxes - backend
parent
50eb1252
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
137 deletions
+50
-137
app/controllers/projects/pipelines_settings_controller.rb
app/controllers/projects/pipelines_settings_controller.rb
+0
-1
app/helpers/auto_devops_helper.rb
app/helpers/auto_devops_helper.rb
+0
-16
app/services/projects/update_service.rb
app/services/projects/update_service.rb
+4
-6
spec/controllers/projects/pipelines_settings_controller_spec.rb
...ontrollers/projects/pipelines_settings_controller_spec.rb
+9
-6
spec/helpers/auto_devops_helper_spec.rb
spec/helpers/auto_devops_helper_spec.rb
+0
-100
spec/services/projects/update_service_spec.rb
spec/services/projects/update_service_spec.rb
+37
-8
No files found.
app/controllers/projects/pipelines_settings_controller.rb
View file @
89d3fcd1
...
...
@@ -29,7 +29,6 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController
:runners_token
,
:builds_enabled
,
:build_allow_git_fetch
,
:build_timeout_in_minutes
,
:build_coverage_regex
,
:public_builds
,
:auto_cancel_pending_pipelines
,
:ci_config_path
,
:run_auto_devops_pipeline_implicit
,
:run_auto_devops_pipeline_explicit
,
auto_devops_attributes:
[
:id
,
:domain
,
:enabled
]
)
end
...
...
app/helpers/auto_devops_helper.rb
View file @
89d3fcd1
...
...
@@ -8,22 +8,6 @@ module AutoDevopsHelper
!
project
.
ci_service
end
def
show_run_auto_devops_pipeline_checkbox_for_instance_setting?
(
project
)
return
false
if
project
.
repository
.
gitlab_ci_yml
if
project
&
.
auto_devops
&
.
enabled
.
present?
!
project
.
auto_devops
.
enabled
&&
current_application_settings
.
auto_devops_enabled?
else
current_application_settings
.
auto_devops_enabled?
end
end
def
show_run_auto_devops_pipeline_checkbox_for_explicit_setting?
(
project
)
return
false
if
project
.
repository
.
gitlab_ci_yml
!
project
.
auto_devops_enabled?
end
def
auto_devops_warning_message
(
project
)
missing_domain
=
!
project
.
auto_devops
&
.
has_domain?
missing_service
=
!
project
.
deployment_platform
&
.
active?
...
...
app/services/projects/update_service.rb
View file @
89d3fcd1
...
...
@@ -15,7 +15,7 @@ module Projects
return
error
(
"Could not set the default branch"
)
unless
project
.
change_head
(
params
[
:default_branch
])
end
if
project
.
update_attributes
(
update_params
)
if
project
.
update_attributes
(
params
.
except
(
:default_branch
)
)
if
project
.
previous_changes
.
include?
(
'path'
)
project
.
rename_repo
else
...
...
@@ -32,15 +32,13 @@ module Projects
end
def
run_auto_devops_pipeline?
params
.
dig
(
:run_auto_devops_pipeline_explicit
)
==
'true'
||
params
.
dig
(
:run_auto_devops_pipeline_implicit
)
==
'true'
return
false
if
project
.
repository
.
gitlab_ci_yml
||
!
project
.
auto_devops
.
previous_changes
.
include?
(
'enabled'
)
project
.
auto_devops
.
enabled?
||
(
project
.
auto_devops
.
enabled
.
nil?
&&
current_application_settings
.
auto_devops_enabled?
)
end
private
def
update_params
params
.
except
(
:default_branch
,
:run_auto_devops_pipeline_explicit
,
:run_auto_devops_pipeline_implicit
)
end
def
renaming_project_with_container_registry_tags?
new_path
=
params
[
:path
]
...
...
spec/controllers/projects/pipelines_settings_controller_spec.rb
View file @
89d3fcd1
...
...
@@ -16,14 +16,13 @@ describe Projects::PipelinesSettingsController do
patch
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
project:
{
auto_devops_attributes:
params
,
run_auto_devops_pipeline_implicit:
'false'
,
run_auto_devops_pipeline_explicit:
auto_devops_pipeline
}
project:
{
auto_devops_attributes:
params
}
end
context
'when updating the auto_devops settings'
do
let
(
:params
)
{
{
enabled:
''
,
domain:
'mepmep.md'
}
}
let
(
:auto_devops_pipeline
)
{
'false'
}
it
'redirects to the settings page'
do
subject
...
...
@@ -44,7 +43,9 @@ describe Projects::PipelinesSettingsController do
end
context
'when run_auto_devops_pipeline is true'
do
let
(
:auto_devops_pipeline
)
{
'true'
}
before
do
expect_any_instance_of
(
Projects
::
UpdateService
).
to
receive
(
:run_auto_devops_pipeline?
).
and_return
(
true
)
end
it
'queues a CreatePipelineWorker'
do
expect
(
CreatePipelineWorker
).
to
receive
(
:perform_async
).
with
(
project
.
id
,
user
.
id
,
project
.
default_branch
,
:web
,
any_args
)
...
...
@@ -54,7 +55,9 @@ describe Projects::PipelinesSettingsController do
end
context
'when run_auto_devops_pipeline is not true'
do
let
(
:auto_devops_pipeline
)
{
'false'
}
before
do
expect_any_instance_of
(
Projects
::
UpdateService
).
to
receive
(
:run_auto_devops_pipeline?
).
and_return
(
false
)
end
it
'does not queue a CreatePipelineWorker'
do
expect
(
CreatePipelineWorker
).
not_to
receive
(
:perform_async
).
with
(
project
.
id
,
user
.
id
,
:web
,
any_args
)
...
...
spec/helpers/auto_devops_helper_spec.rb
View file @
89d3fcd1
...
...
@@ -82,104 +82,4 @@ describe AutoDevopsHelper do
it
{
is_expected
.
to
eq
(
false
)
}
end
end
describe
'.show_run_auto_devops_pipeline_checkbox_for_instance_setting?'
do
subject
{
helper
.
show_run_auto_devops_pipeline_checkbox_for_instance_setting?
(
project
)
}
context
'when master contains a .gitlab-ci.yml file'
do
before
do
allow
(
project
.
repository
).
to
receive
(
:gitlab_ci_yml
).
and_return
(
"script: ['test']"
)
end
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when auto devops is explicitly enabled'
do
before
do
project
.
create_auto_devops!
(
enabled:
true
)
end
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when auto devops is explicitly disabled'
do
before
do
project
.
create_auto_devops!
(
enabled:
false
)
end
context
'when auto devops is enabled system-wide'
do
before
do
stub_application_setting
(
auto_devops_enabled:
true
)
end
it
{
is_expected
.
to
eq
(
true
)
}
end
context
'when auto devops is disabled system-wide'
do
before
do
stub_application_setting
(
auto_devops_enabled:
false
)
end
it
{
is_expected
.
to
eq
(
false
)
}
end
end
context
'when auto devops is set to instance setting'
do
before
do
project
.
create_auto_devops!
(
enabled:
nil
)
end
it
{
is_expected
.
to
eq
(
false
)
}
end
end
describe
'.show_run_auto_devops_pipeline_checkbox_for_explicit_setting?'
do
subject
{
helper
.
show_run_auto_devops_pipeline_checkbox_for_explicit_setting?
(
project
)
}
context
'when master contains a .gitlab-ci.yml file'
do
before
do
allow
(
project
.
repository
).
to
receive
(
:gitlab_ci_yml
).
and_return
(
"script: ['test']"
)
end
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when auto devops is explicitly enabled'
do
before
do
project
.
create_auto_devops!
(
enabled:
true
)
end
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when auto devops is explicitly disabled'
do
before
do
project
.
create_auto_devops!
(
enabled:
false
)
end
it
{
is_expected
.
to
eq
(
true
)
}
end
context
'when auto devops is set to instance setting'
do
before
do
project
.
create_auto_devops!
(
enabled:
nil
)
end
context
'when auto devops is enabled system-wide'
do
before
do
stub_application_setting
(
auto_devops_enabled:
true
)
end
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when auto devops is disabled system-wide'
do
before
do
stub_application_setting
(
auto_devops_enabled:
false
)
end
it
{
is_expected
.
to
eq
(
true
)
}
end
end
end
end
spec/services/projects/update_service_spec.rb
View file @
89d3fcd1
...
...
@@ -199,24 +199,53 @@ describe Projects::UpdateService do
end
describe
'#run_auto_devops_pipeline?'
do
subject
{
described_class
.
new
(
project
,
user
,
params
).
run_auto_devops_pipeline?
}
subject
{
described_class
.
new
(
project
,
user
).
run_auto_devops_pipeline?
}
context
'when neither pipeline setting is true'
do
let
(
:params
)
{
{}
}
context
'when master contains a .gitlab-ci.yml file'
do
before
do
allow
(
project
.
repository
).
to
receive
(
:gitlab_ci_yml
).
and_return
(
"script: ['test']"
)
end
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when run_auto_devops_pipeline_explicit is true'
do
let
(
:params
)
{
{
run_auto_devops_pipeline_explicit:
'true'
}
}
context
'when auto devops is explicitly enabled'
do
before
do
project
.
create_auto_devops!
(
enabled:
true
)
end
it
{
is_expected
.
to
eq
(
true
)
}
end
context
'when run_auto_devops_pipeline_implicit is true'
do
let
(
:params
)
{
{
run_auto_devops_pipeline_implicit:
'true'
}
}
context
'when auto devops is explicitly disabled'
do
before
do
project
.
create_auto_devops!
(
enabled:
false
)
end
it
{
is_expected
.
to
eq
(
true
)
}
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when auto devops is set to instance setting'
do
before
do
project
.
create_auto_devops!
(
enabled:
nil
)
allow
(
project
.
auto_devops
).
to
receive
(
:previous_changes
).
and_return
(
'enabled'
=>
true
)
end
context
'when auto devops is enabled system-wide'
do
before
do
stub_application_setting
(
auto_devops_enabled:
true
)
end
it
{
is_expected
.
to
eq
(
true
)
}
end
context
'when auto devops is disabled system-wide'
do
before
do
stub_application_setting
(
auto_devops_enabled:
false
)
end
it
{
is_expected
.
to
eq
(
false
)
}
end
end
end
...
...
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