Skip to content

Commit 733ec54

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent 383ee13 commit 733ec54

File tree

21 files changed

+256
-54
lines changed

21 files changed

+256
-54
lines changed

GITALY_SERVER_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3bec5af36c5d3304174566c706807806eee8996d
1+
f16c7c18016d6ffa5ef1cf5eedbf1c01f464ddad

app/assets/javascripts/diffs/components/app.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ export default {
673673
if (delta >= 0 && delta < 1000) {
674674
this.disableVirtualScroller();
675675
676-
api.trackRedisHllUserEvent('i_code_review_user_searches_diff');
676+
this.trackEvent('i_code_review_user_searches_diff');
677677
api.trackRedisCounterEvent('diff_searches');
678678
}
679679
},

app/assets/javascripts/projects/your_work/components/app.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,20 @@ export default {
129129
return this.$route.query.sort;
130130
},
131131
sort() {
132-
if (this.sortQuery) {
132+
const sortOptionValues = SORT_OPTIONS.flatMap(({ value }) => [
133+
`${value}_${SORT_DIRECTION_ASC}`,
134+
`${value}_${SORT_DIRECTION_DESC}`,
135+
]);
136+
137+
if (this.sortQuery && sortOptionValues.includes(this.sortQuery)) {
133138
return this.sortQuery;
134139
}
135140
136-
return this.initialSort || `${SORT_OPTION_UPDATED.value}_${SORT_DIRECTION_ASC}`;
141+
if (sortOptionValues.includes(this.initialSort)) {
142+
return this.initialSort;
143+
}
144+
145+
return `${SORT_OPTION_UPDATED.value}_${SORT_DIRECTION_ASC}`;
137146
},
138147
activeSortOption() {
139148
return SORT_OPTIONS.find((sortItem) => this.sort.includes(sortItem.value));

app/graphql/resolvers/projects/user_contributed_projects_resolver.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ class UserContributedProjectsResolver < BaseResolver
2929
required: false,
3030
description: 'Filter projects by programming language name (case insensitive). For example: "css" or "ruby".'
3131

32+
before_connection_authorization do |projects, current_user|
33+
::Preloaders::UserMaxAccessLevelInProjectsPreloader.new(projects, current_user).execute
34+
end
35+
3236
alias_method :user, :object
3337

3438
def resolve_with_lookahead(**args)

app/graphql/resolvers/user_starred_projects_resolver.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ class UserStarredProjectsResolver < BaseResolver
2323
required: false,
2424
description: 'Filter projects by programming language name (case insensitive). For example: "css" or "ruby".'
2525

26+
before_connection_authorization do |projects, current_user|
27+
::Preloaders::UserMaxAccessLevelInProjectsPreloader.new(projects, current_user).execute
28+
end
29+
2630
alias_method :user, :object
2731

2832
def resolve_with_lookahead(**args)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
description: User searches a merge request diff by using the built-in search function in the browser
3+
internal_events: true
4+
action: i_code_review_user_searches_diff
5+
identifiers:
6+
- project
7+
- namespace
8+
- user
9+
product_group: code_review
10+
product_categories:
11+
- code_review_workflow
12+
milestone: '17.10'
13+
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/182580
14+
tiers:
15+
- free
16+
- premium
17+
- ultimate

config/metrics/counts_28d/20210720144005_i_code_review_user_searches_diff_monthly.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ status: active
99
milestone: '14.2'
1010
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66522
1111
time_frame: 28d
12-
data_source: redis_hll
13-
instrumentation_class: RedisHLLMetric
14-
options:
15-
events:
16-
- i_code_review_user_searches_diff
12+
data_source: internal_events
13+
events:
14+
- name: i_code_review_user_searches_diff
15+
unique: user.id
1716
data_category: optional
1817
tiers:
1918
- free

config/metrics/counts_7d/20210720144005_i_code_review_user_searches_diff_weekly.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ status: active
99
milestone: '14.2'
1010
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66522
1111
time_frame: 7d
12-
data_source: redis_hll
13-
instrumentation_class: RedisHLLMetric
14-
options:
15-
events:
16-
- i_code_review_user_searches_diff
12+
data_source: internal_events
13+
events:
14+
- name: i_code_review_user_searches_diff
15+
unique: user.id
1716
data_category: optional
1817
tiers:
1918
- free

doc/administration/gitlab_duo_self_hosted/configure_duo_features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ To enable self-hosted [beta](../../policy/development_stages_support.md#beta) mo
9393
1. On the left sidebar, at the bottom, select **Admin**.
9494
1. Select **GitLab Duo**.
9595
1. In the **GitLab Duo** section, select **Change configuration**.
96-
1. Under **Self-hosted AI models**, select **Use self-hosted models features**.
96+
1. Under **Self-hosted AI models**, select **Use beta self-hosted models features**.
9797
1. Select **Save changes**.
9898

9999
{{< alert type="note" >}}

doc/ci/jobs/ci_job_token.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ is revoked and you cannot use the token anymore.
1919

2020
Use a CI/CD job token to authenticate with certain GitLab features from running jobs.
2121
The token receives the same access level as the user that triggered the pipeline,
22-
but has [access to fewer resources](#job-token-feature-access) than a personal access token. A user can cause a job to run
22+
but has [access to fewer resources](#job-token-access) than a personal access token. A user can cause a job to run
2323
with an action like pushing a commit, triggering a manual job, or being the owner of a scheduled pipeline.
2424
This user must have a [role that has the required privileges](../../user/permissions.md#cicd)
2525
to access the resources.
@@ -31,30 +31,30 @@ If a project is public or internal, you can access some features without being o
3131
For example, you can fetch artifacts from the project's public pipelines.
3232
This access can also [be restricted](#limit-job-token-scope-for-public-or-internal-projects).
3333

34-
## Job token feature access
35-
36-
The CI/CD job token can only access the following features and API endpoints:
37-
38-
| Feature | Additional details |
39-
|-------------------------------------------------------------------------------------------------------|--------------------|
40-
| [Container registry API](../../api/container_registry.md) | The token is scoped to the container registry of the job's project only. |
41-
| [Container registry](../../user/packages/container_registry/build_and_push_images.md#use-gitlab-cicd) | The `$CI_REGISTRY_PASSWORD` [predefined variable](../variables/predefined_variables.md) is the CI/CD job token. Both are scoped to the container registry of the job's project only. |
42-
| [Deployments API](../../api/deployments.md) | `GET` requests are public by default. |
43-
| [Environments API](../../api/environments.md) | `GET` requests are public by default. |
44-
| [Job artifacts API](../../api/job_artifacts.md#get-job-artifacts) | `GET` requests are public by default. |
45-
| [API endpoint to get the job of a job token](../../api/jobs.md#get-job-tokens-job) | To get the job token's job. |
46-
| [Package registry](../../user/packages/package_registry/_index.md#to-build-packages) | |
47-
| [Packages API](../../api/packages.md) | `GET` requests are public by default. |
48-
| [Pipeline triggers](../../api/pipeline_triggers.md) | Used with the `token=` parameter to [trigger a multi-project pipeline](../pipelines/downstream_pipelines.md#trigger-a-multi-project-pipeline-by-using-the-api). |
49-
| [Update pipeline metadata API endpoint](../../api/pipelines.md#update-pipeline-metadata) | To update pipeline metadata. |
50-
| [Release links API](../../api/releases/links.md) | |
51-
| [Releases API](../../api/releases/_index.md) | `GET` requests are public by default. |
52-
| [Repositories API](../../api/repositories.md#generate-changelog-data) | Generates changelog data based on commits in a repository. |
53-
| [Secure files](../secure_files/_index.md#use-secure-files-in-cicd-jobs) | The `download-secure-files` tool authenticates with a CI/CD job token by default. |
54-
| [Terraform plan](../../user/infrastructure/_index.md) | |
55-
56-
Other API endpoints are not accessible using a job token. There is [a proposal](https://gitlab.com/groups/gitlab-org/-/epics/3559)
57-
to redesign the feature for more granular control of access permissions.
34+
## Job token access
35+
36+
CI/CD job tokens can access the following resources:
37+
38+
| Resource | Notes |
39+
| ----------------------------------------------------------------------------------------------------- | ----- |
40+
| [Container registry](../../user/packages/container_registry/build_and_push_images.md#use-gitlab-cicd) | Used as the `$CI_REGISTRY_PASSWORD` [predefined variable](../variables/predefined_variables.md) to authenticate with the container registry associated with the job's project. |
41+
| [Package registry](../../user/packages/package_registry/_index.md#to-build-packages) | Used to authenticate with the registry. |
42+
| [Terraform module registry](../../user/packages/terraform_module_registry/_index.md) | Used to authenticate with the registry. |
43+
| [Secure files](../secure_files/_index.md#use-secure-files-in-cicd-jobs) | Used by the [`download-secure-files`](https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files) tool to use secure files in jobs. |
44+
| [Container registry API](../../api/container_registry.md) | Can authenticate only with the container registry associated with the job's project. |
45+
| [Deployments API](../../api/deployments.md) | Can access all endpoints in this API. |
46+
| [Environments API](../../api/environments.md) | Can access all endpoints in this API. |
47+
| [Jobs API](../../api/jobs.md#get-job-tokens-job) | Can access only the `GET /job` endpoint. |
48+
| [Job artifacts API](../../api/job_artifacts.md) | Can access all endpoints in this API. |
49+
| [Packages API](../../api/packages.md) | Can access all endpoints in this API. |
50+
| [Pipeline trigger tokens API](../../api/pipeline_triggers.md#trigger-a-pipeline-with-a-token) | Can access only the `POST /projects/:id/trigger/pipeline` endpoint. |
51+
| [Pipelines API](../../api/pipelines.md#update-pipeline-metadata) | Can access only the `PUT /projects/:id/pipelines/:pipeline_id/metadata` endpoint. |
52+
| [Release links API](../../api/releases/links.md) | Can access all endpoints in this API. |
53+
| [Releases API](../../api/releases/_index.md) | Can access all endpoints in this API. |
54+
| [Repositories API](../../api/repositories.md#generate-changelog-data) | Can access only the `GET /projects/:id/repository/changelog` endpoint. |
55+
56+
An open [proposal](https://gitlab.com/groups/gitlab-org/-/epics/3559) exists to make permissions
57+
more granular.
5858

5959
## GitLab CI/CD job token security
6060

lib/gitlab/usage_data_counters/hll_redis_key_overrides.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,4 @@ i_container_registry_delete_repository_user-user: i_container_registry_delete_re
186186
i_container_registry_delete_tag_user-user: i_container_registry_delete_tag_user
187187
i_container_registry_push_repository_user-user: i_container_registry_push_repository_user
188188
i_container_registry_push_tag_user-user: i_container_registry_push_tag_user
189+
i_code_review_user_searches_diff-user: i_code_review_user_searches_diff

lib/gitlab/usage_data_counters/hll_redis_legacy_events.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@
157157
- i_code_review_user_resolve_thread_in_issue
158158
- i_code_review_user_review_requested
159159
- i_code_review_user_reviewers_changed
160-
- i_code_review_user_searches_diff
161160
- i_code_review_user_single_file_diffs
162161
- i_code_review_user_time_estimate_changed
163162
- i_code_review_user_time_spent_changed

locale/gitlab.pot

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5406,6 +5406,9 @@ msgstr ""
54065406
msgid "AiPowered|Assign seats"
54075407
msgstr ""
54085408

5409+
msgid "AiPowered|Beta Self-hosted models"
5410+
msgstr ""
5411+
54095412
msgid "AiPowered|By turning on these features, you accept the %{linkStart}GitLab Testing Agreement%{linkEnd}."
54105413
msgstr ""
54115414

@@ -5496,9 +5499,6 @@ msgstr ""
54965499
msgid "AiPowered|Self-hosted AI models"
54975500
msgstr ""
54985501

5499-
msgid "AiPowered|Self-hosted models"
5500-
msgstr ""
5501-
55025502
msgid "AiPowered|Setting unavailable"
55035503
msgstr ""
55045504

@@ -5514,7 +5514,7 @@ msgstr ""
55145514
msgid "AiPowered|Turn on experiment and beta GitLab Duo features"
55155515
msgstr ""
55165516

5517-
msgid "AiPowered|Use self-hosted models features"
5517+
msgid "AiPowered|Use beta self-hosted models features"
55185518
msgstr ""
55195519

55205520
msgid "AiPowered|View GitLab Duo settings"
@@ -19820,6 +19820,9 @@ msgstr ""
1982019820
msgid "Dependencies|Unknown path"
1982119821
msgstr ""
1982219822

19823+
msgid "Dependencies|View dependency paths"
19824+
msgstr ""
19825+
1982319826
msgid "Dependencies|Vulnerabilities"
1982419827
msgstr ""
1982519828

@@ -53534,6 +53537,9 @@ msgstr ""
5353453537
msgid "SecurityReports|Select dismissal reason"
5353553538
msgstr ""
5353653539

53540+
msgid "SecurityReports|Select project"
53541+
msgstr ""
53542+
5353753543
msgid "SecurityReports|Select severity"
5353853544
msgstr ""
5353953545

rubocop/cop/gitlab/mark_used_feature_flags.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ module Gitlab
1212
class MarkUsedFeatureFlags < RuboCop::Cop::Base
1313
include RuboCop::CodeReuseHelpers
1414

15-
FEATURE_CALLERS = %w[Feature Config::FeatureFlags].freeze
16-
FEATURE_METHODS = %i[enabled? disabled?].freeze
15+
FEATURE_CALLERS = %w[Feature Config::FeatureFlags Gitlab::AiGateway].freeze
16+
FEATURE_METHODS = %i[enabled? disabled? push_feature_flag].freeze
1717
EXPERIMENT_METHODS = %i[
1818
experiment
1919
].freeze

scripts/undercoverage

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,15 @@ compare_base = ARGV[0]
2323
compare_base ||= IO.popen(%w[git merge-base origin/master HEAD]) { |p| p.read.chomp }
2424
coverage_file_path = 'coverage/lcov/gitlab.lcov'
2525

26+
# By default undercover includes Ruby related files and only excludes common paths
27+
# like test, spec, *_spec.rb
28+
exclude_file_globs = Undercover::Options::DEFAULT_FILE_EXCLUDE_GLOBS.dup
29+
# We need to exclude more folders:
30+
exclude_file_globs.concat %w[ee/spec/* jh/spec/*] # These are specs too
31+
exclude_file_globs.concat %w[qa/* gem/* vendor/*] # These have own specs
32+
2633
result = if File.exist?(coverage_file_path)
27-
Undercover::CLI.run(%W[-c #{compare_base}])
34+
Undercover::CLI.run(%W[-c #{compare_base} --exclude-files #{exclude_file_globs.join(',')}])
2835
else
2936
warn "#{coverage_file_path} doesn't exist"
3037
0

spec/frontend/diffs/components/app_spec.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { getDiffFileMock } from 'jest/diffs/mock_data/diff_file';
3939
import waitForPromises from 'helpers/wait_for_promises';
4040
import { diffMetadata } from 'jest/diffs/mock_data/diff_metadata';
4141
import { pinia } from '~/pinia/instance';
42+
import { useMockInternalEventsTracking } from 'helpers/tracking_internal_events_helper';
4243
import createDiffsStore from '../create_diffs_store';
4344
import diffsMockData from '../mock_data/merge_request_diffs';
4445

@@ -1158,9 +1159,11 @@ describe('diffs/components/app', () => {
11581159
});
11591160
});
11601161

1161-
describe('track "trackRedisHllUserEvent" and "trackRedisCounterEvent" metrics', () => {
1162+
describe('event tracking', () => {
11621163
let mockGetTime;
11631164

1165+
const { bindInternalEventDocument } = useMockInternalEventsTracking();
1166+
11641167
beforeEach(() => {
11651168
jest.clearAllMocks();
11661169
mockGetTime = jest.spyOn(Date.prototype, 'getTime');
@@ -1178,16 +1181,20 @@ describe('diffs/components/app', () => {
11781181
};
11791182

11801183
it('should not track metrics if keydownTime is not set', async () => {
1184+
const { trackEventSpy } = bindInternalEventDocument(wrapper.element);
1185+
11811186
createComponent({ props: { shouldShow: true } });
11821187

11831188
await nextTick();
11841189
window.dispatchEvent(new Event('blur'));
11851190

1186-
expect(api.trackRedisHllUserEvent).not.toHaveBeenCalled();
1191+
expect(trackEventSpy).not.toHaveBeenCalled();
11871192
expect(api.trackRedisCounterEvent).not.toHaveBeenCalled();
11881193
});
11891194

11901195
it('should track metrics if delta is between 0 and 1000ms', async () => {
1196+
const { trackEventSpy } = bindInternalEventDocument(wrapper.element);
1197+
11911198
createComponent({ props: { shouldShow: true } });
11921199

11931200
// delta 500 ms
@@ -1196,11 +1203,13 @@ describe('diffs/components/app', () => {
11961203

11971204
window.dispatchEvent(new Event('blur'));
11981205

1199-
expect(api.trackRedisHllUserEvent).toHaveBeenCalledWith('i_code_review_user_searches_diff');
1206+
expect(trackEventSpy).toHaveBeenCalledWith('i_code_review_user_searches_diff', {}, undefined);
12001207
expect(api.trackRedisCounterEvent).toHaveBeenCalledWith('diff_searches');
12011208
});
12021209

12031210
it('should not track metrics if delta is greater than or equal to 1000ms', async () => {
1211+
const { trackEventSpy } = bindInternalEventDocument(wrapper.element);
1212+
12041213
createComponent({ props: { shouldShow: true } });
12051214

12061215
// delta 1050 ms
@@ -1209,11 +1218,13 @@ describe('diffs/components/app', () => {
12091218

12101219
window.dispatchEvent(new Event('blur'));
12111220

1212-
expect(api.trackRedisHllUserEvent).not.toHaveBeenCalled();
1221+
expect(trackEventSpy).not.toHaveBeenCalled();
12131222
expect(api.trackRedisCounterEvent).not.toHaveBeenCalled();
12141223
});
12151224

12161225
it('should not track metrics if delta is negative', async () => {
1226+
const { trackEventSpy } = bindInternalEventDocument(wrapper.element);
1227+
12171228
createComponent({ props: { shouldShow: true } });
12181229

12191230
// delta -500 ms
@@ -1222,7 +1233,7 @@ describe('diffs/components/app', () => {
12221233

12231234
window.dispatchEvent(new Event('blur'));
12241235

1225-
expect(api.trackRedisHllUserEvent).not.toHaveBeenCalled();
1236+
expect(trackEventSpy).not.toHaveBeenCalled();
12261237
expect(api.trackRedisCounterEvent).not.toHaveBeenCalled();
12271238
});
12281239
});

0 commit comments

Comments
 (0)