Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
f57f1c6cd8
commit
936d15143b
56 changed files with 567 additions and 226 deletions
3
app/assets/javascripts/pages/groups/runners/index.js
Normal file
3
app/assets/javascripts/pages/groups/runners/index.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
import { initGroupRunners } from '~/runner/group_runners';
|
||||
|
||||
initGroupRunners();
|
|
@ -0,0 +1,19 @@
|
|||
<script>
|
||||
import RunnerTypeHelp from '../components/runner_type_help.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
RunnerTypeHelp,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<runner-type-help />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
17
app/assets/javascripts/runner/group_runners/index.js
Normal file
17
app/assets/javascripts/runner/group_runners/index.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
import Vue from 'vue';
|
||||
import GroupRunnersApp from './group_runners_app.vue';
|
||||
|
||||
export const initGroupRunners = (selector = '#js-group-runners') => {
|
||||
const el = document.querySelector(selector);
|
||||
|
||||
if (!el) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Vue({
|
||||
el,
|
||||
render(h) {
|
||||
return h(GroupRunnersApp);
|
||||
},
|
||||
});
|
||||
};
|
|
@ -548,3 +548,18 @@ span.idiff {
|
|||
// will always be expanded to the maximum needed width.
|
||||
.blob-viewer[data-loading] .file-content.code .line:nth-of-type(1n+70):not(:last-of-type),
|
||||
.blob-viewer[data-loading] .file-content.code .file-line-num:nth-of-type(1n+70):not(:last-of-type) {display: none !important;}
|
||||
|
||||
.blob-viewer[data-loading] .file-content.code .line:nth-of-type(69):not(:last-of-type),
|
||||
.blob-viewer[data-loading] .file-content.code .file-line-num:nth-of-type(69):not(:last-of-type) {
|
||||
&::after {
|
||||
@include gl-display-block;
|
||||
@include gl-font-weight-bold;
|
||||
content: '\2026';
|
||||
}
|
||||
}
|
||||
|
||||
.blob-viewer[data-loading] .file-content.code .line:nth-of-type(69):not(:last-of-type) {
|
||||
&::after {
|
||||
@include gl-text-center;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Groups::RunnersController < Groups::ApplicationController
|
||||
# Proper policies should be implemented per
|
||||
# https://gitlab.com/gitlab-org/gitlab-foss/issues/45894
|
||||
# TODO Proper policies, such as `read_group_runners, should be implemented per
|
||||
# https://gitlab.com/gitlab-org/gitlab/-/issues/334802
|
||||
before_action :authorize_admin_group!
|
||||
|
||||
before_action :runner_list_group_view_vue_ui_enabled, only: [:index]
|
||||
before_action :runner, only: [:edit, :update, :destroy, :pause, :resume, :show]
|
||||
|
||||
feature_category :runner
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def runner_list_group_view_vue_ui_enabled
|
||||
return render_404 unless Feature.enabled?(:runner_list_group_view_vue_ui, group, default_enabled: :yaml)
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
|
|
|
@ -237,6 +237,12 @@ module GroupsHelper
|
|||
can?(current_user, "read_group_#{resource}".to_sym, @group)
|
||||
end
|
||||
|
||||
# TODO Proper policies, such as `read_group_runners, should be implemented per
|
||||
# See https://gitlab.com/gitlab-org/gitlab/-/issues/334802
|
||||
if can?(current_user, :admin_group, @group) && Feature.enabled?(:runner_list_group_view_vue_ui, @group, default_enabled: :yaml)
|
||||
links << :runners
|
||||
end
|
||||
|
||||
if can?(current_user, :read_cluster, @group)
|
||||
links << :kubernetes
|
||||
end
|
||||
|
|
|
@ -39,7 +39,6 @@ module Ci
|
|||
has_one :pending_state, class_name: 'Ci::BuildPendingState', inverse_of: :build
|
||||
has_one :queuing_entry, class_name: 'Ci::PendingBuild', foreign_key: :build_id
|
||||
has_one :runtime_metadata, class_name: 'Ci::RunningBuild', foreign_key: :build_id
|
||||
has_many :trace_sections, class_name: 'Ci::BuildTraceSection'
|
||||
has_many :trace_chunks, class_name: 'Ci::BuildTraceChunk', foreign_key: :build_id, inverse_of: :build
|
||||
has_many :report_results, class_name: 'Ci::BuildReportResult', inverse_of: :build
|
||||
|
||||
|
@ -644,12 +643,6 @@ module Ci
|
|||
update(coverage: coverage) if coverage.present?
|
||||
end
|
||||
|
||||
# rubocop: disable CodeReuse/ServiceClass
|
||||
def parse_trace_sections!
|
||||
ExtractSectionsFromBuildTraceService.new(project, user).execute(self)
|
||||
end
|
||||
# rubocop: enable CodeReuse/ServiceClass
|
||||
|
||||
def trace
|
||||
Gitlab::Ci::Trace.new(self)
|
||||
end
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Ci
|
||||
class BuildTraceSection < ApplicationRecord
|
||||
extend SuppressCompositePrimaryKeyWarning
|
||||
extend Gitlab::Ci::Model
|
||||
include IgnorableColumns
|
||||
|
||||
belongs_to :build, class_name: 'Ci::Build'
|
||||
belongs_to :project
|
||||
belongs_to :section_name, class_name: 'Ci::BuildTraceSectionName'
|
||||
|
||||
validates :section_name, :build, :project, presence: true, allow_blank: false
|
||||
|
||||
ignore_column :build_id_convert_to_bigint, remove_with: '14.2', remove_after: '2021-08-22'
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Ci
|
||||
class BuildTraceSectionName < ApplicationRecord
|
||||
extend Gitlab::Ci::Model
|
||||
|
||||
belongs_to :project
|
||||
has_many :trace_sections, class_name: 'Ci::BuildTraceSection', foreign_key: :section_name_id
|
||||
|
||||
validates :name, :project, presence: true, allow_blank: false
|
||||
validates :name, uniqueness: { scope: :project_id }
|
||||
end
|
||||
end
|
|
@ -10,6 +10,14 @@ class IssuableSeverity < ApplicationRecord
|
|||
critical: 'Critical - S1'
|
||||
}.freeze
|
||||
|
||||
SEVERITY_QUICK_ACTION_PARAMS = {
|
||||
unknown: %w(Unknown 0),
|
||||
low: %w(Low S4 4),
|
||||
medium: %w(Medium S3 3),
|
||||
high: %w(High S2 2),
|
||||
critical: %w(Critical S1 1)
|
||||
}.freeze
|
||||
|
||||
belongs_to :issue
|
||||
|
||||
validates :issue, presence: true, uniqueness: true
|
||||
|
|
|
@ -317,7 +317,6 @@ class Project < ApplicationRecord
|
|||
# still using `dependent: :destroy` here.
|
||||
has_many :builds, class_name: 'Ci::Build', inverse_of: :project, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
|
||||
has_many :processables, class_name: 'Ci::Processable', inverse_of: :project
|
||||
has_many :build_trace_section_names, class_name: 'Ci::BuildTraceSectionName'
|
||||
has_many :build_trace_chunks, class_name: 'Ci::BuildTraceChunk', through: :builds, source: :trace_chunks
|
||||
has_many :build_report_results, class_name: 'Ci::BuildReportResult', inverse_of: :project
|
||||
has_many :job_artifacts, class_name: 'Ci::JobArtifact'
|
||||
|
|
|
@ -117,6 +117,7 @@ class GroupPolicy < BasePolicy
|
|||
enable :delete_metrics_dashboard_annotation
|
||||
enable :update_metrics_dashboard_annotation
|
||||
enable :create_custom_emoji
|
||||
enable :create_package
|
||||
enable :create_package_settings
|
||||
end
|
||||
|
||||
|
@ -134,6 +135,7 @@ class GroupPolicy < BasePolicy
|
|||
end
|
||||
|
||||
rule { maintainer }.policy do
|
||||
enable :destroy_package
|
||||
enable :create_projects
|
||||
enable :admin_pipeline
|
||||
enable :admin_build
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Ci
|
||||
class ExtractSectionsFromBuildTraceService < BaseService
|
||||
def execute(build)
|
||||
return false unless build.trace_sections.empty?
|
||||
|
||||
Gitlab::Database.bulk_insert(BuildTraceSection.table_name, extract_sections(build)) # rubocop:disable Gitlab/BulkInsert
|
||||
true
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# rubocop: disable CodeReuse/ActiveRecord
|
||||
def find_or_create_name(name)
|
||||
project.build_trace_section_names.find_or_create_by!(name: name)
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
project.build_trace_section_names.find_by!(name: name)
|
||||
end
|
||||
# rubocop: enable CodeReuse/ActiveRecord
|
||||
|
||||
def extract_sections(build)
|
||||
build.trace.extract_sections.map do |attr|
|
||||
name = attr.delete(:name)
|
||||
name_record = find_or_create_name(name)
|
||||
|
||||
attr.merge(
|
||||
build_id: build.id,
|
||||
project_id: project.id,
|
||||
section_name_id: name_record.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
6
app/views/groups/runners/index.html.haml
Normal file
6
app/views/groups/runners/index.html.haml
Normal file
|
@ -0,0 +1,6 @@
|
|||
- page_title s_('Runners|Runners')
|
||||
|
||||
%h2.page-title
|
||||
= s_('Runners|Group Runners')
|
||||
|
||||
#js-group-runners
|
|
@ -56,6 +56,23 @@
|
|||
|
||||
= render_if_exists "layouts/nav/ee/push_rules_link" # EE-specific
|
||||
|
||||
- if group_sidebar_link?(:runners)
|
||||
= nav_link(path: 'groups/runners#index') do
|
||||
= link_to group_runners_path(@group), title: _('CI/CD'), class: 'has-sub-items' do
|
||||
.nav-icon-container
|
||||
= sprite_icon('rocket')
|
||||
%span.nav-item-name
|
||||
= _('CI/CD')
|
||||
%ul.sidebar-sub-level-items
|
||||
= nav_link(path: 'groups/runners#index', html_options: { class: "fly-out-top-item" } ) do
|
||||
= link_to group_runners_path(@group), title: _('CI/CD') do
|
||||
%strong.fly-out-top-item-name
|
||||
= _('CI/CD')
|
||||
%li.divider.fly-out-top-item
|
||||
= nav_link(path: 'groups/runners#index') do
|
||||
= link_to group_runners_path(@group), title: s_('Runners|Runners') do
|
||||
%span= s_('Runners|Runners')
|
||||
|
||||
- if group_sidebar_link?(:kubernetes)
|
||||
= nav_link(controller: [:clusters]) do
|
||||
= link_to group_clusters_path(@group) do
|
||||
|
@ -109,7 +126,7 @@
|
|||
%span
|
||||
= _('Repository')
|
||||
|
||||
= nav_link(controller: [:ci_cd, 'groups/runners']) do
|
||||
= nav_link(path: ['groups/runners#show', 'groups/runners#edit'], controller: [:ci_cd]) do
|
||||
= link_to group_settings_ci_cd_path(@group), title: _('CI/CD') do
|
||||
%span
|
||||
= _('CI/CD')
|
||||
|
|
|
@ -33,7 +33,6 @@ module Ci
|
|||
# @param [Ci::Build] build The build to process.
|
||||
def process_build(build)
|
||||
# We execute these in sync to reduce IO.
|
||||
build.parse_trace_sections!
|
||||
build.update_coverage
|
||||
Ci::BuildReportResultService.new.execute(build)
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
name: debian_group_packages
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66188
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/336536
|
||||
milestone: '14.1'
|
||||
type: development
|
||||
group: group::package
|
||||
default_enabled: false
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
name: runner_list_group_view_vue_ui
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66376
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/336405
|
||||
milestone: '14.2'
|
||||
type: development
|
||||
group: group::runner
|
||||
default_enabled: false
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
key_path: redis_hll_counters.quickactions.i_quickactions_severity_monthly
|
||||
description: Count of MAU using the `/severity` quick action
|
||||
product_section: ops
|
||||
product_stage: monitor
|
||||
product_group: group::monitor
|
||||
product_category: incident_management
|
||||
value_type: number
|
||||
status: implemented
|
||||
milestone: "14.2"
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66422
|
||||
time_frame: 28d
|
||||
data_source: redis_hll
|
||||
data_category: Optional
|
||||
distribution:
|
||||
- ce
|
||||
- ee
|
||||
tier:
|
||||
- free
|
||||
- premium
|
||||
- ultimate
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
key_path: redis_hll_counters.quickactions.i_quickactions_severity_weekly
|
||||
description: Count of WAU using the `/severity` quick action
|
||||
product_section: ops
|
||||
product_stage: monitor
|
||||
product_group: group::monitor
|
||||
product_category: incident_management
|
||||
value_type: number
|
||||
status: implemented
|
||||
milestone: "14.2"
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66422
|
||||
time_frame: 7d
|
||||
data_source: redis_hll
|
||||
data_category: Optional
|
||||
distribution:
|
||||
- ce
|
||||
- ee
|
||||
tier:
|
||||
- free
|
||||
- premium
|
||||
- ultimate
|
|
@ -4,7 +4,11 @@ group: Package
|
|||
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
|
||||
---
|
||||
|
||||
# Debian API
|
||||
# Debian API **(FREE SELF)**
|
||||
|
||||
> - Debian API [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42670) in GitLab 13.5.
|
||||
> - Debian group API [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66188) in GitLab 14.2.
|
||||
> - [Deployed behind a feature flag](../../user/feature_flags.md), disabled by default.
|
||||
|
||||
This is the API documentation for [Debian](../../user/packages/debian_repository/index.md).
|
||||
|
||||
|
@ -24,8 +28,10 @@ for details on which headers and token types are supported.
|
|||
|
||||
## Enable the Debian API
|
||||
|
||||
The Debian API for GitLab is behind a feature flag that is disabled by default. GitLab
|
||||
administrators with access to the GitLab Rails console can enable this API for your instance.
|
||||
Debian repository support is still a work in progress. It's gated behind a feature flag that's
|
||||
**disabled by default**.
|
||||
[GitLab administrators with access to the GitLab Rails console](../../administration/feature_flags.md)
|
||||
can opt to enable it.
|
||||
|
||||
To enable it:
|
||||
|
||||
|
@ -39,6 +45,13 @@ To disable it:
|
|||
Feature.disable(:debian_packages)
|
||||
```
|
||||
|
||||
## Enable the Debian group API
|
||||
|
||||
The Debian group API is behind a feature flag that is disabled by default.
|
||||
[GitLab administrators with access to the GitLab Rails console](../../administration/feature_flags.md)
|
||||
can opt to enable it. To enable it, follow the instructions in
|
||||
[Enable the Debian group API](../../user/packages/debian_repository/index.md#enable-the-debian-group-api).
|
||||
|
||||
## Upload a package file
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62028) in GitLab 14.0.
|
||||
|
|
|
@ -4,30 +4,27 @@ group: Package
|
|||
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
|
||||
---
|
||||
|
||||
# Debian group distributions API **(FREE)**
|
||||
# Debian group distributions API **(FREE SELF)**
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/5835) in GitLab 14.0.
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66188) in GitLab 14.2.
|
||||
> - [Deployed behind a feature flag](../../user/feature_flags.md), disabled by default.
|
||||
|
||||
See the [Debian package registry documentation](../../user/packages/debian_repository/index.md)
|
||||
for more information about working with Debian packages.
|
||||
This is the reference documentation for the Debian group distributions API. This API is behind a
|
||||
feature flag that is disabled by default. To use this API, you must [enable it](#enable-the-debian-group-api).
|
||||
|
||||
## Enable Debian repository feature
|
||||
WARNING:
|
||||
This API is under development and is not meant for production use.
|
||||
|
||||
Debian repository support is gated behind a feature flag that is **disabled by default**.
|
||||
For more information about working with Debian packages, see the
|
||||
[Debian package registry documentation](../../user/packages/debian_repository/index.md).
|
||||
|
||||
## Enable the Debian group API
|
||||
|
||||
Debian group repository support is still a work in progress. It's gated behind a feature flag that's
|
||||
**disabled by default**.
|
||||
[GitLab administrators with access to the GitLab Rails console](../../administration/feature_flags.md)
|
||||
can opt to enable it.
|
||||
|
||||
To enable it:
|
||||
|
||||
```ruby
|
||||
Feature.enable(:debian_packages)
|
||||
```
|
||||
|
||||
To disable it:
|
||||
|
||||
```ruby
|
||||
Feature.disable(:debian_packages)
|
||||
```
|
||||
can opt to enable it. To enable it, follow the instructions in
|
||||
[Enable the Debian group API](../../user/packages/debian_repository/index.md#enable-the-debian-group-api).
|
||||
|
||||
## List all Debian distributions in a group
|
||||
|
||||
|
|
|
@ -4,16 +4,24 @@ group: Package
|
|||
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
|
||||
---
|
||||
|
||||
# Debian project distributions API **(FREE)**
|
||||
# Debian project distributions API **(FREE SELF)**
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/5835) in GitLab 14.0.
|
||||
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42670) in GitLab 13.5.
|
||||
> - [Deployed behind a feature flag](../../user/feature_flags.md), disabled by default.
|
||||
|
||||
See the [Debian package registry documentation](../../user/packages/debian_repository/index.md)
|
||||
for more information about working with Debian packages.
|
||||
This is the reference documentation for the Debian project distributions API. This API is behind a
|
||||
feature flag that is disabled by default. To use this API, you must [enable the Debian API](#enable-the-debian-api).
|
||||
|
||||
## Enable Debian repository feature
|
||||
WARNING:
|
||||
This API is under development and is not meant for production use.
|
||||
|
||||
Debian repository support is gated behind a feature flag that is **disabled by default**.
|
||||
For more information about working with Debian packages, see the
|
||||
[Debian package registry documentation](../../user/packages/debian_repository/index.md).
|
||||
|
||||
## Enable the Debian API
|
||||
|
||||
Debian repository support is still a work in progress. It's gated behind a feature flag that's
|
||||
**disabled by default**.
|
||||
[GitLab administrators with access to the GitLab Rails console](../../administration/feature_flags.md)
|
||||
can opt to enable it.
|
||||
|
||||
|
|
|
@ -16666,6 +16666,34 @@ Status: `data_available`
|
|||
|
||||
Tiers: `free`, `premium`, `ultimate`
|
||||
|
||||
### `redis_hll_counters.quickactions.i_quickactions_severity_monthly`
|
||||
|
||||
Count of MAU using the `/severity` quick action
|
||||
|
||||
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_28d/20210721042227_i_quickactions_severity_monthly.yml)
|
||||
|
||||
Group: `group::monitor`
|
||||
|
||||
Data Category: `Optional`
|
||||
|
||||
Status: `implemented`
|
||||
|
||||
Tiers: `free`, `premium`, `ultimate`
|
||||
|
||||
### `redis_hll_counters.quickactions.i_quickactions_severity_weekly`
|
||||
|
||||
Count of WAU using the `/severity` quick action
|
||||
|
||||
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_7d/20210721042223_i_quickactions_severity_weekly.yml)
|
||||
|
||||
Group: `group::monitor`
|
||||
|
||||
Data Category: `Optional`
|
||||
|
||||
Status: `implemented`
|
||||
|
||||
Tiers: `free`, `premium`, `ultimate`
|
||||
|
||||
### `redis_hll_counters.quickactions.i_quickactions_shrug_monthly`
|
||||
|
||||
Count of MAU using the `/shrug` quick action
|
||||
|
|
|
@ -6,7 +6,9 @@ info: To determine the technical writer assigned to the Stage/Group associated w
|
|||
|
||||
# Debian packages in the Package Registry **(FREE)**
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/5835) in GitLab 14.1.
|
||||
> - Debian API [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42670) in GitLab 13.5.
|
||||
> - Debian group API [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66188) in GitLab 14.2.
|
||||
> - [Deployed behind a feature flag](../../feature_flags.md), disabled by default.
|
||||
|
||||
WARNING:
|
||||
The Debian package registry for GitLab is under development and isn't ready for production use due to
|
||||
|
@ -20,7 +22,7 @@ Project and Group packages are supported.
|
|||
For documentation of the specific API endpoints that Debian package manager
|
||||
clients use, see the [Debian API documentation](../../../api/packages/debian.md).
|
||||
|
||||
## Enable Debian repository feature
|
||||
## Enable the Debian API **(FREE SELF)**
|
||||
|
||||
Debian repository support is still a work in progress. It's gated behind a feature flag that's
|
||||
**disabled by default**.
|
||||
|
@ -39,6 +41,22 @@ To disable it:
|
|||
Feature.disable(:debian_packages)
|
||||
```
|
||||
|
||||
## Enable the Debian group API **(FREE SELF)**
|
||||
|
||||
The Debian group repository is also behind a second feature flag that is disabled by default.
|
||||
|
||||
To enable it:
|
||||
|
||||
```ruby
|
||||
Feature.enable(:debian_group_packages)
|
||||
```
|
||||
|
||||
To disable it:
|
||||
|
||||
```ruby
|
||||
Feature.disable(:debian_group_packages)
|
||||
```
|
||||
|
||||
## Build a Debian package
|
||||
|
||||
Creating a Debian package is documented [on the Debian Wiki](https://wiki.debian.org/Packaging).
|
||||
|
|
|
@ -94,6 +94,7 @@ threads. Some quick actions might not be available to all subscription tiers.
|
|||
| `/remove_time_spent` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Remove time spent. |
|
||||
| `/remove_zoom` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Remove Zoom meeting from this issue ([introduced in GitLab 12.4](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/16609)). |
|
||||
| `/reopen` | **{check-circle}** Yes | **{check-circle}** Yes | **{check-circle}** Yes | Reopen. |
|
||||
| `/severity` | **{check-circle}** Yes | **{check-circle}** No | **{check-circle}** No | Set the severity. ([introduced in GitLab 14.2](https://gitlab.com/gitlab-org/gitlab/-/issues/334045)) |
|
||||
| `/shrug <comment>` | **{check-circle}** Yes | **{check-circle}** Yes | **{check-circle}** Yes | Append the comment with `¯\_(ツ)_/¯`. |
|
||||
| `/spend <time> [<date>]` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Add or subtract spent time. Optionally, specify the date that time was spent on. For example, `/spend 1mo 2w 3d 4h 5m 2018-08-26` or `/spend -1h 30m`. Learn more about [time tracking](time_tracking.md). |
|
||||
| `/submit_review` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Submit a pending review ([introduced in GitLab 12.7](https://gitlab.com/gitlab-org/gitlab/-/issues/8041)). |
|
||||
|
|
|
@ -188,6 +188,7 @@ module API
|
|||
mount ::API::GroupMilestones
|
||||
mount ::API::Groups
|
||||
mount ::API::GroupContainerRepositories
|
||||
mount ::API::GroupDebianDistributions
|
||||
mount ::API::GroupVariables
|
||||
mount ::API::ImportBitbucketServer
|
||||
mount ::API::ImportGithub
|
||||
|
|
|
@ -80,6 +80,8 @@ module API
|
|||
use :optional_distribution_params
|
||||
end
|
||||
get '/' do
|
||||
authorize_read_package!(project_or_group)
|
||||
|
||||
distribution_params = declared_params(include_missing: false)
|
||||
distributions = ::Packages::Debian::DistributionsFinder.new(project_or_group, distribution_params).execute
|
||||
|
||||
|
@ -96,6 +98,8 @@ module API
|
|||
requires :codename, type: String, regexp: Gitlab::Regex.debian_distribution_regex, desc: 'The Debian Codename'
|
||||
end
|
||||
get '/:codename' do
|
||||
authorize_read_package!(project_or_group)
|
||||
|
||||
distribution = ::Packages::Debian::DistributionsFinder.new(project_or_group, codename: params[:codename]).execute.last!
|
||||
|
||||
present distribution, with: ::API::Entities::Packages::Debian::Distribution
|
||||
|
|
|
@ -18,7 +18,7 @@ module API
|
|||
before do
|
||||
require_packages_enabled!
|
||||
|
||||
not_found! unless ::Feature.enabled?(:debian_packages, user_group)
|
||||
not_found! unless ::Feature.enabled?(:debian_group_packages, user_group)
|
||||
|
||||
authorize_read_package!(user_group)
|
||||
end
|
||||
|
|
35
lib/api/group_debian_distributions.rb
Normal file
35
lib/api/group_debian_distributions.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module API
|
||||
class GroupDebianDistributions < ::API::Base
|
||||
params do
|
||||
requires :id, type: String, desc: 'The ID of a group'
|
||||
end
|
||||
|
||||
resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
|
||||
rescue_from ArgumentError do |e|
|
||||
render_api_error!(e.message, 400)
|
||||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordInvalid do |e|
|
||||
render_api_error!(e.message, 400)
|
||||
end
|
||||
|
||||
after_validation do
|
||||
require_packages_enabled!
|
||||
|
||||
not_found! unless ::Feature.enabled?(:debian_group_packages, user_group)
|
||||
end
|
||||
|
||||
namespace ':id/-' do
|
||||
helpers do
|
||||
def project_or_group
|
||||
user_group
|
||||
end
|
||||
end
|
||||
|
||||
include ::API::Concerns::Packages::DebianDistributionEndpoints
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -19,8 +19,6 @@ module API
|
|||
require_packages_enabled!
|
||||
|
||||
not_found! unless ::Feature.enabled?(:debian_packages, user_project)
|
||||
|
||||
authorize_read_package!
|
||||
end
|
||||
|
||||
namespace ':id' do
|
||||
|
|
|
@ -10,7 +10,9 @@ module Gitlab
|
|||
# Using before_update here conflicts with elasticsearch-model somehow
|
||||
before_create :refresh_markdown_cache, if: :invalidated_markdown_cache?
|
||||
before_update :refresh_markdown_cache, if: :invalidated_markdown_cache?
|
||||
after_save :store_mentions!, if: :mentionable_attributes_changed?
|
||||
# The import case needs to be fixed to avoid large number of
|
||||
# SQL queries: https://gitlab.com/gitlab-org/gitlab/-/issues/21801
|
||||
after_save :store_mentions!, if: :mentionable_attributes_changed?, unless: ->(obj) { obj.is_a?(Importable) && obj.importing? }
|
||||
end
|
||||
|
||||
# Always exclude _html fields from attributes (including serialization).
|
||||
|
|
|
@ -241,8 +241,43 @@ module Gitlab
|
|||
"#{comment} #{TABLEFLIP}"
|
||||
end
|
||||
|
||||
desc _('Set severity')
|
||||
explanation _('Sets the severity')
|
||||
params '1 / S1 / Critical'
|
||||
types Issue
|
||||
condition do
|
||||
quick_action_target.supports_severity?
|
||||
end
|
||||
parse_params do |severity|
|
||||
find_severity(severity)
|
||||
end
|
||||
command :severity do |severity|
|
||||
if severity
|
||||
::Issues::UpdateService.new(project: quick_action_target.project, current_user: current_user, params: { severity: severity }).execute(quick_action_target)
|
||||
|
||||
@execution_message[:severity] = _("Severity updated to %{severity}.") % { severity: severity.capitalize }
|
||||
else
|
||||
@execution_message[:severity] = _('No severity matches the provided parameter')
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_severity(severity_param)
|
||||
return unless severity_param
|
||||
|
||||
severity_param = severity_param.downcase
|
||||
severities = IssuableSeverity::SEVERITY_QUICK_ACTION_PARAMS.values.map { |vals| vals.map(&:downcase) }
|
||||
|
||||
matched_severity = severities.find do |severity_values|
|
||||
severity_values.include?(severity_param)
|
||||
end
|
||||
|
||||
return unless matched_severity
|
||||
|
||||
matched_severity[0]
|
||||
end
|
||||
|
||||
def run_label_command(labels:, command:, updates_key:)
|
||||
return if labels.empty?
|
||||
|
||||
|
|
|
@ -179,6 +179,10 @@
|
|||
category: quickactions
|
||||
redis_slot: quickactions
|
||||
aggregation: weekly
|
||||
- name: i_quickactions_severity
|
||||
category: quickactions
|
||||
redis_slot: quickactions
|
||||
aggregation: weekly
|
||||
- name: i_quickactions_shrug
|
||||
category: quickactions
|
||||
redis_slot: quickactions
|
||||
|
|
|
@ -5207,6 +5207,9 @@ msgstr ""
|
|||
msgid "Billing|Private"
|
||||
msgstr ""
|
||||
|
||||
msgid "Billing|Project invite"
|
||||
msgstr ""
|
||||
|
||||
msgid "Billing|Remove user %{username} from your subscription"
|
||||
msgstr ""
|
||||
|
||||
|
@ -22279,6 +22282,9 @@ msgstr ""
|
|||
msgid "No schedules"
|
||||
msgstr ""
|
||||
|
||||
msgid "No severity matches the provided parameter"
|
||||
msgstr ""
|
||||
|
||||
msgid "No source selected"
|
||||
msgstr ""
|
||||
|
||||
|
@ -28189,6 +28195,9 @@ msgstr ""
|
|||
msgid "Runners|For each solution, you will choose a capacity. 1 enables warm HA through Auto Scaling group re-spawn. 2 enables hot HA because the service is available even when a node is lost. 3 or more enables hot HA and manual scaling of runner fleet."
|
||||
msgstr ""
|
||||
|
||||
msgid "Runners|Group Runners"
|
||||
msgstr ""
|
||||
|
||||
msgid "Runners|IP Address"
|
||||
msgstr ""
|
||||
|
||||
|
@ -28261,6 +28270,9 @@ msgstr ""
|
|||
msgid "Runners|Runner registration"
|
||||
msgstr ""
|
||||
|
||||
msgid "Runners|Runners"
|
||||
msgstr ""
|
||||
|
||||
msgid "Runners|Shared runners are available to every project in a GitLab instance. If you want a runner to build only specific projects, restrict the project in the table below. After you restrict a runner to a project, you cannot change it back to a shared runner."
|
||||
msgstr ""
|
||||
|
||||
|
@ -29828,6 +29840,9 @@ msgstr ""
|
|||
msgid "Set requirements for a user to sign-in. Enable mandatory two-factor authentication."
|
||||
msgstr ""
|
||||
|
||||
msgid "Set severity"
|
||||
msgstr ""
|
||||
|
||||
msgid "Set size limits for displaying diffs in the browser."
|
||||
msgstr ""
|
||||
|
||||
|
@ -29972,6 +29987,9 @@ msgstr ""
|
|||
msgid "Sets the milestone to %{milestone_reference}."
|
||||
msgstr ""
|
||||
|
||||
msgid "Sets the severity"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sets time estimate to %{time_estimate}."
|
||||
msgstr ""
|
||||
|
||||
|
@ -29999,6 +30017,9 @@ msgstr ""
|
|||
msgid "Severity"
|
||||
msgstr ""
|
||||
|
||||
msgid "Severity updated to %{severity}."
|
||||
msgstr ""
|
||||
|
||||
msgid "SeverityWidget|Severity"
|
||||
msgstr ""
|
||||
|
||||
|
@ -38363,6 +38384,9 @@ msgstr ""
|
|||
msgid "ciReport|Container scanning detects known vulnerabilities in your docker images."
|
||||
msgstr ""
|
||||
|
||||
msgid "ciReport|Could not dismiss vulnerability because the associated pipeline no longer exists. Refresh the page and try again."
|
||||
msgstr ""
|
||||
|
||||
msgid "ciReport|Coverage Fuzzing"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ UsageData/HistogramWithLargeTable:
|
|||
- 'ee/lib/ee/gitlab/usage_data.rb'
|
||||
HighTrafficModels: &high_traffic_models # models for all high traffic tables in Migration/UpdateLargeTable
|
||||
- 'AuditEvent'
|
||||
- 'Ci::BuildTraceSection'
|
||||
- 'CommitStatus'
|
||||
- 'Ci::Processable'
|
||||
- 'Ci::Bridge'
|
||||
|
|
|
@ -15,6 +15,33 @@ RSpec.describe Groups::RunnersController do
|
|||
sign_in(user)
|
||||
end
|
||||
|
||||
describe '#index' do
|
||||
context 'when user is owner' do
|
||||
before do
|
||||
group.add_owner(user)
|
||||
end
|
||||
|
||||
it 'renders show with 200 status code' do
|
||||
get :index, params: { group_id: group }
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template(:index)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user is not owner' do
|
||||
before do
|
||||
group.add_maintainer(user)
|
||||
end
|
||||
|
||||
it 'renders a 404' do
|
||||
get :index, params: { group_id: group }
|
||||
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#show' do
|
||||
context 'when user is owner' do
|
||||
before do
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
FactoryBot.define do
|
||||
factory :ci_build_trace_section_name, class: 'Ci::BuildTraceSectionName' do
|
||||
sequence(:name) { |n| "section_#{n}" }
|
||||
project factory: :project
|
||||
end
|
||||
end
|
|
@ -40,7 +40,7 @@ RSpec.describe 'User searches group settings', :js do
|
|||
visit group_settings_ci_cd_path(group)
|
||||
end
|
||||
|
||||
it_behaves_like 'can search settings', 'Variables', 'Runners'
|
||||
it_behaves_like 'can search settings', 'Variables', 'Auto DevOps'
|
||||
end
|
||||
|
||||
context 'in Packages & Registries page' do
|
||||
|
|
21
spec/frontend/runner/group_runners/group_runners_app_spec.js
Normal file
21
spec/frontend/runner/group_runners/group_runners_app_spec.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { shallowMount } from '@vue/test-utils';
|
||||
import RunnerTypeHelp from '~/runner/components/runner_type_help.vue';
|
||||
import GroupRunnersApp from '~/runner/group_runners/group_runners_app.vue';
|
||||
|
||||
describe('GroupRunnersApp', () => {
|
||||
let wrapper;
|
||||
|
||||
const findRunnerTypeHelp = () => wrapper.findComponent(RunnerTypeHelp);
|
||||
|
||||
const createComponent = ({ mountFn = shallowMount } = {}) => {
|
||||
wrapper = mountFn(GroupRunnersApp);
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
createComponent();
|
||||
});
|
||||
|
||||
it('shows the runner type help', () => {
|
||||
expect(findRunnerTypeHelp().exists()).toBe(true);
|
||||
});
|
||||
});
|
|
@ -313,15 +313,30 @@ RSpec.describe GroupsHelper do
|
|||
it 'returns all the expected links' do
|
||||
links = [
|
||||
:overview, :activity, :issues, :labels, :milestones, :merge_requests,
|
||||
:group_members, :settings
|
||||
:runners, :group_members, :settings
|
||||
]
|
||||
|
||||
expect(helper.group_sidebar_links).to include(*links)
|
||||
end
|
||||
|
||||
it 'includes settings when the user can admin the group' do
|
||||
it 'excludes runners when the user cannot admin the group' do
|
||||
expect(helper).to receive(:current_user) { user }
|
||||
expect(helper).to receive(:can?).with(user, :admin_group, group) { false }
|
||||
# TODO Proper policies, such as `read_group_runners, should be implemented per
|
||||
# See https://gitlab.com/gitlab-org/gitlab/-/issues/334802
|
||||
expect(helper).to receive(:can?).twice.with(user, :admin_group, group) { false }
|
||||
|
||||
expect(helper.group_sidebar_links).not_to include(:runners)
|
||||
end
|
||||
|
||||
it 'excludes runners when the feature "runner_list_group_view_vue_ui" is disabled' do
|
||||
stub_feature_flags(runner_list_group_view_vue_ui: false)
|
||||
|
||||
expect(helper.group_sidebar_links).not_to include(:runners)
|
||||
end
|
||||
|
||||
it 'excludes settings when the user can admin the group' do
|
||||
expect(helper).to receive(:current_user) { user }
|
||||
expect(helper).to receive(:can?).twice.with(user, :admin_group, group) { false }
|
||||
|
||||
expect(helper.group_sidebar_links).not_to include(:settings)
|
||||
end
|
||||
|
|
|
@ -461,7 +461,6 @@ project:
|
|||
- file_uploads
|
||||
- import_state
|
||||
- members_and_requesters
|
||||
- build_trace_section_names
|
||||
- build_trace_chunks
|
||||
- job_artifacts
|
||||
- root_of_fork_network
|
||||
|
|
|
@ -178,4 +178,42 @@ RSpec.describe Gitlab::MarkdownCache::ActiveRecord::Extension do
|
|||
thing.refresh_markdown_cache!
|
||||
end
|
||||
end
|
||||
|
||||
context 'with note' do
|
||||
let(:klass) do
|
||||
Class.new(ActiveRecord::Base) do
|
||||
self.table_name = 'notes'
|
||||
include CacheMarkdownField
|
||||
include Importable
|
||||
include Mentionable
|
||||
|
||||
attr_mentionable :note, pipeline: :note
|
||||
cache_markdown_field :note, pipeline: :note
|
||||
end
|
||||
end
|
||||
|
||||
let(:thing) { klass.new(note: markdown) }
|
||||
|
||||
before do
|
||||
thing.note = "hello world"
|
||||
end
|
||||
|
||||
it 'calls store_mentions!' do
|
||||
expect(thing).to receive(:store_mentions!).and_call_original
|
||||
|
||||
thing.save!
|
||||
end
|
||||
|
||||
context 'during import' do
|
||||
before do
|
||||
thing.importing = true
|
||||
end
|
||||
|
||||
it 'does not call store_mentions!' do
|
||||
expect(thing).not_to receive(:store_mentions!)
|
||||
|
||||
thing.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,7 +20,6 @@ RSpec.describe Ci::Build do
|
|||
it { is_expected.to belong_to(:trigger_request) }
|
||||
it { is_expected.to belong_to(:erased_by) }
|
||||
|
||||
it { is_expected.to have_many(:trace_sections) }
|
||||
it { is_expected.to have_many(:needs) }
|
||||
it { is_expected.to have_many(:sourced_pipelines) }
|
||||
it { is_expected.to have_many(:job_variables) }
|
||||
|
@ -1105,17 +1104,6 @@ RSpec.describe Ci::Build do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#parse_trace_sections!' do
|
||||
it 'calls ExtractSectionsFromBuildTraceService' do
|
||||
expect(Ci::ExtractSectionsFromBuildTraceService)
|
||||
.to receive(:new).with(project, build.user).once.and_call_original
|
||||
expect_any_instance_of(Ci::ExtractSectionsFromBuildTraceService)
|
||||
.to receive(:execute).with(build).once
|
||||
|
||||
build.parse_trace_sections!
|
||||
end
|
||||
end
|
||||
|
||||
describe '#trace' do
|
||||
subject { build.trace }
|
||||
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe Ci::BuildTraceSectionName, model: true do
|
||||
subject { build(:ci_build_trace_section_name) }
|
||||
|
||||
it { is_expected.to belong_to(:project) }
|
||||
it { is_expected.to have_many(:trace_sections)}
|
||||
|
||||
it { is_expected.to validate_presence_of(:project) }
|
||||
it { is_expected.to validate_presence_of(:name) }
|
||||
it { is_expected.to validate_uniqueness_of(:name).scoped_to(:project_id) }
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe Ci::BuildTraceSection, model: true do
|
||||
it { is_expected.to belong_to(:build)}
|
||||
it { is_expected.to belong_to(:project)}
|
||||
it { is_expected.to belong_to(:section_name)}
|
||||
|
||||
it { is_expected.to validate_presence_of(:section_name) }
|
||||
it { is_expected.to validate_presence_of(:build) }
|
||||
it { is_expected.to validate_presence_of(:project) }
|
||||
end
|
|
@ -86,7 +86,6 @@ RSpec.describe Project, factory_default: :keep do
|
|||
it { is_expected.to have_many(:ci_pipelines) }
|
||||
it { is_expected.to have_many(:ci_refs) }
|
||||
it { is_expected.to have_many(:builds) }
|
||||
it { is_expected.to have_many(:build_trace_section_names)}
|
||||
it { is_expected.to have_many(:build_report_results) }
|
||||
it { is_expected.to have_many(:runner_projects) }
|
||||
it { is_expected.to have_many(:runners) }
|
||||
|
|
44
spec/requests/api/group_debian_distributions_spec.rb
Normal file
44
spec/requests/api/group_debian_distributions_spec.rb
Normal file
|
@ -0,0 +1,44 @@
|
|||
# frozen_string_literal: true
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe API::GroupDebianDistributions do
|
||||
include HttpBasicAuthHelpers
|
||||
include WorkhorseHelpers
|
||||
|
||||
include_context 'Debian repository shared context', :group, false do
|
||||
describe 'POST groups/:id/-/debian_distributions' do
|
||||
let(:method) { :post }
|
||||
let(:url) { "/groups/#{container.id}/-/debian_distributions" }
|
||||
let(:api_params) { { 'codename': 'my-codename' } }
|
||||
|
||||
it_behaves_like 'Debian repository write endpoint', 'POST distribution request', :created, /^{.*"codename":"my-codename",.*"components":\["main"\],.*"architectures":\["all","amd64"\]/, authenticate_non_public: false
|
||||
end
|
||||
|
||||
describe 'GET groups/:id/-/debian_distributions' do
|
||||
let(:url) { "/groups/#{container.id}/-/debian_distributions" }
|
||||
|
||||
it_behaves_like 'Debian repository read endpoint', 'GET request', :success, /^\[{.*"codename":"existing-codename",.*"components":\["existing-component"\],.*"architectures":\["all","existing-arch"\]/, authenticate_non_public: false
|
||||
end
|
||||
|
||||
describe 'GET groups/:id/-/debian_distributions/:codename' do
|
||||
let(:url) { "/groups/#{container.id}/-/debian_distributions/#{distribution.codename}" }
|
||||
|
||||
it_behaves_like 'Debian repository read endpoint', 'GET request', :success, /^{.*"codename":"existing-codename",.*"components":\["existing-component"\],.*"architectures":\["all","existing-arch"\]/, authenticate_non_public: false
|
||||
end
|
||||
|
||||
describe 'PUT groups/:id/-/debian_distributions/:codename' do
|
||||
let(:method) { :put }
|
||||
let(:url) { "/groups/#{container.id}/-/debian_distributions/#{distribution.codename}" }
|
||||
let(:api_params) { { suite: 'my-suite' } }
|
||||
|
||||
it_behaves_like 'Debian repository write endpoint', 'PUT distribution request', :success, /^{.*"codename":"existing-codename",.*"suite":"my-suite",/, authenticate_non_public: false
|
||||
end
|
||||
|
||||
describe 'DELETE groups/:id/-/debian_distributions/:codename' do
|
||||
let(:method) { :delete }
|
||||
let(:url) { "/groups/#{container.id}/-/debian_distributions/#{distribution.codename}" }
|
||||
|
||||
it_behaves_like 'Debian repository maintainer write endpoint', 'DELETE distribution request', :success, /^{"message":"202 Accepted"}$/, authenticate_non_public: false
|
||||
end
|
||||
end
|
||||
end
|
|
@ -116,7 +116,6 @@ RSpec.describe RuboCop::Cop::Migration::CreateTableWithForeignKeys do
|
|||
shared_context 'when there is a target to a high traffic table' do |dsl_method|
|
||||
%w[
|
||||
audit_events
|
||||
ci_build_trace_sections
|
||||
ci_builds
|
||||
ci_builds_metadata
|
||||
ci_job_artifacts
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe Ci::ExtractSectionsFromBuildTraceService, '#execute' do
|
||||
let(:user) { create(:user) }
|
||||
let(:project) { create(:project) }
|
||||
let(:build) { create(:ci_build, project: project) }
|
||||
|
||||
subject { described_class.new(project, user) }
|
||||
|
||||
shared_examples 'build trace has sections markers' do
|
||||
before do
|
||||
build.trace.set(File.read(expand_fixture_path('trace/trace_with_sections')))
|
||||
end
|
||||
|
||||
it 'saves the correct extracted sections' do
|
||||
expect(build.trace_sections).to be_empty
|
||||
expect(subject.execute(build)).to be(true)
|
||||
expect(build.trace_sections).not_to be_empty
|
||||
end
|
||||
|
||||
it "fails if trace_sections isn't empty" do
|
||||
expect(subject.execute(build)).to be(true)
|
||||
expect(build.trace_sections).not_to be_empty
|
||||
|
||||
expect(subject.execute(build)).to be(false)
|
||||
expect(build.trace_sections).not_to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'build trace has no sections markers' do
|
||||
before do
|
||||
build.trace.set('no markerts')
|
||||
end
|
||||
|
||||
it 'extracts no sections' do
|
||||
expect(build.trace_sections).to be_empty
|
||||
expect(subject.execute(build)).to be(true)
|
||||
expect(build.trace_sections).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the build has no user' do
|
||||
it_behaves_like 'build trace has sections markers'
|
||||
it_behaves_like 'build trace has no sections markers'
|
||||
end
|
||||
|
||||
context 'when the build has a valid user' do
|
||||
before do
|
||||
build.user = user
|
||||
end
|
||||
|
||||
it_behaves_like 'build trace has sections markers'
|
||||
it_behaves_like 'build trace has no sections markers'
|
||||
end
|
||||
end
|
|
@ -2080,6 +2080,48 @@ RSpec.describe QuickActions::InterpretService do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'severity command' do
|
||||
let_it_be_with_reload(:issuable) { create(:incident, project: project) }
|
||||
|
||||
subject(:set_severity) { service.execute(content, issuable) }
|
||||
|
||||
it_behaves_like 'failed command', 'No severity matches the provided parameter' do
|
||||
let(:content) { '/severity something' }
|
||||
end
|
||||
|
||||
shared_examples 'updates the severity' do |new_severity|
|
||||
it do
|
||||
expect { set_severity }.to change { issuable.severity }.from('unknown').to(new_severity)
|
||||
end
|
||||
end
|
||||
|
||||
context 'severity given with S format' do
|
||||
let(:content) { '/severity s3' }
|
||||
|
||||
it_behaves_like 'updates the severity', 'medium'
|
||||
end
|
||||
|
||||
context 'severity given with number format' do
|
||||
let(:content) { '/severity 3' }
|
||||
|
||||
it_behaves_like 'updates the severity', 'medium'
|
||||
end
|
||||
|
||||
context 'severity given with text format' do
|
||||
let(:content) { '/severity medium' }
|
||||
|
||||
it_behaves_like 'updates the severity', 'medium'
|
||||
end
|
||||
|
||||
context 'an issuable that does not support severity' do
|
||||
let_it_be_with_reload(:issuable) { create(:issue, project: project) }
|
||||
|
||||
it_behaves_like 'failed command', 'Could not apply severity command.' do
|
||||
let(:content) { '/severity s3' }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#explain' do
|
||||
|
|
|
@ -176,6 +176,15 @@ RSpec.shared_context 'group navbar structure' do
|
|||
}
|
||||
end
|
||||
|
||||
let(:ci_cd_nav_item) do
|
||||
{
|
||||
nav_item: _('CI/CD'),
|
||||
nav_sub_items: [
|
||||
s_('Runners|Runners')
|
||||
]
|
||||
}
|
||||
end
|
||||
|
||||
let(:issues_nav_items) do
|
||||
[
|
||||
_('List'),
|
||||
|
|
|
@ -38,12 +38,14 @@ RSpec.shared_context 'GroupPolicy context' do
|
|||
delete_metrics_dashboard_annotation
|
||||
update_metrics_dashboard_annotation
|
||||
create_custom_emoji
|
||||
create_package
|
||||
create_package_settings
|
||||
]
|
||||
end
|
||||
|
||||
let(:maintainer_permissions) do
|
||||
%i[
|
||||
destroy_package
|
||||
create_projects
|
||||
read_cluster create_cluster update_cluster admin_cluster add_cluster
|
||||
]
|
||||
|
|
|
@ -4,7 +4,7 @@ RSpec.shared_context 'Debian repository shared context' do |container_type, can_
|
|||
include_context 'workhorse headers'
|
||||
|
||||
before do
|
||||
stub_feature_flags(debian_packages: true)
|
||||
stub_feature_flags(debian_packages: true, debian_group_packages: true)
|
||||
end
|
||||
|
||||
let_it_be(:private_container, freeze: can_freeze) { create(container_type, :private) }
|
||||
|
|
|
@ -15,7 +15,6 @@ RSpec.describe BuildFinishedWorker do
|
|||
end
|
||||
|
||||
it 'calculates coverage and calls hooks', :aggregate_failures do
|
||||
expect(build).to receive(:parse_trace_sections!).ordered
|
||||
expect(build).to receive(:update_coverage).ordered
|
||||
|
||||
expect_next_instance_of(Ci::BuildReportResultService) do |build_report_result_service|
|
||||
|
|
|
@ -15,7 +15,6 @@ RSpec.describe Ci::BuildFinishedWorker do
|
|||
end
|
||||
|
||||
it 'calculates coverage and calls hooks', :aggregate_failures do
|
||||
expect(build).to receive(:parse_trace_sections!).ordered
|
||||
expect(build).to receive(:update_coverage).ordered
|
||||
|
||||
expect_next_instance_of(Ci::BuildReportResultService) do |build_report_result_service|
|
||||
|
|
Loading…
Reference in a new issue