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
29e8f3ca
Commit
29e8f3ca
authored
May 11, 2020
by
Doug Stull
Committed by
Enrique Alcántara
May 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add out of minutes warning to groups overview
- as per spec
parent
dede1925
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
95 deletions
+96
-95
app/views/groups/_flash_messages.html.haml
app/views/groups/_flash_messages.html.haml
+2
-0
app/views/groups/show.html.haml
app/views/groups/show.html.haml
+2
-0
ee/app/assets/javascripts/pages/groups/show/index.js
ee/app/assets/javascripts/pages/groups/show/index.js
+2
-0
ee/changelogs/unreleased/212392-show-the-you-re-running-out-of-ci-minutes-warnings-on-relevant-.yml
...ou-re-running-out-of-ci-minutes-warnings-on-relevant-.yml
+5
-0
ee/spec/features/ci_shared_runner_warnings_spec.rb
ee/spec/features/ci_shared_runner_warnings_spec.rb
+85
-95
No files found.
app/views/groups/_flash_messages.html.haml
0 → 100644
View file @
29e8f3ca
=
content_for
:flash_message
do
=
render_if_exists
'shared/shared_runners_minutes_limit'
,
namespace:
@group
,
classes:
[
container_class
,
(
"limit-container-width"
unless
fluid_layout
)]
app/views/groups/show.html.haml
View file @
29e8f3ca
...
...
@@ -4,6 +4,8 @@
=
content_for
:meta_tags
do
=
auto_discovery_link_tag
(
:atom
,
group_url
(
@group
,
rss_url_options
),
title:
"
#{
@group
.
name
}
activity"
)
=
render
partial:
'flash_messages'
%div
{
class:
[(
"limit-container-width"
unless
fluid_layout
)]
}
=
render_if_exists
'trials/banner'
,
namespace:
@group
...
...
ee/app/assets/javascripts/pages/groups/show/index.js
View file @
29e8f3ca
...
...
@@ -2,6 +2,7 @@ import initGroupSecurityDashboard from 'ee/security_dashboard/group_init';
import
leaveByUrl
from
'
~/namespaces/leave_by_url
'
;
import
initGroupDetails
from
'
~/pages/groups/shared/group_details
'
;
import
initGroupAnalytics
from
'
ee/analytics/group_analytics/group_analytics_bundle
'
;
import
initVueAlerts
from
'
~/vue_alerts
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
leaveByUrl
(
'
group
'
);
...
...
@@ -13,4 +14,5 @@ document.addEventListener('DOMContentLoaded', () => {
}
initGroupAnalytics
();
initVueAlerts
();
});
ee/changelogs/unreleased/212392-show-the-you-re-running-out-of-ci-minutes-warnings-on-relevant-.yml
0 → 100644
View file @
29e8f3ca
---
title
:
Show the You're running out of CI minutes warnings on relevant pages in GitLab
merge_request
:
31012
author
:
type
:
added
ee/spec/features/ci_shared_runner_warnings_spec.rb
View file @
29e8f3ca
...
...
@@ -3,7 +3,9 @@
require
'spec_helper'
describe
'CI shared runner limits'
do
let
(
:user
)
{
create
(
:user
)
}
using
RSpec
::
Parameterized
::
TableSyntax
let_it_be
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
group
,
shared_runners_enabled:
true
)
}
let
(
:group
)
{
create
(
:group
)
}
...
...
@@ -11,30 +13,65 @@ describe 'CI shared runner limits' do
sign_in
(
user
)
end
shared_examples
'threshold breached
'
do
context
'when on a project related page
'
do
before
do
group
.
update
(
shared_runners_minutes_limit:
20
)
group
.
add_developer
(
user
)
end
it
'displays a warning message on pipelines page'
do
visit
project_pipelines_path
(
project
)
expect_quota_exceeded_alert
(
message
)
where
(
:case_name
,
:percent
,
:remaining_minutes
)
do
'warning level'
|
30
|
4
'danger level'
|
5
|
1
end
it
'displays a warning message on project homepage'
do
visit
project_path
(
project
)
with_them
do
context
"when there is a notification and minutes still exist"
,
:js
do
let
(
:message
)
do
"Group
#{
group
.
name
}
has
#{
percent
}
% or less Shared Runner Pipeline minutes remaining. "
\
"Once it runs out, no new jobs or pipelines in its projects will run."
end
before
do
group
.
update
(
shared_runners_minutes_limit:
20
)
allow_any_instance_of
(
EE
::
Namespace
).
to
receive
(
:shared_runners_remaining_minutes
).
and_return
(
remaining_minutes
)
end
it
'displays a warning message on pipelines page'
do
visit
project_pipelines_path
(
project
)
expect_quota_exceeded_alert
(
message
)
end
it
'displays a warning message on project homepage'
do
visit
project_path
(
project
)
expect_quota_exceeded_alert
(
message
)
expect_quota_exceeded_alert
(
message
)
end
end
end
end
context
'when project member'
do
before
do
group
.
add_developer
(
user
)
context
'when limit is exceeded'
,
:js
do
let
(
:group
)
{
create
(
:group
,
:with_used_build_minutes_limit
)
}
let
(
:message
)
do
"Group
#{
group
.
name
}
has exceeded its pipeline minutes quota. "
\
"Unless you buy additional pipeline minutes, no new jobs or pipelines in its projects will run."
end
it
'displays a warning message on project homepage'
do
visit
project_path
(
project
)
expect_quota_exceeded_alert
(
message
)
end
it
'displays a warning message on pipelines page'
do
visit
project_pipelines_path
(
project
)
expect_quota_exceeded_alert
(
message
)
end
end
context
'without limit'
do
context
'when limit not yet exceeded'
do
let
(
:group
)
{
create
(
:group
,
:with_not_used_build_minutes_limit
)
}
it
'does not display a warning message on project homepage'
do
visit
project_path
(
project
)
...
...
@@ -47,114 +84,67 @@ describe 'CI shared runner limits' do
expect_no_quota_exceeded_alert
end
end
end
context
'when limit is defined'
do
context
'when usage has reached a warning level'
,
:js
do
it_behaves_like
'threshold breached'
do
let
(
:message
)
do
"Group
#{
group
.
name
}
has 30% or less Shared Runner Pipeline minutes remaining. "
\
"Once it runs out, no new jobs or pipelines in its projects will run."
end
before
do
allow_any_instance_of
(
EE
::
Namespace
).
to
receive
(
:shared_runners_remaining_minutes
).
and_return
(
4
)
end
end
end
context
'when on a group related page'
do
let!
(
:user_pipeline
)
{
create
(
:ci_pipeline
,
user:
user
,
project:
project
)
}
context
'when usage has reached a danger level'
,
:js
do
it_behaves_like
'threshold breached'
do
let
(
:message
)
do
"Group
#{
group
.
name
}
has 5% or less Shared Runner Pipeline minutes remaining. "
\
"Once it runs out, no new jobs or pipelines in its projects will run."
end
before
do
allow_any_instance_of
(
EE
::
Namespace
).
to
receive
(
:shared_runners_remaining_minutes
).
and_return
(
1
)
end
end
end
where
(
:case_name
,
:percent
,
:remaining_minutes
)
do
'warning level'
|
30
|
4
'danger level'
|
5
|
1
end
context
'when limit is exceeded'
,
:js
do
let
(
:group
)
{
create
(
:group
,
:with_used_build_minutes_limit
)
}
with_them
do
context
"when there is a notification and minutes still exist"
,
:js
do
let
(
:message
)
do
"Group
#{
group
.
name
}
has
exceeded its pipeline minutes quota
. "
\
"Unless you buy additional pipeline minutes
, no new jobs or pipelines in its projects will run."
"Group
#{
group
.
name
}
has
#{
percent
}
% or less Shared Runner Pipeline minutes remaining
. "
\
"Once it runs out
, no new jobs or pipelines in its projects will run."
end
it
'displays a warning message on project homepage'
do
visit
project_path
(
project
)
expect_quota_exceeded_alert
(
message
)
before
do
group
.
update
(
shared_runners_minutes_limit:
20
)
allow_any_instance_of
(
EE
::
Namespace
).
to
receive
(
:shared_runners_remaining_minutes
).
and_return
(
remaining_minutes
)
end
it
'displays a warning message on
pipelines
page'
do
visit
project_pipelines_path
(
project
)
it
'displays a warning message on
group overview
page'
do
visit
group_path
(
group
)
expect_quota_exceeded_alert
(
message
)
end
end
end
context
'when limit not yet exceeded'
do
let
(
:group
)
{
create
(
:group
,
:with_not_used_build_minutes_limit
)
}
it
'does not display a warning message on project homepage'
do
visit
project_path
(
project
)
expect_no_quota_exceeded_alert
end
it
'does not display a warning message on pipelines page'
do
visit
project_pipelines_path
(
project
)
expect_no_quota_exceeded_alert
end
context
'when limit is exceeded'
,
:js
do
let
(
:group
)
{
create
(
:group
,
:with_used_build_minutes_limit
)
}
let
(
:message
)
do
"Group
#{
group
.
name
}
has exceeded its pipeline minutes quota. "
\
"Unless you buy additional pipeline minutes, no new jobs or pipelines in its projects will run."
end
context
'when minutes are not yet set'
do
let
(
:group
)
{
create
(
:group
,
:with_build_minutes_limit
)
}
it
'does not display a warning message on project homepage'
do
visit
project_path
(
project
)
expect_no_quota_exceeded_alert
end
it
'does not display a warning message on pipelines page'
do
visit
project_pipelines_path
(
project
)
it
'displays a warning message on group overview page'
do
visit
group_path
(
group
)
expect_no_quota_exceeded_alert
end
expect_quota_exceeded_alert
(
message
)
end
end
end
context
'when not a project member
'
do
let
(
:group
)
{
create
(
:group
,
:with
_used_build_minutes_limit
)
}
context
'when limit not yet exceeded
'
do
let
(
:group
)
{
create
(
:group
,
:with_not
_used_build_minutes_limit
)
}
context
'when limit is defined and limit is exceeded'
do
it
'does not display a warning message on project homepage'
do
visit
project_path
(
project
)
expect_no_quota_exceeded_alert
end
it
'does not display a warning message on pipelines page'
do
visit
project_pipelines_path
(
project
)
it
'does not display a warning message on group overview page'
do
visit
group_path
(
group
)
expect_no_quota_exceeded_alert
end
end
end
def
expect_quota_exceeded_alert
(
message
=
nil
)
def
expect_quota_exceeded_alert
(
message
)
expect
(
page
).
to
have_selector
(
'.shared-runner-quota-message'
,
count:
1
)
if
message
page
.
within
(
'.shared-runner-quota-message'
)
do
expect
(
page
).
to
have_content
(
message
)
expect
(
page
).
to
have_link
'Buy more Pipeline minutes'
end
page
.
within
(
'.shared-runner-quota-message'
)
do
expect
(
page
).
to
have_content
(
message
)
expect
(
page
).
to
have_link
'Buy more Pipeline minutes'
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