Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-07-15 00:10:03 +00:00
parent dc60045db7
commit 0c6c91556b
24 changed files with 447 additions and 26 deletions

View file

@ -133,10 +133,3 @@ export const timeFor = (time, expiredLabel) => {
}
return timeago.format(time, `${timeagoLanguageCode}-remaining`).trim();
};
window.timeago = getTimeago();
window.gl = window.gl || {};
window.gl.utils = {
...(window.gl.utils || {}),
localTimeAgo,
};

View file

@ -46,6 +46,9 @@ applyGitLabUIConfig();
window.jQuery = jQuery;
window.$ = jQuery;
// ensure that window.gl is set up
window.gl = window.gl || {};
// inject test utilities if necessary
if (process.env.NODE_ENV !== 'production' && gon?.test_env) {
import(/* webpackMode: "eager" */ './test_utils/');

View file

@ -3,7 +3,7 @@
class Packages::Event < ApplicationRecord
belongs_to :package, optional: true
UNIQUE_EVENTS_ALLOWED = %i[push_package delete_package pull_package].freeze
UNIQUE_EVENTS_ALLOWED = %i[push_package delete_package pull_package pull_symbol_package push_symbol_package].freeze
EVENT_SCOPES = ::Packages::Package.package_types.merge(container: 1000, tag: 1001).freeze
EVENT_PREFIX = "i_package"
@ -21,7 +21,9 @@ class Packages::Event < ApplicationRecord
delete_tag: 7,
delete_tag_bulk: 8,
list_tags: 9,
cli_metadata: 10
cli_metadata: 10,
pull_symbol_package: 11,
push_symbol_package: 12
}
enum originator_type: { user: 0, deploy_token: 1, guest: 2 }

View file

@ -0,0 +1,8 @@
---
name: redirect_trial_user_to_feature
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65450
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/335824
milestone: '14.1'
type: experiment
group: group::conversion
default_enabled: false

View file

@ -0,0 +1,22 @@
---
key_path: counts.package_events_i_package_nuget_pull_symbol_package
name: nuget_symbol_packages_pulled
description: A count of NuGet symbol packages that have been downloaded from the package registry
product_section: ops
product_stage: package
product_group: group::package
product_category: package registry
value_type: number
status: implemented
milestone: "14.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame: all
data_source: redis
data_category: Optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate

View file

@ -0,0 +1,22 @@
---
key_path: counts.package_events_i_package_nuget_push_symbol_package
name: nuget_symbol_packages_pushed
description: A count of NuGet symbol packages that have been uploaded to the package registry
product_section: ops
product_stage: package
product_group: group::package
product_category: package registry
value_type: number
status: implemented
milestone: "14.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame: all
data_source: redis
data_category: Optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate

View file

@ -0,0 +1,22 @@
---
key_path: counts.package_events_i_package_pull_symbol_package
name: symbol_packages_pulled
description: A count of symbol packages that have been pulled from the package registry
product_section: ops
product_stage: package
product_group: group::package
product_category: package registry
value_type: number
status: implemented
milestone: "14.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame: all
data_source: redis
data_category: Optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate

View file

@ -0,0 +1,22 @@
---
key_path: counts.package_events_i_package_pull_symbol_package_by_deploy_token
name: symbol_packages_pulled_by_deploy_token
description: A count of symbol packages that have been pulled with a deploy token from the package registry
product_section: ops
product_stage: package
product_group: group::package
product_category: package registry
value_type: number
status: implemented
milestone: "14.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame: all
data_source: redis
data_category: Optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate

View file

@ -0,0 +1,22 @@
---
key_path: counts.package_events_i_package_pull_symbol_package_by_guest
name: symbol_packages_pulled_by_guest
description: A count of symbol packages that have been pulled with by a guest from the package registry
product_section: ops
product_stage: package
product_group: group::package
product_category: package registry
value_type: number
status: implemented
milestone: "14.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame: all
data_source: redis
data_category: Optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate

View file

@ -0,0 +1,22 @@
---
key_path: counts.package_events_i_package_pull_symbol_package_by_user
name: symbol_packages_pulled_by_user
description: A count of symbol packages that have been pulled with by an authenticated user from the package registry
product_section: ops
product_stage: package
product_group: group::package
product_category: package registry
value_type: number
status: implemented
milestone: "14.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame: all
data_source: redis
data_category: Optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate

View file

@ -0,0 +1,22 @@
---
key_path: counts.package_events_i_package_push_symbol_package
name: symbol_packages_pushed
description: A count of symbol packages that have been pushed to the package registry
product_section: ops
product_stage: package
product_group: group::package
product_category: package registry
value_type: number
status: implemented
milestone: "14.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame: all
data_source: redis
data_category: Optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate

View file

@ -0,0 +1,22 @@
---
key_path: counts.package_events_i_package_push_symbol_package_by_deploy_token
name: symbol_packages_pushed_by_deploy_token
description: A count of symbol packages that have been pushed with a deploy token to the package registry
product_section: ops
product_stage: package
product_group: group::package
product_category: package registry
value_type: number
status: implemented
milestone: "14.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame: all
data_source: redis
data_category: Optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate

View file

@ -0,0 +1,22 @@
---
key_path: counts.package_events_i_package_push_symbol_package_by_guest
name: symbol_packages_pushed_by_guest
description: A count of symbol packages that have been pushed by a guest to the package registry
product_section: ops
product_stage: package
product_group: group::package
product_category: package registry
value_type: number
status: implemented
milestone: "14.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame: all
data_source: redis
data_category: Optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate

View file

@ -0,0 +1,22 @@
---
key_path: counts.package_events_i_package_push_symbol_package_by_user
name: symbol_packages_pushed_by_user
description: A count of symbol packages that have been pushed by an authenticated user to the package registry
product_section: ops
product_stage: package
product_group: group::package
product_category: package registry
value_type: number
status: implemented
milestone: "14.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64554
time_frame: all
data_source: redis
data_category: Optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate

View file

@ -1626,10 +1626,7 @@ praefect['reconciliation_scheduling_interval'] = '0' # disable the feature
### Manual reconciliation
WARNING:
The `reconcile` sub-command is deprecated and scheduled for removal in GitLab 14.0. Use
[automatic reconciliation](#automatic-reconciliation) instead. Manual reconciliation may
produce excess replication jobs and is limited in functionality. Manual reconciliation does
not work when [repository-specific primary nodes](#repository-specific-primary-nodes) are
The `reconcile` sub-command was removed in GitLab 14.1. Use [automatic reconciliation](#automatic-reconciliation) instead. Manual reconciliation may produce excess replication jobs and is limited in functionality. Manual reconciliation does not work when [repository-specific primary nodes](#repository-specific-primary-nodes) are
enabled.
The Praefect `reconcile` sub-command allows for the manual reconciliation between two Gitaly nodes. The

View file

@ -906,6 +906,35 @@ apollo: {
},
```
### Best Practices
#### When to use (and not use) `update` hook in mutations
Apollo Client's [`.mutate()`](https://www.apollographql.com/docs/react/api/core/ApolloClient/#ApolloClient.mutate)
method exposes an `update` hook that is invoked twice during the mutation lifecycle:
- Once at the beginning. That is, before the mutation has completed.
- Once after the mutation has completed.
You should use this hook only if you're adding or removing an item from the store
(that is, ApolloCache). If you're _updating_ an existing item, it is usually represented by
a global `id`.
In that case, presence of this `id` in your mutation query definition makes the store update
automatically. Here's an example of a typical mutation query with `id` present in it:
```graphql
mutation issueSetWeight($input: IssueSetWeightInput!) {
issuableSetWeight: issueSetWeight(input: $input) {
issuable: issue {
id
weight
}
errors
}
}
```
### Testing
#### Generating the GraphQL schema

View file

@ -4472,6 +4472,20 @@ Status: `data_available`
Tiers: `free`, `premium`, `ultimate`
### `counts.package_events_i_package_nuget_pull_symbol_package`
A count of NuGet symbol packages that have been downloaded from the package registry
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709191135_package_events_i_package_nuget_pull_symbol_package.yml)
Group: `group::package`
Data Category: `Optional`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts.package_events_i_package_nuget_push_package`
A count of NuGet packages that have been published
@ -4486,6 +4500,20 @@ Status: `data_available`
Tiers: `free`, `premium`, `ultimate`
### `counts.package_events_i_package_nuget_push_symbol_package`
A count of NuGet symbol packages that have been uploaded to the package registry
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709191829_package_events_i_package_nuget_push_symbol_package.yml)
Group: `group::package`
Data Category: `Optional`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts.package_events_i_package_pull_package`
A count of packages that have been downloaded from the package registry
@ -4542,6 +4570,62 @@ Status: `data_available`
Tiers: `free`, `premium`, `ultimate`
### `counts.package_events_i_package_pull_symbol_package`
A count of symbol packages that have been pulled from the package registry
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709210941_package_events_i_package_pull_symbol_package.yml)
Group: `group::package`
Data Category: `Optional`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts.package_events_i_package_pull_symbol_package_by_deploy_token`
A count of symbol packages that have been pulled with a deploy token from the package registry
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709211058_package_events_i_package_pull_symbol_package_by_deploy_token.yml)
Group: `group::package`
Data Category: `Optional`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts.package_events_i_package_pull_symbol_package_by_guest`
A count of symbol packages that have been pulled with by a guest from the package registry
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709211248_package_events_i_package_pull_symbol_package_by_guest.yml)
Group: `group::package`
Data Category: `Optional`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts.package_events_i_package_pull_symbol_package_by_user`
A count of symbol packages that have been pulled with by an authenticated user from the package registry
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709211341_package_events_i_package_pull_symbol_package_by_user.yml)
Group: `group::package`
Data Category: `Optional`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts.package_events_i_package_push_package`
A count of packages that have been published to the package registry
@ -4598,6 +4682,62 @@ Status: `data_available`
Tiers: `free`, `premium`, `ultimate`
### `counts.package_events_i_package_push_symbol_package`
A count of symbol packages that have been pushed to the package registry
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709211439_package_events_i_package_push_symbol_package.yml)
Group: `group::package`
Data Category: `Optional`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts.package_events_i_package_push_symbol_package_by_deploy_token`
A count of symbol packages that have been pushed with a deploy token to the package registry
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709211636_package_events_i_package_push_symbol_package_by_deploy_token.yml)
Group: `group::package`
Data Category: `Optional`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts.package_events_i_package_push_symbol_package_by_guest`
A count of symbol packages that have been pushed by a guest to the package registry
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709211731_package_events_i_package_push_symbol_package_by_guest.yml)
Group: `group::package`
Data Category: `Optional`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts.package_events_i_package_push_symbol_package_by_user`
A count of symbol packages that have been pushed by an authenticated user to the package registry
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210709211831_package_events_i_package_push_symbol_package_by_user.yml)
Group: `group::package`
Data Category: `Optional`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts.package_events_i_package_pypi_delete_package`
A count of Python packages that have been deleted from the package registry

View file

@ -99,3 +99,8 @@ which may lead to a `401 unauthorized` error when testing your Jira integration.
If CAPTCHA has been triggered, you can't use Jira's REST API to
authenticate with the Jira site. You need to log in to your Jira instance
and complete the CAPTCHA.
## Third-party Jira integrations
Developers have built several third-party Jira integrations for GitLab that are
listed on the [Atlassian Marketplace](https://marketplace.atlassian.com/search?product=jira&query=gitlab).

View file

@ -134,7 +134,16 @@ module API
use :file_params
end
put 'symbolpackage' do
upload_nuget_package_file(symbol_package: true)
upload_nuget_package_file(symbol_package: true) do |package|
track_package_event(
'push_symbol_package',
:nuget,
category: 'API::NugetPackages',
user: current_user,
project: package.project,
namespace: package.project.namespace
)
end
rescue ObjectStorage::RemoteStoreError => e
Gitlab::ErrorTracking.track_exception(e, extra: { file_name: params[:file_name], project_id: project_or_group.id })
@ -175,15 +184,13 @@ module API
not_found!('Package') unless package_file
if params[:format] == 'nupkg'
track_package_event(
'pull_package',
:nuget,
category: 'API::NugetPackages',
project: package_file.project,
namespace: package_file.project.namespace
)
end
track_package_event(
params[:format] == 'snupkg' ? 'pull_symbol_package' : 'pull_package',
:nuget,
category: 'API::NugetPackages',
project: package_file.project,
namespace: package_file.project.namespace
)
# nuget and dotnet don't support 302 Moved status codes, supports_direct_download has to be set to false
present_carrierwave_file!(package_file.file, supports_direct_download: false)

View file

@ -32,14 +32,24 @@
- i_package_nuget_delete_package
- i_package_nuget_pull_package
- i_package_nuget_push_package
- i_package_nuget_pull_symbol_package
- i_package_nuget_push_symbol_package
- i_package_pull_package
- i_package_pull_package_by_deploy_token
- i_package_pull_package_by_guest
- i_package_pull_package_by_user
- i_package_pull_symbol_package
- i_package_pull_symbol_package_by_deploy_token
- i_package_pull_symbol_package_by_guest
- i_package_pull_symbol_package_by_user
- i_package_push_package
- i_package_push_package_by_deploy_token
- i_package_push_package_by_guest
- i_package_push_package_by_user
- i_package_push_symbol_package
- i_package_push_symbol_package_by_deploy_token
- i_package_push_symbol_package_by_guest
- i_package_push_symbol_package_by_user
- i_package_pypi_delete_package
- i_package_pypi_pull_package
- i_package_pypi_push_package

View file

@ -43,6 +43,9 @@ class CustomEnvironment extends JSDOMEnvironment {
};
this.global.IS_EE = IS_EE;
// Set up global `gl` object
this.global.gl = {};
this.rejectedPromises = [];
this.global.promiseRejectionHandler = (error) => {

View file

@ -14,7 +14,7 @@ RSpec.describe Gitlab::UsageDataCounters::PackageEventCounter, :clean_gitlab_red
end
it 'includes the right events' do
expect(described_class::KNOWN_EVENTS.size).to eq 53
expect(described_class::KNOWN_EVENTS.size).to eq 63
end
described_class::KNOWN_EVENTS.each do |event|

View file

@ -170,7 +170,9 @@ RSpec.shared_examples 'process nuget upload' do |user_type, status, add_member =
it_behaves_like 'package workhorse uploads'
it_behaves_like 'creates nuget package files'
unless symbol_package
if symbol_package
it_behaves_like 'a package tracking event', 'API::NugetPackages', 'push_symbol_package'
else
it_behaves_like 'a package tracking event', 'API::NugetPackages', 'push_package'
end
end
@ -311,6 +313,8 @@ RSpec.shared_examples 'process nuget download content request' do |user_type, st
expect(response.media_type).to eq('application/octet-stream')
end
it_behaves_like 'a package tracking event', 'API::NugetPackages', 'pull_symbol_package'
end
context 'with lower case package name' do

View file

@ -147,7 +147,7 @@ RSpec.shared_examples 'a package tracking event' do |category, action|
stub_feature_flags(collect_package_events: true)
end
it "creates a gitlab tracking event #{action}", :snowplow do
it "creates a gitlab tracking event #{action}", :snowplow, :aggregate_failures do
expect { subject }.to change { Packages::Event.count }.by(1)
expect_snowplow_event(category: category, action: action, **snowplow_gitlab_standard_context)