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
Boxiang Sun
gitlab-ce
Commits
c5955a8d
Commit
c5955a8d
authored
Nov 03, 2021
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@13-12-stable-ee
parent
aabeb0a5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
139 additions
and
12 deletions
+139
-12
.gitlab/ci/rules.gitlab-ci.yml
.gitlab/ci/rules.gitlab-ci.yml
+4
-1
app/assets/javascripts/admin/users/components/users_table.vue
...assets/javascripts/admin/users/components/users_table.vue
+1
-1
app/models/project.rb
app/models/project.rb
+35
-6
qa/qa/flow/user.rb
qa/qa/flow/user.rb
+3
-3
qa/qa/page/admin/overview/users/index.rb
qa/qa/page/admin/overview/users/index.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+41
-0
spec/support/shared_examples/models/project_ci_cd_settings_shared_examples.rb
...examples/models/project_ci_cd_settings_shared_examples.rb
+54
-0
No files found.
.gitlab/ci/rules.gitlab-ci.yml
View file @
c5955a8d
...
...
@@ -526,19 +526,22 @@
.qa:rules:package-and-qa:
rules
:
-
<<
:
*if-not-ee
when
:
never
when
:
manual
-
<<
:
*if-dot-com-gitlab-org-and-security-merge-request
changes
:
*ci-qa-patterns
allow_failure
:
true
when
:
manual
-
<<
:
*if-dot-com-gitlab-org-and-security-merge-request
changes
:
*qa-patterns
allow_failure
:
true
when
:
manual
-
<<
:
*if-dot-com-gitlab-org-and-security-merge-request
changes
:
*code-patterns
when
:
manual
allow_failure
:
true
-
<<
:
*if-dot-com-gitlab-org-schedule
allow_failure
:
true
when
:
manual
###############
# Rails rules #
...
...
app/assets/javascripts/admin/users/components/users_table.vue
View file @
c5955a8d
...
...
@@ -112,7 +112,7 @@ export default {
:empty-text=
"s__('AdminUsers|No users found')"
show-empty
stacked=
"md"
data-qa-selector=
"user_row_content
"
:tbody-tr-attr=
"
{ 'data-qa-selector': 'user_row_content' }
"
>
<template
#cell(name)=
"
{ item: user }">
<user-avatar
:user=
"user"
:admin-user-path=
"paths.adminUser"
/>
...
...
app/models/project.rb
View file @
c5955a8d
...
...
@@ -444,16 +444,15 @@ class Project < ApplicationRecord
delegate
:members
,
to: :team
,
prefix:
true
delegate
:add_user
,
:add_users
,
to: :team
delegate
:add_guest
,
:add_reporter
,
:add_developer
,
:add_maintainer
,
:add_role
,
to: :team
delegate
:group_runners_enabled
,
:group_runners_enabled
=
,
:group_runners_enabled?
,
to: :ci_cd_settings
delegate
:group_runners_enabled
,
:group_runners_enabled
=
,
to: :ci_cd_settings
,
allow_nil:
true
delegate
:root_ancestor
,
to: :namespace
,
allow_nil:
true
delegate
:last_pipeline
,
to: :commit
,
allow_nil:
true
delegate
:external_dashboard_url
,
to: :metrics_setting
,
allow_nil:
true
,
prefix:
true
delegate
:dashboard_timezone
,
to: :metrics_setting
,
allow_nil:
true
,
prefix:
true
delegate
:default_git_depth
,
:default_git_depth
=
,
to: :ci_cd_settings
,
prefix: :ci
delegate
:forward_deployment_enabled
,
:forward_deployment_enabled
=
,
:forward_deployment_enabled?
,
to: :ci_cd_settings
,
prefix: :ci
delegate
:keep_latest_artifact
,
:keep_latest_artifact
=
,
:keep_latest_artifact?
,
:keep_latest_artifacts_available?
,
to: :ci_cd_settings
delegate
:restrict_user_defined_variables
,
:restrict_user_defined_variables
=
,
:restrict_user_defined_variables?
,
to: :ci_cd_settings
delegate
:default_git_depth
,
:default_git_depth
=
,
to: :ci_cd_settings
,
prefix: :ci
,
allow_nil:
true
delegate
:forward_deployment_enabled
,
:forward_deployment_enabled
=
,
to: :ci_cd_settings
,
prefix: :ci
,
allow_nil:
true
delegate
:keep_latest_artifact
,
:keep_latest_artifact
=
,
to: :ci_cd_settings
,
allow_nil:
true
delegate
:restrict_user_defined_variables
,
:restrict_user_defined_variables
=
,
to: :ci_cd_settings
,
allow_nil:
true
delegate
:actual_limits
,
:actual_plan_name
,
to: :namespace
,
allow_nil:
true
delegate
:allow_merge_on_skipped_pipeline
,
:allow_merge_on_skipped_pipeline?
,
:allow_merge_on_skipped_pipeline
=
,
:has_confluence?
,
:allow_editing_commit_messages?
,
...
...
@@ -2614,6 +2613,36 @@ class Project < ApplicationRecord
ProjectStatistics
.
increment_statistic
(
self
,
statistic
,
delta
)
end
def
ci_forward_deployment_enabled?
return
false
unless
ci_cd_settings
ci_cd_settings
.
forward_deployment_enabled?
end
def
restrict_user_defined_variables?
return
false
unless
ci_cd_settings
ci_cd_settings
.
restrict_user_defined_variables?
end
def
keep_latest_artifacts_available?
return
false
unless
ci_cd_settings
ci_cd_settings
.
keep_latest_artifacts_available?
end
def
keep_latest_artifact?
return
false
unless
ci_cd_settings
ci_cd_settings
.
keep_latest_artifact?
end
def
group_runners_enabled?
return
false
unless
ci_cd_settings
ci_cd_settings
.
group_runners_enabled?
end
private
def
set_container_registry_access_level
...
...
qa/qa/flow/user.rb
View file @
c5955a8d
...
...
@@ -9,13 +9,13 @@ module QA
Capybara
.
current_session
end
def
confirm_user
(
user
name
)
def
confirm_user
(
user
)
Flow
::
Login
.
while_signed_in_as_admin
do
Page
::
Main
::
Menu
.
perform
(
&
:go_to_admin_area
)
Page
::
Admin
::
Menu
.
perform
(
&
:go_to_users_overview
)
Page
::
Admin
::
Overview
::
Users
::
Index
.
perform
do
|
index
|
index
.
search_user
(
user
name
)
index
.
click_user
(
username
)
index
.
search_user
(
user
.
email
)
index
.
click_user
(
user
.
name
)
end
Page
::
Admin
::
Overview
::
Users
::
Show
.
perform
(
&
:confirm_user
)
...
...
qa/qa/page/admin/overview/users/index.rb
View file @
c5955a8d
...
...
@@ -11,7 +11,7 @@ module QA
element
:pending_approval_tab
end
view
'app/
views/admin/users/_user.html.haml
'
do
view
'app/
assets/javascripts/admin/users/components/users_table.vue
'
do
element
:user_row_content
end
...
...
spec/models/project_spec.rb
View file @
c5955a8d
...
...
@@ -636,6 +636,47 @@ RSpec.describe Project, factory_default: :keep do
it
{
is_expected
.
to
delegate_method
(
:root_ancestor
).
to
(
:namespace
).
with_arguments
(
allow_nil:
true
)
}
it
{
is_expected
.
to
delegate_method
(
:last_pipeline
).
to
(
:commit
).
with_arguments
(
allow_nil:
true
)
}
it
{
is_expected
.
to
delegate_method
(
:allow_editing_commit_messages?
).
to
(
:project_setting
)
}
include_examples
'ci_cd_settings delegation'
do
# Skip attributes defined in EE code
let
(
:exclude_attributes
)
do
%w(
merge_pipelines_enabled
merge_trains_enabled
auto_rollback_enabled
)
end
end
describe
'#ci_forward_deployment_enabled?'
do
it_behaves_like
'a ci_cd_settings predicate method'
,
prefix:
'ci_'
do
let
(
:delegated_method
)
{
:forward_deployment_enabled?
}
end
end
describe
'#restrict_user_defined_variables?'
do
it_behaves_like
'a ci_cd_settings predicate method'
do
let
(
:delegated_method
)
{
:restrict_user_defined_variables?
}
end
end
describe
'#keep_latest_artifacts_available?'
do
it_behaves_like
'a ci_cd_settings predicate method'
do
let
(
:delegated_method
)
{
:keep_latest_artifacts_available?
}
end
end
describe
'#keep_latest_artifact?'
do
it_behaves_like
'a ci_cd_settings predicate method'
do
let
(
:delegated_method
)
{
:keep_latest_artifact?
}
end
end
describe
'#group_runners_enabled?'
do
it_behaves_like
'a ci_cd_settings predicate method'
do
let
(
:delegated_method
)
{
:group_runners_enabled?
}
end
end
end
describe
'reference methods'
do
...
...
spec/support/shared_examples/models/project_ci_cd_settings_shared_examples.rb
0 → 100644
View file @
c5955a8d
# frozen_string_literal: true
RSpec
.
shared_examples
'ci_cd_settings delegation'
do
let
(
:exclude_attributes
)
{
[]
}
context
'when ci_cd_settings is destroyed but project is not'
do
it
'allows methods delegated to ci_cd_settings to be nil'
,
:aggregate_failures
do
project
=
create
(
:project
)
attributes
=
project
.
ci_cd_settings
.
attributes
.
keys
-
%w(id project_id)
-
exclude_attributes
project
.
ci_cd_settings
.
destroy!
project
.
reload
attributes
.
each
do
|
attr
|
method
=
project
.
respond_to?
(
"ci_
#{
attr
}
"
)
?
"ci_
#{
attr
}
"
:
attr
expect
(
project
.
send
(
method
)).
to
be_nil
,
"
#{
attr
}
was not nil"
end
end
end
end
RSpec
.
shared_examples
'a ci_cd_settings predicate method'
do
|
prefix:
''
|
using
RSpec
::
Parameterized
::
TableSyntax
let_it_be
(
:project
)
{
create
(
:project
)
}
context
'when ci_cd_settings is nil'
do
before
do
allow
(
project
).
to
receive
(
:ci_cd_settings
).
and_return
(
nil
)
end
it
'returns false'
do
expect
(
project
.
send
(
"
#{
prefix
}#{
delegated_method
}
"
)).
to
be
(
false
)
end
end
context
'when ci_cd_settings is not nil'
do
where
(
:delegated_method_return
,
:subject_return
)
do
true
|
true
false
|
false
end
with_them
do
let
(
:ci_cd_settings_double
)
{
double
(
'ProjectCiCdSetting'
)
}
before
do
allow
(
project
).
to
receive
(
:ci_cd_settings
).
and_return
(
ci_cd_settings_double
)
allow
(
ci_cd_settings_double
).
to
receive
(
delegated_method
).
and_return
(
delegated_method_return
)
end
it
'returns the expected boolean value'
do
expect
(
project
.
send
(
"
#{
prefix
}#{
delegated_method
}
"
)).
to
be
(
subject_return
)
end
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