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
ad4d5788
Commit
ad4d5788
authored
Jan 05, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
688580ca
52d0c0ed
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
115 additions
and
6 deletions
+115
-6
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+10
-5
app/views/shared/_auto_devops_implicitly_enabled_banner.html.haml
...s/shared/_auto_devops_implicitly_enabled_banner.html.haml
+1
-1
changelogs/unreleased/52446-hide-ado-project-banner-for-ci-file-or-ci-disabled.yml
...46-hide-ado-project-banner-for-ci-file-or-ci-disabled.yml
+5
-0
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+99
-0
No files found.
app/helpers/projects_helper.rb
View file @
ad4d5788
...
...
@@ -206,12 +206,10 @@ module ProjectsHelper
current_user
.
require_extra_setup_for_git_auth?
end
def
show_auto_devops_implicitly_enabled_banner?
(
project
)
cookie_key
=
"hide_auto_devops_implicitly_enabled_banner_
#{
project
.
id
}
"
def
show_auto_devops_implicitly_enabled_banner?
(
project
,
user
)
return
false
unless
user_can_see_auto_devops_implicitly_enabled_banner?
(
project
,
user
)
project
.
has_auto_devops_implicitly_enabled?
&&
cookies
[
cookie_key
.
to_sym
].
blank?
&&
(
project
.
owner
==
current_user
||
project
.
team
.
maintainer?
(
current_user
))
cookies
[
"hide_auto_devops_implicitly_enabled_banner_
#{
project
.
id
}
"
.
to_sym
].
blank?
end
def
link_to_set_password
...
...
@@ -581,4 +579,11 @@ module ProjectsHelper
gcp
]
end
def
user_can_see_auto_devops_implicitly_enabled_banner?
(
project
,
user
)
Ability
.
allowed?
(
user
,
:admin_project
,
project
)
&&
project
.
has_auto_devops_implicitly_enabled?
&&
project
.
builds_enabled?
&&
!
project
.
repository
.
gitlab_ci_yml
end
end
app/views/shared/_auto_devops_implicitly_enabled_banner.html.haml
View file @
ad4d5788
-
if
show_auto_devops_implicitly_enabled_banner?
(
project
)
-
if
show_auto_devops_implicitly_enabled_banner?
(
project
,
current_user
)
.auto-devops-implicitly-enabled-banner.alert.alert-warning
-
more_information_link
=
link_to
_
(
'More information'
),
help_page_path
(
'topics/autodevops/index.md'
),
target:
'_blank'
,
class:
'alert-link'
-
auto_devops_message
=
s_
(
"AutoDevOps|The Auto DevOps pipeline has been enabled and will be used if no alternative CI configuration file is found. %{more_information_link}"
)
%
{
more_information_link:
more_information_link
}
...
...
changelogs/unreleased/52446-hide-ado-project-banner-for-ci-file-or-ci-disabled.yml
0 → 100644
View file @
ad4d5788
---
title
:
Don't show Auto DevOps enabled banner for projects with CI file or CI disabled
merge_request
:
24067
author
:
type
:
other
spec/helpers/projects_helper_spec.rb
View file @
ad4d5788
...
...
@@ -638,4 +638,103 @@ describe ProjectsHelper do
end
end
end
describe
'#show_auto_devops_implicitly_enabled_banner?'
do
using
RSpec
::
Parameterized
::
TableSyntax
let
(
:user
)
{
create
(
:user
)
}
let
(
:feature_visibilities
)
do
{
enabled:
ProjectFeature
::
ENABLED
,
disabled:
ProjectFeature
::
DISABLED
}
end
where
(
:global_setting
,
:project_setting
,
:builds_visibility
,
:gitlab_ci_yml
,
:user_access
,
:result
)
do
# With ADO implicitly enabled scenarios
true
|
nil
|
:disabled
|
true
|
:developer
|
false
true
|
nil
|
:disabled
|
true
|
:maintainer
|
false
true
|
nil
|
:disabled
|
true
|
:owner
|
false
true
|
nil
|
:disabled
|
false
|
:developer
|
false
true
|
nil
|
:disabled
|
false
|
:maintainer
|
false
true
|
nil
|
:disabled
|
false
|
:owner
|
false
true
|
nil
|
:enabled
|
true
|
:developer
|
false
true
|
nil
|
:enabled
|
true
|
:maintainer
|
false
true
|
nil
|
:enabled
|
true
|
:owner
|
false
true
|
nil
|
:enabled
|
false
|
:developer
|
false
true
|
nil
|
:enabled
|
false
|
:maintainer
|
true
true
|
nil
|
:enabled
|
false
|
:owner
|
true
# With ADO enabled scenarios
true
|
true
|
:disabled
|
true
|
:developer
|
false
true
|
true
|
:disabled
|
true
|
:maintainer
|
false
true
|
true
|
:disabled
|
true
|
:owner
|
false
true
|
true
|
:disabled
|
false
|
:developer
|
false
true
|
true
|
:disabled
|
false
|
:maintainer
|
false
true
|
true
|
:disabled
|
false
|
:owner
|
false
true
|
true
|
:enabled
|
true
|
:developer
|
false
true
|
true
|
:enabled
|
true
|
:maintainer
|
false
true
|
true
|
:enabled
|
true
|
:owner
|
false
true
|
true
|
:enabled
|
false
|
:developer
|
false
true
|
true
|
:enabled
|
false
|
:maintainer
|
false
true
|
true
|
:enabled
|
false
|
:owner
|
false
# With ADO disabled scenarios
true
|
false
|
:disabled
|
true
|
:developer
|
false
true
|
false
|
:disabled
|
true
|
:maintainer
|
false
true
|
false
|
:disabled
|
true
|
:owner
|
false
true
|
false
|
:disabled
|
false
|
:developer
|
false
true
|
false
|
:disabled
|
false
|
:maintainer
|
false
true
|
false
|
:disabled
|
false
|
:owner
|
false
true
|
false
|
:enabled
|
true
|
:developer
|
false
true
|
false
|
:enabled
|
true
|
:maintainer
|
false
true
|
false
|
:enabled
|
true
|
:owner
|
false
true
|
false
|
:enabled
|
false
|
:developer
|
false
true
|
false
|
:enabled
|
false
|
:maintainer
|
false
true
|
false
|
:enabled
|
false
|
:owner
|
false
end
def
grant_user_access
(
project
,
user
,
access
)
case
access
when
:developer
,
:maintainer
project
.
add_user
(
user
,
access
)
when
:owner
project
.
namespace
.
update
(
owner:
user
)
end
end
with_them
do
let
(
:project
)
do
if
project_setting
.
nil?
create
(
:project
,
:repository
)
else
create
(
:project
,
:repository
,
:auto_devops
)
end
end
before
do
stub_application_setting
(
auto_devops_enabled:
global_setting
)
allow_any_instance_of
(
Repository
).
to
receive
(
:gitlab_ci_yml
).
and_return
(
gitlab_ci_yml
)
grant_user_access
(
project
,
user
,
user_access
)
project
.
project_feature
.
update_attribute
(
:builds_access_level
,
feature_visibilities
[
builds_visibility
])
project
.
auto_devops
.
update_attribute
(
:enabled
,
project_setting
)
unless
project_setting
.
nil?
end
subject
{
helper
.
show_auto_devops_implicitly_enabled_banner?
(
project
,
user
)
}
it
{
is_expected
.
to
eq
(
result
)
}
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