Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2023-04-21 21:08:28 +00:00
parent 07d811cd3c
commit 0a93f691bf
37 changed files with 617 additions and 195 deletions

View File

@ -67,6 +67,10 @@ stages:
# todo: remove in 16.1 milestone when not needed for backwards compatibility anymore
EE_LICENSE: $QA_EE_LICENSE
GITHUB_ACCESS_TOKEN: $QA_GITHUB_ACCESS_TOKEN
# Allow QA jobs to fail as they are flaky. The top level `package-and-e2e:ee`
# pipeline is not allowed to fail, so without allowing QA to fail, we will be
# blocking merges due to flaky tests.
allow_failure: true
# ==========================================
# Prepare stage

View File

@ -1353,7 +1353,6 @@
allow_failure: true
- <<: *if-merge-request
changes: *dependency-patterns
allow_failure: true
variables:
OMNIBUS_GITLAB_BUILD_ON_ALL_OS: 'true'
- <<: *if-merge-request-labels-run-all-e2e

View File

@ -103,6 +103,15 @@ export default {
this.count = newCount;
},
},
methods: {
fetchJobsByStatus(scope) {
this.infiniteScrollingTriggered = false;
this.scope = scope;
this.$apollo.queries.jobs.refetch({ statuses: scope });
},
},
};
</script>
@ -112,7 +121,11 @@ export default {
{{ error }}
</gl-alert>
<jobs-table-tabs :all-jobs-count="count" :loading="loading" />
<jobs-table-tabs
:all-jobs-count="count"
:loading="loading"
@fetchJobsByStatus="fetchJobsByStatus"
/>
<jobs-skeleton-loader v-if="showSkeletonLoader" class="gl-mt-5" />

View File

@ -545,14 +545,14 @@ export default {
<div class="mr-widget-body-controls gl-display-flex gl-align-items-center gl-flex-wrap">
<template v-if="shouldShowMergeControls">
<div
class="gl-display-flex gl-sm-flex-direction-column gl-md-align-items-center gl-flex-wrap gl-w-full gl-md-pb-2"
class="gl-display-flex gl-sm-flex-direction-column gl-md-align-items-center gl-flex-wrap gl-w-full"
>
<gl-form-checkbox
v-if="canRemoveSourceBranch"
id="remove-source-branch-input"
v-model="removeSourceBranch"
:disabled="isRemoveSourceBranchButtonDisabled"
class="js-remove-source-branch-checkbox gl-display-flex gl-align-items-center gl-mr-5 gl-mb-3 gl-md-mb-0"
class="js-remove-source-branch-checkbox gl-display-flex gl-align-items-center gl-mr-5"
data-testid="delete-source-branch-checkbox"
>
{{ __('Delete source branch') }}
@ -564,14 +564,13 @@ export default {
v-model="squashBeforeMerge"
:help-path="mr.squashBeforeMergeHelpPath"
:is-disabled="isSquashReadOnly"
class="gl-mr-5 gl-mb-3 gl-md-mb-0"
class="gl-mr-5"
/>
<gl-form-checkbox
v-if="shouldShowSquashEdit || shouldShowMergeEdit"
v-model="editCommitMessage"
data-testid="widget_edit_commit_message"
class="gl-display-flex gl-align-items-center gl-mb-3 gl-md-mb-0"
>
{{ __('Edit commit message') }}
</gl-form-checkbox>

View File

@ -39,13 +39,13 @@ export default {
</script>
<template>
<div class="gl-display-flex gl-align-items-center">
<div class="gl-display-flex">
<gl-form-checkbox
v-gl-tooltip
:checked="value"
:disabled="isDisabled"
name="squash"
class="js-squash-checkbox gl-mr-2 gl-display-flex gl-align-items-center"
class="js-squash-checkbox gl-mr-2"
data-qa-selector="squash_checkbox"
:title="tooltipTitle"
@change="(checked) => $emit('input', checked)"
@ -57,7 +57,7 @@ export default {
v-gl-tooltip
:href="helpPath"
:title="$options.i18n.helpLabel"
class="gl-text-blue-600"
class="gl-text-blue-600 gl-line-height-1"
target="_blank"
>
<gl-icon name="question-o" />

View File

@ -597,10 +597,6 @@ $tabs-holder-z-index: 250;
}
}
label {
margin-bottom: 0;
}
.btn {
font-size: $gl-font-size;
}
@ -695,10 +691,6 @@ $tabs-holder-z-index: 250;
margin-right: 7px;
}
label {
font-weight: $gl-font-weight-normal;
}
.spacing {
margin: 0 0 0 10px;
}

View File

@ -144,9 +144,9 @@ module IssuablesHelper
def issuable_meta(issuable, project)
output = []
if issuable.respond_to?(:work_item_type) && WorkItems::Type::WI_TYPES_WITH_CREATED_HEADER.include?(issuable.work_item_type.base_type)
if issuable.respond_to?(:work_item_type) && WorkItems::Type::WI_TYPES_WITH_CREATED_HEADER.include?(issue_type_for(issuable))
output << content_tag(:span, sprite_icon(issuable.work_item_type.icon_name.to_s, css_class: 'gl-icon gl-vertical-align-middle gl-text-gray-500'), class: 'gl-mr-2', aria: { hidden: 'true' })
output << content_tag(:span, s_('IssuableStatus|%{wi_type} created %{created_at} by ').html_safe % { wi_type: IntegrationsHelper.integration_issue_type(issuable.issue_type), created_at: time_ago_with_tooltip(issuable.created_at) }, class: 'gl-mr-2')
output << content_tag(:span, s_('IssuableStatus|%{wi_type} created %{created_at} by ').html_safe % { wi_type: IntegrationsHelper.integration_issue_type(issue_type_for(issuable)), created_at: time_ago_with_tooltip(issuable.created_at) }, class: 'gl-mr-2')
else
output << content_tag(:span, s_('IssuableStatus|Created %{created_at} by').html_safe % { created_at: time_ago_with_tooltip(issuable.created_at) }, class: 'gl-mr-2')
end
@ -263,7 +263,7 @@ module IssuablesHelper
{
hasClosingMergeRequest: issuable.merge_requests_count(current_user) != 0,
issueType: issuable.issue_type,
issueType: issue_type_for(issuable),
zoomMeetingUrl: ZoomMeeting.canonical_meeting_url(issuable),
sentryIssueIdentifier: SentryIssue.find_by(issue: issuable)&.sentry_issue_identifier, # rubocop:disable CodeReuse/ActiveRecord
iid: issuable.iid.to_s,
@ -329,7 +329,7 @@ module IssuablesHelper
def issuable_display_type(issuable)
case issuable
when Issue
issuable.issue_type.downcase
issue_type_for(issuable).downcase
when MergeRequest
issuable.model_name.human.downcase
end
@ -388,7 +388,7 @@ module IssuablesHelper
def issuable_type_selector_data(issuable)
{
selected_type: issuable.issue_type,
selected_type: issue_type_for(issuable),
is_issue_allowed: create_issue_type_allowed?(@project, :issue).to_s,
is_incident_allowed: create_issue_type_allowed?(@project, :incident).to_s,
issue_path: new_project_issue_path(@project),

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
module IssueTypeHelper
def issue_type_for(issue)
return if issue.blank?
if Feature.enabled?(:issue_type_uses_work_item_types_table)
issue.work_item_type.base_type
else
issue.issue_type
end
end
end

View File

@ -76,7 +76,9 @@ module TodosHelper
elsif todo.member_access_requested?
_('Group')
elsif todo.for_issue_or_work_item?
IntegrationsHelper.integration_issue_type(todo.target.issue_type)
IntegrationsHelper.integration_issue_type(
issue_type_for(todo.target)
)
else
IntegrationsHelper.integration_todo_target_type(todo.target_type)
end

View File

@ -17,6 +17,7 @@ module Issues
end
@issue = model_klass.new(issue_params.merge(container_param)).tap do |issue|
set_work_item_type(issue)
initialize_callbacks!(issue) if initialize_callbacks
end
end
@ -74,6 +75,26 @@ module Issues
private
def set_work_item_type(issue)
work_item_type = if params[:work_item_type_id].present?
params.delete(:work_item_type)
WorkItems::Type.find_by(id: params.delete(:work_item_type_id)) # rubocop: disable CodeReuse/ActiveRecord
else
params.delete(:work_item_type)
end
base_type = work_item_type&.base_type
if create_issue_type_allowed?(container, base_type)
issue.work_item_type = work_item_type
# Up to this point issue_type might be set to the default, so we need to sync if a work item type is provided
issue.issue_type = work_item_type.base_type
end
# If no work item type was provided, we need to set it to whatever issue_type was up to this point,
# and that includes the column default
issue.work_item_type = WorkItems::Type.default_by_type(issue.issue_type)
end
def model_klass
::Issue
end

View File

@ -27,11 +27,10 @@ module Issues
# We should not initialize the callback classes during the build service execution because these will be
# initialized when we call #create below
@issue = @build_service.execute(initialize_callbacks: false)
set_work_item_type(@issue)
# issue_type is set in BuildService, so we can delete it from params, in later phase
# it can be set also from quick actions - in that case work_item_id is synced later again
params.delete(:issue_type)
# issue_type and work_item_type are set in BuildService, so we can delete it from params, in later phase
# it can be set also from quick actions
[:issue_type, :work_item_type, :work_item_type_id].each { |attribute| params.delete(attribute) }
handle_move_between_ids(@issue)
@ -106,26 +105,6 @@ module Issues
private
def set_work_item_type(issue)
work_item_type = if params[:work_item_type_id].present?
params.delete(:work_item_type)
WorkItems::Type.find_by(id: params.delete(:work_item_type_id)) # rubocop: disable CodeReuse/ActiveRecord
else
params.delete(:work_item_type)
end
base_type = work_item_type&.base_type
if create_issue_type_allowed?(container, base_type)
issue.work_item_type = work_item_type
# Up to this point issue_type might be set to the default, so we need to sync if a work item type is provided
issue.issue_type = work_item_type.base_type
end
# If no work item type was provided, we need to set it to whatever issue_type was up to this point,
# and that includes the column default
issue.work_item_type = WorkItems::Type.default_by_type(issue.issue_type)
end
def authorization_action
:create_issue
end

View File

@ -0,0 +1,29 @@
# frozen_string_literal: true
class EnsureTodosBigintBackfillIsFinishedForGitlabDotCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
restrict_gitlab_migration gitlab_schema: :gitlab_main
disable_ddl_transaction!
def up
return unless should_run?
ensure_batched_background_migration_is_finished(
job_class_name: 'CopyColumnUsingBackgroundMigrationJob',
table_name: 'todos',
column_name: 'id',
job_arguments: [['note_id'], ['note_id_convert_to_bigint']]
)
end
def down
# no-op
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1,29 @@
# frozen_string_literal: true
class AddIndexTodosNoteIdConvertToBigintForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
disable_ddl_transaction!
TABLE_NAME = :todos
INDEX_NAME = :index_todos_on_note_id_convert_to_bigint
def up
return unless should_run?
# This will replace the existing index_todos_on_note_id
add_concurrent_index TABLE_NAME, :note_id_convert_to_bigint, name: INDEX_NAME
end
def down
return unless should_run?
remove_concurrent_index_by_name(TABLE_NAME, INDEX_NAME)
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1,43 @@
# frozen_string_literal: true
class AddFkOnTodosNoteIdConvertToBigintForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
disable_ddl_transaction!
SOURCE_TABLE_NAME = :todos
TARGET_TABLE_NAME = :notes
FK_NAME = :fk_todos_note_id_convert_to_bigint
def up
return unless should_run?
# This will replace the existing fk_91d1f47b13
# when we swap the integer and bigint columns
add_concurrent_foreign_key SOURCE_TABLE_NAME, TARGET_TABLE_NAME,
column: :note_id_convert_to_bigint,
name: FK_NAME,
on_delete: :cascade,
reverse_lock_order: true,
validate: false
end
def down
return unless should_run?
with_lock_retries do
remove_foreign_key_if_exists(
SOURCE_TABLE_NAME,
TARGET_TABLE_NAME,
name: FK_NAME,
reverse_lock_order: true
)
end
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1,27 @@
# frozen_string_literal: true
class AsyncValidateFkTodosNoteIdConvertToBigintForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
TABLE_NAME = :todos
COLUMN = :note_id_convert_to_bigint
FK_NAME = :fk_todos_note_id_convert_to_bigint
def up
return unless should_run?
prepare_async_foreign_key_validation TABLE_NAME, COLUMN, name: FK_NAME
end
def down
return unless should_run?
unprepare_async_foreign_key_validation TABLE_NAME, COLUMN, name: FK_NAME
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1 @@
440922ff7763edaa21e1ceaa435929f5c181d25bfd712f9f4b67792cc59d58d6

View File

@ -0,0 +1 @@
2bf372259e17947046aa63889975a4051395785dfa27092e55f1e3541984fa74

View File

@ -0,0 +1 @@
108adc46f0e9e05912325e8fbd7d32d35d80257e55c370d782640c06c7737030

View File

@ -0,0 +1 @@
0a8b81bdb20958c543322578cb0955a212319d272338f3064ee8d5a493282c24

View File

@ -32444,6 +32444,8 @@ CREATE INDEX index_todos_on_group_id ON todos USING btree (group_id);
CREATE INDEX index_todos_on_note_id ON todos USING btree (note_id);
CREATE INDEX index_todos_on_note_id_convert_to_bigint ON todos USING btree (note_id_convert_to_bigint);
CREATE INDEX index_todos_on_project_id_and_id ON todos USING btree (project_id, id);
CREATE INDEX index_todos_on_target_type_and_target_id ON todos USING btree (target_type, target_id);
@ -37182,6 +37184,9 @@ ALTER TABLE ONLY timelogs
ALTER TABLE ONLY timelogs
ADD CONSTRAINT fk_timelogs_note_id FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE SET NULL;
ALTER TABLE ONLY todos
ADD CONSTRAINT fk_todos_note_id_convert_to_bigint FOREIGN KEY (note_id_convert_to_bigint) REFERENCES notes(id) ON DELETE CASCADE NOT VALID;
ALTER TABLE ONLY u2f_registrations
ADD CONSTRAINT fk_u2f_registrations_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;

View File

@ -5,26 +5,23 @@ group: Development
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
---
# Contribute to GitLab
# Contribute to GitLab development
Thank you for your interest in contributing to GitLab. This guide details how
to contribute to the development of GitLab in a way that is easy for everyone.
to contribute to the development of GitLab.
For a first-time step-by-step guide to the contribution process for development, see [Tutorial: Make a GitLab contribution](first_contribution.md).
For a first-time step-by-step guide, see [Tutorial: Make a GitLab contribution](first_contribution.md).
For other ways to contribute see our [Contributing to GitLab](https://about.gitlab.com/community/contribute/) page.
## How to contribute
Looking for something to work on? See the
[How to contribute](#how-to-contribute) section for more information.
1. Read the code of conduct.
1. Choose or create an issue to work on.
1. Set up the GitLab Development Kit.
1. Open your merge request.
GitLab comes in two flavors:
Your merge request is triaged, reviewed, and can then be incorporated into the product.
- GitLab Community Edition (CE), our free and open source edition.
- GitLab Enterprise Edition (EE), which is our commercial edition.
Throughout this guide you will see references to CE and EE for abbreviation.
## Code of conduct
### Code of conduct
We want to create a welcoming environment for everyone who is interested in contributing.
For more information about our commitment to an open and welcoming environment, see our [Code of Conduct page](https://about.gitlab.com/community/contribute/code-of-conduct/).
@ -32,22 +29,85 @@ For more information about our commitment to an open and welcoming environment,
Issues and merge requests should be in English and contain appropriate language
for audiences of all ages.
## How to contribute
### Choose or create an issue
If you would like to contribute to GitLab:
If you know what you're going to work on, see if an issue exists. If it doesn't,
open a [new issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new?issue%5Bmilestone_id%5D=).
Select the appropriate template, and add all the necessary information about the work you are planning on doing.
That way you can get more guidance and support from GitLab team members.
- Issues with the
[`~Seeking community contributions` label](../labels/index.md#label-for-community-contributors)
are a great place to start.
- Optimizing our tests is another great opportunity to contribute. You can use
[RSpec profiling statistics](https://gitlab-org.gitlab.io/rspec_profiling_stats/) to identify
slowest tests. These tests are good candidates for improving and checking if any of
[best practices](../testing_guide/best_practices.md)
could speed them up.
If you're not sure what to work on, you can:
For a walkthrough of the contribution process, see [Tutorial: Make a GitLab contribution](first_contribution.md).
- View issues with the
[`~Seeking community contributions` label](../labels/index.md#label-for-community-contributors).
- Optimize tests. Use [RSpec profiling statistics](https://gitlab-org.gitlab.io/rspec_profiling_stats/)
to identify the slowest tests. These tests are good candidates for improving and checking if any
[best practices](../testing_guide/best_practices.md) can speed them up.
### Review process
When you find an issue, leave a comment on the issue you want to work on.
This helps the GitLab team and members of the wider GitLab community know that you will be working on that issue.
For details, see [the issues workflow](issue_workflow.md).
### Set up the GitLab Development Kit
To write and test your code, you will use the GitLab Development Kit.
1. [Request access](https://gitlab.com/gitlab-community/meta#request-access-to-community-forks) to the [GitLab Community fork](https://gitlab.com/gitlab-community/meta). Alternatively, you can create your own public fork, but will miss out on the [benefits of the community forks](https://gitlab.com/gitlab-community/meta#why).
1. Some GitLab projects have a detailed contributing guide located in the README or CONTRIBUTING files in the repo. Reviewing these files before setting up your development environment will help ensure you get off to a good start.
1. Do one of the following:
- To run the development environment locally, download and set up the
[GitLab Development Kit](https://gitlab.com/gitlab-org/gitlab-development-kit).
See the [GDK README](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/main/README.md) for setup instructions
and [Troubleshooting](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/troubleshooting.md) if you get stuck.
- GDK is heavy. If you need to build something fast, by trial and error,
consider doing so with an empty rails app and port it to GDK after.
- To run a pre-configured GDK instance in the cloud, use [GDK with Gitpod](../../integration/gitpod.md).
From a project's repository, select the caret (angle-down) next to **Web IDE**,
and select **Gitpod** from the list.
1. If you want to contribute to the [website](https://about.gitlab.com/) or the [handbook](https://about.gitlab.com/handbook/),
go to the footer of any page and select **Edit in Web IDE** to open the [Web IDE](../../user/project/web_ide/index.md).
### Open a merge request
Now [Open a merge request](../../user/project/merge_requests/creating_merge_requests.md)
to merge your code and its documentation. The earlier you open a merge request, the sooner
you can get feedback. You can [mark it as a draft](../../user/project/merge_requests/drafts.md)
to signal that youre not done yet.
1. In the merge request, fill out all the information requested in the template,
like why you are introducing these changes and a link to the issue this merge request is attempting to close/fix.
1. [Add tests if needed](../testing_guide/best_practices.md), as well as [a changelog entry](../changelog.md).
1. If the change impacts users or admins, [update the documentation](../documentation/index.md).
For details, see the [merge request workflow](merge_request_workflow.md).
#### How community merge requests are triaged
1. When you create a merge request, the [`@gitlab-bot`](https://gitlab.com/gitlab-bot) automatically applies
the ["~Community contribution"](https://about.gitlab.com/handbook/engineering/quality/triage-operations/#ensure-quick-feedback-for-community-contributions) label.
1. In the 24-48 hours after you create the merge request, a
[Merge Request Coach](https://about.gitlab.com/handbook/marketing/community-relations/contributor-success/merge-request-coach-lifecycle.html)
will review your merge request and apply stage, group, and type labels.
1. If a merge request was not automatically assigned, ask for a review by typing `@gitlab-bot ready` in a comment.
If your code has not been assigned a reviewer within two working days of its initial submission, you can ask
for help with `@gitlab-bot help`.
1. The Merge Request Coach will assign the relevant reviewers or tackle the review themselves if possible.
The goal is to have a merge request reviewed within a week after a reviewer is assigned. At times this may take longer due to high workload, holidays, or other reasons.
If you need to, look at the [team page](https://about.gitlab.com/company/team/) for the merge request coach who specializes in
the type of code you have written and mention them in the merge request. For example, if you have
written some front-end code, you should mention the frontend merge request coach. If
your code has multiple disciplines, you can mention multiple merge request coaches.
For details about timelines and how you can request help or escalate a merge request,
see the [Wider Community Merge Request guide](https://about.gitlab.com/handbook/engineering/quality/merge-request-triage/).
After your merge request is reviewed and merged, your changes will be deployed to GitLab.com and included in the next release!
#### Review process
When you submit code to GitLab, we really want it to get merged! However, we always review
submissions carefully, and this takes time. Code submissions will usually be reviewed by two
@ -79,50 +139,31 @@ Lastly, keep the following in mind when submitting merge requests:
be merged, as well as some guidance. The maintainers will be open to discussion about how to change
the code so it can be approved and merged in the future.
### Getting attention on your merge request
GitLab will do its best to review community contributions as quickly as possible. Specially
appointed developers review community contributions daily. Look at the
[team page](https://about.gitlab.com/company/team/) for the merge request coach who specializes in
the type of code you have written and mention them in the merge request. For example, if you have
written some front-end code, you should mention the frontend merge request coach. If
your code has multiple disciplines, you may mention multiple merge request coaches.
GitLab receives a lot of community contributions. If your code has not been reviewed within two
working days of its initial submission, you can ask for help with `@gitlab-bot help`.
#### Issues workflow
This [documentation](issue_workflow.md) outlines the current issue workflow:
- [Issue triaging](issue_workflow.md#issue-triaging)
- [Labels](../labels/index.md)
- [Feature proposals](issue_workflow.md#feature-proposals)
- [Issue weight](issue_workflow.md#issue-weight)
- [Regression issues](issue_workflow.md#regression-issues)
- [Technical and UX debt](../labels/index.md#technical-and-ux-debt)
- [Technical debt in follow-up issues](issue_workflow.md#technical-debt-in-follow-up-issues)
### Merge requests workflow
This [documentation](merge_request_workflow.md) outlines the current merge request process.
- [Merge request guidelines](merge_request_workflow.md#merge-request-guidelines-for-contributors)
- [Contribution acceptance criteria](merge_request_workflow.md#contribution-acceptance-criteria)
- [Definition of done](merge_request_workflow.md#definition-of-done)
- [Dependencies](merge_request_workflow.md#dependencies)
## Closing policy for issues and merge requests
- For the criteria for closing issues, see [the Issue Triage handbook page](https://about.gitlab.com/handbook/engineering/quality/issue-triage/#outdated-issues).
- For the criteria for closing merge requests, see [the Merge Request Workflow](merge_request_workflow.md).
## Getting an Enterprise Edition License
## Getting an Enterprise Edition license
GitLab has two development platforms:
- GitLab Community Edition (CE), our free and open source edition.
- GitLab Enterprise Edition (EE), which is our commercial edition.
If you need a license for contributing to an EE-feature, see
[relevant information](https://about.gitlab.com/handbook/marketing/community-relations/contributor-success/community-contributors-workflows.html#contributing-to-the-gitlab-enterprise-edition-ee).
## Finding help
## Get help
- [Get help](https://about.gitlab.com/get-help/).
- Join the community-run [Discord server](https://discord.gg/gitlab) and find other contributors in the `#contribute` channel.
If you need any help while contributing to GitLab:
- If you need help with a merge request or need help finding a reviewer:
- Don't hesitate to ask for help by typing `@gitlab-bot help` in a comment.
- Find reviewers and maintainers of GitLab projects in our
[handbook](https://about.gitlab.com/handbook/engineering/projects/) and
[mention](../../user/group/subgroups/index.md#mention-subgroups) them in a comment.
- Join the community on the [GitLab Community Discord](https://discord.gg/gitlab) and find other
contributors in the `#contribute` channel or [initiate a mentor session](https://about.gitlab.com//community/contribute/mentor-sessions/).
- For any other questions or feedback, email `contributors@gitlab.com`.
- Did you run out of compute credits for your GitLab merge requests? Join the [GitLab community forks](https://gitlab.com/gitlab-community/meta) project.

View File

@ -242,6 +242,10 @@ Continuing the above example, the migration would look like:
class BackfillPartitionAuditEvents < Gitlab::Database::Migration[2.1]
include Gitlab::Database::PartitioningMigrationHelpers
disable_ddl_transaction!
restrict_gitlab_migration gitlab_schema: :gitlab_main
def up
enqueue_partitioning_data_migration :audit_events
end
@ -252,17 +256,12 @@ class BackfillPartitionAuditEvents < Gitlab::Database::Migration[2.1]
end
```
This step uses the same mechanism as any background migration, so you
may want to read the [Background Migration](background_migrations.md)
guide for details on that process. Background jobs are scheduled every
2 minutes and copy `50_000` records at a time, which can be used to
estimate the timing of the background migration portion of the
partitioning migration.
This step [queues a batched background migration](batched_background_migrations.md#queueing) internally with BATCH_SIZE and SUB_BATCH_SIZE as `50,000` and `2,500`. Refer [Batched Background migrations guide](batched_background_migrations.md) for more details.
### Step 3: Post-backfill cleanup (Release N+1)
The third step must occur at least one release after the release that
includes the background migration. This gives time for the background
This step must occur at least one release after the release that
includes step (2). This gives time for the background
migration to execute properly in self-managed installations. In this step,
add another post-deployment migration that cleans up after the
background migration. This includes forcing any remaining jobs to
@ -275,6 +274,10 @@ Once again, continuing the example, this migration would look like:
class CleanupPartitionedAuditEventsBackfill < Gitlab::Database::Migration[2.1]
include Gitlab::Database::PartitioningMigrationHelpers
disable_ddl_transaction!
restrict_gitlab_migration gitlab_schema: :gitlab_main
def up
finalize_backfilling_partitioned_table :audit_events
end
@ -285,16 +288,45 @@ class CleanupPartitionedAuditEventsBackfill < Gitlab::Database::Migration[2.1]
end
```
After this migration has completed, the original table and partitioned
After this migration completes, the original table and partitioned
table should contain identical data. The trigger installed on the
original table guarantees that the data remains in sync going forward.
### Step 4: Swap the partitioned and non-partitioned tables (Release N+1)
The final step of the migration makes the partitioned table ready
for use by the application. This section will be updated when the
migration helper is ready, for now development can be followed in the
[Tracking Issue](https://gitlab.com/gitlab-org/gitlab/-/issues/241267).
This step replaces the non-partitioned table with its partitioned copy, this should be used only after all other migration steps have completed successfully.
Some limitations to this method MUST be handled before, or during, the swap migration:
- Secondary indexes and foreign keys are not automatically recreated on the partitioned table.
- Some types of constraints (UNIQUE and EXCLUDE) which rely on indexes, are not automatically recreated
on the partitioned table, since the underlying index will not be present.
- Foreign keys referencing the original non-partitioned table should be updated to reference the
partitioned table. This is not supported in PostgreSQL 11.
- Views referencing the original table are not automatically updated to reference the partitioned table.
```ruby
# frozen_string_literal: true
class SwapPartitionedAuditEvents < ActiveRecord::Migration[6.0]
include Gitlab::Database::PartitioningMigrationHelpers
def up
replace_with_partitioned_table :audit_events
end
def down
rollback_replace_with_partitioned_table :audit_events
end
end
```
After this migration completes:
- The partitioned table replaces the non-partitioned (original) table.
- The sync trigger created earlier is dropped.
The partitioned table is now ready for use by the application.
## Partitioning a table (Hash)

View File

@ -6,7 +6,7 @@ info: "See the Technical Writers assigned to Development Guidelines: https://abo
description: "Development Guidelines: learn how to contribute to GitLab."
---
# Contribute to the development of GitLab
# Contribute to development
Learn how to contribute to the development of the GitLab product.

View File

@ -75,7 +75,7 @@ Configuring both the client and the server is unnecessary.
```
- On Windows, if you are using PuTTY, go to your session properties, then
navigate to "Connection" and under "Sending of null packets to keep
go to "Connection" and under "Sending of null packets to keep
session active", set `Seconds between keepalives (0 to turn off)` to `60`.
**To configure SSH on the server side**, edit `/etc/ssh/sshd_config` and add:
@ -186,7 +186,7 @@ fatal: early EOF
fatal: index-pack failed
```
This is a common problem with Git itself, due to its inability to handle large files or large quantities of files.
This problem is common in Git itself, due to its inability to handle large files or large quantities of files.
[Git LFS](https://about.gitlab.com/blog/2017/01/30/getting-started-with-git-lfs-tutorial/) was created to work around this problem; however, even it has limitations. It's usually due to one of these reasons:
- The number of files in the repository.
@ -288,3 +288,105 @@ The bug was reported [in this issue](https://gitlab.com/gitlab-org/gitlab/-/issu
If you receive an `HTTP Basic: Access denied` error when using Git over HTTP(S),
refer to the [two-factor authentication troubleshooting guide](../../user/profile/account/two_factor_authentication.md#troubleshooting).
## `401` errors logged during successful `git clone`
When cloning a repository via HTTP, the
[`production_json.log`](../../administration/logs/index.md#production_jsonlog) file
may show an initial status of `401` (unauthorized), quickly followed by a `200`.
```json
{
"method":"GET",
"path":"/group/project.git/info/refs",
"format":"*/*",
"controller":"Repositories::GitHttpController",
"action":"info_refs",
"status":401,
"time":"2023-04-18T22:55:15.371Z",
"remote_ip":"x.x.x.x",
"ua":"git/2.39.2",
"correlation_id":"01GYB98MBM28T981DJDGAD98WZ",
"duration_s":0.03585
}
{
"method":"GET",
"path":"/group/project.git/info/refs",
"format":"*/*",
"controller":"Repositories::GitHttpController",
"action":"info_refs",
"status":200,
"time":"2023-04-18T22:55:15.714Z",
"remote_ip":"x.x.x.x",
"user_id":1,
"username":"root",
"ua":"git/2.39.2",
"correlation_id":"01GYB98MJ0CA3G9K8WDH7HWMQX",
"duration_s":0.17111
}
```
You should expect this initial `401` log entry for each Git operation performed over HTTP,
due to how [HTTP Basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) works.
When the Git client initiates a clone, the initial request sent to GitLab does not provide
any authentication details. GitLab returns a `401 Unauthorized` result for that request.
A few milliseconds later, the Git client sends a follow-up request containing authentication
details. This second request should succeed, and result in a `200 OK` log entry.
If a `401` log entry lacks a corresponding `200` log entry, the Git client is likely using either:
- An incorrect password.
- An expired or revoked token.an incorrect
If not rectified, you could encounter
[`403` (Forbidden) errors](#403-error-when-performing-git-operations-over-http)
instead.
## `403` error when performing Git operations over HTTP
When performing Git operations over HTTP, a `403` (Forbidden) error indicates that
your IP address has been blocked by the failed-authentication ban:
```plaintext
fatal: unable to access 'https://gitlab.com/group/project.git/': The requested URL returned error: 403
```
The `403` can be seen in the [`production_json.log`](../../administration/logs/index.md#production_jsonlog):
```json
{
"method":"GET",
"path":"/group/project.git/info/refs",
"format":"*/*",
"controller":"Repositories::GitHttpController",
"action":"info_refs",
"status":403,
"time":"2023-04-19T22:14:25.894Z",
"remote_ip":"x.x.x.x",
"user_id":1,
"username":"root",
"ua":"git/2.39.2",
"correlation_id":"01GYDSAKAN2SPZPAMJNRWW5H8S",
"duration_s":0.00875
}
```
If your IP address has been blocked, a corresponding log entry exists in the
[`auth_json.log`](../../administration/logs/index.md#auth_jsonlog):
```json
{
"severity":"ERROR",
"time":"2023-04-19T22:14:25.893Z",
"correlation_id":"01GYDSAKAN2SPZPAMJNRWW5H8S",
"message":"Rack_Attack",
"env":"blocklist",
"remote_ip":"x.x.x.x",
"request_method":"GET",
"path":"/group/project.git/info/refs?service=git-upload-pack"}
```
The failed authentication ban limits differ depending if you are using a
[self-managed instance](../../security/rate_limits.md#failed-authentication-ban-for-git-and-container-registry)
or [GitLab.com](../../user/gitlab_com/index.md#ip-blocks).

View File

@ -31,9 +31,12 @@ module Gitlab
end
def self.log_signal(signal, migration)
Gitlab::AppLogger.info(
message: "#{migration} signaled: #{signal}",
migration_id: migration.id
Gitlab::BackgroundMigration::Logger.info(
migration_id: migration.id,
health_status_indicator: signal.indicator_class.to_s,
indicator_signal: signal.short_name,
signal_reason: signal.reason,
message: "#{migration} signaled: #{signal}"
)
end
end

View File

@ -28,8 +28,6 @@ module Gitlab
end
# :nocov:
private
def short_name
self.class.name.demodulize
end

View File

@ -100,3 +100,6 @@ Gitlab::SubscriptionPortal::PAYMENT_VALIDATION_FORM_ID = Gitlab::SubscriptionPor
Gitlab::SubscriptionPortal::RENEWAL_SERVICE_EMAIL = Gitlab::SubscriptionPortal.renewal_service_email.freeze
Gitlab::SubscriptionPortal::REGISTRATION_VALIDATION_FORM_URL = Gitlab::SubscriptionPortal.registration_validation_form_url.freeze
Gitlab::SubscriptionPortal::REGISTRATION_VALIDATION_FORM_ID = Gitlab::SubscriptionPortal.registration_validation_form_id.freeze
Gitlab::SubscriptionPortal::SUBSCRIPTION_PORTAL_ADMIN_EMAIL = Gitlab::SubscriptionPortal.subscription_portal_admin_email.freeze
Gitlab::SubscriptionPortal::SUBSCRIPTION_PORTAL_ADMIN_TOKEN = Gitlab::SubscriptionPortal.subscription_portal_admin_token.freeze
Gitlab::SubscriptionPortal::SUBSCRIPTIONS_MANAGE_URL = ::Gitlab::SubscriptionPortal.subscriptions_manage_url.freeze

View File

@ -13213,6 +13213,9 @@ msgstr ""
msgid "DORA4Metrics|Something went wrong while getting time to restore service data."
msgstr ""
msgid "DORA4Metrics|The Value Streams Dashboard allows all stakeholders from executives to individual contributors to identify trends, patterns, and opportunities for software development improvements."
msgstr ""
msgid "DORA4Metrics|The chart displays the frequency of deployments to production environment(s) that are based on the %{linkStart}deployment_tier%{linkEnd} value."
msgstr ""
@ -13228,6 +13231,9 @@ msgstr ""
msgid "DORA4Metrics|Time to restore service (median days)"
msgstr ""
msgid "DORA4Metrics|Value Streams Dashboard"
msgstr ""
msgid "DSN"
msgstr ""
@ -15194,9 +15200,6 @@ msgstr ""
msgid "DevopsAdoption|You cannot remove the group you are currently in."
msgstr ""
msgid "DevopsMetricsDashboard|%{strongStart}Beta feature:%{strongEnd} Leave your thoughts in the %{linkStart}feedback issue%{linkEnd}."
msgstr ""
msgid "DevopsReport|DevOps Score"
msgstr ""
@ -48326,9 +48329,6 @@ msgstr ""
msgid "Value Stream Analytics can help you determine your teams velocity"
msgstr ""
msgid "Value Streams Dashboard (Beta)"
msgstr ""
msgid "Value Streams Dashboard | DORA"
msgstr ""

View File

@ -56,8 +56,8 @@
"@gitlab/cluster-client": "^1.2.0",
"@gitlab/favicon-overlay": "2.0.0",
"@gitlab/fonts": "^1.2.0",
"@gitlab/svgs": "3.38.0",
"@gitlab/ui": "60.1.0",
"@gitlab/svgs": "3.40.0",
"@gitlab/ui": "60.2.0",
"@gitlab/visual-review-tools": "1.7.3",
"@gitlab/web-ide": "0.0.1-dev-20230418150125",
"@mattiasbuelens/web-streams-adapter": "^0.1.0",

View File

@ -5,9 +5,9 @@ import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper';
import waitForPromises from 'helpers/wait_for_promises';
import JobsTable from '~/jobs/components/table/jobs_table.vue';
import JobsTableTabs from '~/jobs/components/table/jobs_table_tabs.vue';
import getJobsQuery from '~/pages/admin/jobs/components/table/graphql/queries/get_all_jobs.query.graphql';
import AdminJobsTableApp from '~/pages/admin/jobs/components/table/admin_jobs_table_app.vue';
import JobsTableTabs from '~/jobs/components/table/jobs_table_tabs.vue';
import JobsSkeletonLoader from '~/pages/admin/jobs/components/jobs_skeleton_loader.vue';
import {
@ -87,6 +87,16 @@ describe('Job table app', () => {
expect(findSkeletonLoader().exists()).toBe(false);
expect(findLoadingSpinner().exists()).toBe(false);
});
it('should refetch jobs query on fetchJobsByStatus event', async () => {
jest.spyOn(wrapper.vm.$apollo.queries.jobs, 'refetch').mockImplementation(jest.fn());
expect(wrapper.vm.$apollo.queries.jobs.refetch).toHaveBeenCalledTimes(0);
await findTabs().vm.$emit('fetchJobsByStatus');
expect(wrapper.vm.$apollo.queries.jobs.refetch).toHaveBeenCalledTimes(1);
});
});
describe('empty state', () => {

View File

@ -151,7 +151,9 @@ describe('MrWidgetOptions', () => {
return createComponent();
});
describe('data', () => {
// https://gitlab.com/gitlab-org/gitlab/-/issues/385238
// eslint-disable-next-line jest/no-disabled-tests
describe.skip('data', () => {
it('should instantiate Store and Service', () => {
expect(wrapper.vm.mr).toBeDefined();
expect(wrapper.vm.service).toBeDefined();

View File

@ -0,0 +1,36 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe IssueTypeHelper, feature_category: :team_planning do
describe '.issue_type_for' do
let(:input_issue_type) { :incident }
let(:issue) { build(:issue, input_issue_type) }
subject(:issue_type) { helper.issue_type_for(issue) }
context 'when issue is nil' do
let(:issue) { nil }
it { is_expected.to be_nil }
end
context 'when issue_type_uses_work_item_types_table feature flag is enabled' do
it 'gets type from the work_item_types table' do
expect(issue).to receive(:work_item_type).and_call_original
expect(issue_type).to eq(input_issue_type.to_s)
end
end
context 'when issue_type_uses_work_item_types_table feature flag is disabled' do
before do
stub_feature_flags(issue_type_uses_work_item_types_table: false)
end
it 'gets type from the issue_type column' do
expect(issue).to receive(:issue_type).and_call_original
expect(issue_type).to eq(input_issue_type.to_s)
end
end
end
end

View File

@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Gitlab::Database::BackgroundMigration::HealthStatus do
RSpec.describe Gitlab::Database::BackgroundMigration::HealthStatus, feature_category: :database do
let(:connection) { Gitlab::Database.database_base_models[:main].connection }
around do |example|
@ -55,10 +55,23 @@ RSpec.describe Gitlab::Database::BackgroundMigration::HealthStatus do
end
it 'logs interesting signals' do
signal = instance_double("#{health_status}::Signals::Stop", log_info?: true)
signal = instance_double(
"#{health_status}::Signals::Stop",
log_info?: true,
indicator_class: autovacuum_indicator_class,
short_name: 'Stop',
reason: 'Test Exception'
)
expect(autovacuum_indicator).to receive(:evaluate).and_return(signal)
expect(described_class).to receive(:log_signal).with(signal, migration)
expect(Gitlab::BackgroundMigration::Logger).to receive(:info).with(
migration_id: migration.id,
health_status_indicator: autovacuum_indicator_class.to_s,
indicator_signal: 'Stop',
signal_reason: 'Test Exception',
message: "#{migration} signaled: #{signal}"
)
evaluate
end

View File

@ -0,0 +1,35 @@
# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe EnsureTodosBigintBackfillIsFinishedForGitlabDotCom, feature_category: :database do
describe '#up' do
let(:migration_arguments) do
{
job_class_name: 'CopyColumnUsingBackgroundMigrationJob',
table_name: 'todos',
column_name: 'id',
job_arguments: [['note_id'], ['note_id_convert_to_bigint']]
}
end
it 'ensures the migration is completed for GitLab.com, dev, or test' do
expect_next_instance_of(described_class) do |instance|
expect(instance).to receive(:com_or_dev_or_test_but_not_jh?).and_return(true)
expect(instance).to receive(:ensure_batched_background_migration_is_finished).with(migration_arguments)
end
migrate!
end
it 'skips the check for other instances' do
expect_next_instance_of(described_class) do |instance|
expect(instance).to receive(:com_or_dev_or_test_but_not_jh?).and_return(false)
expect(instance).not_to receive(:ensure_batched_background_migration_is_finished)
end
migrate!
end
end
end

View File

@ -172,5 +172,37 @@ RSpec.describe Issues::BuildService, feature_category: :team_planning do
end
end
end
describe 'setting issue type' do
context 'with a corresponding WorkItems::Type' do
let_it_be(:type_issue_id) { WorkItems::Type.default_issue_type.id }
let_it_be(:type_incident_id) { WorkItems::Type.default_by_type(:incident).id }
where(:issue_type, :current_user, :work_item_type_id, :resulting_issue_type) do
nil | ref(:guest) | ref(:type_issue_id) | 'issue'
'issue' | ref(:guest) | ref(:type_issue_id) | 'issue'
'incident' | ref(:guest) | ref(:type_issue_id) | 'issue'
'incident' | ref(:reporter) | ref(:type_incident_id) | 'incident'
# update once support for test_case is enabled
'test_case' | ref(:guest) | ref(:type_issue_id) | 'issue'
# update once support for requirement is enabled
'requirement' | ref(:guest) | ref(:type_issue_id) | 'issue'
'invalid' | ref(:guest) | ref(:type_issue_id) | 'issue'
# ensure that we don't set a value which has a permission check but is an invalid issue type
'project' | ref(:guest) | ref(:type_issue_id) | 'issue'
end
with_them do
let(:user) { current_user }
it 'builds an issue' do
issue = build_issue(issue_type: issue_type)
expect(issue.issue_type).to eq(resulting_issue_type)
expect(issue.work_item_type_id).to eq(work_item_type_id)
end
end
end
end
end
end

View File

@ -858,49 +858,5 @@ RSpec.describe Issues::CreateService, feature_category: :team_planning do
subject.execute
end
end
describe 'setting issue type' do
using RSpec::Parameterized::TableSyntax
let_it_be(:guest) { user.tap { |u| project.add_guest(u) } }
let_it_be(:reporter) { assignee.tap { |u| project.add_reporter(u) } }
context 'with a corresponding WorkItems::Type' do
let_it_be(:type_issue_id) { WorkItems::Type.default_issue_type.id }
let_it_be(:type_incident_id) { WorkItems::Type.default_by_type(:incident).id }
where(:issue_type, :current_user, :work_item_type_id, :resulting_issue_type) do
nil | ref(:guest) | ref(:type_issue_id) | 'issue'
'issue' | ref(:guest) | ref(:type_issue_id) | 'issue'
'incident' | ref(:guest) | ref(:type_issue_id) | 'issue'
'incident' | ref(:reporter) | ref(:type_incident_id) | 'incident'
# update once support for test_case is enabled
'test_case' | ref(:guest) | ref(:type_issue_id) | 'issue'
# update once support for requirement is enabled
'requirement' | ref(:guest) | ref(:type_issue_id) | 'issue'
'invalid' | ref(:guest) | ref(:type_issue_id) | 'issue'
# ensure that we don't set a value which has a permission check but is an invalid issue type
'project' | ref(:guest) | ref(:type_issue_id) | 'issue'
end
with_them do
let(:user) { current_user }
let(:params) { { title: 'title', issue_type: issue_type } }
let(:issue) do
described_class.new(
container: project,
current_user: user,
params: params,
spam_params: spam_params
).execute[:issue]
end
it 'creates an issue' do
expect(issue.issue_type).to eq(resulting_issue_type)
expect(issue.work_item_type_id).to eq(work_item_type_id)
end
end
end
end
end
end

View File

@ -1110,15 +1110,15 @@
stylelint-declaration-strict-value "1.8.0"
stylelint-scss "4.2.0"
"@gitlab/svgs@3.38.0":
version "3.38.0"
resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-3.38.0.tgz#5c316bc139b3017eea92bb8d603c7ff26fa9ddb7"
integrity sha512-yDkZnuYDQlBB7Eb7noSHGlNpZE6KgM6kX2zB0bmGdHBY2w4wbnjgCR8INYFblH19QGlIToxoW3rOL9iobu4Puw==
"@gitlab/svgs@3.40.0":
version "3.40.0"
resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-3.40.0.tgz#f1ebb2fcdbb1181550d53f0db827eca1f5060af0"
integrity sha512-9CVkIbV0VnIFfVBjWcW8+nHzpMhHhC73C9mGPEktEPfpEbaaRws2UywgDEH+C2B8Ba1QdBo/aFr68RDu2VwvfA==
"@gitlab/ui@60.1.0":
version "60.1.0"
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-60.1.0.tgz#cbdbf5456297a7446d9b2d188be256a76324b756"
integrity sha512-dA6fogo1o+hgQ4rBcbKB46unOAJtMDJ51dCzdG9W7M/dqqNAxtSw7wI4EWoRbqcsaQnSuxTCV+YjpihwcPJL5g==
"@gitlab/ui@60.2.0":
version "60.2.0"
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-60.2.0.tgz#d3c8c6f6cb9f8209ad4ca1f4e530810e04440285"
integrity sha512-AvVYA49B1InCtq+on3Zgu7+I2GX5iA320qjrrK5h7bUcq1Gywxrq28+GZrkIV7eicC05slReWRGqebwpsqrrOg==
dependencies:
"@popperjs/core" "^2.11.2"
bootstrap-vue "2.23.1"