Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2023-05-05 15:14:35 +00:00
parent eb3f624622
commit 6634288474
22 changed files with 90 additions and 75 deletions

View File

@ -103,7 +103,7 @@ export default {
};
</script>
<template>
<div :style="scrollContainerStyle">
<div :style="scrollContainerStyle" class="gl-overflow-auto">
<dynamic-scroller :items="artifacts.nodes" :min-item-size="$options.ARTIFACT_ROW_HEIGHT">
<template #default="{ item, index, active }">
<dynamic-scroller-item :item="item" :active="active" :class="{ active }">

View File

@ -201,8 +201,6 @@ module CounterAttribute
#
# It does not guarantee that there will not be any concurrent updates.
def detect_race_on_record(log_fields: {})
return yield unless Feature.enabled?(:counter_attribute_db_lease_for_update, project)
# Ensure attributes is always an array before we log
log_fields[:attributes] = Array(log_fields[:attributes])

View File

@ -1876,11 +1876,11 @@ class Project < ApplicationRecord
repository.update!(shard_name: repository_storage, disk_path: disk_path)
end
def create_repository(force: false)
def create_repository(force: false, default_branch: nil)
# Forked import is handled asynchronously
return if forked? && !force
repository.create_repository
repository.create_repository(default_branch)
repository.after_create
true

View File

@ -197,7 +197,7 @@ module Projects
def create_readme
commit_attrs = {
branch_name: @default_branch.presence || @project.default_branch_or_main,
branch_name: default_branch,
commit_message: 'Initial commit',
file_path: 'README.md',
file_content: readme_content
@ -211,7 +211,11 @@ module Projects
end
def readme_content
@readme_template.presence || ReadmeRendererService.new(@project, current_user).execute
readme_attrs = {
default_branch: default_branch
}
@readme_template.presence || ReadmeRendererService.new(@project, current_user, readme_attrs).execute
end
def skip_wiki?
@ -227,8 +231,10 @@ module Projects
@project.create_labels unless @project.gitlab_project_import?
unless @project.import?
raise 'Failed to create repository' unless @project.create_repository
break if @project.import?
unless @project.create_repository(default_branch: default_branch)
raise 'Failed to create repository'
end
end
end
@ -277,6 +283,10 @@ module Projects
private
def default_branch
@default_branch.presence || @project.default_branch_or_main
end
def validate_import_source_enabled!
return unless @params[:import_type]

View File

@ -17,8 +17,8 @@ Already a pro? Just edit this README.md and make it your own. Want to make it ea
```
cd existing_repo
git remote add origin <%= project.http_url_to_repo %>
git branch -M <%= project.default_branch_or_main %>
git push -uf origin <%= project.default_branch_or_main %>
git branch -M <%= params[:default_branch] %>
git push -uf origin <%= params[:default_branch] %>
```
## Integrate with your tools

View File

@ -1,8 +0,0 @@
---
name: counter_attribute_db_lease_for_update
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/97912
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/374596
milestone: '15.5'
type: development
group: group::pipeline security
default_enabled: false

View File

@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/352956
milestone: '14.9'
type: development
group: group::project management
default_enabled: false
default_enabled: true

View File

@ -430,7 +430,8 @@ No password is used from mirroring because GitLab JH is a public project.
##### How the GitLab JH validation project is set up
This [GitLab JH validation](https://gitlab.com/gitlab-org-sandbox/gitlab-jh-validation) project is public and CI is enabled, without any project variables.
This [GitLab JH validation](https://gitlab.com/gitlab-org-sandbox/gitlab-jh-validation) project is public and CI is enabled, with temporary
project variables set.
It's a pull mirror pulling from [GitLab JH mirror](https://gitlab.com/gitlab-org/gitlab-jh-mirrors/gitlab),
mirroring only protected branches, `master` and `main-jh`, overriding
@ -464,6 +465,14 @@ when the merge requests changed the dependencies. See
[How we generate the as-if-JH branch](#how-we-generate-the-as-if-jh-branch)
for how it works.
###### Temporary GitLab JH validation project variables
- `BUNDLER_CHECKSUM_VERIFICATION_OPT_IN` is set to `false`
- We can remove this variable after JiHu has
[`jh/Gemfile.checksum`](https://jihulab.com/gitlab-cn/gitlab/-/blob/main-jh/jh/Gemfile.checksum)
committed. More context can be found at:
[Setting it to `false` to skip it](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/118938#note_1374688877)
### `rspec:undercoverage` job
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74859) in GitLab 14.6.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

View File

@ -17,22 +17,21 @@ GitLab issues and merge requests. Mention a Jira issue in a GitLab issue,
merge request, or comment, and GitLab adds a formatted comment to the Jira issue.
The comment links back to your work in GitLab.
For example, this commit references the Jira issue `GIT-1`:
For example, when this commit refers to a `GIT-1` Jira issue:
```shell
git commit -m "GIT-1 this is a test commit"
```
GitLab adds a reference to the **Issue Links** section of Jira issue `GIT-1`:
GitLab adds to that issue:
![Example of mentioning or closing the Jira issue](img/jira_issue_reference.png)
- A reference in the **Issue links** section
- A comment in the **Activity** section that follows this format:
GitLab also adds a comment to the issue, and uses this format:
```plaintext
USER mentioned this issue in RESOURCE_NAME of [PROJECT_NAME|COMMENTLINK]:
ENTITY_TITLE
```
```plaintext
USER mentioned this issue in RESOURCE_NAME of [PROJECT_NAME|COMMENTLINK]:
ENTITY_TITLE
```
- `USER`: The name of the user who mentioned the issue, linked to their GitLab user profile.
- `COMMENTLINK`: A link to where the Jira issue was mentioned.
@ -110,7 +109,7 @@ For example, use any of these trigger words to close the Jira issue `PROJECT-1`:
- `Fixes PROJECT-1`
The commit or merge request must target your project's [default branch](../../user/project/repository/branches/default.md).
You can change your project's default branch under [project settings](img/jira_project_settings.png).
You can change your project's default branch in [project settings](../../user/project/settings/index.md).
### Use case for closing issues
@ -120,8 +119,7 @@ Consider this example:
1. You create a merge request in GitLab to build the requested feature.
1. In the merge request, you add the issue closing trigger `Closes PROJECT-7`.
1. When the merge request is merged:
- GitLab closes the Jira issue for you:
![The GitLab integration closes Jira issue](img/jira_service_close_issue.png)
- GitLab closes the Jira issue for you.
- GitLab adds a formatted comment to Jira, linking back to the commit that
resolved the issue. You can [disable comments](#disable-comments-on-jira-issues).
@ -129,19 +127,19 @@ Consider this example:
> [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/3622) in GitLab 13.2.
You can browse, search, and view issues from a selected Jira project directly in GitLab,
if your GitLab administrator [has configured it](configure.md).
You can view and search issues from a selected Jira project directly in GitLab,
provided your GitLab administrator [has configured the integration](configure.md#configure-the-integration).
To do this, in GitLab, go to your project and select **Issues > Jira issues**. The issue list
sorts by **Created date** by default, with the newest issues listed at the top:
To view Jira issues:
![Jira issues integration enabled](img/open_jira_issues_list_v14_6.png)
1. On the top bar, select **Main menu > Projects** and find your project.
1. On the left sidebar, select **Issues > Jira issues**.
The issues are sorted by **Created date** by default, with the most recently created issues listed at the top.
- To display the most recently updated issues first, select **Updated date**.
- You can [search and filter](#search-and-filter-the-issues-list) the issues list.
- In GitLab [versions 13.10 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/299832),
you can select an issue from the list to view it in GitLab:
![Jira issue detail view](img/jira_issue_detail_view_v13.10.png)
- You can [search and filter the issue list](#search-and-filter-the-issue-list).
- In GitLab 13.10 and later, you can [select an issue from the list to view the issue in GitLab](https://gitlab.com/gitlab-org/gitlab/-/issues/299832).
Issues are grouped into tabs based on their
[Jira status](https://confluence.atlassian.com/adminjiraserver070/defining-status-field-values-749382903.html):
@ -150,7 +148,7 @@ Issues are grouped into tabs based on their
- **Closed** tab: All issues with a Jira status categorized as Done.
- **All** tab: All issues of any status.
### Search and filter the issues list **(PREMIUM)**
### Search and filter the issue list **(PREMIUM)**
To refine the list of issues, use the search bar to search for any text
contained in an issue summary (title) or description. Use any combination

View File

@ -9,6 +9,7 @@ type: howto
> - GraphQL support [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/352956) in GitLab 14.9 [with a flag](../../administration/feature_flags.md) named `saved_replies`. Disabled by default.
> - User interface [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/113232) in GitLab 15.10 [with a flag](../../administration/feature_flags.md) named `saved_replies`. Disabled by default. Enabled for GitLab team members only.
> - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/119468) in GitLab 16.0.
FLAG:
On self-managed GitLab, by default this feature is not available. To make it available, ask an administrator to [enable the feature flag](../../administration/feature_flags.md) named `saved_replies`.

View File

@ -3135,6 +3135,12 @@ RSpec.describe Project, factory_default: :keep, feature_category: :projects do
expect(project.create_repository).to eq(false)
expect(project.errors).not_to be_empty
end
it 'passes through default branch' do
expect(project.repository).to receive(:create_repository).with('pineapple')
expect(project.create_repository(default_branch: 'pineapple')).to eq(true)
end
end
context 'using a forked repository' do

View File

@ -736,16 +736,34 @@ RSpec.describe Projects::CreateService, '#execute', feature_category: :projects
end
end
context 'and a default_branch_name is specified' do
context 'and default_branch is specified' do
before do
opts[:default_branch] = 'example_branch'
end
it 'creates the correct branch' do
expect(project.repository.branch_names).to contain_exactly('example_branch')
end
it_behaves_like 'a repo with a README.md' do
let(:expected_content) do
<<~MARKDOWN
cd existing_repo
git remote add origin #{project.http_url_to_repo}
git branch -M example_branch
git push -uf origin example_branch
MARKDOWN
end
end
end
context 'and the default branch setting is configured' do
before do
allow(Gitlab::CurrentSettings).to receive(:default_branch_name).and_return('example_branch')
end
it 'creates the correct branch' do
branches = project.repository.branches
expect(branches.size).to eq(1)
expect(branches.collect(&:name)).to contain_exactly('example_branch')
expect(project.repository.branch_names).to contain_exactly('example_branch')
end
it_behaves_like 'a repo with a README.md' do

View File

@ -9,7 +9,7 @@ RSpec.describe Projects::ReadmeRendererService, '#execute', feature_category: :p
let_it_be(:project) { create(:project, title: 'My Project', description: '_custom_description_') }
let(:opts) { {} }
let(:opts) { { default_branch: 'master' } }
it 'renders the an ERB readme template' do
expect(service.execute).to start_with(<<~MARKDOWN)

View File

@ -1,14 +1,12 @@
# frozen_string_literal: true
require_relative 'helpers/capybara_helpers'
require_relative 'helpers/wait_helpers'
require_relative 'helpers/wait_for_requests'
module Capybara
class Session
module WaitForAllRequestsAfterVisitPage
include CapybaraHelpers
include WaitHelpers
include WaitForRequests
def visit(visit_uri)

View File

@ -1,6 +1,9 @@
# frozen_string_literal: true
require_relative 'wait_helpers'
module WaitForRequests
include WaitHelpers
extend self
# This is inspired by http://www.salsify.com/blog/engineering/tearing-capybara-ajax-tests

View File

@ -235,17 +235,4 @@ RSpec.shared_examples 'obtaining lease to update database' do
expect { subject }.not_to raise_error
end
end
context 'when feature flag counter_attribute_db_lease_for_update is disabled' do
before do
stub_feature_flags(counter_attribute_db_lease_for_update: false)
allow(model).to receive(:in_lock).and_call_original
end
it 'does not attempt to get a lock' do
expect(model).not_to receive(:in_lock)
subject
end
end
end

View File

@ -1,17 +1,12 @@
# GitLab-Workhorse development process
## Maintainers
GitLab-Workhorse has the following maintainers:
- Patrick Bajao `@patrickbajao`
- Alessio Caiazza `@nolith`
- Nick Thomas `@nick.thomas`
- Jacob Vosmaer `@jacobvosmaer-gitlab`
This authoritative source for this list is https://about.gitlab.com/team/.
## Merging and reviewing contributions
Contributions must be reviewed by at least one Workhorse maintainer.
The final merge must be performed by a maintainer.
It is preferable to request a review from a reviewer or a trainee maintainer before passing it to a maintainer:
- [Maintainers](https://gitlab-org.gitlab.io/gitlab-roulette/?mode=show&visible=maintainer%7Cworkhorse)
- [Trainee Maintainers](https://gitlab-org.gitlab.io/gitlab-roulette/?mode=show&visible=trainee+maintainer%7Cworkhorse)
- [Reviewers](https://gitlab-org.gitlab.io/gitlab-roulette/?mode=show&visible=reviewer%7Cworkhorse)