Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2024-08-07 21:09:01 +00:00
parent 43c1f6104a
commit d73c302d02
30 changed files with 281 additions and 145 deletions

View File

@ -5,6 +5,8 @@ import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import csrf from '~/lib/utils/csrf';
import TopicSelect from './topic_select.vue';
const formId = 'merge-topics-form';
export default {
components: {
GlAlert,
@ -43,6 +45,8 @@ export default {
attributes: {
variant: 'danger',
disabled: !this.validSelectedTopics,
type: 'submit',
form: formId,
},
};
},
@ -54,9 +58,6 @@ export default {
selectTargetTopic(topic) {
this.targetTopic = topic;
},
mergeTopics() {
this.$refs.mergeForm.submit();
},
},
i18n: {
title: s__('MergeTopics|Merge topics'),
@ -70,6 +71,7 @@ export default {
warningRemoveTopic: s__('MergeTopics|%{sourceTopic} will be removed'),
warningMoveProjects: s__('MergeTopics|All assigned projects will be moved to %{targetTopic}'),
},
formId,
modal: {
id: 'merge-topics',
actionSecondary: {
@ -93,7 +95,6 @@ export default {
:action-secondary="$options.modal.actionSecondary"
:modal-id="$options.modal.id"
size="sm"
@primary="mergeTopics"
>
<p>{{ $options.i18n.body }}</p>
<topic-select
@ -130,7 +131,7 @@ export default {
</ul>
{{ $options.i18n.warningBody }}
</gl-alert>
<form ref="mergeForm" method="post" :action="path">
<form :id="$options.formId" method="post" :action="path">
<input type="hidden" name="_method" value="post" />
<input type="hidden" name="authenticity_token" :value="$options.csrf.token" />
<input type="hidden" name="source_topic_id" :value="sourceTopicId" />

View File

@ -1,5 +1,5 @@
<script>
import { GlAvatarLabeled, GlCollapsibleListbox } from '@gitlab/ui';
import { GlAvatarLabeled, GlCollapsibleListbox, GlFormGroup } from '@gitlab/ui';
import { uniqueId } from 'lodash';
import { s__, n__ } from '~/locale';
import { AVATAR_SHAPE_OPTION_RECT } from '~/vue_shared/constants';
@ -9,6 +9,7 @@ export default {
components: {
GlAvatarLabeled,
GlCollapsibleListbox,
GlFormGroup,
},
props: {
selectedTopic: {
@ -95,8 +96,10 @@ export default {
</script>
<template>
<div>
<label v-if="labelText" :id="labelId">{{ labelText }}</label>
<gl-form-group :id="labelId">
<template #label>
{{ labelText }}
</template>
<gl-collapsible-listbox
v-model="selected"
block
@ -125,5 +128,5 @@ export default {
{{ searchSummary }}
</template>
</gl-collapsible-listbox>
</div>
</gl-form-group>
</template>

View File

@ -93,7 +93,7 @@ export default {
h(
'span',
{
class: 'gl-flex-grow-1 gl-whitespace-pre-wrap',
class: 'job-log-line-content',
},
parts,
),

View File

@ -76,7 +76,7 @@ export default {
<gl-icon :name="iconName" class="arrow gl-absolute gl-top-2" />
<line-number :line-number="line.lineNumber" :path="path" />
<span v-if="line.time" class="job-log-time">{{ line.time }}</span>
<span class="gl-flex-grow-1 gl-whitespace-pre-wrap">
<span class="job-log-line-content">
<span v-for="(content, i) in line.content" :key="i" :class="content.style">{{
content.text
}}</span>

View File

@ -43,6 +43,25 @@ export const periodToDate = (timePeriod) => {
return { min: new Date(maxMs - minMs), max: new Date(maxMs) };
};
/**
* Converts a time period string to a date range object.
*
* @param {string} timePeriod - The time period string (e.g., '5m', '3h', '7d').
* @returns {{value: string, startDate: Date, endDate: Date}} An object containing the date range.
* - value: Always set to CUSTOM_DATE_RANGE_OPTION.
* - startDate: The start date of the range.
* - endDate: The end date of the range (current time).
*/
export const periodToDateRange = (timePeriod) => {
const { min, max } = periodToDate(timePeriod);
return {
startDate: min,
endDate: max,
value: CUSTOM_DATE_RANGE_OPTION,
};
};
/**
* Validates the date range query parameters and returns an object with the validated date range.
*

View File

@ -3,22 +3,20 @@ import { GlBadge, GlButton } from '@gitlab/ui';
import { s__, sprintf, n__ } from '~/locale';
import { getAccessLevels } from '../../../utils';
export const i18n = {
defaultLabel: s__('BranchRules|default'),
protectedLabel: s__('BranchRules|protected'),
detailsButtonLabel: s__('BranchRules|View details'),
allowForcePush: s__('BranchRules|Allowed to force push'),
codeOwnerApprovalRequired: s__('BranchRules|Requires CODEOWNERS approval'),
statusChecks: s__('BranchRules|%{total} status %{subject}'),
approvalRules: s__('BranchRules|%{total} approval %{subject}'),
matchingBranches: s__('BranchRules|%{total} matching %{subject}'),
pushAccessLevels: s__('BranchRules|Allowed to push and merge'),
mergeAccessLevels: s__('BranchRules|Allowed to merge'),
};
export default {
name: 'BranchRule',
i18n,
i18n: {
defaultLabel: s__('BranchRules|default'),
protectedLabel: s__('BranchRules|protected'),
detailsButtonLabel: s__('BranchRules|View details'),
allowForcePush: s__('BranchRules|Allowed to force push'),
codeOwnerApprovalRequired: s__('BranchRules|Requires CODEOWNERS approval'),
statusChecks: s__('BranchRules|%{total} status %{subject}'),
approvalRules: s__('BranchRules|%{total} approval %{subject}'),
matchingBranches: s__('BranchRules|%{total} matching %{subject}'),
pushAccessLevels: s__('BranchRules|Allowed to push and merge'),
mergeAccessLevels: s__('BranchRules|Allowed to merge'),
},
components: {
GlBadge,
GlButton,

View File

@ -186,8 +186,7 @@
.job-log-line {
display: flex;
padding: 1px $gl-padding-8 1px $gl-padding-8;
min-height: $gl-line-height-20;
padding: 0 $gl-padding-8;
}
.job-log-line-number {
@ -219,6 +218,11 @@
}
}
.job-log-line-content {
flex-grow: 1;
white-space: pre-wrap;
}
.job-log-line-header {
display: flex;
position: relative;

View File

@ -45,7 +45,8 @@ class UserPreference < ApplicationRecord
attribute :keyboard_shortcuts_enabled, default: true
attribute :use_web_ide_extension_marketplace, default: false
enum visibility_pipeline_id_type: { id: 0, iid: 1 }
enum :visibility_pipeline_id_type, { id: 0, iid: 1 }, scopes: false
enum extensions_marketplace_opt_in_status: Enums::WebIde::ExtensionsMarketplaceOptInStatus.statuses
enum organization_groups_projects_display: { projects: 0, groups: 1 }

View File

@ -141,6 +141,7 @@ class PostReceive
end
rescue Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError
log("Failed to obtain lease for expiring branch name cache")
repository.expire_branches_cache
end
def expire_tag_cache(repository)
@ -155,6 +156,7 @@ class PostReceive
end
rescue Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError
log("Failed to obtain lease for expiring tag name cache")
repository.expire_caches_for_tags
end
def lease_key(ref_type)

View File

@ -119,7 +119,13 @@ module Gitlab
config.generators.templates.push("#{config.root}/generator_templates")
foss_eager_load_paths = config.eager_load_paths.dup.freeze
foss_eager_load_paths =
if Gitlab.next_rails?
config.all_eager_load_paths.dup.freeze
else
config.eager_load_paths.dup.freeze
end
load_paths = ->(dir:) do
ext_paths = foss_eager_load_paths.each_with_object([]) do |path, memo|
ext_path = config.root.join(dir, Pathname.new(path).relative_path_from(config.root))

View File

@ -22,7 +22,7 @@
# We can probably drop this patch for Rails 7.1 and up, but we might
# want to wait for https://github.com/rails/rails/pull/51441 or some
# mechanism that can disable the `Link` header.
if Gem::Version.new(ActionView.version) >= Gem::Version.new('7.1')
if Gem::Version.new(ActionView.version) >= Gem::Version.new('7.2')
raise 'New version of ActionView detected. This patch can likely be removed.'
end

View File

@ -2,15 +2,16 @@
# As discussed in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/148637#note_1850247875,
# Rails 7.1 introduces enqueue_all which is not covered in this patch.
if Gem::Version.new(Rails.gem_version) >= Gem::Version.new('7.1')
raise 'New version of Rails detected, please remove or update this patch'
end
# We deliver emails using the `deliver_later` method and it uses ActiveJob
# under the hood, which later processes the email via the defined ActiveJob adapter's `enqueue` method.
# For GitLab, the ActiveJob adapter is Sidekiq (in development and production environments).
# We need to set the following up to override the ActiveJob adapater
# so as to ensure that mailer jobs are enqueued in a shard-aware manner.
if Gem::Version.new(Rails.gem_version) >= Gem::Version.new('7.2')
raise 'New version of Rails detected, please remove or update this patch'
end
module ActiveJob
module QueueAdapters
module ActiveJobShardSupport

View File

@ -1,11 +1,5 @@
# frozen_string_literal: true
# https://github.com/rails/rails/pull/46656 disables IRB auto-completion
# by default in Rails 7.1.
if Gem::Version.new(Rails.gem_version) >= Gem::Version.new('7.1') # rubocop:disable Style/GuardClause -- This is easier to read
raise 'New version of Rails detected, please remove USE_AUTOCOMPLETE override'
end
if Gitlab::Runtime.console?
# Stop irb from writing a history file by default.
module IrbNoHistory
@ -17,11 +11,13 @@ if Gitlab::Runtime.console?
init_autocomplete
end
def init_autocomplete
return unless Rails.env.production?
unless ::Gitlab.next_rails?
def init_autocomplete
return unless Rails.env.production?
# IRB_USE_AUTOCOMPLETE was added in https://github.com/ruby/irb/pull/469
IRB.conf[:USE_AUTOCOMPLETE] = ENV.fetch("IRB_USE_AUTOCOMPLETE", "false") == "true"
# IRB_USE_AUTOCOMPLETE was added in https://github.com/ruby/irb/pull/469
IRB.conf[:USE_AUTOCOMPLETE] = ENV.fetch("IRB_USE_AUTOCOMPLETE", "false") == "true"
end
end
end

View File

@ -0,0 +1,10 @@
# frozen_string_literal: true
class AddSizeBytesIndexFileCountInZoektRepositories < Gitlab::Database::Migration[2.2]
milestone '17.3'
def change
add_column :zoekt_repositories, :size_bytes, :bigint, default: 0, null: false
add_column :zoekt_repositories, :index_file_count, :int, default: 0, null: false
end
end

View File

@ -0,0 +1 @@
71426ad992adea71a675a543a36c5680a46c4735ca4bc347744ea362e73e9b2c

View File

@ -20293,6 +20293,8 @@ CREATE TABLE zoekt_repositories (
updated_at timestamp with time zone NOT NULL,
indexed_at timestamp with time zone,
state smallint DEFAULT 0 NOT NULL,
size_bytes bigint DEFAULT 0 NOT NULL,
index_file_count integer DEFAULT 0 NOT NULL,
CONSTRAINT c_zoekt_repositories_on_project_id_and_project_identifier CHECK (((project_id IS NULL) OR (project_identifier = project_id)))
);

View File

@ -1024,7 +1024,7 @@ can be used.
DETAILS:
**Tier:** Ultimate
**Offering:** GitLab.com
**Offering:** GitLab.com, Self-managed, GitLab Dedicated
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/120506) in GitLab 16.0.

View File

@ -8,45 +8,123 @@ description: "Use the GitLab Workflow extension for VS Code to handle common Git
# GitLab Workflow extension for VS Code
The [GitLab Workflow extension](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow)
integrates GitLab with Visual Studio Code. You can decrease context switching and
do more day-to-day tasks in Visual Studio Code, such as:
for Visual Studio Code integrates GitLab Duo and other GitLab features directly into your IDE.
- [View issues](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#browse-issues-review-mrs).
- Run [common commands](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#commands)
from the Visual Studio Code [command palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette).
- Create and [review](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#merge-request-reviews)
merge requests directly from Visual Studio Code.
- [Validate your GitLab CI/CD configuration](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#validate-gitlab-cicd-configuration).
- [View the status of your pipeline](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#information-about-your-branch-pipelines-mr-closing-issue).
- [View the output of CI/CD jobs](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#view-the-job-output).
- [Create](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#create-snippet)
and paste snippets to, and from, your editor.
- [Browse repositories](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#browse-a-repository-without-cloning)
without cloning them.
- [Receive Code Suggestions](../../user/project/repository/code_suggestions/index.md).
- [View Security findings](https://marketplace.visualstudio.com/items?itemName=gitlab.gitlab-workflow#security-findings).
The GitLab Workflow extension streamlines your VS Code workflow with AI-assisted features:
## Download the extension
- **GitLab Duo Chat**: Interact with an AI assistant directly in VS Code. See
[how to set up GitLab Duo Chat](../../user/gitlab_duo_chat/index.md#use-gitlab-duo-chat-in-vs-code).
- [**GitLab Duo Code Suggestions**](#code-suggestions-features): Suggest completions to your current line of code,
or write natural-language code comments to get more substantive suggestions.
Download the extension from the [Visual Studio Code Marketplace](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow).
## Code Suggestions features
## Configure the extension
GitLab Duo provides AI-powered code suggestions as you type in VS Code, helping you write code more efficiently.
To interact with a [code suggestion](../../user/project/repository/code_suggestions/index.md) on the current line:
After you [download the extension](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow)
you can [configure](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#extension-settings):
- To accept the entire suggestion, press <kbd>Tab</kbd>.
- To accept the suggestion word-by-word, press <kbd>Command</kbd> + <kbd></kbd> (right arrow).
- To accept an entire line, right-click and select **Accept Line**.
GitLab Duo can also generate code based on comments in the file you're editing in VS Code. When you write comments in a
[supported file type](https://gitlab.com/gitlab-org/editor-extensions/gitlab-lsp/-/tree/main/vendor/grammars?ref_type=heads),
use natural language to describe what you want the code to do. Press <kbd>Enter</kbd> to see suggestions from
GitLab Duo inline in your current file.
To learn more, see the [documentation for Code Suggestions](../../user/project/repository/code_suggestions/index.md).
## Set up the GitLab Workflow extension
This extension requires you to create a GitLab personal access token, and assign it to the extension:
1. [Install the extension](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow) from the Visual Studio Marketplace and enable it. If you use an unofficial version of VS Code, install the extension from the [Open VSX Registry](https://open-vsx.org/extension/GitLab/gitlab-workflow).
1. To sign in to your GitLab instance, run the command **GitLab: Authenticate** in VS Code.
1. Open the command palette by pressing <kbd>Command</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd>.
1. In the command palette, search for **GitLab: Authenticate** and press <kbd>Enter<kbd>.
1. Select your GitLab instance URL from the offered options, or enter one manually.
- When manually adding an instance to **URL to GitLab instance**, paste the full URL to your
GitLab instance, including the `http://` or `https://`. Press <kbd>Enter</kbd> to confirm.
1. For `GitLab.com`, you can use the OAuth authentication method.
1. If you don't use OAuth, use a personal access token to log in.
- If you have an existing personal access token with `api` scope, select **Enter an existing token** to enter it.
- If you don't, select **Create a token first**, and the extension opens the token settings page for you.
If this method fails, follow the instructions to [create a personal access token](../../user/profile/personal_access_tokens.md#create-a-personal-access-token).
1. Copy the token. _For security reasons, this value is never displayed again, so you must copy this value now._
1. Paste in your GitLab personal access token and press <kbd>Enter</kbd>. The token is not displayed, nor is it accessible to others.
The extension matches your Git repository remote URL with the GitLab instance URL you specified
for your token. If you have multiple accounts or projects, you can choose the one you want to use.
For more details, see [Account management](https://gitlab.com/gitlab-org/gitlab-vscode-extension/#account-management).
The extension shows information in the VS Code status bar if both:
- Your project has a pipeline for the last commit.
- Your current branch is associated with a merge request.
## Configure extension settings
After you install GitLab Workflow, go to **Settings > Extensions > GitLab Workflow** in VS Code to configure its settings:
- [GitLab Duo Chat](../../user/gitlab_duo_chat/index.md#use-gitlab-duo-chat-in-vs-code).
- [Features to display or hide](https://gitlab.com/gitlab-org/gitlab-vscode-extension#extension-settings).
- [Self-signed certificate](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#self-signed-certificates) information.
- [Code Suggestions](../../user/project/repository/code_suggestions/index.md).
- [GitLab Duo Chat](../../user/gitlab_duo_chat/index.md#use-gitlab-duo-chat-in-vs-code).
## Report issues with the extension
### Customize keyboard shortcuts
Report any issues, bugs, or feature requests in the
[`gitlab-vscode-extension` issue queue](https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/issues).
You can assign different keyboard shortcuts for **Accept Inline Suggestion**, **Accept Next Word Of Inline Suggestion**,
or **Accept Next Line Of Inline Suggestion**:
1. In VS Code, run the `Preferences: Open Keyboard Shortcuts` command.
1. Find the shortcut you want to edit, and select **Change keybinding** (**{pencil}**).
1. Assign your preferred shortcuts to **Accept Inline Suggestion**, **Accept Next Word Of Inline Suggestion**,
or **Accept Next Line Of Inline Suggestion**.
1. Press <kbd>Enter</kbd> to save your changes.
## Configure more languages for Code Suggestions
To add more languages to Code Suggestions:
1. Find your desired language in the list of
[language identifiers](https://code.visualstudio.com/docs/languages/identifiers#_known-language-identifiers)
for VS Code. You need the **Identifier** for a later step.
1. In VS Code, open the extension settings for **GitLab Workflow**:
1. On the top bar, go to **Code > Settings > Extensions**.
1. Search for **GitLab Workflow** in the list, then select **Manage** (**{settings}**) **> Extension Settings**.
1. In your **User** settings, find
**GitLab Ai Assisted Code Suggestions: Additional Languages** and select **Add Item**.
1. In **Item**, add the language identifier, and select **OK**.
## Integrate with GitLab
This extension brings the GitLab features you use every day directly into your VS Code environment:
- [View issues](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#browse-issues-review-mrs) and merge requests.
- Run [common commands](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#commands)
from the Visual Studio Code [command palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette).
- Create and [review](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#merge-request-reviews)
merge requests.
- [Validate your GitLab CI/CD configuration](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#validate-gitlab-cicd-configuration).
- View [pipeline status](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#information-about-your-branch-pipelines-mr-closing-issue) and
[job outputs](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#view-the-job-output).
- [Create](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#create-snippet) and manage snippets.
- [Browse repositories](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow#browse-a-repository-without-cloning)
without cloning them.
- [View security findings](https://marketplace.visualstudio.com/items?itemName=gitlab.gitlab-workflow#security-findings).
For detailed information on these features, refer to the [GitLab Workflow extension documentation](https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/blob/main/README.md).
## Troubleshooting
If you encounter any issues or have feature requests:
1. Check the [extension documentation](https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/blob/main/README.md)
for known issues and solutions.
1. Report bugs or request features in the
[`gitlab-vscode-extension` issue queue](https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/issues).
## Related topics
- [Download the extension](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow)
- [Extension documentation](https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/blob/main/README.md)
- [View source code](https://gitlab.com/gitlab-org/gitlab-vscode-extension/)
- [Download the GitLab Workflow extension](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow)
- Extension [source code](https://gitlab.com/gitlab-org/gitlab-vscode-extension/)
- [GitLab Duo documentation](../../user/project/repository/code_suggestions/index.md)

View File

@ -120,8 +120,8 @@ GitLab Duo Chat is not available in the Web IDE on self-managed.
To use GitLab Duo Chat in GitLab Workflow extension for VS Code:
1. Install and set up the Workflow extension for VS Code:
1. In VS Code, download and install the [GitLab Workflow extension for VS Code](../../editor_extensions/visual_studio_code/index.md#download-the-extension).
1. Configure the [GitLab Workflow extension](../../editor_extensions/visual_studio_code/index.md#configure-the-extension).
1. In VS Code, download and install the [GitLab Workflow extension for VS Code](../../editor_extensions/visual_studio_code/index.md).
1. Configure the [GitLab Workflow extension](../../editor_extensions/visual_studio_code/index.md).
1. In VS Code, open a file. The file does not need to be a file in a Git repository.
1. Open Chat by using one of the following methods:
- On the left sidebar, select **GitLab Duo Chat**.

View File

@ -187,10 +187,24 @@ terms.md @legal-team
The Code Owner for `terms.md` would be `@legal-team`.
If you use sections, the last pattern matching the file or directory for each section is used.
For example, in a `CODEOWNERS` file using sections:
### Organize Code Owners by putting them into sections
In a Code Owners file, _sections_ are named areas of the file that are analyzed separately,
and always enforced. Until you define a section, GitLab treats your entire Code Owners file
as a single section. Adding more sections
[changes how GitLab evaluates your Code Owners file](#use-regular-entries-and-sections-together):
- GitLab treats [entries without sections](#use-regular-entries-and-sections-together), including rules defined
before the first section header, as if they were another, unnamed section.
- Each section enforces its rules separately.
- Only one CODEOWNERS pattern per section is matched to a file path.
- In a section, GitLab uses the _last_ pattern matching the file or directory for each section.
For example, in a `CODEOWNERS` file using sections, let's look at the ownership of a `README` file:
```plaintext
* @admin
[README Owners]
README.md @user1 @user2
internal/README.md @user4
@ -199,17 +213,15 @@ internal/README.md @user4
README.md @user3
```
The Code Owners for the `README.md` in the root directory are `@user1`, `@user2`,
and `@user3`. The Code Owners for `internal/README.md` are `@user4` and `@user3`.
Only one CODEOWNERS pattern per section is matched to a file path.
### Organize Code Owners by putting them into sections
You can organize Code Owners by putting them into named sections.
You can use sections for shared directories, so that multiple
teams can be reviewers.
- The Code Owners for the `README.md` in the _root_ directory are:
- `@admin`, from the unnamed section.
- `@user1` and `@user2`, from `[README Owners]`.
- `@user3`, from `[README other owners]`.
- The Code Owners for `internal/README.md` are:
- `@admin`, from the unnamed section.
- `@user4`, from the last entry in `[README Owners]`.
- `@user3` from `[README other owners]`. (Both lines in `[README Owners]` match this file's name,
but only the last line in the section is kept.)
To add a section to the `CODEOWNERS` file, enter a section name in square brackets,
followed by the files or directories, and users, groups, or subgroups:

View File

@ -148,7 +148,7 @@ you can add support for it locally.
Prerequisites:
- You have installed and enabled the
[GitLab Workflow extension for VS Code](../../../../editor_extensions/visual_studio_code/index.md#download-the-extension).
[GitLab Workflow extension for VS Code](../../../../editor_extensions/visual_studio_code/index.md).
- You have completed the [extension setup](https://gitlab.com/gitlab-org/gitlab-vscode-extension/#setup)
instructions, and authorized the extension to access your GitLab account.

View File

@ -9,13 +9,13 @@
#
# It overrides the new behavior that removes the constant first:
#
# https://github.com/rails/rails/blob/v7.0.5/activerecord/lib/active_record/migration.rb#L1054
# https://github.com/rails/rails/blob/v7.1.3.4/activerecord/lib/active_record/migration.rb#L1186
# The following is a reminder for when we upgrade to Rails 7.1. In particular,
# The following is a reminder for when we upgrade to Rails 7.2. In particular,
# we need to pay special attention to ensure that our ActiveRecord overrides are
# compatible.
if ::ActiveRecord::VERSION::STRING >= "7.1"
if ::ActiveRecord::VERSION::STRING >= "7.2"
raise 'New version of active-record detected, please remove or update this patch'
end

View File

@ -1,4 +1,4 @@
import { GlAvatarLabeled, GlCollapsibleListbox, GlListboxItem } from '@gitlab/ui';
import { GlAvatarLabeled, GlCollapsibleListbox, GlListboxItem, GlFormGroup } from '@gitlab/ui';
import { mount } from '@vue/test-utils';
import Vue from 'vue';
import VueApollo from 'vue-apollo';
@ -95,13 +95,15 @@ describe('TopicSelect', () => {
});
it('renders label', () => {
const labelText = 'my label';
createComponent({
props: {
labelText: 'my label',
labelText,
},
});
expect(wrapper.find('label').text()).toBe('my label');
expect(wrapper.findComponent(GlFormGroup).text()).toContain(labelText);
});
it('renders dropdown items', () => {

View File

@ -1,5 +1,6 @@
import {
periodToDate,
periodToDateRange,
dateFilterObjToQuery,
queryToDateFilterObj,
addTimeToDate,
@ -16,18 +17,16 @@ import {
TIME_RANGE_OPTIONS_VALUES,
} from '~/observability/constants';
const MOCK_NOW_DATE = new Date('2023-10-09 15:30:00');
const realDateNow = Date.now;
describe('periodToDate', () => {
const realDateNow = Date.now;
const MOCK_NOW_DATE = new Date('2023-10-09 15:30:00');
beforeEach(() => {
global.Date.now = jest.fn().mockReturnValue(MOCK_NOW_DATE);
});
afterEach(() => {
global.Date.now = realDateNow;
});
it.each`
periodLabel | period | expectedMinDate
${'minutes (m)'} | ${'30m'} | ${new Date('2023-10-09 15:00:00')}
@ -50,6 +49,23 @@ describe('periodToDate', () => {
});
});
describe('periodToDateRange', () => {
beforeEach(() => {
global.Date.now = jest.fn().mockReturnValue(MOCK_NOW_DATE);
});
afterEach(() => {
global.Date.now = realDateNow;
});
it('returns a date range object from period', () => {
expect(periodToDateRange('30m')).toEqual({
value: 'custom',
endDate: new Date('2023-10-09T15:30:00.000Z'),
startDate: new Date('2023-10-09T15:00:00.000Z'),
});
});
});
describe('queryToDateFilterObj', () => {
it('returns default date range if no query params provided', () => {
expect(queryToDateFilterObj({})).toEqual({ value: '1h' });

View File

@ -1,8 +1,5 @@
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import BranchRule, {
i18n,
} from '~/projects/settings/repository/branch_rules/components/branch_rule.vue';
import { sprintf, n__ } from '~/locale';
import BranchRule from '~/projects/settings/repository/branch_rules/components/branch_rule.vue';
import {
branchRuleProvideMock,
branchRulePropsMock,
@ -19,12 +16,12 @@ describe('Branch rule', () => {
});
};
const findDefaultBadge = () => wrapper.findByText(i18n.defaultLabel);
const findProtectedBadge = () => wrapper.findByText(i18n.protectedLabel);
const findDefaultBadge = () => wrapper.findByText('default');
const findProtectedBadge = () => wrapper.findByText('protected');
const findBranchName = () => wrapper.findByText(branchRulePropsMock.name);
const findProtectionDetailsList = () => wrapper.findByRole('list');
const findProtectionDetailsListItems = () => wrapper.findAllByRole('listitem');
const findDetailsButton = () => wrapper.findByText(i18n.detailsButtonLabel);
const findDetailsButton = () => wrapper.findByText('View details');
beforeEach(() => createComponent());
@ -56,18 +53,13 @@ describe('Branch rule', () => {
it('renders the protection details list items', () => {
expect(findProtectionDetailsListItems()).toHaveLength(wrapper.vm.approvalDetails.length);
expect(findProtectionDetailsListItems().at(0).text()).toBe(i18n.allowForcePush);
expect(findProtectionDetailsListItems().at(0).text()).toBe('Allowed to force push');
expect(findProtectionDetailsListItems().at(1).text()).toBe(wrapper.vm.pushAccessLevelsText);
});
it('renders branches count for wildcards', () => {
createComponent({ name: 'test-*' });
expect(findProtectionDetailsListItems().at(0).text()).toMatchInterpolatedText(
sprintf(i18n.matchingBranches, {
total: branchRulePropsMock.matchingBranchesCount,
subject: n__('branch', 'branches', branchRulePropsMock.matchingBranchesCount),
}),
);
expect(findProtectionDetailsListItems().at(0).text()).toBe('1 matching branch');
});
it('renders a detail button with the correct href', () => {

View File

@ -654,7 +654,7 @@ RSpec.describe ApplicationHelper do
describe '#profile_social_links' do
context 'when discord is set' do
let_it_be(:user) { build(:user) }
let(:user) { build(:user) }
let(:discord) { discord_url(user) }
it 'returns an empty string if discord is not set' do
@ -669,7 +669,7 @@ RSpec.describe ApplicationHelper do
end
context 'when bluesky is set' do
let_it_be(:user) { build(:user) }
let(:user) { build(:user) }
let(:bluesky) { bluesky_url(user) }
it 'returns an empty string if bluesky did id is not set' do
@ -684,7 +684,7 @@ RSpec.describe ApplicationHelper do
end
context 'when mastodon is set' do
let_it_be(:user) { build(:user) }
let(:user) { build(:user) }
let(:mastodon) { mastodon_url(user) }
it 'returns an empty string if mastodon username is not set' do

View File

@ -3215,37 +3215,22 @@ RSpec.describe Ci::Build, feature_category: :continuous_integration, factory_def
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'feature') }
context 'when feature flag remove_shared_jwts is enabled' do
context 'and id_tokens are not present in the build' do
it 'does not return id_token variables' do
expect(build.variables)
.not_to include(key: 'ID_TOKEN_1', value: 'feature', public: true, masked: false)
end
end
context 'and id_tokens are present in the build' do
before do
build.id_tokens = {
'ID_TOKEN_1' => { aud: 'developers' },
'ID_TOKEN_2' => { aud: 'maintainers' }
}
end
it 'returns static predefined variables' do
expect(build.variables)
.to include(key: 'CI_COMMIT_REF_NAME', value: 'feature', public: true, masked: false)
expect(build).not_to be_persisted
end
context 'and id_tokens are not present in the build' do
it 'does not return id_token variables' do
expect(build.variables)
.not_to include(key: 'ID_TOKEN_1', value: 'feature', public: true, masked: false)
end
end
context 'when feature flag remove_shared_jwts is disabled' do
context 'and id_tokens are present in the build' do
before do
stub_feature_flags(remove_shared_jwts: false)
build.id_tokens = {
'ID_TOKEN_1' => { aud: 'developers' },
'ID_TOKEN_2' => { aud: 'maintainers' }
}
end
it 'returns static predefined variables' do
expect(build.variables.size).to be >= 28
expect(build.variables)
.to include(key: 'CI_COMMIT_REF_NAME', value: 'feature', public: true, masked: false)
expect(build).not_to be_persisted

View File

@ -70,7 +70,7 @@ RSpec.describe UserPreference, feature_category: :user_profile do
expect(pref.visibility_pipeline_id_type).to eq('id')
end
it { is_expected.to define_enum_for(:visibility_pipeline_id_type).with_values(id: 0, iid: 1) }
it { is_expected.to define_enum_for(:visibility_pipeline_id_type) }
end
describe 'extensions_marketplace_opt_in_status' do

View File

@ -79,7 +79,12 @@ quality_level = Quality::TestLevel.new
RSpec.configure do |config|
config.use_transactional_fixtures = true
config.use_instantiated_fixtures = false
config.fixture_path = Rails.root
if ::Gitlab.next_rails?
config.fixture_paths = [Rails.root]
else
config.fixture_path = Rails.root
end
config.verbose_retry = true
config.display_try_failure_messages = true

View File

@ -464,7 +464,8 @@ RSpec.describe PostReceive, :clean_gitlab_redis_shared_state, feature_category:
context 'when exclusive lease fails' do
it 'logs a message' do
expect(snippet.repository).to receive(:branch_names).and_raise(Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError)
expect(worker).to receive(:in_lock).and_raise(Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError)
expect(snippet.repository).to receive(:expire_branches_cache).and_call_original
expect(Gitlab::GitLogger).to receive(:error).with("POST-RECEIVE: Failed to obtain lease for expiring branch name cache")
perform
@ -522,7 +523,8 @@ RSpec.describe PostReceive, :clean_gitlab_redis_shared_state, feature_category:
context 'when exclusive lease fails' do
it 'logs a message' do
expect(snippet.repository).to receive(:tag_names).and_raise(Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError)
expect(worker).to receive(:in_lock).and_raise(Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError)
expect(snippet.repository).to receive(:expire_tags_cache).and_call_original
expect(Gitlab::GitLogger).to receive(:error).with("POST-RECEIVE: Failed to obtain lease for expiring tag name cache")
perform