Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-01-25 00:11:49 +00:00
parent 8e73c80c68
commit 706338ea16
86 changed files with 222 additions and 209 deletions

View file

@ -247,30 +247,6 @@ $gl-line-height-42: px-to-rem(42px);
max-width: 50%;
}
// Will be moved to @gitlab/ui by https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1490
.gl-w-grid-size-28 {
width: $grid-size * 28;
}
// Will be removed after https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2347 is merged
.gl-min-w-8 {
min-width: $gl-spacing-scale-8;
}
// Will be removed after https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2347 is merged
.gl-min-w-10 {
min-width: $gl-spacing-scale-10;
}
// Will both be moved to @gitlab/ui by https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1526
.gl-opacity-6 {
opacity: 0.6;
}
.gl-opacity-7 {
opacity: 0.7;
}
/**
Note: ::-webkit-scrollbar is a non-standard rule only
supported by webkit browsers.

View file

@ -11,10 +11,7 @@
.gl-alert-body
- docs_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('user/group/import/index.md') }
- link_end = '</a>'.html_safe
= s_('GroupsNew|This feature is deprecated and replaced by %{docs_link_start}Group Migration%{docs_link_end}.').html_safe % { docs_link_start: docs_link_start, docs_link_end: link_end }
- if Feature.enabled?(:bulk_import, default_enabled: :yaml)
- enable_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('user/group/import/index.md', anchor: 'enable-or-disable-gitlab-group-migration') }
= s_('GroupsNew|Ask your administrator to %{enable_link_start}enable%{enable_link_end} Group Migration.').html_safe % { enable_link_start: enable_link_start, enable_link_end: link_end }
= s_('GroupsNew|This feature is deprecated and replaced by %{docs_link_start}group migration%{docs_link_end}.').html_safe % { docs_link_start: docs_link_start, docs_link_end: link_end }
.form-group.gl-display-flex.gl-flex-direction-column.gl-mt-5
= f.label :name, _('New group name'), for: 'import_group_name'

View file

@ -10,7 +10,7 @@
.gl-alert-body
- docs_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('user/group/import/index.md') }
- docs_link_end = '</a>'.html_safe
= s_('GroupsNew|This feature is deprecated and replaced by %{docs_link_start}Group Migration%{docs_link_end}.').html_safe % { docs_link_start: docs_link_start, docs_link_end: docs_link_end }
= s_('GroupsNew|This feature is deprecated and replaced by %{docs_link_start}group migration%{docs_link_end}.').html_safe % { docs_link_start: docs_link_start, docs_link_end: docs_link_end }
%p
- export_information = _('After the export is complete, download the data file from a notification email or from this page. You can then import the data file from the %{strong_text_start}Create new group%{strong_text_end} page of another GitLab instance.') % { strong_text_start: '<strong>'.html_safe, strong_text_end: '</strong>'.html_safe}
= export_information.html_safe

View file

@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/349755
milestone: '14.7'
type: development
group: group::analyzer frontend
default_enabled: true
default_enabled: false

View file

@ -0,0 +1,15 @@
# frozen_string_literal: true
class RemoveIndexClusterAgentTokensOnAgentIdAndLastUsedAt < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
INDEX = 'index_cluster_agent_tokens_on_agent_id_and_last_used_at'
def up
remove_concurrent_index_by_name :cluster_agent_tokens, name: INDEX
end
def down
add_concurrent_index :cluster_agent_tokens, 'agent_id, last_used_at DESC NULLS LAST', name: INDEX
end
end

View file

@ -0,0 +1 @@
afc54500374602edcdc4fce5acf3673b84882da1afbb5598a6684a5ef480a2d7

View file

@ -25791,8 +25791,6 @@ CREATE INDEX index_ci_variables_on_key ON ci_variables USING btree (key);
CREATE UNIQUE INDEX index_ci_variables_on_project_id_and_key_and_environment_scope ON ci_variables USING btree (project_id, key, environment_scope);
CREATE INDEX index_cluster_agent_tokens_on_agent_id_and_last_used_at ON cluster_agent_tokens USING btree (agent_id, last_used_at DESC NULLS LAST);
CREATE INDEX index_cluster_agent_tokens_on_agent_id_status_last_used_at ON cluster_agent_tokens USING btree (agent_id, status, last_used_at DESC NULLS LAST);
CREATE INDEX index_cluster_agent_tokens_on_created_by_user_id ON cluster_agent_tokens USING btree (created_by_user_id);

View file

@ -18,7 +18,7 @@ With the Project Relations Export API, you can partially export project structur
similar to [project export](project_import_export.md),
but it exports each top-level relation (for example, milestones/boards/labels) as a separate file
instead of one archive. The project relations export API is primarily used in
[group migration](../user/group/import/index.md#enable-or-disable-gitlab-group-migration)
[group migration](../user/group/import/index.md)
to support group project import.
## Schedule new export

View file

@ -10,20 +10,81 @@ info: To determine the technical writer assigned to the Stage/Group associated w
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/249160) in GitLab 13.7 [with a flag](../../feature_flags.md) named `bulk_import`. Disabled by default.
> - [Enabled on GitLab.com and self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/338985) in GitLab 14.3.
FLAG:
On self-managed GitLab, by default this feature is available. To hide the feature, ask an administrator to [disable the feature flag](../../../administration/feature_flags.md) named `bulk_import`. On GitLab.com, this feature is available.
You can migrate your existing top-level groups to any of the following:
- Another GitLab instance, including GitLab.com.
- Another top-level group.
- The subgroup of any existing top-level group.
Migrating groups is not the same as [group import/export](../settings/import_export.md).
- Group import/export requires you to export a group to a file and then import that file in
another GitLab instance.
- Group migration automates this process.
## Import your groups into GitLab
When you migrate a group, you connect to your GitLab instance and then choose
groups to import. Not all the data is migrated. View the
[Migrated resources](#migrated-resources) list for details.
Leave feedback about group migration in [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/284495).
NOTE:
The importer migrates **only** the group data listed on this page. To leave feedback on this
feature, see [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/284495).
You might need to reconfigure your firewall to prevent blocking the connection on the self-managed
instance.
Using GitLab Group Migration, you can migrate existing top-level groups from GitLab.com or a self-managed instance. Groups can be migrated to a target instance, as a top-level group, or as a subgroup of any existing top-level group.
### Connect to the remote GitLab instance
The following resources are migrated to the target instance:
Before you begin, ensure that the target GitLab instance can communicate with the source over HTTPS
(HTTP is not supported). You might need to reconfigure your firewall to prevent blocking the connection on the self-managed
instance.
Then create the group you want to import into, and connect:
1. Create a new group or subgroup:
- On the top bar, select `+` and then **New group**.
- Or, on an existing group's page, in the top right, select **New subgroup**.
1. Select **Import group**.
1. Enter the source URL of your GitLab instance.
1. Generate or copy a [personal access token](../../../user/profile/personal_access_tokens.md)
with the `api` and `read_repository` scopes on your remote GitLab instance.
1. Enter the [personal access token](../../../user/profile/personal_access_tokens.md) for your remote GitLab instance.
1. Select **Connect instance**.
### Select the groups to import
After you have authorized access to the GitLab instance, you are redirected to the GitLab Group
Migration importer page. The remote groups you have the Owner role for are listed.
1. By default, the proposed group namespaces match the names as they exist in remote instance, but based on your permissions, you can choose to edit these names before you proceed to import any of them.
1. Next to the groups you want to import, select **Import**.
1. The **Status** column shows the import status of each group. If you leave the page open, it updates in real-time.
1. After a group has been imported, select its GitLab path to open its GitLab URL.
![Group Importer page](img/bulk_imports_v14_1.png)
## Automate group and project import **(PREMIUM)**
For information on automating user, group, and project import API calls, see
[Automate group and project import](../../project/import/index.md#automate-group-and-project-import).
## Migrated resources
Only the following resources are migrated to the target instance. Any other items are **not**
migrated:
- Groups ([Introduced](https://gitlab.com/groups/gitlab-org/-/epics/4374) in 13.7)
- description
- attributes
- subgroups
- avatar ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/322904) in 14.0)
- Group Labels ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/292429) in 13.9)
- Group labels ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/292429) in 13.9)
- title
- description
- color
@ -71,67 +132,3 @@ The following resources are migrated to the target instance:
- image URL
- Boards
- Board Lists
Any other items are **not** migrated.
## Enable or disable GitLab Group Migration
GitLab Migration is deployed behind the `bulk_import` feature flag, which is **enabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md)
can disable it.
To disable it:
```ruby
Feature.disable(:bulk_import)
```
To enable it:
```ruby
Feature.enable(:bulk_import)
```
## Import your groups into GitLab
Before you begin, ensure that the target instance of GitLab can communicate with the source
over HTTPS (HTTP is not supported).
NOTE:
This might involve reconfiguring your firewall to prevent blocking connection on the side of self-managed instance.
### Connect to the remote GitLab instance
1. Go to the New Group page:
- On the top bar, select `+` and then **New group**.
- Or, on an existing group's page, in the top right, select **New subgroup**.
![Navigation paths to create a new group](img/new_group_navigation_v13_8.png)
1. On the New Group page, select **Import group**.
![Fill in import details](img/import_panel_v14_1.png)
1. Enter the source URL of your GitLab instance.
1. Generate or copy a [personal access token](../../../user/profile/personal_access_tokens.md)
with the `api` and `read_repository` scopes on your remote GitLab instance.
1. Enter the [personal access token](../../../user/profile/personal_access_tokens.md) for your remote GitLab instance.
1. Select **Connect instance**.
### Selecting which groups to import
After you have authorized access to the GitLab instance, you are redirected to the GitLab Group
Migration importer page. The remote groups you have the Owner role for are listed.
1. By default, the proposed group namespaces match the names as they exist in remote instance, but based on your permissions, you can choose to edit these names before you proceed to import any of them.
1. Next to the groups you want to import, select **Import**.
1. The **Status** column shows the import status of each group. If you leave the page open, it updates in real-time.
1. After a group has been imported, select its GitLab path to open its GitLab URL.
![Group Importer page](img/bulk_imports_v14_1.png)
## Automate group and project import **(PREMIUM)**
For information on automating user, group, and project import API calls, see
[Automate group and project import](../../project/import/index.md#automate-group-and-project-import).

View file

@ -349,6 +349,16 @@ used to access them:
subgroups.
- A project deploy token only has access to packages published to that particular project.
## Troubleshooting
To improve performance, Composer caches files related to a package. Note that Composer doesn't remove data by
itself. The cache grows as new packages are installed. If you encounter issues, clear the cache with
this command:
```shell
composer clearcache
```
## Supported CLI commands
The GitLab Composer repository supports the following Composer CLI commands:

View file

@ -407,6 +407,16 @@ characters are removed.
A `pip install` request for `my.package` looks for packages that match any of
the three characters, such as `my-package`, `my_package`, and `my....package`.
## Troubleshooting
To improve performance, PyPI caches files related to a package. Note that PyPI doesn't remove data by
itself. The cache grows as new packages are installed. If you encounter issues, clear the cache with
this command:
```shell
pip cache purge
```
## Supported CLI commands
The GitLab PyPI repository supports the following CLI commands:

View file

@ -207,7 +207,7 @@ module Gitlab
return unless valid_scoped_token?(token, all_available_scopes)
if project && token.user.project_bot?
return unless token_bot_in_project?(token.user, project) || token_bot_in_group?(token.user, project)
return unless token_bot_in_resource?(token.user, project)
end
if token.user.can_log_in_with_non_expired_password? || token.user.project_bot?
@ -229,6 +229,10 @@ module Gitlab
end
# rubocop: enable CodeReuse/ActiveRecord
def token_bot_in_resource?(user, project)
token_bot_in_project?(user, project) || token_bot_in_group?(user, project)
end
def valid_oauth_token?(token)
token && token.accessible? && valid_scoped_token?(token, Doorkeeper.configuration.scopes)
end
@ -309,7 +313,7 @@ module Gitlab
return unless build.project.builds_enabled?
if build.user
return unless build.user.can_log_in_with_non_expired_password? || (build.user.project_bot? && build.project.bots&.include?(build.user))
return unless build.user.can_log_in_with_non_expired_password? || (build.user.project_bot? && token_bot_in_resource?(build.user, build.project))
# If user is assigned to build, use restricted credentials of user
Gitlab::Auth::Result.new(build.user, build.project, :build, build_authentication_abilities)

View file

@ -12,8 +12,6 @@ variables:
dast:
stage: dast
image: $DAST_API_IMAGE
variables:
GIT_STRATEGY: none
allow_failure: true
script:
- /peach/analyzer-dast-api

View file

@ -56,8 +56,7 @@ module Gitlab
# https://gitlab.com/gitlab-org/gitaly/-/blob/bf9f52bc/client/dial.go#L78
{
'grpc.keepalive_time_ms': 20000,
'grpc.keepalive_permit_without_calls': 1,
'grpc.http2.max_pings_without_data': 0
'grpc.keepalive_permit_without_calls': 1
}
end
private_class_method :channel_args

View file

@ -17402,9 +17402,6 @@ msgstr ""
msgid "GroupsNew|%{linkStart}Groups%{linkEnd} allow you to manage and collaborate across multiple projects. Members of a group have access to all of its projects."
msgstr ""
msgid "GroupsNew|Ask your administrator to %{enable_link_start}enable%{enable_link_end} Group Migration."
msgstr ""
msgid "GroupsNew|Assemble related projects together and grant members access to several projects at once."
msgstr ""
@ -17459,7 +17456,7 @@ msgstr ""
msgid "GroupsNew|Provide credentials for another instance of GitLab to import your groups directly."
msgstr ""
msgid "GroupsNew|This feature is deprecated and replaced by %{docs_link_start}Group Migration%{docs_link_end}."
msgid "GroupsNew|This feature is deprecated and replaced by %{docs_link_start}group migration%{docs_link_end}."
msgstr ""
msgid "GroupsNew|To import a group, navigate to the group settings for the GitLab source instance, %{link_start}generate an export file%{link_end}, and upload it here."

View file

@ -51,14 +51,10 @@ module QA
expect(imported_mrs.count).to eq(1)
aggregate_failures do
# TODO: remove custom comparison after member migration is implemented
# https://gitlab.com/gitlab-org/gitlab/-/issues/341886
expect(imported_mr.comparable.except(:author)).to eq(source_mr.reload!.comparable.except(:author))
expect(imported_mr).to eq(source_mr.reload!)
expect(imported_mr_comments.count).to eq(1)
expect(imported_mr_comments.first[:body]).to include(source_comment[:body])
# Comment will have mention of original user since members are not migrated yet
expect(imported_mr_comments.first[:body]).to include(other_user.name)
expect(imported_mr_comments.first.except(:id, :noteable_id)).to eq(source_comment.except(:id, :noteable_id))
end
end
end

View file

@ -17,7 +17,7 @@ RSpec.describe 'Breadcrumbs schema markup', :aggregate_failures do
expect(item_list.size).to eq 2
expect(item_list[0]['name']).to eq project.namespace.name
expect(item_list[0]['item']).to eq user_url(project.owner)
expect(item_list[0]['item']).to eq user_url(project.first_owner)
expect(item_list[1]['name']).to eq project.name
expect(item_list[1]['item']).to eq project_url(project)
@ -59,7 +59,7 @@ RSpec.describe 'Breadcrumbs schema markup', :aggregate_failures do
expect(item_list.size).to eq 3
expect(item_list[0]['name']).to eq project.namespace.name
expect(item_list[0]['item']).to eq user_url(project.owner)
expect(item_list[0]['item']).to eq user_url(project.first_owner)
expect(item_list[1]['name']).to eq project.name
expect(item_list[1]['item']).to eq project_url(project)
@ -75,7 +75,7 @@ RSpec.describe 'Breadcrumbs schema markup', :aggregate_failures do
expect(item_list.size).to eq 4
expect(item_list[0]['name']).to eq project.namespace.name
expect(item_list[0]['item']).to eq user_url(project.owner)
expect(item_list[0]['item']).to eq user_url(project.first_owner)
expect(item_list[1]['name']).to eq project.name
expect(item_list[1]['item']).to eq project_url(project)

View file

@ -6,7 +6,7 @@ RSpec.describe 'Contextual sidebar', :js do
context 'when context is a project' do
let_it_be(:project) { create(:project) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -7,11 +7,11 @@ RSpec.describe 'Dashboard snippets' do
context 'when the project has snippets' do
let(:project) { create(:project, :public, creator: user) }
let!(:snippets) { create_list(:project_snippet, 2, :public, author: project.owner, project: project) }
let!(:snippets) { create_list(:project_snippet, 2, :public, author: project.first_owner, project: project) }
before do
allow(Snippet).to receive(:default_per_page).and_return(1)
sign_in(project.owner)
sign_in(project.first_owner)
visit dashboard_snippets_path
end
@ -27,7 +27,7 @@ RSpec.describe 'Dashboard snippets' do
let(:project) { create(:project, :public, creator: user) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
visit dashboard_snippets_path
end

View file

@ -22,7 +22,7 @@ RSpec.describe 'When a user filters Sentry errors by status', :js, :use_clean_ra
end
it 'displays the results' do
sign_in(project.owner)
sign_in(project.first_owner)
visit project_error_tracking_index_path(project)
page.within(find('.gl-table')) do
results = page.all('.table-row')

View file

@ -22,7 +22,7 @@ RSpec.describe 'When a user searches for Sentry errors', :js, :use_clean_rails_m
end
it 'displays the results' do
sign_in(project.owner)
sign_in(project.first_owner)
visit project_error_tracking_index_path(project)
page.within(find('.gl-table')) do

View file

@ -7,7 +7,7 @@ RSpec.describe 'View error details page', :js, :use_clean_rails_memory_store_cac
context 'with current user as project owner' do
before do
sign_in(project.owner)
sign_in(project.first_owner)
visit details_project_error_tracking_index_path(project, issue_id: issue_id)
end

View file

@ -18,7 +18,7 @@ RSpec.describe 'View error index page', :js, :use_clean_rails_memory_store_cachi
context 'with current user as project owner' do
before do
sign_in(project.owner)
sign_in(project.first_owner)
visit project_error_tracking_index_path(project)
end
@ -43,7 +43,7 @@ RSpec.describe 'View error index page', :js, :use_clean_rails_memory_store_cachi
context 'with error tracking settings disabled' do
before do
project_error_tracking_settings.update!(enabled: false)
sign_in(project.owner)
sign_in(project.first_owner)
visit project_error_tracking_index_path(project)
end

View file

@ -6,7 +6,7 @@ RSpec.describe 'Upload an attachment', :api, :js do
include_context 'file upload requests helpers'
let_it_be(:project) { create(:project) }
let_it_be(:user) { project.owner }
let_it_be(:user) { project.first_owner }
let_it_be(:personal_access_token) { create(:personal_access_token, user: user) }
let(:api_path) { "/projects/#{project_id}/uploads" }

View file

@ -6,7 +6,7 @@ RSpec.describe 'Upload a git lfs object', :js do
include_context 'file upload requests helpers'
let_it_be(:project) { create(:project) }
let_it_be(:user) { project.owner }
let_it_be(:user) { project.first_owner }
let_it_be(:personal_access_token) { create(:personal_access_token, user: user) }
let(:file) { fixture_file_upload('spec/fixtures/banana_sample.gif') }

View file

@ -6,7 +6,7 @@ RSpec.describe 'Upload a maven package', :api, :js do
include_context 'file upload requests helpers'
let_it_be(:project) { create(:project) }
let_it_be(:user) { project.owner }
let_it_be(:user) { project.first_owner }
let_it_be(:personal_access_token) { create(:personal_access_token, user: user) }
let(:project_id) { project.id }

View file

@ -6,7 +6,7 @@ RSpec.describe 'Upload a nuget package', :api, :js do
include_context 'file upload requests helpers'
let_it_be(:project) { create(:project) }
let_it_be(:user) { project.owner }
let_it_be(:user) { project.first_owner }
let_it_be(:personal_access_token) { create(:personal_access_token, user: user) }
let(:api_path) { "/projects/#{project.id}/packages/nuget/" }

View file

@ -6,7 +6,7 @@ RSpec.describe 'Upload a RubyGems package', :api, :js do
include_context 'file upload requests helpers'
let_it_be(:project) { create(:project) }
let_it_be(:user) { project.owner }
let_it_be(:user) { project.first_owner }
let_it_be(:personal_access_token) { create(:personal_access_token, user: user) }
let(:api_path) { "/projects/#{project_id}/packages/rubygems/api/v1/gems" }

View file

@ -6,7 +6,7 @@ RSpec.describe 'IDE user commits changes', :js do
include WebIdeSpecHelpers
let(:project) { create(:project, :public, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'IDE merge request', :js do
let(:merge_request) { create(:merge_request, :simple, source_project: project) }
let(:project) { create(:project, :public, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -5,11 +5,11 @@ require 'spec_helper'
RSpec.describe "Internal references", :js do
include Spec::Support::Helpers::Features::NotesHelpers
let(:private_project_user) { private_project.owner }
let(:private_project_user) { private_project.first_owner }
let(:private_project) { create(:project, :private, :repository) }
let(:private_project_issue) { create(:issue, project: private_project) }
let(:private_project_merge_request) { create(:merge_request, source_project: private_project) }
let(:public_project_user) { public_project.owner }
let(:public_project_user) { public_project.first_owner }
let(:public_project) { create(:project, :public, :repository) }
let(:public_project_issue) { create(:issue, project: public_project) }
let(:public_project_merge_request) { create(:merge_request, source_project: public_project) }

View file

@ -8,7 +8,7 @@ RSpec.describe 'Issues shortcut', :js do
let(:project) { create(:project) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
visit project_path(project)
end
@ -23,7 +23,7 @@ RSpec.describe 'Issues shortcut', :js do
let(:project) { create(:project, :issues_disabled) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
visit project_path(project)
end

View file

@ -663,7 +663,7 @@ RSpec.describe 'Copy as GFM', :js do
let(:project) { create(:project, :repository) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
end
context 'from a diff' do

View file

@ -24,7 +24,7 @@ RSpec.describe 'Merge request > User edits assignees sidebar', :js do
before do
stub_const('Autocomplete::UsersFinder::LIMIT', users_find_limit)
sign_in(project.owner)
sign_in(project.first_owner)
merge_request.assignees << assignee

View file

@ -10,7 +10,7 @@ RSpec.describe 'Batch diffs', :js do
let(:merge_request) { create(:merge_request, source_project: project, source_branch: 'master', target_branch: 'empty-branch') }
before do
sign_in(project.owner)
sign_in(project.first_owner)
visit diffs_project_merge_request_path(merge_request.project, merge_request)
wait_for_requests

View file

@ -3,7 +3,7 @@
require "spec_helper"
RSpec.describe "User merges a merge request", :js do
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -4,7 +4,7 @@ require "spec_helper"
RSpec.describe "User rebases a merge request", :js do
let(:merge_request) { create(:merge_request, :simple, source_project: project) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -6,7 +6,7 @@ RSpec.describe 'Merge request > image review', :js do
include MergeRequestDiffHelpers
include RepoHelpers
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request_with_diffs, :with_image_diffs, source_project: project, author: user) }

View file

@ -82,7 +82,7 @@ RSpec.describe 'Merge request > User sees diff', :js do
end
context 'when file contains html' do
let(:current_user) { project.owner }
let(:current_user) { project.first_owner }
let(:branch_name) {"test_branch"}
it 'escapes any HTML special characters in the diff chunk header' do
@ -123,7 +123,7 @@ RSpec.describe 'Merge request > User sees diff', :js do
context 'when file is stored in LFS' do
let(:merge_request) { create(:merge_request, source_project: project) }
let(:current_user) { project.owner }
let(:current_user) { project.first_owner }
context 'when LFS is enabled on the project' do
before do

View file

@ -11,7 +11,7 @@ RSpec.describe 'User views merged merge request from deleted fork' do
let(:project) { create(:project, :repository) }
let(:source_project) { fork_project(project, nil, repository: true) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let!(:merge_request) { create(:merge_request, :merged, source_project: source_project, target_project: project) }
before do

View file

@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'Project active tab' do
let_it_be(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'Project Activity RSS' do
let(:project) { create(:project, :public) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:path) { activity_project_path(project) }
before do
@ -13,7 +13,7 @@ RSpec.describe 'Project Activity RSS' do
context 'when signed in' do
before do
sign_in(project.owner)
sign_in(project.first_owner)
visit path
end

View file

@ -174,7 +174,7 @@ RSpec.describe 'File blob', :js do
it 'displays no highlighted number of different ref' do
Files::UpdateService.new(
project,
project.owner,
project.first_owner,
commit_message: 'Update',
start_branch: 'feature',
branch_name: 'feature',

View file

@ -6,7 +6,7 @@ RSpec.describe 'User follows pipeline suggest nudge spec when feature is enabled
include CookieHelper
let(:project) { create(:project, :empty_repo) }
let(:user) { project.owner }
let(:user) { project.first_owner }
describe 'viewing the new blob page' do
before do

View file

@ -4,7 +4,7 @@ require "spec_helper"
RSpec.describe "User views branches", :js do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { project.owner }
let_it_be(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -21,7 +21,7 @@ RSpec.describe 'Environment > Pod Logs', :js, :kubeclient do
stub_kubeclient_ingresses(environment.deployment_namespace)
stub_kubeclient_nodes_and_nodes_metrics(cluster.platform.api_url)
sign_in(project.owner)
sign_in(project.first_owner)
end
it "shows environments in dropdown" do

View file

@ -7,7 +7,7 @@ RSpec.describe 'Projects > Files > User wants to add a Dockerfile file', :js do
before do
project = create(:project, :repository)
sign_in project.owner
sign_in project.first_owner
visit project_new_blob_path(project, 'master', file_name: 'Dockerfile')
end

View file

@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'Projects > Files > User uses soft wrap while editing file', :js do
before do
project = create(:project, :repository)
user = project.owner
user = project.first_owner
sign_in user
visit project_new_blob_path(project, 'master', file_name: 'test_file-name')

View file

@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'Projects > Files > User wants to edit a file' do
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:commit_params) do
{
start_branch: project.default_branch,

View file

@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'Projects > Files > User views files page' do
let(:project) { create(:forked_project_with_submodules) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in user

View file

@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'Projects > Files > Find file keyboard shortcuts', :js do
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in user

View file

@ -7,7 +7,7 @@ RSpec.describe 'Projects > Files > User wants to add a .gitignore file', :js do
before do
project = create(:project, :repository)
sign_in project.owner
sign_in project.first_owner
visit project_new_blob_path(project, 'master', file_name: '.gitignore')
end

View file

@ -11,7 +11,7 @@ RSpec.describe 'Projects > Files > User wants to add a .gitlab-ci.yml file', :js
let_it_be(:project) { create(:project, :repository) }
before do
sign_in project.owner
sign_in project.first_owner
visit project_new_blob_path(project, 'master', file_name: filename, **params)
end

View file

@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'Projects > Files > Project owner creates a license file', :js do
let(:project) { create(:project, :repository) }
let(:project_maintainer) { project.owner }
let(:project_maintainer) { project.first_owner }
before do
project.repository.delete_file(project_maintainer, 'LICENSE',

View file

@ -6,7 +6,7 @@ RSpec.describe 'Projects > Files > Project owner sees a link to create a license
include WebIdeSpecHelpers
let(:project) { create(:project_empty_repo) }
let(:project_maintainer) { project.owner }
let(:project_maintainer) { project.first_owner }
before do
sign_in(project_maintainer)

View file

@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'Projects > Files > Template type dropdown selector', :js do
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in user

View file

@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'Projects > Files > Template Undo Button', :js do
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in user

View file

@ -5,7 +5,7 @@ require 'spec_helper'
# This is a regression test for https://gitlab.com/gitlab-org/gitlab-foss/issues/37569
RSpec.describe 'Projects > Files > User browses a tree with a folder containing only a folder', :js do
let(:project) { create(:project, :empty_repo) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
project.repository.create_dir(user, 'foo/bar', branch_name: 'master', message: 'Add the foo/bar folder')

View file

@ -13,7 +13,7 @@ RSpec.describe "User browses files", :js do
let(:project) { create(:project, :repository, name: "Shop") }
let(:project2) { create(:project, :repository, name: "Another Project", path: "another-project") }
let(:tree_path_root_ref) { project_tree_path(project, project.repository.root_ref) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'Projects > Files > User browses LFS files' do
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe 'Projects > Files > User searches for files' do
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -6,7 +6,7 @@ RSpec.describe 'GFM autocomplete loading', :js do
let(:project) { create(:project) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
visit project_path(project)
end

View file

@ -6,7 +6,7 @@ RSpec.describe 'User uploads new design', :js do
include DesignManagementTestHelpers
let(:project) { create(:project_empty_repo, :public) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:issue) { create(:issue, project: project) }
before do

View file

@ -6,7 +6,7 @@ RSpec.describe 'Projects > Members > Owner cannot leave project' do
let(:project) { create(:project) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
visit project_path(project)
end

View file

@ -6,7 +6,7 @@ RSpec.describe 'Projects > Members > Owner cannot request access to their own pr
let(:project) { create(:project) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
visit project_path(project)
end

View file

@ -6,7 +6,7 @@ RSpec.describe 'Projects > Members > User requests access', :js do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public, :repository) }
let(:maintainer) { project.owner }
let(:maintainer) { project.first_owner }
before do
sign_in(user)

View file

@ -10,7 +10,7 @@ RSpec.describe 'Project navbar' do
let_it_be(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -715,7 +715,7 @@ RSpec.describe 'Pipeline', :js do
let(:schedule) do
create(:ci_pipeline_schedule,
project: project,
owner: project.owner,
owner: project.first_owner,
description: 'blocked user schedule'
).tap do |schedule|
schedule.update_column(:next_run_at, 1.minute.ago)

View file

@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'Projects > Settings > For a forked project', :js do
let_it_be(:project) { create(:project, :repository, create_templates: :issue) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'Projects > Settings > Packages', :js do
let_it_be(:project) { create(:project) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'Projects settings' do
let_it_be(:project) { create(:project) }
let(:user) { project.owner }
let(:user) { project.first_owner }
let(:panel) { find('.general-settings', match: :first) }
let(:button) { panel.find('.btn.gl-button.js-settings-toggle') }
let(:title) { panel.find('.settings-title') }

View file

@ -4,7 +4,7 @@ require "spec_helper"
RSpec.describe "User interacts with deploy keys", :js do
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -47,7 +47,7 @@ RSpec.describe 'Projects > Show > Redirects' do
it 'redirects to private project page after sign in' do
visit project_path(private_project)
owner = private_project.owner
owner = private_project.first_owner
fill_in 'user_login', with: owner.email
fill_in 'user_password', with: owner.password
click_button 'Sign in'

View file

@ -6,7 +6,7 @@ RSpec.describe 'Projects > Show > User manages notifications', :js do
let(:project) { create(:project, :public, :repository) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
end
def click_notifications_button

View file

@ -6,7 +6,7 @@ RSpec.describe 'Projects > Show > User sees a deletion failure message' do
let(:project) { create(:project, :empty_repo, pending_delete: true) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
end
it 'shows error message if deletion for project fails' do

View file

@ -61,7 +61,7 @@ RSpec.describe 'Projects > Show > User sees Git instructions' do
let_it_be(:project) { create(:project, :public) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
visit project_path(project)
end
@ -77,7 +77,7 @@ RSpec.describe 'Projects > Show > User sees Git instructions' do
.at_least(:once)
.and_return('example_branch')
sign_in(project.owner)
sign_in(project.first_owner)
visit project_path(project)
end

View file

@ -43,9 +43,9 @@ RSpec.describe 'User changes public project visibility', :js do
context 'when the project has forks' do
before do
fork_project(project, project.owner)
fork_project(project, project.first_owner)
sign_in(project.owner)
sign_in(project.first_owner)
visit edit_project_path(project)
end
@ -84,7 +84,7 @@ RSpec.describe 'User changes public project visibility', :js do
let(:project) { create(:project, :empty_repo, :public) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
visit edit_project_path(project)
end
@ -98,9 +98,9 @@ RSpec.describe 'User changes public project visibility', :js do
before do
stub_feature_flags(unlink_fork_network_upon_visibility_decrease: false)
fork_project(project, project.owner)
fork_project(project, project.first_owner)
sign_in(project.owner)
sign_in(project.first_owner)
visit edit_project_path(project)
end

View file

@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'User uses shortcuts', :js do
let_it_be(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe 'Projects > Wiki > User views wiki in project page' do
before do
sign_in(project.owner)
sign_in(project.first_owner)
end
context 'when repository is disabled for project' do

View file

@ -59,7 +59,7 @@ RSpec.describe 'Project' do
let(:path) { project_path(project) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
end
it 'parses Markdown' do
@ -123,7 +123,7 @@ RSpec.describe 'Project' do
let(:path) { project_path(project) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
visit path
end
@ -154,7 +154,7 @@ RSpec.describe 'Project' do
let(:path) { project_path(project) }
before do
sign_in(project.owner)
sign_in(project.first_owner)
visit path
end
@ -201,7 +201,7 @@ RSpec.describe 'Project' do
it 'does not show the name of the deleted project when the source was deleted', :sidekiq_might_not_need_inline do
forked_project
Projects::DestroyService.new(base_project, base_project.owner).execute
Projects::DestroyService.new(base_project, base_project.first_owner).execute
visit project_path(forked_project)

View file

@ -6,7 +6,7 @@ RSpec.describe 'Protected Tags', :js do
include ProtectedTagHelpers
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:user) { project.first_owner }
before do
sign_in(user)

View file

@ -6,8 +6,8 @@ RSpec.describe "Internal Project Snippets Access" do
include AccessMatchers
let_it_be(:project) { create(:project, :internal) }
let_it_be(:internal_snippet) { create(:project_snippet, :internal, project: project, author: project.owner) }
let_it_be(:private_snippet) { create(:project_snippet, :private, project: project, author: project.owner) }
let_it_be(:internal_snippet) { create(:project_snippet, :internal, project: project, author: project.first_owner) }
let_it_be(:private_snippet) { create(:project_snippet, :private, project: project, author: project.first_owner) }
describe "GET /:project_path/snippets" do
subject { project_snippets_path(project) }

View file

@ -6,7 +6,7 @@ RSpec.describe "Private Project Snippets Access" do
include AccessMatchers
let_it_be(:project) { create(:project, :private) }
let_it_be(:private_snippet) { create(:project_snippet, :private, project: project, author: project.owner) }
let_it_be(:private_snippet) { create(:project_snippet, :private, project: project, author: project.first_owner) }
describe "GET /:project_path/snippets" do
subject { project_snippets_path(project) }

View file

@ -6,9 +6,9 @@ RSpec.describe "Public Project Snippets Access" do
include AccessMatchers
let_it_be(:project) { create(:project, :public) }
let_it_be(:public_snippet) { create(:project_snippet, :public, project: project, author: project.owner) }
let_it_be(:internal_snippet) { create(:project_snippet, :internal, project: project, author: project.owner) }
let_it_be(:private_snippet) { create(:project_snippet, :private, project: project, author: project.owner) }
let_it_be(:public_snippet) { create(:project_snippet, :public, project: project, author: project.first_owner) }
let_it_be(:internal_snippet) { create(:project_snippet, :internal, project: project, author: project.first_owner) }
let_it_be(:private_snippet) { create(:project_snippet, :private, project: project, author: project.first_owner) }
describe "GET /:project_path/snippets" do
subject { project_snippets_path(project) }

View file

@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'Snippets' do
context 'when the project has snippets' do
let(:project) { create(:project, :public) }
let!(:snippets) { create_list(:project_snippet, 2, :public, author: project.owner, project: project) }
let!(:snippets) { create_list(:project_snippet, 2, :public, author: project.first_owner, project: project) }
before do
allow(Snippet).to receive(:default_per_page).and_return(1)

View file

@ -156,8 +156,9 @@ RSpec.describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
let(:username) { 'gitlab-ci-token' }
context 'for running build' do
let!(:build) { create(:ci_build, :running) }
let(:project) { build.project }
let!(:group) { create(:group) }
let!(:project) { create(:project, group: group) }
let!(:build) { create(:ci_build, :running, project: project) }
it 'recognises user-less build' do
expect(subject).to have_attributes(actor: nil, project: build.project, type: :ci, authentication_abilities: described_class.build_authentication_abilities)
@ -169,6 +170,20 @@ RSpec.describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
expect(subject).to have_attributes(actor: build.user, project: build.project, type: :build, authentication_abilities: described_class.build_authentication_abilities)
end
it 'recognises project level bot access token' do
build.update(user: create(:user, :project_bot))
project.add_maintainer(build.user)
expect(subject).to have_attributes(actor: build.user, project: build.project, type: :build, authentication_abilities: described_class.build_authentication_abilities)
end
it 'recognises group level bot access token' do
build.update(user: create(:user, :project_bot))
group.add_maintainer(build.user)
expect(subject).to have_attributes(actor: build.user, project: build.project, type: :build, authentication_abilities: described_class.build_authentication_abilities)
end
it 'fails with blocked user token' do
build.update(user: create(:user, :blocked))