diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-05 18:14:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-05 18:14:35 +0300 |
commit | 6634288474d2a83cac7b4205f3ffc736cc6b36db (patch) | |
tree | 40f13dbe9e39ee30d5ec19a32fa792938b64a8e7 | |
parent | eb3f624622331c74198ba299af90bd1e431a330f (diff) |
Add latest changes from gitlab-org/gitlab@master
22 files changed, 90 insertions, 75 deletions
diff --git a/app/assets/javascripts/ci/artifacts/components/artifacts_table_row_details.vue b/app/assets/javascripts/ci/artifacts/components/artifacts_table_row_details.vue index ea0d4d585be..e893040edd8 100644 --- a/app/assets/javascripts/ci/artifacts/components/artifacts_table_row_details.vue +++ b/app/assets/javascripts/ci/artifacts/components/artifacts_table_row_details.vue @@ -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 }"> diff --git a/app/models/concerns/counter_attribute.rb b/app/models/concerns/counter_attribute.rb index d7ee533b53c..56608c49a6b 100644 --- a/app/models/concerns/counter_attribute.rb +++ b/app/models/concerns/counter_attribute.rb @@ -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]) diff --git a/app/models/project.rb b/app/models/project.rb index fcbef23bc4c..8f9b7042a0e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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 diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 691e2235605..ac19f21ffc7 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -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] diff --git a/app/views/projects/readme_templates/default.md.tt b/app/views/projects/readme_templates/default.md.tt index cd0b2db1d31..ad1d6cce08d 100644 --- a/app/views/projects/readme_templates/default.md.tt +++ b/app/views/projects/readme_templates/default.md.tt @@ -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 diff --git a/config/feature_flags/development/counter_attribute_db_lease_for_update.yml b/config/feature_flags/development/counter_attribute_db_lease_for_update.yml deleted file mode 100644 index 8a991dd7aea..00000000000 --- a/config/feature_flags/development/counter_attribute_db_lease_for_update.yml +++ /dev/null @@ -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 diff --git a/config/feature_flags/development/saved_replies.yml b/config/feature_flags/development/saved_replies.yml index b6a7151addf..0c973292ba0 100644 --- a/config/feature_flags/development/saved_replies.yml +++ b/config/feature_flags/development/saved_replies.yml @@ -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 diff --git a/doc/development/pipelines/index.md b/doc/development/pipelines/index.md index 5c0e2ba3ce0..a779e75d5fb 100644 --- a/doc/development/pipelines/index.md +++ b/doc/development/pipelines/index.md @@ -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. diff --git a/doc/integration/jira/img/jira_issue_detail_view_v13.10.png b/doc/integration/jira/img/jira_issue_detail_view_v13.10.png Binary files differdeleted file mode 100644 index bf1607a35fe..00000000000 --- a/doc/integration/jira/img/jira_issue_detail_view_v13.10.png +++ /dev/null diff --git a/doc/integration/jira/img/jira_issue_reference.png b/doc/integration/jira/img/jira_issue_reference.png Binary files differdeleted file mode 100644 index db8bc4f0bb9..00000000000 --- a/doc/integration/jira/img/jira_issue_reference.png +++ /dev/null diff --git a/doc/integration/jira/img/jira_project_settings.png b/doc/integration/jira/img/jira_project_settings.png Binary files differdeleted file mode 100644 index d96002b7db8..00000000000 --- a/doc/integration/jira/img/jira_project_settings.png +++ /dev/null diff --git a/doc/integration/jira/img/jira_service_close_issue.png b/doc/integration/jira/img/jira_service_close_issue.png Binary files differdeleted file mode 100644 index 73d6498192c..00000000000 --- a/doc/integration/jira/img/jira_service_close_issue.png +++ /dev/null diff --git a/doc/integration/jira/img/open_jira_issues_list_v14_6.png b/doc/integration/jira/img/open_jira_issues_list_v14_6.png Binary files differdeleted file mode 100644 index 6f06b7fec9a..00000000000 --- a/doc/integration/jira/img/open_jira_issues_list_v14_6.png +++ /dev/null diff --git a/doc/integration/jira/issues.md b/doc/integration/jira/issues.md index 636337d6817..d75d8a434c1 100644 --- a/doc/integration/jira/issues.md +++ b/doc/integration/jira/issues.md @@ -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: + +1. On the top bar, select **Main menu > Projects** and find your project. +1. On the left sidebar, select **Issues > Jira issues**. -![Jira issues integration enabled](img/open_jira_issues_list_v14_6.png) +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 diff --git a/doc/user/profile/comment_templates.md b/doc/user/profile/comment_templates.md index b9cd595916c..8a94aff44fe 100644 --- a/doc/user/profile/comment_templates.md +++ b/doc/user/profile/comment_templates.md @@ -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`. diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 7959412e6dd..f25ff0884b9 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -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 diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb index 35b715d82ee..1c903954658 100644 --- a/spec/services/projects/create_service_spec.rb +++ b/spec/services/projects/create_service_spec.rb @@ -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 - allow(Gitlab::CurrentSettings).to receive(:default_branch_name).and_return('example_branch') + opts[:default_branch] = 'example_branch' end it 'creates the correct branch' do - branches = project.repository.branches + expect(project.repository.branch_names).to contain_exactly('example_branch') + end - expect(branches.size).to eq(1) - expect(branches.collect(&:name)).to contain_exactly('example_branch') + 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 + expect(project.repository.branch_names).to contain_exactly('example_branch') end it_behaves_like 'a repo with a README.md' do diff --git a/spec/services/projects/readme_renderer_service_spec.rb b/spec/services/projects/readme_renderer_service_spec.rb index 58b967b7e9c..842d75e82ee 100644 --- a/spec/services/projects/readme_renderer_service_spec.rb +++ b/spec/services/projects/readme_renderer_service_spec.rb @@ -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) diff --git a/spec/support/capybara_wait_for_all_requests_after_visit_page.rb b/spec/support/capybara_wait_for_all_requests_after_visit_page.rb index 3c971db34d7..f20e82e89a9 100644 --- a/spec/support/capybara_wait_for_all_requests_after_visit_page.rb +++ b/spec/support/capybara_wait_for_all_requests_after_visit_page.rb @@ -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) diff --git a/spec/support/helpers/wait_for_requests.rb b/spec/support/helpers/wait_for_requests.rb index 8fd9bb47053..5e2e8ad53e0 100644 --- a/spec/support/helpers/wait_for_requests.rb +++ b/spec/support/helpers/wait_for_requests.rb @@ -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 diff --git a/spec/support/shared_examples/models/concerns/counter_attribute_shared_examples.rb b/spec/support/shared_examples/models/concerns/counter_attribute_shared_examples.rb index 139deaaece9..9d189842b28 100644 --- a/spec/support/shared_examples/models/concerns/counter_attribute_shared_examples.rb +++ b/spec/support/shared_examples/models/concerns/counter_attribute_shared_examples.rb @@ -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 diff --git a/workhorse/PROCESS.md b/workhorse/PROCESS.md index 1231ab3968c..6cb8068f29f 100644 --- a/workhorse/PROCESS.md +++ b/workhorse/PROCESS.md @@ -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) |