Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-10-28 09:13:54 +00:00
parent ac38136845
commit 89cbcca95d
42 changed files with 359 additions and 241 deletions

View file

@ -1 +1 @@
0697e25f0d30d7d1c005c3fef3130cee001d198c bf9abd731ba2dab65e8c275c51d578d95dd3d506

View file

@ -688,17 +688,20 @@ export const searchBy = (query = '', searchSpace = {}) => {
*/ */
export const isScopedLabel = ({ title = '' } = {}) => title.includes(SCOPED_LABEL_DELIMITER); export const isScopedLabel = ({ title = '' } = {}) => title.includes(SCOPED_LABEL_DELIMITER);
const scopedLabelRegex = new RegExp(`(.*)${SCOPED_LABEL_DELIMITER}.*`);
/** /**
* Returns the base value of the scoped label * Returns the key of a scoped label.
* For example:
* - returns `scoped` if the label is `scoped::value`.
* - returns `scoped::label` if the label is `scoped::label::value`.
* *
* Expected Label to be an Object with `title` as a key: * @param {Object} label object containing `title` property
* { title: 'LabelTitle', ...otherProperties }; * @returns String scoped label key, or full label if it is not a scoped label
*
* @param {Object} label
* @returns String
*/ */
export const scopedLabelKey = ({ title = '' }) => export const scopedLabelKey = ({ title = '' }) => {
isScopedLabel({ title }) && title.split(SCOPED_LABEL_DELIMITER)[0]; return title.replace(scopedLabelRegex, '$1');
};
// Methods to set and get Cookie // Methods to set and get Cookie
export const setCookie = (name, value) => Cookies.set(name, value, { expires: 365 }); export const setCookie = (name, value) => Cookies.set(name, value, { expires: 365 });

View file

@ -1,5 +1,4 @@
import { isScopedLabel, scopedLabelKey } from '~/lib/utils/common_utils'; import { isScopedLabel, scopedLabelKey } from '~/lib/utils/common_utils';
import { SCOPED_LABEL_DELIMITER } from '~/vue_shared/components/sidebar/labels_select_widget/constants';
import { DropdownVariant } from '../constants'; import { DropdownVariant } from '../constants';
import * as types from './mutation_types'; import * as types from './mutation_types';
@ -67,9 +66,11 @@ export default {
} }
if (isScopedLabel(candidateLabel)) { if (isScopedLabel(candidateLabel)) {
const scopedKeyWithDelimiter = `${scopedLabelKey(candidateLabel)}${SCOPED_LABEL_DELIMITER}`;
const currentActiveScopedLabel = state.labels.find( const currentActiveScopedLabel = state.labels.find(
({ title }) => title.startsWith(scopedKeyWithDelimiter) && title !== candidateLabel.title, ({ set, title }) =>
set &&
title !== candidateLabel.title &&
scopedLabelKey({ title }) === scopedLabelKey(candidateLabel),
); );
if (currentActiveScopedLabel) { if (currentActiveScopedLabel) {

View file

@ -1,17 +0,0 @@
# frozen_string_literal: true
module Clusters
class DeployableAgentsFinder
def initialize(project)
@project = project
end
def execute
project.cluster_agents.ordered_by_name
end
private
attr_reader :project
end
end

View file

@ -1277,11 +1277,7 @@ module Ci
def authorized_cluster_agents def authorized_cluster_agents
strong_memoize(:authorized_cluster_agents) do strong_memoize(:authorized_cluster_agents) do
if ::Feature.enabled?(:group_authorized_agents, project, default_enabled: :yaml) ::Clusters::AgentAuthorizationsFinder.new(project).execute.map(&:agent)
::Clusters::AgentAuthorizationsFinder.new(project).execute.map(&:agent)
else
::Clusters::DeployableAgentsFinder.new(project).execute
end
end end
end end

View file

@ -37,6 +37,15 @@ module Enums
security_audit: 4 security_audit: 4
}.with_indifferent_access.freeze }.with_indifferent_access.freeze
# keep the order of the values in the state enum, it is used in state_order method to properly order vulnerabilities based on state
# remember to recreate index_vulnerabilities_on_state_case_id index when you update or extend this enum
VULNERABILITY_STATES = {
detected: 1,
confirmed: 4,
resolved: 3,
dismissed: 2
}.with_indifferent_access.freeze
def self.confidence_levels def self.confidence_levels
CONFIDENCE_LEVELS CONFIDENCE_LEVELS
end end
@ -52,6 +61,10 @@ module Enums
def self.detection_methods def self.detection_methods
DETECTION_METHODS DETECTION_METHODS
end end
def self.vulnerability_states
VULNERABILITY_STATES
end
end end
end end

View file

@ -131,17 +131,27 @@ module ApplicationWorker
end end
end end
def log_bulk_perform_async?
@log_bulk_perform_async
end
def log_bulk_perform_async!
@log_bulk_perform_async = true
end
def queue_size def queue_size
Sidekiq::Queue.new(queue).size Sidekiq::Queue.new(queue).size
end end
def bulk_perform_async(args_list) def bulk_perform_async(args_list)
if Feature.enabled?(:sidekiq_push_bulk_in_batches) if log_bulk_perform_async?
in_safe_limit_batches(args_list) do |args_batch, _| Sidekiq.logger.info('class' => self, 'args_list' => args_list, 'args_list_count' => args_list.length, 'message' => 'Inserting multiple jobs')
Sidekiq::Client.push_bulk('class' => self, 'args' => args_batch) end
do_push_bulk(args_list).tap do |job_ids|
if log_bulk_perform_async?
Sidekiq.logger.info('class' => self, 'jid_list' => job_ids, 'jid_list_count' => job_ids.length, 'message' => 'Completed JID insertion')
end end
else
Sidekiq::Client.push_bulk('class' => self, 'args' => args_list)
end end
end end
@ -188,6 +198,16 @@ module ApplicationWorker
private private
def do_push_bulk(args_list)
if Feature.enabled?(:sidekiq_push_bulk_in_batches)
in_safe_limit_batches(args_list) do |args_batch, _|
Sidekiq::Client.push_bulk('class' => self, 'args' => args_batch)
end
else
Sidekiq::Client.push_bulk('class' => self, 'args' => args_list)
end
end
def in_safe_limit_batches(args_list, schedule_at = nil, safe_limit = SAFE_PUSH_BULK_LIMIT) def in_safe_limit_batches(args_list, schedule_at = nil, safe_limit = SAFE_PUSH_BULK_LIMIT)
# `schedule_at` could be one of # `schedule_at` could be one of
# - nil. # - nil.

View file

@ -1,8 +0,0 @@
---
name: group_authorized_agents
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69047
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/340166
milestone: '14.3'
type: development
group: group::configure
default_enabled: true

View file

@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/323730
milestone: '13.10' milestone: '13.10'
type: development type: development
group: group::optimize group: group::optimize
default_enabled: false default_enabled: true

View file

@ -0,0 +1,11 @@
# frozen_string_literal: true
class AddStatesIntoApprovalProjectRules < Gitlab::Database::Migration[1.0]
def up
add_column :approval_project_rules, :vulnerability_states, :text, array: true, null: false, default: ['newly_detected']
end
def down
remove_column :approval_project_rules, :vulnerability_states
end
end

View file

@ -0,0 +1 @@
eeda27c42a80d23851bb58b00cee79feeffbe9ae1fef76b3034f92c8610a8aaf

View file

@ -10579,7 +10579,8 @@ CREATE TABLE approval_project_rules (
scanners text[], scanners text[],
vulnerabilities_allowed smallint DEFAULT 0 NOT NULL, vulnerabilities_allowed smallint DEFAULT 0 NOT NULL,
severity_levels text[] DEFAULT '{}'::text[] NOT NULL, severity_levels text[] DEFAULT '{}'::text[] NOT NULL,
report_type smallint report_type smallint,
vulnerability_states text[] DEFAULT '{newly_detected}'::text[] NOT NULL
); );
CREATE TABLE approval_project_rules_groups ( CREATE TABLE approval_project_rules_groups (

View file

@ -183,7 +183,7 @@ successfully, you must replicate their data using some other means.
|[Application data in PostgreSQL](../../postgresql/index.md) | **Yes** (10.2) | **Yes** (10.2) | No | | |[Application data in PostgreSQL](../../postgresql/index.md) | **Yes** (10.2) | **Yes** (10.2) | No | |
|[Project repository](../../../user/project/repository/) | **Yes** (10.2) | **Yes** (10.7) | No | | |[Project repository](../../../user/project/repository/) | **Yes** (10.2) | **Yes** (10.7) | No | |
|[Project wiki repository](../../../user/project/wiki/) | **Yes** (10.2) | **Yes** (10.7) | No | | |[Project wiki repository](../../../user/project/wiki/) | **Yes** (10.2) | **Yes** (10.7) | No | |
|[Group wiki repository](../../../user/project/wiki/index.md#group-wikis) | [**Yes** (13.10)](https://gitlab.com/gitlab-org/gitlab/-/issues/208147) | No | No | Behind feature flag `geo_group_wiki_repository_replication`, enabled by default. | |[Group wiki repository](../../../user/project/wiki/group.md) | [**Yes** (13.10)](https://gitlab.com/gitlab-org/gitlab/-/issues/208147) | No | No | Behind feature flag `geo_group_wiki_repository_replication`, enabled by default. |
|[Uploads](../../uploads.md) | **Yes** (10.2) | [No](https://gitlab.com/groups/gitlab-org/-/epics/1817) | No | Verified only on transfer or manually using [Integrity Check Rake Task](../../raketasks/check.md) on both sites and comparing the output between them. | |[Uploads](../../uploads.md) | **Yes** (10.2) | [No](https://gitlab.com/groups/gitlab-org/-/epics/1817) | No | Verified only on transfer or manually using [Integrity Check Rake Task](../../raketasks/check.md) on both sites and comparing the output between them. |
|[LFS objects](../../lfs/index.md) | **Yes** (10.2) | [No](https://gitlab.com/gitlab-org/gitlab/-/issues/8922) | Via Object Storage provider if supported. Native Geo support (Beta). | Verified only on transfer or manually using [Integrity Check Rake Task](../../raketasks/check.md) on both sites and comparing the output between them. GitLab versions 11.11.x and 12.0.x are affected by [a bug that prevents any new LFS objects from replicating](https://gitlab.com/gitlab-org/gitlab/-/issues/32696).<br /><br />Behind feature flag `geo_lfs_object_replication`, enabled by default. | |[LFS objects](../../lfs/index.md) | **Yes** (10.2) | [No](https://gitlab.com/gitlab-org/gitlab/-/issues/8922) | Via Object Storage provider if supported. Native Geo support (Beta). | Verified only on transfer or manually using [Integrity Check Rake Task](../../raketasks/check.md) on both sites and comparing the output between them. GitLab versions 11.11.x and 12.0.x are affected by [a bug that prevents any new LFS objects from replicating](https://gitlab.com/gitlab-org/gitlab/-/issues/32696).<br /><br />Behind feature flag `geo_lfs_object_replication`, enabled by default. |
|[Personal snippets](../../../user/snippets.md) | **Yes** (10.2) | **Yes** (10.2) | No | | |[Personal snippets](../../../user/snippets.md) | **Yes** (10.2) | **Yes** (10.2) | No | |

View file

@ -11,7 +11,7 @@ type: reference
Group repositories can be moved between storages. This API can help you when Group repositories can be moved between storages. This API can help you when
[migrating to Gitaly Cluster](../administration/gitaly/index.md#migrating-to-gitaly-cluster), for [migrating to Gitaly Cluster](../administration/gitaly/index.md#migrating-to-gitaly-cluster), for
example, or to migrate a [group wiki](../user/project/wiki/index.md#group-wikis). example, or to migrate a [group wiki](../user/project/wiki/group.md).
As group repository storage moves are processed, they transition through different states. Values As group repository storage moves are processed, they transition through different states. Values
of `state` are: of `state` are:

View file

@ -9,7 +9,7 @@ type: reference, api
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/212199) in GitLab 13.5. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/212199) in GitLab 13.5.
The [group wikis](../user/project/wiki/index.md#group-wikis) API is available only in APIv4. The [group wikis](../user/project/wiki/group.md) API is available only in APIv4.
An API for [project wikis](wikis.md) is also available. An API for [project wikis](wikis.md) is also available.
## List wiki pages ## List wiki pages

View file

@ -95,12 +95,12 @@ build:
- mkdir -p /kaniko/.docker - mkdir -p /kaniko/.docker
- |- - |-
KANIKOPROXYBUILDARGS="" KANIKOPROXYBUILDARGS=""
KANIKOCFG="{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" KANIKOCFG="\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}"
if [ "x${http_proxy}" != "x" -o "x${https_proxy}" != "x" ]; then if [ "x${http_proxy}" != "x" -o "x${https_proxy}" != "x" ]; then
KANIKOCFG="${KANIKOCFG}, \"proxies\": { \"default\": { \"httpProxy\": \"${http_proxy}\", \"httpsProxy\": \"${https_proxy}\", \"noProxy\": \"${no_proxy}\"}}" KANIKOCFG="${KANIKOCFG}, \"proxies\": { \"default\": { \"httpProxy\": \"${http_proxy}\", \"httpsProxy\": \"${https_proxy}\", \"noProxy\": \"${no_proxy}\"}}"
KANIKOPROXYBUILDARGS="--build-arg http_proxy=${http_proxy} --build-arg https_proxy=${https_proxy} --build-arg no_proxy=${no_proxy}" KANIKOPROXYBUILDARGS="--build-arg http_proxy=${http_proxy} --build-arg https_proxy=${https_proxy} --build-arg no_proxy=${no_proxy}"
fi fi
KANIKOCFG="${KANIKOCFG} }" KANIKOCFG="{ ${KANIKOCFG} }"
echo "${KANIKOCFG}" > /kaniko/.docker/config.json echo "${KANIKOCFG}" > /kaniko/.docker/config.json
- >- - >-
/kaniko/executor /kaniko/executor

View file

@ -163,6 +163,35 @@ We can then loop over the `versions` array with something like:
Note that the data file must have the `yaml` extension (not `yml`) and that Note that the data file must have the `yaml` extension (not `yml`) and that
we reference the array with a symbol (`:versions`). we reference the array with a symbol (`:versions`).
## Archived documentation banner
A banner is displayed on archived documentation pages with the text `This is archived documentation for
GitLab. Go to the latest.` when either:
- The version of the documentation displayed is not the first version entry in `online` in
`content/_data/versions.yaml`.
- The documentation was built from the default branch (`main`).
For example, if the `online` entries for `content/_data/versions.yaml` are:
```yaml
online:
- "14.4"
- "14.3"
- "14.2"
```
In this case, the archived documentation banner isn't displayed:
- For 14.4, the docs built from the `14.4` branch. The branch name is the first entry in `online`.
- For 14.5-pre, the docs built from the default project branch (`main`).
The archived documentation banner is displayed:
- For 14.3.
- For 14.2.
- For any other version.
## Bumping versions of CSS and JavaScript ## Bumping versions of CSS and JavaScript
Whenever the custom CSS and JavaScript files under `content/assets/` change, Whenever the custom CSS and JavaScript files under `content/assets/` change,

View file

@ -555,13 +555,18 @@ We can also disable tracking completely by using the global flag:
##### Known events are added automatically in Service Data payload ##### Known events are added automatically in Service Data payload
All events added in [`known_events/common.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/usage_data_counters/known_events/common.yml) are automatically added to Service Data generation under the `redis_hll_counters` key. This column is stored in [version-app as a JSON](https://gitlab.com/gitlab-services/version-gitlab-com/-/blob/master/db/schema.rb#L209). Service Ping adds all events [`known_events/*.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/usage_data_counters/known_events) to Service Data generation under the `redis_hll_counters` key. This column is stored in [version-app as a JSON](https://gitlab.com/gitlab-services/version-gitlab-com/-/blob/master/db/schema.rb#L209).
For each event we add metrics for the weekly and monthly time frames, and totals for each where applicable: For each event we add metrics for the weekly and monthly time frames, and totals for each where applicable:
- `#{event_name}_weekly`: Data for 7 days for daily [aggregation](#add-new-events) events and data for the last complete week for weekly [aggregation](#add-new-events) events. - `#{event_name}_weekly`: Data for 7 days for daily [aggregation](#add-new-events) events and data for the last complete week for weekly [aggregation](#add-new-events) events.
- `#{event_name}_monthly`: Data for 28 days for daily [aggregation](#add-new-events) events and data for the last 4 complete weeks for weekly [aggregation](#add-new-events) events. - `#{event_name}_monthly`: Data for 28 days for daily [aggregation](#add-new-events) events and data for the last 4 complete weeks for weekly [aggregation](#add-new-events) events.
Redis HLL implementation calculates automatic total metrics, if there are more than one metric for the same category, aggregation, and Redis slot. Redis HLL implementation calculates total metrics when both of these conditions are met:
- The category is manually included in [CATEGORIES_FOR_TOTALS](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/usage_data_counters/hll_redis_counter.rb#L21).
- There is more than one metric for the same category, aggregation, and Redis slot.
We add total unique counts for the weekly and monthly time frames where applicable:
- `#{category}_total_unique_counts_weekly`: Total unique counts for events in the same category for the last 7 days or the last complete week, if events are in the same Redis slot and we have more than one metric. - `#{category}_total_unique_counts_weekly`: Total unique counts for events in the same category for the last 7 days or the last complete week, if events are in the same Redis slot and we have more than one metric.
- `#{category}_total_unique_counts_monthly`: Total unique counts for events in same category for the last 28 days or the last 4 complete weeks, if events are in the same Redis slot and we have more than one metric. - `#{category}_total_unique_counts_monthly`: Total unique counts for events in same category for the last 28 days or the last 4 complete weeks, if events are in the same Redis slot and we have more than one metric.

View file

@ -61,7 +61,7 @@ including:
- Container Registry images - Container Registry images
- GitLab Pages content - GitLab Pages content
- Snippets - Snippets
- [Group wikis](../user/project/wiki/index.md#group-wikis) - [Group wikis](../user/project/wiki/group.md)
Backups do not include: Backups do not include:

View file

@ -42,6 +42,7 @@ Documentation for GitLab instance administrators is under [LFS administration do
credentials store is recommended. credentials store is recommended.
- Git LFS always assumes HTTPS so if you have GitLab server on HTTP you must - Git LFS always assumes HTTPS so if you have GitLab server on HTTP you must
[add the URL to Git configuration manually](#troubleshooting). [add the URL to Git configuration manually](#troubleshooting).
- [Group wikis](../../../user/project/wiki/group.md) do not support Git LFS.
NOTE: NOTE:
With 8.12 GitLab added LFS support to SSH. The Git LFS communication With 8.12 GitLab added LFS support to SSH. The Git LFS communication

View file

@ -153,11 +153,6 @@ gitops:
> [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/5784) in GitLab 14.3. > [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/5784) in GitLab 14.3.
FLAG:
On self-managed GitLab, by default this feature is available. To hide the
feature, ask an administrator to [disable the feature flag](../../../administration/feature_flags.md) named `group_authorized_agents`. On
GitLab.com, this feature is available.
If you use the same cluster across multiple projects, you can set up the CI/CD Tunnel If you use the same cluster across multiple projects, you can set up the CI/CD Tunnel
to grant the Agent access to one or more groups. This way, all the projects that belong to grant the Agent access to one or more groups. This way, all the projects that belong
to the authorized groups can access the same Agent. This enables you to save resources and to the authorized groups can access the same Agent. This enables you to save resources and

View file

@ -266,6 +266,8 @@ These Group Activity Analytics can be enabled with the `group_activity_analytics
![Recent Group Activity](img/group_activity_analytics_v13_10.png) ![Recent Group Activity](img/group_activity_analytics_v13_10.png)
Changes to [group wikis](../project/wiki/group.md) do not appear in group activity analytics.
### View group activity ### View group activity
You can view the most recent actions taken in a group, either in your browser or in an RSS feed: You can view the most recent actions taken in a group, either in your browser or in an RSS feed:

View file

@ -40,7 +40,7 @@ be imported into the desired group structure.
- To preserve the member list and their respective permissions on imported groups, review the users in these groups. Make - To preserve the member list and their respective permissions on imported groups, review the users in these groups. Make
sure these users exist before importing the desired groups. sure these users exist before importing the desired groups.
### Exported Contents ### Exported contents
The following items are exported: The following items are exported:
@ -51,7 +51,7 @@ The following items are exported:
- Subgroups (including all the aforementioned data) - Subgroups (including all the aforementioned data)
- Epics - Epics
- Events - Events
- [Wikis](../../project/wiki/index.md#group-wikis) **(PREMIUM SELF)** - [Wikis](../../project/wiki/group.md) **(PREMIUM SELF)**
(Introduced in [GitLab 13.9](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53247)) (Introduced in [GitLab 13.9](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53247))
The following items are **not** exported: The following items are **not** exported:

View file

@ -0,0 +1,56 @@
---
stage: Create
group: Editor
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"
type: reference, how-to
---
# Group wikis **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/13195) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.5.
If you use GitLab groups to manage multiple projects, some of your documentation
might span multiple groups. You can create group wikis, instead of [project wikis](index.md),
to ensure all group members have the correct access permissions to contribute.
Group wikis are similar to [project wikis](index.md), with a few limitations:
- [Git LFS](../../../topics/git/lfs/index.md) is not supported.
- Group wikis are not included in [global search](../../search/advanced_search.md).
- Changes to group wikis don't show up in the [group's activity feed](../../group/index.md#group-activity-analytics).
- Group wikis are enabled by default for **(PREMIUM)** and higher tiers.
You [can't turn them off from the GitLab user interface](https://gitlab.com/gitlab-org/gitlab/-/issues/208413).
For updates, follow [the epic that tracks feature parity with project wikis](https://gitlab.com/groups/gitlab-org/-/epics/2782).
Similar to project wikis, group members with the [Developer role](../../permissions.md#group-members-permissions)
and higher can edit group wikis. Group wiki repositories can be moved using the
[Group repository storage moves API](../../../api/group_repository_storage_moves.md).
## View a group wiki
To access a group wiki:
1. On the top bar, select **Menu > Groups** and find your group.
1. To display the wiki, either:
- On the left sidebar, select **Wiki**.
- On any page in the project, use the <kbd>g</kbd> + <kbd>w</kbd>
[wiki keyboard shortcut](../../shortcuts.md).
## Export a group wiki
> Introduced in [GitLab 13.9](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53247).
Users with the [Owner role](../../permissions.md) in a group can
[import and export group wikis](../../group/settings/import_export.md) when importing
or exporting a group.
Content created in a group wiki is not deleted when an account is downgraded or a GitLab trial ends.
## Related topics
- [Wiki settings for administrators](../../../administration/wikis/index.md)
- [Project wikis API](../../../api/wikis.md)
- [Group repository storage moves API](../../../api/group_repository_storage_moves.md)
- [Group wikis API](../../../api/group_wikis.md)
- [Wiki keyboard shortcuts](../../shortcuts.md#wiki-pages)
- [Epic: Feature parity with project wikis](https://gitlab.com/groups/gitlab-org/-/epics/2782)

View file

@ -12,16 +12,6 @@ to keep it in the same project as your code, you can use the wiki GitLab provide
in each GitLab project. Every wiki is a separate Git repository, so you can create in each GitLab project. Every wiki is a separate Git repository, so you can create
wiki pages in the web interface, or [locally using Git](#create-or-edit-wiki-pages-locally). wiki pages in the web interface, or [locally using Git](#create-or-edit-wiki-pages-locally).
To access the wiki for a project or group, go to the page for your project or group
and either:
- In the left sidebar, select **Wiki**.
- On any page in the project, use the <kbd>g</kbd> + <kbd>w</kbd>
[wiki keyboard shortcut](../../shortcuts.md).
If **Wiki** is not listed in the left sidebar of your project, a project administrator
has [disabled it](#enable-or-disable-a-project-wiki).
GitLab wikis support Markdown, RDoc, AsciiDoc, and Org for content. GitLab wikis support Markdown, RDoc, AsciiDoc, and Org for content.
Wiki pages written in Markdown support all [Markdown features](../../markdown.md), Wiki pages written in Markdown support all [Markdown features](../../markdown.md),
and also provide some [wiki-specific behavior](../../markdown.md#wiki-specific-markdown) and also provide some [wiki-specific behavior](../../markdown.md#wiki-specific-markdown)
@ -35,6 +25,19 @@ with sibling pages listed in alphabetical order. To view a list of all pages, se
![Wiki sidebar](img/wiki_sidebar_v13_5.png) ![Wiki sidebar](img/wiki_sidebar_v13_5.png)
## View a project wiki
To access a project wiki:
1. On the top bar, select **Menu > Projects** and find your project.
1. To display the wiki, either:
- On the left sidebar, select **Wiki**.
- On any page in the project, use the <kbd>g</kbd> + <kbd>w</kbd>
[wiki keyboard shortcut](../../shortcuts.md).
If **Wiki** is not listed in the left sidebar of your project, a project administrator
has [disabled it](#enable-or-disable-a-project-wiki).
## Configure a default branch for your wiki ## Configure a default branch for your wiki
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/221159) in GitLab 14.1. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/221159) in GitLab 14.1.
@ -56,7 +59,10 @@ When a wiki is created, it is empty. On your first visit, you can create the
home page users see when viewing the wiki. This page requires a specific title home page users see when viewing the wiki. This page requires a specific title
to be used as your wiki's home page. To create it: to be used as your wiki's home page. To create it:
1. Go to your project or group and select **Wiki**. 1. On the top bar, select **Menu**.
- For project wikis, select **Projects** and find your project.
- For group wikis, select **Groups** and find your group.
1. On the left sidebar, select **Wiki**.
1. Select **Create your first page**. 1. Select **Create your first page**.
1. GitLab requires this first page be titled `home`. The page with this 1. GitLab requires this first page be titled `home`. The page with this
title serves as the front page for your wiki. title serves as the front page for your wiki.
@ -71,7 +77,10 @@ to be used as your wiki's home page. To create it:
Users with the [Developer role](../../permissions.md) can create new wiki pages: Users with the [Developer role](../../permissions.md) can create new wiki pages:
1. Go to your project or group and select **Wiki**. 1. On the top bar, select **Menu**.
- For project wikis, select **Projects** and find your project.
- For group wikis, select **Groups** and find your group.
1. On the left sidebar, select **Wiki**.
1. Select **New page** on this page, or any other wiki page. 1. Select **New page** on this page, or any other wiki page.
1. Select a content format. 1. Select a content format.
1. Add a title for your new page. Page titles use 1. Add a title for your new page. Page titles use
@ -135,7 +144,10 @@ may not be able to check out the wiki locally afterward.
You need at least the [Developer role](../../permissions.md) to edit a wiki page: You need at least the [Developer role](../../permissions.md) to edit a wiki page:
1. Go to your project or group and select **Wiki**. 1. On the top bar, select **Menu**.
- For project wikis, select **Projects** and find your project.
- For group wikis, select **Groups** and find your group.
1. On the left sidebar, select **Wiki**.
1. Go to the page you want to edit, and either: 1. Go to the page you want to edit, and either:
- Use the <kbd>e</kbd> wiki [keyboard shortcut](../../shortcuts.md#wiki-pages). - Use the <kbd>e</kbd> wiki [keyboard shortcut](../../shortcuts.md#wiki-pages).
- Select the edit icon (**{pencil}**). - Select the edit icon (**{pencil}**).
@ -151,7 +163,10 @@ For an example, read [Table of contents](../../markdown.md#table-of-contents).
You need at least the [Developer role](../../permissions.md) to delete a wiki page: You need at least the [Developer role](../../permissions.md) to delete a wiki page:
1. Go to your project or group and select **Wiki**. 1. On the top bar, select **Menu**.
- For project wikis, select **Projects** and find your project.
- For group wikis, select **Groups** and find your group.
1. On the left sidebar, select **Wiki**.
1. Go to the page you want to delete. 1. Go to the page you want to delete.
1. Select the edit icon (**{pencil}**). 1. Select the edit icon (**{pencil}**).
1. Select **Delete page**. 1. Select **Delete page**.
@ -161,7 +176,10 @@ You need at least the [Developer role](../../permissions.md) to delete a wiki pa
You need at least the [Developer role](../../permissions.md) to move a wiki page: You need at least the [Developer role](../../permissions.md) to move a wiki page:
1. Go to your project or group and select **Wiki**. 1. On the top bar, select **Menu**.
- For project wikis, select **Projects** and find your project.
- For group wikis, select **Groups** and find your group.
1. On the left sidebar, select **Wiki**.
1. Go to the page you want to move. 1. Go to the page you want to move.
1. Select the edit icon (**{pencil}**). 1. Select the edit icon (**{pencil}**).
1. Add the new path to the **Title** field. For example, if you have a wiki page 1. Add the new path to the **Title** field. For example, if you have a wiki page
@ -172,9 +190,7 @@ You need at least the [Developer role](../../permissions.md) to move a wiki page
## View history of a wiki page ## View history of a wiki page
The changes of a wiki page over time are recorded in the wiki's Git repository. The changes of a wiki page over time are recorded in the wiki's Git repository.
To view the changes for a wiki page, select **Page history**. The history page shows:
From the history page you can see:
![Wiki page history](img/wiki_page_history.png) ![Wiki page history](img/wiki_page_history.png)
@ -184,13 +200,25 @@ From the history page you can see:
- The last update. - The last update.
- Previous revisions, by selecting a revision number in the **Page version** column. - Previous revisions, by selecting a revision number in the **Page version** column.
To view the changes for a wiki page:
1. On the top bar, select **Menu**.
- For project wikis, select **Projects** and find your project.
- For group wikis, select **Groups** and find your group.
1. On the left sidebar, select **Wiki**.
1. Go to the page you want to view history for.
1. Select **Page history**.
### View changes between page versions ### View changes between page versions
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/15242) in GitLab 13.2. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/15242) in GitLab 13.2.
You can see the changes made in a version of a wiki page, similar to versioned diff file views: You can see the changes made in a version of a wiki page, similar to versioned diff file views:
1. Go to your project or group and select **Wiki**. 1. On the top bar, select **Menu**.
- For project wikis, select **Projects** and find your project.
- For group wikis, select **Groups** and find your group.
1. On the left sidebar, select **Wiki**.
1. Go to the wiki page you're interested in. 1. Go to the wiki page you're interested in.
1. Select **Page history** to see all page versions. 1. Select **Page history** to see all page versions.
1. Select the commit message in the **Changes** column for the version you're interested in. 1. Select the commit message in the **Changes** column for the version you're interested in.
@ -203,10 +231,12 @@ You can see the changes made in a version of a wiki page, similar to versioned d
> - Git events were [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/216014) in **GitLab 13.0.** > - Git events were [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/216014) in **GitLab 13.0.**
> - [Feature flag for Git events was removed](https://gitlab.com/gitlab-org/gitlab/-/issues/258665) in **GitLab 13.5** > - [Feature flag for Git events was removed](https://gitlab.com/gitlab-org/gitlab/-/issues/258665) in **GitLab 13.5**
GitLab tracks wiki creation, deletion, and update events. These events are displayed on the GitLab tracks wiki creation, deletion, and update events. These events are displayed on these pages:
[user profile](../../profile/index.md#access-your-user-profile),
[group](../../group/index.md#view-group-activity), - [User profile](../../profile/index.md#access-your-user-profile).
and [project](../working_with_projects.md#project-activity) activity pages. - Activity pages, depending on the type of wiki:
- [Group activity](../../group/index.md#view-group-activity).
- [Project activity](../working_with_projects.md#project-activity).
Commits to wikis are not counted in [repository analytics](../../analytics/repository_analytics.md). Commits to wikis are not counted in [repository analytics](../../analytics/repository_analytics.md).
@ -218,7 +248,10 @@ You need at least the [Developer role](../../permissions.md) to customize the wi
navigation sidebar. This process creates a wiki page named `_sidebar` which fully navigation sidebar. This process creates a wiki page named `_sidebar` which fully
replaces the default sidebar navigation: replaces the default sidebar navigation:
1. Go to your project or group and select **Wiki**. 1. On the top bar, select **Menu**.
- For project wikis, select **Projects** and find your project.
- For group wikis, select **Groups** and find your group.
1. On the left sidebar, select **Wiki**.
1. In the top right corner of the page, select **Edit sidebar**. 1. In the top right corner of the page, select **Edit sidebar**.
1. When complete, select **Save changes**. 1. When complete, select **Save changes**.
@ -241,42 +274,20 @@ Support for displaying a generated table of contents with a custom side navigati
## Enable or disable a project wiki ## Enable or disable a project wiki
Wikis are enabled by default in GitLab. Project [administrators](../../permissions.md) Wikis are enabled by default in GitLab. Project [administrators](../../permissions.md)
can enable or disable the project wiki by following the instructions in can enable or disable a project wiki by following the instructions in
[Sharing and permissions](../settings/index.md#sharing-and-permissions). [Sharing and permissions](../settings/index.md#sharing-and-permissions).
Administrators for self-managed GitLab installs can Administrators for self-managed GitLab installs can
[configure additional wiki settings](../../../administration/wikis/index.md). [configure additional wiki settings](../../../administration/wikis/index.md).
## Group wikis **(PREMIUM)** You can't disable [group wikis](group.md) from the GitLab user interface.
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/13195) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.5.
Group wikis work the same way as project wikis. Their usage is similar to project
wikis, with a few limitations:
- Git LFS is not supported.
- Group wikis are not included in global search.
- Changes to group wikis don't show up in the group's activity feed.
For updates, follow [the epic that tracks feature parity with project wikis](https://gitlab.com/groups/gitlab-org/-/epics/2782).
Group wikis can be edited by members with the [Developer role](../../permissions.md#group-members-permissions)
and above. Group wiki repositories can be moved using the
[Group repository storage moves API](../../../api/group_repository_storage_moves.md).
### Export a group wiki **(PREMIUM)**
Users with the [Owner role](../../permissions.md) in a group can
[import and export group wikis](../../group/settings/import_export.md) when importing
or exporting a group.
Content created in a group wiki is not deleted when an account is downgraded or a GitLab trial ends.
## Link an external wiki ## Link an external wiki
To add a link to an external wiki from a project's left sidebar: To add a link to an external wiki from a project's left sidebar:
1. Go to your project and select **Settings > Integrations**. 1. On the top bar, select **Menu > Projects** and find your project.
1. On the left sidebar, select **Settings > Integrations**.
1. Select **External wiki**. 1. Select **External wiki**.
1. Add the URL to your external wiki. 1. Add the URL to your external wiki.
1. (Optional) Select **Test settings** to verify the connection. 1. (Optional) Select **Test settings** to verify the connection.
@ -291,7 +302,8 @@ To hide the internal wiki from the sidebar, [disable the project's wiki](#disabl
To hide the link to an external wiki: To hide the link to an external wiki:
1. Go to your project and select **Settings > Integrations**. 1. On the top bar, select **Menu > Projects** and find your project.
1. On the left sidebar, select **Settings > Integrations**.
1. Select **External wiki**. 1. Select **External wiki**.
1. In the **Enable integration** section, clear the **Active** checkbox. 1. In the **Enable integration** section, clear the **Active** checkbox.
1. Select **Save changes**. 1. Select **Save changes**.
@ -300,6 +312,7 @@ To hide the link to an external wiki:
To disable a project's internal wiki: To disable a project's internal wiki:
1. On the top bar, select **Menu > Projects** and find your project.
1. Go to your project and select **Settings > General**. 1. Go to your project and select **Settings > General**.
1. Expand **Visibility, project features, permissions**. 1. Expand **Visibility, project features, permissions**.
1. Scroll down to find **Wiki** and toggle it off (in gray). 1. Scroll down to find **Wiki** and toggle it off (in gray).
@ -356,7 +369,7 @@ For the status of the ongoing development for CommonMark and GitLab Flavored Mar
- [Basic Markdown formatting extensions](https://gitlab.com/groups/gitlab-org/-/epics/5404) epic. - [Basic Markdown formatting extensions](https://gitlab.com/groups/gitlab-org/-/epics/5404) epic.
- [GitLab Flavored Markdown extensions](https://gitlab.com/groups/gitlab-org/-/epics/5438) epic. - [GitLab Flavored Markdown extensions](https://gitlab.com/groups/gitlab-org/-/epics/5438) epic.
## Resources ## Related topics
- [Wiki settings for administrators](../../../administration/wikis/index.md) - [Wiki settings for administrators](../../../administration/wikis/index.md)
- [Project wikis API](../../../api/wikis.md) - [Project wikis API](../../../api/wikis.md)

View file

@ -26,7 +26,7 @@ when searching in:
- Comments - Comments
- Code - Code
- Commits - Commits
- Wiki - Wiki (except [group wikis](../project/wiki/group.md))
- Users - Users
The Advanced Search can be useful in various scenarios: The Advanced Search can be useful in various scenarios:
@ -139,4 +139,4 @@ its performance:
| Commits | `global_search_commits_tab` | When enabled, the global search includes commits as part of the search. | | Commits | `global_search_commits_tab` | When enabled, the global search includes commits as part of the search. |
| Issues | `global_search_issues_tab` | When enabled, the global search includes issues as part of the search. | | Issues | `global_search_issues_tab` | When enabled, the global search includes issues as part of the search. |
| Merge Requests | `global_search_merge_requests_tab` | When enabled, the global search includes merge requests as part of the search. | | Merge Requests | `global_search_merge_requests_tab` | When enabled, the global search includes merge requests as part of the search. |
| Wiki | `global_search_wiki_tab` | When enabled, the global search includes wiki as part of the search. | | Wiki | `global_search_wiki_tab` | When enabled, the global search includes wiki as part of the search. [Group wikis](../project/wiki/group.md) are not included. |

View file

@ -132,7 +132,7 @@ A single snippet can support up to 10 files, which helps keep related files toge
If you need more than 10 files for your snippet, we recommend you create a If you need more than 10 files for your snippet, we recommend you create a
[wiki](project/wiki/index.md) instead. Wikis are available for projects at all [wiki](project/wiki/index.md) instead. Wikis are available for projects at all
subscription levels, and [groups](project/wiki/index.md#group-wikis) for subscription levels, and [groups](project/wiki/group.md) for
[GitLab Premium](https://about.gitlab.com/pricing/). [GitLab Premium](https://about.gitlab.com/pricing/).
Snippets with multiple files display a file count in the [snippet list](https://gitlab.com/dashboard/snippets): Snippets with multiple files display a file count in the [snippet list](https://gitlab.com/dashboard/snippets):

View file

@ -189,18 +189,10 @@ module API
pipeline = current_authenticated_job.pipeline pipeline = current_authenticated_job.pipeline
project = current_authenticated_job.project project = current_authenticated_job.project
agent_authorizations = Clusters::AgentAuthorizationsFinder.new(project).execute
allowed_agents =
if Feature.enabled?(:group_authorized_agents, project, default_enabled: :yaml)
agent_authorizations = Clusters::AgentAuthorizationsFinder.new(project).execute
Entities::Clusters::AgentAuthorization.represent(agent_authorizations)
else
associated_agents = Clusters::DeployableAgentsFinder.new(project).execute
Entities::Clusters::Agent.represent(associated_agents)
end
{ {
allowed_agents: allowed_agents, allowed_agents: Entities::Clusters::AgentAuthorization.represent(agent_authorizations),
job: Entities::Ci::JobRequest::JobInfo.represent(current_authenticated_job), job: Entities::Ci::JobRequest::JobInfo.represent(current_authenticated_job),
pipeline: Entities::Ci::PipelineBasic.represent(pipeline), pipeline: Entities::Ci::PipelineBasic.represent(pipeline),
project: Entities::ProjectIdentity.represent(project), project: Entities::ProjectIdentity.represent(project),

View file

@ -22,21 +22,24 @@ module Gitlab
reports.values.flat_map(&:findings) reports.values.flat_map(&:findings)
end end
def violates_default_policy_against?(target_reports, vulnerabilities_allowed, severity_levels) def violates_default_policy_against?(target_reports, vulnerabilities_allowed, severity_levels, vulnerability_states)
unsafe_findings_count(target_reports, severity_levels) > vulnerabilities_allowed unsafe_findings_count(target_reports, severity_levels, vulnerability_states) > vulnerabilities_allowed
end
def unsafe_findings_uuids(severity_levels)
findings.select { |finding| finding.unsafe?(severity_levels) }.map(&:uuid)
end end
private private
def findings_diff(target_reports) def unsafe_findings_count(target_reports, severity_levels, vulnerability_states)
findings - target_reports&.findings.to_a new_uuids = unsafe_findings_uuids(severity_levels) - target_reports&.unsafe_findings_uuids(severity_levels).to_a
end new_uuids.count
def unsafe_findings_count(target_reports, severity_levels)
findings_diff(target_reports).count {|finding| finding.unsafe?(severity_levels)}
end end
end end
end end
end end
end end
end end
Gitlab::Ci::Reports::Security::Reports.prepend_mod_with('Gitlab::Ci::Reports::Security::Reports')

View file

@ -76,7 +76,7 @@ module Gitlab
def items def items
original_items = super original_items = super
return original_items if Gitlab::Pagination::Keyset::Order.keyset_aware?(original_items) || Feature.disabled?(:new_graphql_keyset_pagination) return original_items if Feature.disabled?(:new_graphql_keyset_pagination, default_enabled: :yaml) || Gitlab::Pagination::Keyset::Order.keyset_aware?(original_items)
strong_memoize(:generic_keyset_pagination_items) do strong_memoize(:generic_keyset_pagination_items) do
rebuilt_items_with_keyset_order, success = Gitlab::Pagination::Keyset::SimpleOrderBuilder.build(original_items) rebuilt_items_with_keyset_order, success = Gitlab::Pagination::Keyset::SimpleOrderBuilder.build(original_items)

View file

@ -10,10 +10,10 @@ module Gitlab
uncached_data.deep_stringify_keys.dig(*key_path.split('.')) uncached_data.deep_stringify_keys.dig(*key_path.split('.'))
end end
def add_metric(metric, time_frame: 'none') def add_metric(metric, time_frame: 'none', options: {})
metric_class = "Gitlab::Usage::Metrics::Instrumentations::#{metric}".constantize metric_class = "Gitlab::Usage::Metrics::Instrumentations::#{metric}".constantize
metric_class.new(time_frame: time_frame).suggested_name metric_class.new(time_frame: time_frame, options: options).suggested_name
end end
private private

View file

@ -12,10 +12,10 @@ module Gitlab
super.with_indifferent_access.deep_merge(instrumentation_metrics.with_indifferent_access) super.with_indifferent_access.deep_merge(instrumentation_metrics.with_indifferent_access)
end end
def add_metric(metric, time_frame: 'none') def add_metric(metric, time_frame: 'none', options: {})
metric_class = "Gitlab::Usage::Metrics::Instrumentations::#{metric}".constantize metric_class = "Gitlab::Usage::Metrics::Instrumentations::#{metric}".constantize
metric_class.new(time_frame: time_frame).instrumentation metric_class.new(time_frame: time_frame, options: options).instrumentation
end end
def count(relation, column = nil, batch: true, batch_size: nil, start: nil, finish: nil) def count(relation, column = nil, batch: true, batch_size: nil, start: nil, finish: nil)

View file

@ -12,10 +12,10 @@ module Gitlab
super.with_indifferent_access.deep_merge(instrumentation_metrics.with_indifferent_access) super.with_indifferent_access.deep_merge(instrumentation_metrics.with_indifferent_access)
end end
def add_metric(metric, time_frame: 'none') def add_metric(metric, time_frame: 'none', options: {})
metric_class = "Gitlab::Usage::Metrics::Instrumentations::#{metric}".constantize metric_class = "Gitlab::Usage::Metrics::Instrumentations::#{metric}".constantize
metric_class.new(time_frame: time_frame).instrumentation metric_class.new(time_frame: time_frame, options: options).instrumentation
end end
def count(relation, column = nil, *args, **kwargs) def count(relation, column = nil, *args, **kwargs)

View file

@ -45,14 +45,14 @@ module Gitlab
MAX_BUCKET_SIZE = 100 MAX_BUCKET_SIZE = 100
INSTRUMENTATION_CLASS_FALLBACK = -100 INSTRUMENTATION_CLASS_FALLBACK = -100
def add_metric(metric, time_frame: 'none') def add_metric(metric, time_frame: 'none', options: {})
# Results of this method should be overwritten by instrumentation class values # Results of this method should be overwritten by instrumentation class values
# -100 indicates the metric was not properly merged. # -100 indicates the metric was not properly merged.
return INSTRUMENTATION_CLASS_FALLBACK if Feature.enabled?(:usage_data_instrumentation) return INSTRUMENTATION_CLASS_FALLBACK if Feature.enabled?(:usage_data_instrumentation)
metric_class = "Gitlab::Usage::Metrics::Instrumentations::#{metric}".constantize metric_class = "Gitlab::Usage::Metrics::Instrumentations::#{metric}".constantize
metric_class.new(time_frame: time_frame).value metric_class.new(time_frame: time_frame, options: options).value
end end
def count(relation, column = nil, batch: true, batch_size: nil, start: nil, finish: nil) def count(relation, column = nil, batch: true, batch_size: nil, start: nil, finish: nil)

View file

@ -4223,12 +4223,18 @@ msgstr ""
msgid "ApprovalRule|All severity levels" msgid "ApprovalRule|All severity levels"
msgstr "" msgstr ""
msgid "ApprovalRule|All vulnerability states"
msgstr ""
msgid "ApprovalRule|Apply this approval rule to consider only the selected security scanners." msgid "ApprovalRule|Apply this approval rule to consider only the selected security scanners."
msgstr "" msgstr ""
msgid "ApprovalRule|Apply this approval rule to consider only the selected severity levels." msgid "ApprovalRule|Apply this approval rule to consider only the selected severity levels."
msgstr "" msgstr ""
msgid "ApprovalRule|Apply this approval rule to consider only the selected vulnerability states."
msgstr ""
msgid "ApprovalRule|Approval rules" msgid "ApprovalRule|Approval rules"
msgstr "" msgstr ""
@ -4241,12 +4247,21 @@ msgstr ""
msgid "ApprovalRule|Approvers" msgid "ApprovalRule|Approvers"
msgstr "" msgstr ""
msgid "ApprovalRule|Confirmed"
msgstr ""
msgid "ApprovalRule|Dismissed"
msgstr ""
msgid "ApprovalRule|Examples: QA, Security." msgid "ApprovalRule|Examples: QA, Security."
msgstr "" msgstr ""
msgid "ApprovalRule|Name" msgid "ApprovalRule|Name"
msgstr "" msgstr ""
msgid "ApprovalRule|Newly detected"
msgstr ""
msgid "ApprovalRule|Number of vulnerabilities allowed before approval rule is triggered." msgid "ApprovalRule|Number of vulnerabilities allowed before approval rule is triggered."
msgstr "" msgstr ""
@ -4259,6 +4274,15 @@ msgstr ""
msgid "ApprovalRule|Please select at least one severity level" msgid "ApprovalRule|Please select at least one severity level"
msgstr "" msgstr ""
msgid "ApprovalRule|Please select at least one vulnerability state"
msgstr ""
msgid "ApprovalRule|Previously detected"
msgstr ""
msgid "ApprovalRule|Resolved"
msgstr ""
msgid "ApprovalRule|Rule name" msgid "ApprovalRule|Rule name"
msgstr "" msgstr ""
@ -4274,6 +4298,9 @@ msgstr ""
msgid "ApprovalRule|Select severity levels" msgid "ApprovalRule|Select severity levels"
msgstr "" msgstr ""
msgid "ApprovalRule|Select vulnerability states"
msgstr ""
msgid "ApprovalRule|Severity levels" msgid "ApprovalRule|Severity levels"
msgstr "" msgstr ""
@ -4283,6 +4310,9 @@ msgstr ""
msgid "ApprovalRule|Vulnerabilities allowed" msgid "ApprovalRule|Vulnerabilities allowed"
msgstr "" msgstr ""
msgid "ApprovalRule|Vulnerability states"
msgstr ""
msgid "ApprovalSettings|Merge request approval settings have been updated." msgid "ApprovalSettings|Merge request approval settings have been updated."
msgstr "" msgstr ""
@ -5431,6 +5461,9 @@ msgstr ""
msgid "Blog" msgid "Blog"
msgstr "" msgstr ""
msgid "Board scope affects which epics are displayed for anyone who visits this board"
msgstr ""
msgid "Board scope affects which issues are displayed for anyone who visits this board" msgid "Board scope affects which issues are displayed for anyone who visits this board"
msgstr "" msgstr ""

View file

@ -1,15 +0,0 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Clusters::DeployableAgentsFinder do
describe '#execute' do
let_it_be(:agent) { create(:cluster_agent) }
let(:project) { agent.project }
subject { described_class.new(project).execute }
it { is_expected.to contain_exactly(agent) }
end
end

View file

@ -1008,6 +1008,21 @@ describe('common_utils', () => {
}); });
}); });
describe('scopedLabelKey', () => {
it.each`
label | expectedLabelKey
${undefined} | ${''}
${''} | ${''}
${'title'} | ${'title'}
${'scoped::value'} | ${'scoped'}
${'scoped::label::value'} | ${'scoped::label'}
${'scoped::label-some::value'} | ${'scoped::label-some'}
${'scoped::label::some::value'} | ${'scoped::label::some'}
`('returns "$expectedLabelKey" when label is "$label"', ({ label, expectedLabelKey }) => {
expect(commonUtils.scopedLabelKey({ title: label })).toBe(expectedLabelKey);
});
});
describe('getDashPath', () => { describe('getDashPath', () => {
it('returns the path following /-/', () => { it('returns the path following /-/', () => {
expect(commonUtils.getDashPath('/some/-/url-with-dashes-/')).toEqual('url-with-dashes-/'); expect(commonUtils.getDashPath('/some/-/url-with-dashes-/')).toEqual('url-with-dashes-/');

View file

@ -1,3 +1,4 @@
import { cloneDeep } from 'lodash';
import * as types from '~/vue_shared/components/sidebar/labels_select_vue/store/mutation_types'; import * as types from '~/vue_shared/components/sidebar/labels_select_vue/store/mutation_types';
import mutations from '~/vue_shared/components/sidebar/labels_select_vue/store/mutations'; import mutations from '~/vue_shared/components/sidebar/labels_select_vue/store/mutations';
@ -153,47 +154,40 @@ describe('LabelsSelect Mutations', () => {
}); });
describe(`${types.UPDATE_SELECTED_LABELS}`, () => { describe(`${types.UPDATE_SELECTED_LABELS}`, () => {
let labels; const labels = [
{ id: 1, title: 'scoped' },
{ id: 2, title: 'scoped::label::one', set: false },
{ id: 3, title: 'scoped::label::two', set: false },
{ id: 4, title: 'scoped::label::three', set: true },
{ id: 5, title: 'scoped::one', set: false },
{ id: 6, title: 'scoped::two', set: false },
{ id: 7, title: 'scoped::three', set: true },
{ id: 8, title: '' },
];
beforeEach(() => { it.each`
labels = [ label | labelGroupIds
{ id: 1, title: 'scoped' }, ${labels[0]} | ${[]}
{ id: 2, title: 'scoped::one', set: false }, ${labels[1]} | ${[labels[2], labels[3]]}
{ id: 3, title: 'scoped::test', set: true }, ${labels[2]} | ${[labels[1], labels[3]]}
{ id: 4, title: '' }, ${labels[3]} | ${[labels[1], labels[2]]}
]; ${labels[4]} | ${[labels[5], labels[6]]}
}); ${labels[5]} | ${[labels[4], labels[6]]}
${labels[6]} | ${[labels[4], labels[5]]}
${labels[7]} | ${[]}
`('updates `touched` and `set` props for $label.title', ({ label, labelGroupIds }) => {
const state = { labels: cloneDeep(labels) };
it('updates `state.labels` to include `touched` and `set` props based on provided `labels` param', () => { mutations[types.UPDATE_SELECTED_LABELS](state, { labels: [{ id: label.id }] });
const updatedLabelIds = [2];
const state = {
labels,
};
mutations[types.UPDATE_SELECTED_LABELS](state, { labels: [{ id: 2 }] });
state.labels.forEach((label) => { expect(state.labels[label.id - 1]).toMatchObject({
if (updatedLabelIds.includes(label.id)) { touched: true,
expect(label.touched).toBe(true); set: !labels[label.id - 1].set,
expect(label.set).toBe(true);
}
}); });
});
describe('when label is scoped', () => { labelGroupIds.forEach((l) => {
it('unsets the currently selected scoped label and sets the current label', () => { expect(state.labels[l.id - 1].touched).toBeFalsy();
const state = { expect(state.labels[l.id - 1].set).toBe(false);
labels,
};
mutations[types.UPDATE_SELECTED_LABELS](state, {
labels: [{ id: 2, title: 'scoped::one' }],
});
expect(state.labels).toEqual([
{ id: 1, title: 'scoped' },
{ id: 2, title: 'scoped::one', set: true, touched: true },
{ id: 3, title: 'scoped::test', set: false },
{ id: 4, title: '' },
]);
}); });
}); });
}); });

View file

@ -57,8 +57,9 @@ RSpec.describe Gitlab::Ci::Reports::Security::Reports do
let(:high_severity_dast) { build(:ci_reports_security_finding, severity: 'high', report_type: :dast) } let(:high_severity_dast) { build(:ci_reports_security_finding, severity: 'high', report_type: :dast) }
let(:vulnerabilities_allowed) { 0 } let(:vulnerabilities_allowed) { 0 }
let(:severity_levels) { %w(critical high) } let(:severity_levels) { %w(critical high) }
let(:vulnerability_states) { %w(newly_detected)}
subject { security_reports.violates_default_policy_against?(target_reports, vulnerabilities_allowed, severity_levels) } subject { security_reports.violates_default_policy_against?(target_reports, vulnerabilities_allowed, severity_levels, vulnerability_states) }
before do before do
security_reports.get_report('sast', artifact).add_finding(high_severity_dast) security_reports.get_report('sast', artifact).add_finding(high_severity_dast)

View file

@ -4610,22 +4610,5 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
expect(pipeline.authorized_cluster_agents).to contain_exactly(agent) expect(pipeline.authorized_cluster_agents).to contain_exactly(agent)
expect(pipeline.authorized_cluster_agents).to contain_exactly(agent) # cached expect(pipeline.authorized_cluster_agents).to contain_exactly(agent) # cached
end end
context 'group_authorized_agents feature flag is disabled' do
let(:finder) { double(execute: [agent]) }
before do
stub_feature_flags(group_authorized_agents: false)
end
it 'retrieves agent records from the legacy finder and caches the result' do
expect(Clusters::DeployableAgentsFinder).to receive(:new).once
.with(pipeline.project)
.and_return(finder)
expect(pipeline.authorized_cluster_agents).to contain_exactly(agent)
expect(pipeline.authorized_cluster_agents).to contain_exactly(agent) # cached
end
end
end end
end end

View file

@ -187,14 +187,12 @@ RSpec.describe API::Ci::Jobs do
let(:job) { create(:ci_build, :artifacts, pipeline: pipeline, user: api_user, status: job_status) } let(:job) { create(:ci_build, :artifacts, pipeline: pipeline, user: api_user, status: job_status) }
let(:job_status) { 'running' } let(:job_status) { 'running' }
let(:params) { {} } let(:params) { {} }
let(:group_authorized_agents_enabled) { true }
subject do subject do
get api('/job/allowed_agents'), headers: headers, params: params get api('/job/allowed_agents'), headers: headers, params: params
end end
before do before do
stub_feature_flags(group_authorized_agents: group_authorized_agents_enabled)
allow(Clusters::AgentAuthorizationsFinder).to receive(:new).with(project).and_return(authorizations_finder) allow(Clusters::AgentAuthorizationsFinder).to receive(:new).with(project).and_return(authorizations_finder)
subject subject
@ -247,30 +245,6 @@ RSpec.describe API::Ci::Jobs do
]) ])
end end
end end
context 'group_authorized_agents feature flag is disabled' do
let(:group_authorized_agents_enabled) { false }
let(:agents_finder) { double(execute: [associated_agent]) }
before do
allow(Clusters::DeployableAgentsFinder).to receive(:new).with(project).and_return(agents_finder)
end
it 'returns agent info', :aggregate_failures do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response.dig('job', 'id')).to eq(job.id)
expect(json_response.dig('pipeline', 'id')).to eq(job.pipeline_id)
expect(json_response.dig('project', 'id')).to eq(job.project_id)
expect(json_response.dig('user', 'username')).to eq(api_user.username)
expect(json_response['allowed_agents']).to match_array([
{
'id' => associated_agent.id,
'config_project' => hash_including('id' => associated_agent.project_id)
}
])
end
end
end end
context 'when user is anonymous' do context 'when user is anonymous' do

View file

@ -341,6 +341,7 @@ RSpec.describe ApplicationWorker do
it 'enqueues jobs in one go' do it 'enqueues jobs in one go' do
expect(Sidekiq::Client).to( expect(Sidekiq::Client).to(
receive(:push_bulk).with(hash_including('args' => args)).once.and_call_original) receive(:push_bulk).with(hash_including('args' => args)).once.and_call_original)
expect(Sidekiq.logger).not_to receive(:info)
perform_action perform_action
@ -349,6 +350,19 @@ RSpec.describe ApplicationWorker do
end end
end end
shared_examples_for 'logs bulk insertions' do
it 'logs arguments and job IDs' do
worker.log_bulk_perform_async!
expect(Sidekiq.logger).to(
receive(:info).with(hash_including('args_list' => args)).once.and_call_original)
expect(Sidekiq.logger).to(
receive(:info).with(hash_including('jid_list' => anything)).once.and_call_original)
perform_action
end
end
before do before do
stub_const(worker.name, worker) stub_const(worker.name, worker)
end end
@ -381,6 +395,7 @@ RSpec.describe ApplicationWorker do
include_context 'set safe limit beyond the number of jobs to be enqueued' include_context 'set safe limit beyond the number of jobs to be enqueued'
it_behaves_like 'enqueues jobs in one go' it_behaves_like 'enqueues jobs in one go'
it_behaves_like 'logs bulk insertions'
it_behaves_like 'returns job_id of all enqueued jobs' it_behaves_like 'returns job_id of all enqueued jobs'
it_behaves_like 'does not schedule the jobs for any specific time' it_behaves_like 'does not schedule the jobs for any specific time'
end end
@ -400,6 +415,7 @@ RSpec.describe ApplicationWorker do
include_context 'set safe limit beyond the number of jobs to be enqueued' include_context 'set safe limit beyond the number of jobs to be enqueued'
it_behaves_like 'enqueues jobs in one go' it_behaves_like 'enqueues jobs in one go'
it_behaves_like 'logs bulk insertions'
it_behaves_like 'returns job_id of all enqueued jobs' it_behaves_like 'returns job_id of all enqueued jobs'
it_behaves_like 'does not schedule the jobs for any specific time' it_behaves_like 'does not schedule the jobs for any specific time'
end end