diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index 8dfc8fd1aaa..c75d1df87c0 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -0697e25f0d30d7d1c005c3fef3130cee001d198c +bf9abd731ba2dab65e8c275c51d578d95dd3d506 diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index ecf04ee4879..a82dad7e2c9 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -688,17 +688,20 @@ export const searchBy = (query = '', searchSpace = {}) => { */ 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: - * { title: 'LabelTitle', ...otherProperties }; - * - * @param {Object} label - * @returns String + * @param {Object} label object containing `title` property + * @returns String scoped label key, or full label if it is not a scoped label */ -export const scopedLabelKey = ({ title = '' }) => - isScopedLabel({ title }) && title.split(SCOPED_LABEL_DELIMITER)[0]; +export const scopedLabelKey = ({ title = '' }) => { + return title.replace(scopedLabelRegex, '$1'); +}; // Methods to set and get Cookie export const setCookie = (name, value) => Cookies.set(name, value, { expires: 365 }); diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/mutations.js b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/mutations.js index 0ea22eb7aea..9e64f03fe84 100644 --- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/mutations.js +++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/store/mutations.js @@ -1,5 +1,4 @@ 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 * as types from './mutation_types'; @@ -67,9 +66,11 @@ export default { } if (isScopedLabel(candidateLabel)) { - const scopedKeyWithDelimiter = `${scopedLabelKey(candidateLabel)}${SCOPED_LABEL_DELIMITER}`; const currentActiveScopedLabel = state.labels.find( - ({ title }) => title.startsWith(scopedKeyWithDelimiter) && title !== candidateLabel.title, + ({ set, title }) => + set && + title !== candidateLabel.title && + scopedLabelKey({ title }) === scopedLabelKey(candidateLabel), ); if (currentActiveScopedLabel) { diff --git a/app/finders/clusters/deployable_agents_finder.rb b/app/finders/clusters/deployable_agents_finder.rb deleted file mode 100644 index 131663d4aee..00000000000 --- a/app/finders/clusters/deployable_agents_finder.rb +++ /dev/null @@ -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 diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index fffc06ecb29..9cc382f0c95 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -1277,11 +1277,7 @@ module Ci def authorized_cluster_agents strong_memoize(:authorized_cluster_agents) do - if ::Feature.enabled?(:group_authorized_agents, project, default_enabled: :yaml) - ::Clusters::AgentAuthorizationsFinder.new(project).execute.map(&:agent) - else - ::Clusters::DeployableAgentsFinder.new(project).execute - end + ::Clusters::AgentAuthorizationsFinder.new(project).execute.map(&:agent) end end diff --git a/app/models/concerns/enums/vulnerability.rb b/app/models/concerns/enums/vulnerability.rb index 749d1ad65cd..4b325de61bc 100644 --- a/app/models/concerns/enums/vulnerability.rb +++ b/app/models/concerns/enums/vulnerability.rb @@ -37,6 +37,15 @@ module Enums security_audit: 4 }.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 CONFIDENCE_LEVELS end @@ -52,6 +61,10 @@ module Enums def self.detection_methods DETECTION_METHODS end + + def self.vulnerability_states + VULNERABILITY_STATES + end end end diff --git a/app/workers/concerns/application_worker.rb b/app/workers/concerns/application_worker.rb index caf3fcf01fc..3127d12d225 100644 --- a/app/workers/concerns/application_worker.rb +++ b/app/workers/concerns/application_worker.rb @@ -131,17 +131,27 @@ module ApplicationWorker 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 Sidekiq::Queue.new(queue).size end def bulk_perform_async(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) + if log_bulk_perform_async? + Sidekiq.logger.info('class' => self, 'args_list' => args_list, 'args_list_count' => args_list.length, 'message' => 'Inserting multiple jobs') + 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 - else - Sidekiq::Client.push_bulk('class' => self, 'args' => args_list) end end @@ -188,6 +198,16 @@ module ApplicationWorker 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) # `schedule_at` could be one of # - nil. diff --git a/config/feature_flags/development/group_authorized_agents.yml b/config/feature_flags/development/group_authorized_agents.yml deleted file mode 100644 index 8d1fd26181f..00000000000 --- a/config/feature_flags/development/group_authorized_agents.yml +++ /dev/null @@ -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 diff --git a/config/feature_flags/development/new_graphql_keyset_pagination.yml b/config/feature_flags/development/new_graphql_keyset_pagination.yml index f4afcba68cf..7f1c73756b3 100644 --- a/config/feature_flags/development/new_graphql_keyset_pagination.yml +++ b/config/feature_flags/development/new_graphql_keyset_pagination.yml @@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/323730 milestone: '13.10' type: development group: group::optimize -default_enabled: false +default_enabled: true diff --git a/db/migrate/20211013192749_add_states_into_approval_project_rules.rb b/db/migrate/20211013192749_add_states_into_approval_project_rules.rb new file mode 100644 index 00000000000..98fefbab12c --- /dev/null +++ b/db/migrate/20211013192749_add_states_into_approval_project_rules.rb @@ -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 diff --git a/db/schema_migrations/20211013192749 b/db/schema_migrations/20211013192749 new file mode 100644 index 00000000000..54f05dc3fd6 --- /dev/null +++ b/db/schema_migrations/20211013192749 @@ -0,0 +1 @@ +eeda27c42a80d23851bb58b00cee79feeffbe9ae1fef76b3034f92c8610a8aaf \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 158ac90945a..bef331f94ab 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -10579,7 +10579,8 @@ CREATE TABLE approval_project_rules ( scanners text[], vulnerabilities_allowed smallint DEFAULT 0 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 ( diff --git a/doc/administration/geo/replication/datatypes.md b/doc/administration/geo/replication/datatypes.md index e8e87f92481..085f08acbe4 100644 --- a/doc/administration/geo/replication/datatypes.md +++ b/doc/administration/geo/replication/datatypes.md @@ -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 | | |[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 | | -|[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. | |[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).

Behind feature flag `geo_lfs_object_replication`, enabled by default. | |[Personal snippets](../../../user/snippets.md) | **Yes** (10.2) | **Yes** (10.2) | No | | diff --git a/doc/api/group_repository_storage_moves.md b/doc/api/group_repository_storage_moves.md index 9d4120ec355..1d6e08b5840 100644 --- a/doc/api/group_repository_storage_moves.md +++ b/doc/api/group_repository_storage_moves.md @@ -11,7 +11,7 @@ type: reference 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 -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 of `state` are: diff --git a/doc/api/group_wikis.md b/doc/api/group_wikis.md index 17337934a92..4af907bd387 100644 --- a/doc/api/group_wikis.md +++ b/doc/api/group_wikis.md @@ -9,7 +9,7 @@ type: reference, api > [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. ## List wiki pages diff --git a/doc/ci/docker/using_kaniko.md b/doc/ci/docker/using_kaniko.md index f1c21f44e4e..ea3e81329d3 100644 --- a/doc/ci/docker/using_kaniko.md +++ b/doc/ci/docker/using_kaniko.md @@ -95,12 +95,12 @@ build: - mkdir -p /kaniko/.docker - |- 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 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}" fi - KANIKOCFG="${KANIKOCFG} }" + KANIKOCFG="{ ${KANIKOCFG} }" echo "${KANIKOCFG}" > /kaniko/.docker/config.json - >- /kaniko/executor diff --git a/doc/development/documentation/site_architecture/index.md b/doc/development/documentation/site_architecture/index.md index d1736e10000..2c126bc0a1c 100644 --- a/doc/development/documentation/site_architecture/index.md +++ b/doc/development/documentation/site_architecture/index.md @@ -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 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 Whenever the custom CSS and JavaScript files under `content/assets/` change, diff --git a/doc/development/service_ping/implement.md b/doc/development/service_ping/implement.md index fdf02b5e2ce..65a8b4c1cad 100644 --- a/doc/development/service_ping/implement.md +++ b/doc/development/service_ping/implement.md @@ -555,13 +555,18 @@ We can also disable tracking completely by using the global flag: ##### 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: - `#{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. -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_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. diff --git a/doc/raketasks/backup_restore.md b/doc/raketasks/backup_restore.md index 8cf5dfc4206..f1ddefef5de 100644 --- a/doc/raketasks/backup_restore.md +++ b/doc/raketasks/backup_restore.md @@ -61,7 +61,7 @@ including: - Container Registry images - GitLab Pages content - Snippets -- [Group wikis](../user/project/wiki/index.md#group-wikis) +- [Group wikis](../user/project/wiki/group.md) Backups do not include: diff --git a/doc/topics/git/lfs/index.md b/doc/topics/git/lfs/index.md index 0b4fd335455..b21237203d7 100644 --- a/doc/topics/git/lfs/index.md +++ b/doc/topics/git/lfs/index.md @@ -42,6 +42,7 @@ Documentation for GitLab instance administrators is under [LFS administration do credentials store is recommended. - Git LFS always assumes HTTPS so if you have GitLab server on HTTP you must [add the URL to Git configuration manually](#troubleshooting). +- [Group wikis](../../../user/project/wiki/group.md) do not support Git LFS. NOTE: With 8.12 GitLab added LFS support to SSH. The Git LFS communication diff --git a/doc/user/clusters/agent/repository.md b/doc/user/clusters/agent/repository.md index 68fa3024ce2..9cafe8c9bed 100644 --- a/doc/user/clusters/agent/repository.md +++ b/doc/user/clusters/agent/repository.md @@ -153,11 +153,6 @@ gitops: > [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 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 diff --git a/doc/user/group/index.md b/doc/user/group/index.md index 9b4dc04b2fd..5cc0de9cdd3 100644 --- a/doc/user/group/index.md +++ b/doc/user/group/index.md @@ -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) +Changes to [group wikis](../project/wiki/group.md) do not appear in group activity analytics. + ### View group activity You can view the most recent actions taken in a group, either in your browser or in an RSS feed: diff --git a/doc/user/group/settings/import_export.md b/doc/user/group/settings/import_export.md index 3f9d94f044e..ce916fb33ae 100644 --- a/doc/user/group/settings/import_export.md +++ b/doc/user/group/settings/import_export.md @@ -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 sure these users exist before importing the desired groups. -### Exported Contents +### Exported contents The following items are exported: @@ -51,7 +51,7 @@ The following items are exported: - Subgroups (including all the aforementioned data) - Epics - 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)) The following items are **not** exported: diff --git a/doc/user/project/wiki/group.md b/doc/user/project/wiki/group.md new file mode 100644 index 00000000000..6e364a688d3 --- /dev/null +++ b/doc/user/project/wiki/group.md @@ -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 g + w + [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) diff --git a/doc/user/project/wiki/index.md b/doc/user/project/wiki/index.md index e2a8167b14c..5d2a0530f68 100644 --- a/doc/user/project/wiki/index.md +++ b/doc/user/project/wiki/index.md @@ -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 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 g + w - [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. Wiki pages written in Markdown support all [Markdown features](../../markdown.md), 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) +## 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 g + w + [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 > [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 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. GitLab requires this first page be titled `home`. The page with this 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: -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 a content format. 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: -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: - Use the e wiki [keyboard shortcut](../../shortcuts.md#wiki-pages). - 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: -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. Select the edit icon (**{pencil}**). 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: -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. Select the edit icon (**{pencil}**). 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 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**. - -From the history page you can see: +The history page shows: ![Wiki page history](img/wiki_page_history.png) @@ -184,13 +200,25 @@ From the history page you can see: - The last update. - 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 > [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: -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. Select **Page history** to see all page versions. 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.** > - [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 -[user profile](../../profile/index.md#access-your-user-profile), -[group](../../group/index.md#view-group-activity), -and [project](../working_with_projects.md#project-activity) activity pages. +GitLab tracks wiki creation, deletion, and update events. These events are displayed on these pages: + +- [User profile](../../profile/index.md#access-your-user-profile). +- 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). @@ -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 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. 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 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). Administrators for self-managed GitLab installs can [configure additional wiki settings](../../../administration/wikis/index.md). -## Group wikis **(PREMIUM)** - -> [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. +You can't disable [group wikis](group.md) from the GitLab user interface. ## Link an external wiki 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. Add the URL to your external wiki. 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: -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. In the **Enable integration** section, clear the **Active** checkbox. 1. Select **Save changes**. @@ -300,6 +312,7 @@ To hide the link to an external 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. Expand **Visibility, project features, permissions**. 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. - [GitLab Flavored Markdown extensions](https://gitlab.com/groups/gitlab-org/-/epics/5438) epic. -## Resources +## Related topics - [Wiki settings for administrators](../../../administration/wikis/index.md) - [Project wikis API](../../../api/wikis.md) diff --git a/doc/user/search/advanced_search.md b/doc/user/search/advanced_search.md index f994539b9fc..f68951badff 100644 --- a/doc/user/search/advanced_search.md +++ b/doc/user/search/advanced_search.md @@ -26,7 +26,7 @@ when searching in: - Comments - Code - Commits -- Wiki +- Wiki (except [group wikis](../project/wiki/group.md)) - Users 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. | | 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. | -| 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. | diff --git a/doc/user/snippets.md b/doc/user/snippets.md index 441c269da70..3929ed7c5bf 100644 --- a/doc/user/snippets.md +++ b/doc/user/snippets.md @@ -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 [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/). Snippets with multiple files display a file count in the [snippet list](https://gitlab.com/dashboard/snippets): diff --git a/lib/api/ci/jobs.rb b/lib/api/ci/jobs.rb index d0ca49029a8..7c9c4a7af12 100644 --- a/lib/api/ci/jobs.rb +++ b/lib/api/ci/jobs.rb @@ -189,18 +189,10 @@ module API pipeline = current_authenticated_job.pipeline project = current_authenticated_job.project - - 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 + agent_authorizations = Clusters::AgentAuthorizationsFinder.new(project).execute { - allowed_agents: allowed_agents, + allowed_agents: Entities::Clusters::AgentAuthorization.represent(agent_authorizations), job: Entities::Ci::JobRequest::JobInfo.represent(current_authenticated_job), pipeline: Entities::Ci::PipelineBasic.represent(pipeline), project: Entities::ProjectIdentity.represent(project), diff --git a/lib/gitlab/ci/reports/security/reports.rb b/lib/gitlab/ci/reports/security/reports.rb index b7a5e36b108..7099548b10c 100644 --- a/lib/gitlab/ci/reports/security/reports.rb +++ b/lib/gitlab/ci/reports/security/reports.rb @@ -22,21 +22,24 @@ module Gitlab reports.values.flat_map(&:findings) end - def violates_default_policy_against?(target_reports, vulnerabilities_allowed, severity_levels) - unsafe_findings_count(target_reports, severity_levels) > vulnerabilities_allowed + def violates_default_policy_against?(target_reports, vulnerabilities_allowed, severity_levels, vulnerability_states) + 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 private - def findings_diff(target_reports) - findings - target_reports&.findings.to_a - end - - def unsafe_findings_count(target_reports, severity_levels) - findings_diff(target_reports).count {|finding| finding.unsafe?(severity_levels)} + def unsafe_findings_count(target_reports, severity_levels, vulnerability_states) + new_uuids = unsafe_findings_uuids(severity_levels) - target_reports&.unsafe_findings_uuids(severity_levels).to_a + new_uuids.count end end end end end end + +Gitlab::Ci::Reports::Security::Reports.prepend_mod_with('Gitlab::Ci::Reports::Security::Reports') diff --git a/lib/gitlab/graphql/pagination/keyset/generic_keyset_pagination.rb b/lib/gitlab/graphql/pagination/keyset/generic_keyset_pagination.rb index 5a9d21e7469..15f95edd318 100644 --- a/lib/gitlab/graphql/pagination/keyset/generic_keyset_pagination.rb +++ b/lib/gitlab/graphql/pagination/keyset/generic_keyset_pagination.rb @@ -76,7 +76,7 @@ module Gitlab def items 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 rebuilt_items_with_keyset_order, success = Gitlab::Pagination::Keyset::SimpleOrderBuilder.build(original_items) diff --git a/lib/gitlab/usage/metrics/names_suggestions/generator.rb b/lib/gitlab/usage/metrics/names_suggestions/generator.rb index 96ee3e1a2a7..6dcbe5f5fe5 100644 --- a/lib/gitlab/usage/metrics/names_suggestions/generator.rb +++ b/lib/gitlab/usage/metrics/names_suggestions/generator.rb @@ -10,10 +10,10 @@ module Gitlab uncached_data.deep_stringify_keys.dig(*key_path.split('.')) 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.new(time_frame: time_frame).suggested_name + metric_class.new(time_frame: time_frame, options: options).suggested_name end private diff --git a/lib/gitlab/usage_data_non_sql_metrics.rb b/lib/gitlab/usage_data_non_sql_metrics.rb index f425ea92729..be5a571fb82 100644 --- a/lib/gitlab/usage_data_non_sql_metrics.rb +++ b/lib/gitlab/usage_data_non_sql_metrics.rb @@ -12,10 +12,10 @@ module Gitlab super.with_indifferent_access.deep_merge(instrumentation_metrics.with_indifferent_access) 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.new(time_frame: time_frame).instrumentation + metric_class.new(time_frame: time_frame, options: options).instrumentation end def count(relation, column = nil, batch: true, batch_size: nil, start: nil, finish: nil) diff --git a/lib/gitlab/usage_data_queries.rb b/lib/gitlab/usage_data_queries.rb index 171b0a22820..f543b29e43f 100644 --- a/lib/gitlab/usage_data_queries.rb +++ b/lib/gitlab/usage_data_queries.rb @@ -12,10 +12,10 @@ module Gitlab super.with_indifferent_access.deep_merge(instrumentation_metrics.with_indifferent_access) 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.new(time_frame: time_frame).instrumentation + metric_class.new(time_frame: time_frame, options: options).instrumentation end def count(relation, column = nil, *args, **kwargs) diff --git a/lib/gitlab/utils/usage_data.rb b/lib/gitlab/utils/usage_data.rb index 0c4d767f126..77f04929661 100644 --- a/lib/gitlab/utils/usage_data.rb +++ b/lib/gitlab/utils/usage_data.rb @@ -45,14 +45,14 @@ module Gitlab MAX_BUCKET_SIZE = 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 # -100 indicates the metric was not properly merged. return INSTRUMENTATION_CLASS_FALLBACK if Feature.enabled?(:usage_data_instrumentation) 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 def count(relation, column = nil, batch: true, batch_size: nil, start: nil, finish: nil) diff --git a/locale/gitlab.pot b/locale/gitlab.pot index e468b168f96..8090094d077 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -4223,12 +4223,18 @@ msgstr "" msgid "ApprovalRule|All severity levels" msgstr "" +msgid "ApprovalRule|All vulnerability states" +msgstr "" + msgid "ApprovalRule|Apply this approval rule to consider only the selected security scanners." msgstr "" msgid "ApprovalRule|Apply this approval rule to consider only the selected severity levels." msgstr "" +msgid "ApprovalRule|Apply this approval rule to consider only the selected vulnerability states." +msgstr "" + msgid "ApprovalRule|Approval rules" msgstr "" @@ -4241,12 +4247,21 @@ msgstr "" msgid "ApprovalRule|Approvers" msgstr "" +msgid "ApprovalRule|Confirmed" +msgstr "" + +msgid "ApprovalRule|Dismissed" +msgstr "" + msgid "ApprovalRule|Examples: QA, Security." msgstr "" msgid "ApprovalRule|Name" msgstr "" +msgid "ApprovalRule|Newly detected" +msgstr "" + msgid "ApprovalRule|Number of vulnerabilities allowed before approval rule is triggered." msgstr "" @@ -4259,6 +4274,15 @@ msgstr "" msgid "ApprovalRule|Please select at least one severity level" msgstr "" +msgid "ApprovalRule|Please select at least one vulnerability state" +msgstr "" + +msgid "ApprovalRule|Previously detected" +msgstr "" + +msgid "ApprovalRule|Resolved" +msgstr "" + msgid "ApprovalRule|Rule name" msgstr "" @@ -4274,6 +4298,9 @@ msgstr "" msgid "ApprovalRule|Select severity levels" msgstr "" +msgid "ApprovalRule|Select vulnerability states" +msgstr "" + msgid "ApprovalRule|Severity levels" msgstr "" @@ -4283,6 +4310,9 @@ msgstr "" msgid "ApprovalRule|Vulnerabilities allowed" msgstr "" +msgid "ApprovalRule|Vulnerability states" +msgstr "" + msgid "ApprovalSettings|Merge request approval settings have been updated." msgstr "" @@ -5431,6 +5461,9 @@ msgstr "" msgid "Blog" 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" msgstr "" diff --git a/spec/finders/clusters/deployable_agents_finder_spec.rb b/spec/finders/clusters/deployable_agents_finder_spec.rb deleted file mode 100644 index ed3ffafed78..00000000000 --- a/spec/finders/clusters/deployable_agents_finder_spec.rb +++ /dev/null @@ -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 diff --git a/spec/frontend/lib/utils/common_utils_spec.js b/spec/frontend/lib/utils/common_utils_spec.js index 94b1e1cbb15..de1be5bc337 100644 --- a/spec/frontend/lib/utils/common_utils_spec.js +++ b/spec/frontend/lib/utils/common_utils_spec.js @@ -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', () => { it('returns the path following /-/', () => { expect(commonUtils.getDashPath('/some/-/url-with-dashes-/')).toEqual('url-with-dashes-/'); diff --git a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js index d9b7cd5afa2..a60e6f52862 100644 --- a/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js +++ b/spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js @@ -1,3 +1,4 @@ +import { cloneDeep } from 'lodash'; 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'; @@ -153,47 +154,40 @@ describe('LabelsSelect Mutations', () => { }); 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(() => { - labels = [ - { id: 1, title: 'scoped' }, - { id: 2, title: 'scoped::one', set: false }, - { id: 3, title: 'scoped::test', set: true }, - { id: 4, title: '' }, - ]; - }); + it.each` + label | labelGroupIds + ${labels[0]} | ${[]} + ${labels[1]} | ${[labels[2], labels[3]]} + ${labels[2]} | ${[labels[1], labels[3]]} + ${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', () => { - const updatedLabelIds = [2]; - const state = { - labels, - }; - mutations[types.UPDATE_SELECTED_LABELS](state, { labels: [{ id: 2 }] }); + mutations[types.UPDATE_SELECTED_LABELS](state, { labels: [{ id: label.id }] }); - state.labels.forEach((label) => { - if (updatedLabelIds.includes(label.id)) { - expect(label.touched).toBe(true); - expect(label.set).toBe(true); - } + expect(state.labels[label.id - 1]).toMatchObject({ + touched: true, + set: !labels[label.id - 1].set, }); - }); - describe('when label is scoped', () => { - it('unsets the currently selected scoped label and sets the current label', () => { - const state = { - 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: '' }, - ]); + labelGroupIds.forEach((l) => { + expect(state.labels[l.id - 1].touched).toBeFalsy(); + expect(state.labels[l.id - 1].set).toBe(false); }); }); }); diff --git a/spec/lib/gitlab/ci/reports/security/reports_spec.rb b/spec/lib/gitlab/ci/reports/security/reports_spec.rb index 9b1e02f1418..6ad0f1dd616 100644 --- a/spec/lib/gitlab/ci/reports/security/reports_spec.rb +++ b/spec/lib/gitlab/ci/reports/security/reports_spec.rb @@ -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(:vulnerabilities_allowed) { 0 } 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 security_reports.get_report('sast', artifact).add_finding(high_severity_dast) diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 62e2639e518..8505b19258c 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -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) # cached 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 diff --git a/spec/requests/api/ci/jobs_spec.rb b/spec/requests/api/ci/jobs_spec.rb index 811feca4621..59a9836e530 100644 --- a/spec/requests/api/ci/jobs_spec.rb +++ b/spec/requests/api/ci/jobs_spec.rb @@ -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_status) { 'running' } let(:params) { {} } - let(:group_authorized_agents_enabled) { true } subject do get api('/job/allowed_agents'), headers: headers, params: params end before do - stub_feature_flags(group_authorized_agents: group_authorized_agents_enabled) allow(Clusters::AgentAuthorizationsFinder).to receive(:new).with(project).and_return(authorizations_finder) subject @@ -247,30 +245,6 @@ RSpec.describe API::Ci::Jobs do ]) 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 context 'when user is anonymous' do diff --git a/spec/workers/concerns/application_worker_spec.rb b/spec/workers/concerns/application_worker_spec.rb index cae3440f11f..2f2d4c2e999 100644 --- a/spec/workers/concerns/application_worker_spec.rb +++ b/spec/workers/concerns/application_worker_spec.rb @@ -341,6 +341,7 @@ RSpec.describe ApplicationWorker do it 'enqueues jobs in one go' do expect(Sidekiq::Client).to( receive(:push_bulk).with(hash_including('args' => args)).once.and_call_original) + expect(Sidekiq.logger).not_to receive(:info) perform_action @@ -349,6 +350,19 @@ RSpec.describe ApplicationWorker do 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 stub_const(worker.name, worker) end @@ -381,6 +395,7 @@ RSpec.describe ApplicationWorker do include_context 'set safe limit beyond the number of jobs to be enqueued' 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 'does not schedule the jobs for any specific time' end @@ -400,6 +415,7 @@ RSpec.describe ApplicationWorker do include_context 'set safe limit beyond the number of jobs to be enqueued' 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 'does not schedule the jobs for any specific time' end