Commit 8ebedab8 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '2139-pipelines-minutes' into 'master'

Rename build minutes to pipeline minutes

Closes #2139

See merge request !1644
parents b2e02061 9ff492bd
.form-group .form-group
= form.label :shared_runners_minutes, 'Build minutes quota', class: 'control-label col-sm-2' = form.label :shared_runners_minutes, 'Pipeline minutes quota', class: 'control-label col-sm-2'
.col-sm-10 .col-sm-10
= form.number_field :shared_runners_minutes, class: 'form-control' = form.number_field :shared_runners_minutes, class: 'form-control'
.help-block .help-block
Set the maximum number of build minutes that a group can use on shared Runners per month. Set the maximum number of pipeline minutes that a group can use on shared Runners per month.
0 for unlimited. 0 for unlimited.
= link_to icon('question-circle'), help_page_path("user/admin_area/settings/continuous_integration", anchor: "shared-runners-build-minutes-quota"), target: '_blank' = link_to icon('question-circle'), help_page_path("user/admin_area/settings/continuous_integration", anchor: "shared-runners-build-minutes-quota"), target: '_blank'
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
Enabled Enabled
- if project.shared_runners_minutes_limit_enabled? - if project.shared_runners_minutes_limit_enabled?
- limit = project.actual_shared_runners_minutes_limit.to_i - limit = project.actual_shared_runners_minutes_limit.to_i
(Limited to #{limit} build minutes per month) (Limited to #{limit} pipeline minutes per month)
- else - else
(Unlimited build minutes) (Unlimited pipeline minutes)
- else - else
Disabled Disabled
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
Group pipelines quota Group pipelines quota
= link_to icon('question-circle'), help_page_path("user/admin_area/settings/continuous_integration", anchor: "shared-runners-build-minutes-quota"), target: '_blank' = link_to icon('question-circle'), help_page_path("user/admin_area/settings/continuous_integration", anchor: "shared-runners-build-minutes-quota"), target: '_blank'
%p.light %p.light
Monthly build minutes usage across shared Runners for the Monthly pipeline minutes usage across shared Runners for the
%strong= @group.name %strong= @group.name
group group
......
- namespace = local_assigns.fetch(:namespace) - namespace = local_assigns.fetch(:namespace)
- if namespace.shared_runners_enabled? - if namespace.shared_runners_enabled?
%li %li
%span.light Build minutes quota: %span.light Pipeline minutes quota:
%strong %strong
= group_shared_runner_limits_quota(namespace) = group_shared_runner_limits_quota(namespace)
= link_to icon('question-circle'), help_page_path("user/admin_area/settings/continuous_integration", anchor: "shared-runners-build-minutes-quota"), target: '_blank' = link_to icon('question-circle'), help_page_path("user/admin_area/settings/continuous_integration", anchor: "shared-runners-build-minutes-quota"), target: '_blank'
- if current_user.admin? - if current_user.admin?
.form-group .form-group
= f.label :shared_runners_minutes_limit, class: 'control-label' do = f.label :shared_runners_minutes_limit, class: 'control-label' do
Build Minutes Quota Pipeline Minutes Quota
.col-sm-10 .col-sm-10
= f.number_field :shared_runners_minutes_limit, class: 'form-control', min: 0 = f.number_field :shared_runners_minutes_limit, class: 'form-control', min: 0
%span.help-block#shared_runners_minutes_limit_help_block %span.help-block#shared_runners_minutes_limit_help_block
Set the maximum number of build minutes that a group can use on shared Runners per month. Set the maximum number of pipeline minutes that a group can use on shared Runners per month.
Set 0 for unlimited. Set 0 for unlimited.
Set empty to inherit the global setting of #{current_application_settings.shared_runners_minutes}. Set empty to inherit the global setting of #{current_application_settings.shared_runners_minutes}.
= link_to icon('question-circle'), help_page_path("user/admin_area/settings/continuous_integration", anchor: "shared-runners-build-minutes-quota"), target: '_blank' = link_to icon('question-circle'), help_page_path("user/admin_area/settings/continuous_integration", anchor: "shared-runners-build-minutes-quota"), target: '_blank'
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
- quota_limit = project.namespace.actual_shared_runners_minutes_limit - quota_limit = project.namespace.actual_shared_runners_minutes_limit
.bs-callout.bs-callout-warning .bs-callout.bs-callout-warning
%p %p
You have used all your shared Runners build minutes. You have used all your shared Runners pipeline minutes.
= "(#{quota_used} of #{quota_limit})." = "(#{quota_used} of #{quota_limit})."
- if can?(current_user, :admin_build, @project) - if can?(current_user, :admin_build, @project)
%br %br
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
- if cookies[:hide_shared_runner_quota_message].blank? && has_limit && namespace.shared_runners_minutes_used? && can_see_status - if cookies[:hide_shared_runner_quota_message].blank? && has_limit && namespace.shared_runners_minutes_used? && can_see_status
.shared-runner-quota-message.alert.alert-warning.hidden-xs{ data: { scope: scope } } .shared-runner-quota-message.alert.alert-warning.hidden-xs{ data: { scope: scope } }
= namespace.name = namespace.name
has exceeded their build minutes quota. Pipelines will not run anymore on shared Runners. has exceeded their pipeline minutes quota. Pipelines will not run anymore on shared Runners.
.pull-right .pull-right
= link_to 'Remind later', '#', class: 'hide-shared-runner-limit-message alert-link' = link_to 'Remind later', '#', class: 'hide-shared-runner-limit-message alert-link'
...@@ -37,13 +37,13 @@ expiration. ...@@ -37,13 +37,13 @@ expiration.
[art-yml]: ../../../administration/job_artifacts.md [art-yml]: ../../../administration/job_artifacts.md
[duration-syntax]: ../../../ci/yaml/README.md#artifactsexpire_in [duration-syntax]: ../../../ci/yaml/README.md#artifactsexpire_in
## Shared Runners build minutes quota ## Shared Runners pipeline minutes quota
> [Introduced][ee-1078] in GitLab Enterprise Edition 8.16. > [Introduced][ee-1078] in GitLab Enterprise Edition 8.16.
If you have enabled shared Runners for your GitLab instance, you can limit their If you have enabled shared Runners for your GitLab instance, you can limit their
usage by setting a maximum number of build minutes that a group can use on usage by setting a maximum number of pipeline minutes that a group can use on
shared Runners per month. Set 0 to grant unlimited build minutes. shared Runners per month. Set 0 to grant unlimited pipeline minutes.
While build limits are stored as minutes, the counting is done in seconds. While build limits are stored as minutes, the counting is done in seconds.
1. Go to the **Admin area ➔ Settings** (`/admin/application_settings`). 1. Go to the **Admin area ➔ Settings** (`/admin/application_settings`).
...@@ -51,23 +51,23 @@ While build limits are stored as minutes, the counting is done in seconds. ...@@ -51,23 +51,23 @@ While build limits are stored as minutes, the counting is done in seconds.
![Admin area settings button](img/admin_area_settings_button.png) ![Admin area settings button](img/admin_area_settings_button.png)
1. Navigate to the **Continuous Integration** block and enable the Shared 1. Navigate to the **Continuous Integration** block and enable the Shared
Runners setting. Then set the build minutes quota limit. Runners setting. Then set the pipeline minutes quota limit.
![Shared Runners build minutes quota](img/ci_shared_runners_build_minutes_quota.png) ![Shared Runners pipeline minutes quota](img/ci_shared_runners_build_minutes_quota.png)
1. Hit **Save** for the changes to take effect. 1. Hit **Save** for the changes to take effect.
--- ---
While the setting in the Admin area has a global effect, as an admin you can While the setting in the Admin area has a global effect, as an admin you can
also change each group's build minutes quota to override the global value. also change each group's pipeline minutes quota to override the global value.
1. Navigate to the **Groups** admin area and hit the **Edit** button for the 1. Navigate to the **Groups** admin area and hit the **Edit** button for the
group you wish to change the build minutes quota. group you wish to change the pipeline minutes quota.
![Groups in the admin area](img/admin_area_groups.png) ![Groups in the admin area](img/admin_area_groups.png)
1. Set the build minutes quota to the desired value and hit **Save changes** for 1. Set the pipeline minutes quota to the desired value and hit **Save changes** for
the changes to take effect. the changes to take effect.
![Edit group in the admin area](img/admin_area_group_edit.png) ![Edit group in the admin area](img/admin_area_group_edit.png)
...@@ -81,12 +81,12 @@ are enabled. ...@@ -81,12 +81,12 @@ are enabled.
![Project admin info](img/admin_project_quota_view.png) ![Project admin info](img/admin_project_quota_view.png)
When the build minutes quota for a group is set to a value different than 0, When the pipeline minutes quota for a group is set to a value different than 0,
the **Pipelines quota** page is available to the group page settings list. the **Pipelines quota** page is available to the group page settings list.
![Group settings](img/group_settings.png) ![Group settings](img/group_settings.png)
You can see there an overview of the build minutes quota of all projects of You can see there an overview of the pipeline minutes quota of all projects of
the group. the group.
![Group pipelines quota](img/group_pipelines_quota.png) ![Group pipelines quota](img/group_pipelines_quota.png)
......
...@@ -208,7 +208,7 @@ describe "Admin::Users", feature: true do ...@@ -208,7 +208,7 @@ describe "Admin::Users", feature: true do
click_link user.name click_link user.name
expect(page).to have_content('Build minutes quota: 0 / 500') expect(page).to have_content('Pipeline minutes quota: 0 / 500')
end end
end end
...@@ -222,7 +222,7 @@ describe "Admin::Users", feature: true do ...@@ -222,7 +222,7 @@ describe "Admin::Users", feature: true do
click_link user.name click_link user.name
expect(page).not_to have_content('Build minutes quota:') expect(page).not_to have_content('Pipeline minutes quota:')
end end
end end
end end
...@@ -299,7 +299,7 @@ describe "Admin::Users", feature: true do ...@@ -299,7 +299,7 @@ describe "Admin::Users", feature: true do
end end
it "shows page with new data" do it "shows page with new data" do
expect(page).to have_content('Build minutes quota: 0 / 500') expect(page).to have_content('Pipeline minutes quota: 0 / 500')
end end
end end
end end
......
...@@ -15,7 +15,7 @@ feature 'CI shared runner settings', feature: true do ...@@ -15,7 +15,7 @@ feature 'CI shared runner settings', feature: true do
context 'without global shared runners quota' do context 'without global shared runners quota' do
scenario 'should display ratio with global quota' do scenario 'should display ratio with global quota' do
visit_admin_group_path visit_admin_group_path
expect(page).to have_content("Build minutes quota: 400 / Unlimited") expect(page).to have_content("Pipeline minutes quota: 400 / Unlimited")
expect(page).to have_selector('.shared_runners_limit_disabled') expect(page).to have_selector('.shared_runners_limit_disabled')
end end
end end
...@@ -27,21 +27,21 @@ feature 'CI shared runner settings', feature: true do ...@@ -27,21 +27,21 @@ feature 'CI shared runner settings', feature: true do
scenario 'should display ratio with global quota' do scenario 'should display ratio with global quota' do
visit_admin_group_path visit_admin_group_path
expect(page).to have_content("Build minutes quota: 400 / 500") expect(page).to have_content("Pipeline minutes quota: 400 / 500")
expect(page).to have_selector('.shared_runners_limit_under_quota') expect(page).to have_selector('.shared_runners_limit_under_quota')
end end
scenario 'should display new ratio with overridden group quota' do scenario 'should display new ratio with overridden group quota' do
set_group_shared_runners_minutes 300 set_group_shared_runners_minutes 300
visit_admin_group_path visit_admin_group_path
expect(page).to have_content("Build minutes quota: 400 / 300") expect(page).to have_content("Pipeline minutes quota: 400 / 300")
expect(page).to have_selector('.shared_runners_limit_over_quota') expect(page).to have_selector('.shared_runners_limit_over_quota')
end end
scenario 'should display unlimited ratio with overridden group quota' do scenario 'should display unlimited ratio with overridden group quota' do
set_group_shared_runners_minutes 0 set_group_shared_runners_minutes 0
visit_admin_group_path visit_admin_group_path
expect(page).to have_content("Build minutes quota: 400 / Unlimited") expect(page).to have_content("Pipeline minutes quota: 400 / Unlimited")
expect(page).to have_selector('.shared_runners_limit_disabled') expect(page).to have_selector('.shared_runners_limit_disabled')
end end
end end
......
...@@ -32,12 +32,12 @@ feature 'CI shared runner limits', feature: true do ...@@ -32,12 +32,12 @@ feature 'CI shared runner limits', feature: true do
scenario 'it displays a warning message on project homepage' do scenario 'it displays a warning message on project homepage' do
visit_project_home visit_project_home
expect_quota_exceeded_alert("#{group.name} has exceeded their build minutes quota.") expect_quota_exceeded_alert("#{group.name} has exceeded their pipeline minutes quota.")
end end
scenario 'it displays a warning message on pipelines page' do scenario 'it displays a warning message on pipelines page' do
visit_project_pipelines visit_project_pipelines
expect_quota_exceeded_alert("#{group.name} has exceeded their build minutes quota.") expect_quota_exceeded_alert("#{group.name} has exceeded their pipeline minutes quota.")
end end
end end
......
...@@ -282,7 +282,7 @@ feature 'Builds', :feature do ...@@ -282,7 +282,7 @@ feature 'Builds', :feature do
it 'displays a warning message' do it 'displays a warning message' do
visit namespace_project_build_path(project.namespace, project, build) visit namespace_project_build_path(project.namespace, project, build)
expect(page).to have_content('You have used all your shared Runners build minutes.') expect(page).to have_content('You have used all your shared Runners pipeline minutes.')
end end
end end
end end
......
...@@ -41,7 +41,7 @@ describe Ci::Build, models: true do ...@@ -41,7 +41,7 @@ describe Ci::Build, models: true do
end end
end end
context 'updates build minutes' do context 'updates pipeline minutes' do
let(:build) { create(:ci_build, :running, pipeline: pipeline) } let(:build) { create(:ci_build, :running, pipeline: pipeline) }
%w(success drop cancel).each do |event| %w(success drop cancel).each do |event|
......
...@@ -31,7 +31,7 @@ describe Project, models: true do ...@@ -31,7 +31,7 @@ describe Project, models: true do
expect(project.any_runners? { |runner| runner == shared_runner }).to be_truthy expect(project.any_runners? { |runner| runner == shared_runner }).to be_truthy
end end
context 'with used build minutes' do context 'with used pipeline minutes' do
let(:namespace) { create(:namespace, :with_used_build_minutes_limit) } let(:namespace) { create(:namespace, :with_used_build_minutes_limit) }
let(:project) do let(:project) do
create(:empty_project, create(:empty_project,
...@@ -49,7 +49,7 @@ describe Project, models: true do ...@@ -49,7 +49,7 @@ describe Project, models: true do
describe '#shared_runners_available?' do describe '#shared_runners_available?' do
subject { project.shared_runners_available? } subject { project.shared_runners_available? }
context 'with used build minutes' do context 'with used pipeline minutes' do
let(:namespace) { create(:namespace, :with_used_build_minutes_limit) } let(:namespace) { create(:namespace, :with_used_build_minutes_limit) }
let(:project) do let(:project) do
create(:empty_project, create(:empty_project,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment