Skip to content

Commit d4e22f4

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent c185993 commit d4e22f4

File tree

80 files changed

+414
-245
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+414
-245
lines changed

.gitlab-ci.yml

-5
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ workflow:
3737
- if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^release-tools\/\d+\.\d+\.\d+-rc\d+$/ && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^[\d-]+-stable(-ee)?$/ && $CI_PROJECT_PATH == "gitlab-org/gitlab"'
3838
when: never
3939
# For merge requests running exclusively in Ruby 3.0
40-
- if: '($CI_MERGE_REQUEST_EVENT_TYPE == "merged_result" || $CI_MERGE_REQUEST_EVENT_TYPE == "merge_train") && $CI_MERGE_REQUEST_LABELS =~ /pipeline:run-in-ruby3/'
41-
variables:
42-
RUBY_VERSION: "3.0"
43-
PIPELINE_NAME: 'Ruby 3 $CI_MERGE_REQUEST_EVENT_TYPE MR pipeline'
44-
# For merge requests running exclusively in Ruby 3.0
4540
- if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-in-ruby3/'
4641
variables:
4742
RUBY_VERSION: "3.0"

.gitlab/ci/rules.gitlab-ci.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@
197197
- "spec/support/gitlab-git-test.git/**/*"
198198

199199
.yaml-lint-patterns: &yaml-lint-patterns
200-
- "*.yml"
201-
- "**/*.yml"
200+
- "**/*.{yml,yaml}{,.*}"
202201

203202
.lint-pipeline-yaml-patterns: &lint-pipeline-yaml-patterns
204203
- ".gitlab-ci.yml"

.rubocop_todo/security/io_methods.yml

-18
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,3 @@ Security/IoMethods:
44
Details: grace period
55
Exclude:
66
- 'db/migrate/20210301200959_init_schema.rb'
7-
- 'ee/lib/tasks/gitlab/spdx.rake'
8-
- 'ee/spec/factories/spdx_catalogue.rb'
9-
- 'ee/spec/lib/ee/gitlab/import_export/group/legacy_tree_saver_spec.rb'
10-
- 'ee/spec/lib/gitlab/spdx/catalogue_spec.rb'
11-
- 'lib/gitlab/import_export/json/legacy_reader.rb'
12-
- 'lib/gitlab/import_export/lfs_restorer.rb'
13-
- 'lib/tasks/gitlab/assets.rake'
14-
- 'spec/features/projects/import_export/export_file_spec.rb'
15-
- 'spec/lib/backup/gitaly_backup_spec.rb'
16-
- 'spec/lib/gitlab/import_export/group/legacy_tree_restorer_spec.rb'
17-
- 'spec/lib/gitlab/import_export/group/legacy_tree_saver_spec.rb'
18-
- 'spec/lib/gitlab/import_export/group/tree_restorer_spec.rb'
19-
- 'spec/lib/gitlab/import_export/import_test_coverage_spec.rb'
20-
- 'spec/lib/gitlab/import_export/json/legacy_writer_spec.rb'
21-
- 'spec/lib/gitlab/import_export/lfs_saver_spec.rb'
22-
- 'spec/lib/gitlab/import_export/project/relation_saver_spec.rb'
23-
- 'spec/support/helpers/gitaly_setup.rb'
24-
- 'spec/support/import_export/common_util.rb'

.yamllint

+19
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
extends: default
44

5+
yaml-files:
6+
# defaults
7+
- '*.yaml'
8+
- '*.yml'
9+
- '.yamllint'
10+
# match more extensions
11+
- '*.yaml.*'
12+
- '*.yml.*'
13+
514
# Ideally, we should have nothing in this ignore section.
615
#
716
# Please consider removing entries below by fixing them.
@@ -19,6 +28,16 @@ ignore: |
1928
# Broken on purpose (for testing)
2029
spec/fixtures/lib/gitlab/metrics/dashboard/broken_yml_syntax.yml
2130

31+
# Dynamic YAML files have syntax errors sometimes.
32+
*.erb
33+
34+
# Vim temporary files.
35+
*.sw[pon]
36+
37+
# Zipped files (by e.g. asset pipeline)
38+
*.gz
39+
*.bz2
40+
2241
#### Folders ####
2342
node_modules/
2443
tmp/

GITALY_SERVER_VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
38812995ea07e43b12b4151c24bf6b960a70f74d
1+
6d9ffab522aae0f2fac5d3ff152064f56b01081d

app/assets/javascripts/ci_secure_files/components/secure_files_list.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from '@gitlab/ui';
1414
import * as Sentry from '@sentry/browser';
1515
import Api, { DEFAULT_PER_PAGE } from '~/api';
16-
import httpStatusCodes from '~/lib/utils/http_status';
16+
import { HTTP_STATUS_PAYLOAD_TOO_LARGE } from '~/lib/utils/http_status';
1717
import { __, s__, sprintf } from '~/locale';
1818
import Tracking from '~/tracking';
1919
import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
@@ -145,7 +145,7 @@ export default {
145145
let message = '';
146146
if (error?.response?.data?.message?.name) {
147147
message = this.$options.i18n.uploadErrorMessages.duplicate;
148-
} else if (error.response.status === httpStatusCodes.PAYLOAD_TOO_LARGE) {
148+
} else if (error.response.status === HTTP_STATUS_PAYLOAD_TOO_LARGE) {
149149
message = sprintf(this.$options.i18n.uploadErrorMessages.tooLarge, {
150150
limit: this.fileSizeLimit,
151151
});

app/assets/javascripts/ide/stores/modules/terminal/actions/session_controls.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createAlert } from '~/flash';
22
import axios from '~/lib/utils/axios_utils';
3-
import httpStatus from '~/lib/utils/http_status';
3+
import httpStatus, { HTTP_STATUS_UNPROCESSABLE_ENTITY } from '~/lib/utils/http_status';
44
import * as terminalService from '../../../../services/terminals';
55
import { STARTING, STOPPING, STOPPED } from '../constants';
66
import * as messages from '../messages';
@@ -108,7 +108,7 @@ export const restartSession = ({ state, dispatch, rootState }) => {
108108
// We may have removed the build, in this case we'll just create a new session
109109
if (
110110
responseStatus === httpStatus.NOT_FOUND ||
111-
responseStatus === httpStatus.UNPROCESSABLE_ENTITY
111+
responseStatus === HTTP_STATUS_UNPROCESSABLE_ENTITY
112112
) {
113113
dispatch('startSession');
114114
} else {

app/assets/javascripts/ide/stores/modules/terminal/messages.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { escape } from 'lodash';
2-
import httpStatus from '~/lib/utils/http_status';
2+
import httpStatus, { HTTP_STATUS_UNPROCESSABLE_ENTITY } from '~/lib/utils/http_status';
33
import { __, sprintf } from '~/locale';
44

55
export const UNEXPECTED_ERROR_CONFIG = __(
@@ -28,7 +28,7 @@ export const ERROR_PERMISSION = __(
2828
);
2929

3030
export const configCheckError = (status, helpUrl) => {
31-
if (status === httpStatus.UNPROCESSABLE_ENTITY) {
31+
if (status === HTTP_STATUS_UNPROCESSABLE_ENTITY) {
3232
return sprintf(
3333
ERROR_CONFIG,
3434
{

app/assets/javascripts/import_entities/import_projects/store/actions.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import _ from 'lodash';
33
import { createAlert } from '~/flash';
44
import axios from '~/lib/utils/axios_utils';
55
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
6-
import httpStatusCodes from '~/lib/utils/http_status';
6+
import { HTTP_STATUS_TOO_MANY_REQUESTS } from '~/lib/utils/http_status';
77
import Poll from '~/lib/utils/poll';
88
import { capitalizeFirstCharacter } from '~/lib/utils/text_utility';
99
import { visitUrl, objectToQuery } from '~/lib/utils/url_utility';
@@ -16,7 +16,7 @@ let eTagPoll;
1616

1717
const hasRedirectInError = (e) => e?.response?.data?.error?.redirect;
1818
const redirectToUrlInError = (e) => visitUrl(e.response.data.error.redirect);
19-
const tooManyRequests = (e) => e.response.status === httpStatusCodes.TOO_MANY_REQUESTS;
19+
const tooManyRequests = (e) => e.response.status === HTTP_STATUS_TOO_MANY_REQUESTS;
2020
const pathWithParams = ({ path, ...params }) => {
2121
const filteredParams = Object.fromEntries(
2222
Object.entries(params).filter(([, value]) => value !== ''),
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,43 @@
1-
/**
2-
* exports HTTP status codes
3-
*/
1+
export const HTTP_STATUS_ABORTED = 0;
2+
export const HTTP_STATUS_CREATED = 201;
3+
export const HTTP_STATUS_ACCEPTED = 202;
4+
export const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION = 203;
5+
export const HTTP_STATUS_NO_CONTENT = 204;
6+
export const HTTP_STATUS_RESET_CONTENT = 205;
7+
export const HTTP_STATUS_PARTIAL_CONTENT = 206;
8+
export const HTTP_STATUS_MULTI_STATUS = 207;
9+
export const HTTP_STATUS_ALREADY_REPORTED = 208;
10+
export const HTTP_STATUS_IM_USED = 226;
11+
export const HTTP_STATUS_METHOD_NOT_ALLOWED = 405;
12+
export const HTTP_STATUS_CONFLICT = 409;
13+
export const HTTP_STATUS_GONE = 410;
14+
export const HTTP_STATUS_PAYLOAD_TOO_LARGE = 413;
15+
export const HTTP_STATUS_UNPROCESSABLE_ENTITY = 422;
16+
export const HTTP_STATUS_TOO_MANY_REQUESTS = 429;
417

18+
// TODO move the rest of the status codes to primitive constants
19+
// https://docs.gitlab.com/ee/development/fe_guide/style/javascript.html#export-constants-as-primitives
520
const httpStatusCodes = {
6-
ABORTED: 0,
721
OK: 200,
8-
CREATED: 201,
9-
ACCEPTED: 202,
10-
NON_AUTHORITATIVE_INFORMATION: 203,
11-
NO_CONTENT: 204,
12-
RESET_CONTENT: 205,
13-
PARTIAL_CONTENT: 206,
14-
MULTI_STATUS: 207,
15-
ALREADY_REPORTED: 208,
16-
IM_USED: 226,
17-
MULTIPLE_CHOICES: 300,
1822
BAD_REQUEST: 400,
1923
UNAUTHORIZED: 401,
2024
FORBIDDEN: 403,
2125
NOT_FOUND: 404,
22-
METHOD_NOT_ALLOWED: 405,
23-
CONFLICT: 409,
24-
GONE: 410,
25-
PAYLOAD_TOO_LARGE: 413,
26-
UNPROCESSABLE_ENTITY: 422,
27-
TOO_MANY_REQUESTS: 429,
2826
INTERNAL_SERVER_ERROR: 500,
2927
SERVICE_UNAVAILABLE: 503,
3028
};
3129

3230
export const successCodes = [
3331
httpStatusCodes.OK,
34-
httpStatusCodes.CREATED,
35-
httpStatusCodes.ACCEPTED,
36-
httpStatusCodes.NON_AUTHORITATIVE_INFORMATION,
37-
httpStatusCodes.NO_CONTENT,
38-
httpStatusCodes.RESET_CONTENT,
39-
httpStatusCodes.PARTIAL_CONTENT,
40-
httpStatusCodes.MULTI_STATUS,
41-
httpStatusCodes.ALREADY_REPORTED,
42-
httpStatusCodes.IM_USED,
32+
HTTP_STATUS_CREATED,
33+
HTTP_STATUS_ACCEPTED,
34+
HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION,
35+
HTTP_STATUS_NO_CONTENT,
36+
HTTP_STATUS_RESET_CONTENT,
37+
HTTP_STATUS_PARTIAL_CONTENT,
38+
HTTP_STATUS_MULTI_STATUS,
39+
HTTP_STATUS_ALREADY_REPORTED,
40+
HTTP_STATUS_IM_USED,
4341
];
4442

4543
export default httpStatusCodes;

app/assets/javascripts/lib/utils/poll.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { normalizeHeaders } from './common_utils';
2-
import httpStatusCodes, { successCodes } from './http_status';
2+
import { HTTP_STATUS_ABORTED, successCodes } from './http_status';
33

44
/**
55
* Polling utility for handling realtime updates.
@@ -108,7 +108,7 @@ export default class Poll {
108108
})
109109
.catch((error) => {
110110
notificationCallback(false);
111-
if (error.status === httpStatusCodes.ABORTED) {
111+
if (error.status === HTTP_STATUS_ABORTED) {
112112
return;
113113
}
114114
errorCallback(error);

app/assets/javascripts/monitoring/requests/index.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import axios from '~/lib/utils/axios_utils';
22
import { backOff } from '~/lib/utils/common_utils';
3-
import statusCodes from '~/lib/utils/http_status';
3+
import statusCodes, {
4+
HTTP_STATUS_NO_CONTENT,
5+
HTTP_STATUS_UNPROCESSABLE_ENTITY,
6+
} from '~/lib/utils/http_status';
47
import { PROMETHEUS_TIMEOUT } from '../constants';
58

69
const cancellableBackOffRequest = (makeRequestCallback) =>
710
backOff((next, stop) => {
811
makeRequestCallback()
912
.then((resp) => {
10-
if (resp.status === statusCodes.NO_CONTENT) {
13+
if (resp.status === HTTP_STATUS_NO_CONTENT) {
1114
next();
1215
} else {
1316
stop(resp);
@@ -34,7 +37,7 @@ export const getPrometheusQueryData = (prometheusEndpoint, params, opts) =>
3437
const { response = {} } = error;
3538
if (
3639
response.status === statusCodes.BAD_REQUEST ||
37-
response.status === statusCodes.UNPROCESSABLE_ENTITY ||
40+
response.status === HTTP_STATUS_UNPROCESSABLE_ENTITY ||
3841
response.status === statusCodes.SERVICE_UNAVAILABLE
3942
) {
4043
const { data } = response;

app/assets/javascripts/notes/components/comment_form.vue

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Autosave from '~/autosave';
77
import { refreshUserMergeRequestCounts } from '~/commons/nav/user_merge_requests';
88
import { createAlert } from '~/flash';
99
import { badgeState } from '~/issuable/components/status_box.vue';
10-
import httpStatusCodes from '~/lib/utils/http_status';
10+
import { HTTP_STATUS_UNPROCESSABLE_ENTITY } from '~/lib/utils/http_status';
1111
import {
1212
capitalizeFirstCharacter,
1313
convertToCamelCase,
@@ -28,8 +28,6 @@ import CommentTypeDropdown from './comment_type_dropdown.vue';
2828
import DiscussionLockedWidget from './discussion_locked_widget.vue';
2929
import NoteSignedOutWidget from './note_signed_out_widget.vue';
3030
31-
const { UNPROCESSABLE_ENTITY } = httpStatusCodes;
32-
3331
export default {
3432
name: 'CommentForm',
3533
i18n: COMMENT_FORM,
@@ -198,7 +196,7 @@ export default {
198196
'toggleIssueLocalState',
199197
]),
200198
handleSaveError({ data, status }) {
201-
if (status === UNPROCESSABLE_ENTITY && data.errors?.commands_only?.length) {
199+
if (status === HTTP_STATUS_UNPROCESSABLE_ENTITY && data.errors?.commands_only?.length) {
202200
this.errors = data.errors.commands_only;
203201
} else {
204202
this.errors = [this.$options.i18n.GENERIC_UNSUBMITTABLE_NETWORK];

app/assets/javascripts/notes/components/noteable_note.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import SafeHtml from '~/vue_shared/directives/safe_html';
77
import { confirmAction } from '~/lib/utils/confirm_via_gl_modal/confirm_via_gl_modal';
88
import { INLINE_DIFF_LINES_KEY } from '~/diffs/constants';
99
import { createAlert } from '~/flash';
10-
import httpStatusCodes from '~/lib/utils/http_status';
10+
import { HTTP_STATUS_GONE } from '~/lib/utils/http_status';
1111
import { ignoreWhilePending } from '~/lib/utils/ignore_while_pending';
1212
import { truncateSha } from '~/lib/utils/text_utility';
1313
import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue';
@@ -338,7 +338,7 @@ export default {
338338
callback();
339339
})
340340
.catch((response) => {
341-
if (response.status === httpStatusCodes.GONE) {
341+
if (response.status === HTTP_STATUS_GONE) {
342342
this.removeNote(this.note);
343343
this.updateSuccess();
344344
callback();

app/assets/javascripts/self_monitor/store/actions.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import axios from '~/lib/utils/axios_utils';
22
import { backOff } from '~/lib/utils/common_utils';
3-
import statusCodes from '~/lib/utils/http_status';
3+
import statusCodes, { HTTP_STATUS_ACCEPTED } from '~/lib/utils/http_status';
44
import { __, s__ } from '~/locale';
55
import * as types from './mutation_types';
66

@@ -10,7 +10,7 @@ function backOffRequest(makeRequestCallback) {
1010
return backOff((next, stop) => {
1111
makeRequestCallback()
1212
.then((resp) => {
13-
if (resp.status === statusCodes.ACCEPTED) {
13+
if (resp.status === HTTP_STATUS_ACCEPTED) {
1414
next();
1515
} else {
1616
stop(resp);
@@ -31,7 +31,7 @@ export const requestCreateProject = ({ dispatch, state, commit }) => {
3131
axios
3232
.post(state.createProjectEndpoint)
3333
.then((resp) => {
34-
if (resp.status === statusCodes.ACCEPTED) {
34+
if (resp.status === HTTP_STATUS_ACCEPTED) {
3535
dispatch('requestCreateProjectStatus', resp.data.job_id);
3636
}
3737
})
@@ -83,7 +83,7 @@ export const requestDeleteProject = ({ dispatch, state, commit }) => {
8383
axios
8484
.delete(state.deleteProjectEndpoint)
8585
.then((resp) => {
86-
if (resp.status === statusCodes.ACCEPTED) {
86+
if (resp.status === HTTP_STATUS_ACCEPTED) {
8787
dispatch('requestDeleteProjectStatus', resp.data.job_id);
8888
}
8989
})

app/assets/javascripts/vue_merge_request_widget/components/deployment/memory_usage.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script>
22
import { GlLoadingIcon, GlSprintf, GlLink } from '@gitlab/ui';
33
import { backOff } from '~/lib/utils/common_utils';
4-
import statusCodes from '~/lib/utils/http_status';
4+
import { HTTP_STATUS_NO_CONTENT } from '~/lib/utils/http_status';
55
import { bytesToMiB } from '~/lib/utils/number_utils';
66
import { s__ } from '~/locale';
77
import MemoryGraph from '~/vue_shared/components/memory_graph.vue';
@@ -107,7 +107,7 @@ export default {
107107
backOff((next, stop) => {
108108
MRWidgetService.fetchMetrics(this.metricsUrl)
109109
.then((res) => {
110-
if (res.status === statusCodes.NO_CONTENT) {
110+
if (res.status === HTTP_STATUS_NO_CONTENT) {
111111
this.backOffRequestCounter += 1;
112112
/* eslint-disable no-unused-expressions */
113113
this.backOffRequestCounter < 3 ? next() : stop(res);
@@ -118,7 +118,7 @@ export default {
118118
.catch(stop);
119119
})
120120
.then((res) => {
121-
if (res.status === statusCodes.NO_CONTENT) {
121+
if (res.status === HTTP_STATUS_NO_CONTENT) {
122122
return res;
123123
}
124124

app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from '~/lib/utils/axios_utils';
22
import { EXTENSION_ICONS } from '~/vue_merge_request_widget/constants';
33
import { SEVERITY_ICONS_MR_WIDGET } from '~/ci/reports/codequality_report/constants';
4-
import httpStatusCodes from '~/lib/utils/http_status';
4+
import { HTTP_STATUS_NO_CONTENT } from '~/lib/utils/http_status';
55
import { parseCodeclimateMetrics } from '~/ci/reports/codequality_report/store/utils/codequality_parser';
66
import { capitalizeFirstCharacter } from '~/lib/utils/text_utility';
77
import { i18n } from './constants';
@@ -43,7 +43,7 @@ export default {
4343
return {
4444
...response,
4545
data: {
46-
parsingInProgress: status === httpStatusCodes.NO_CONTENT,
46+
parsingInProgress: status === HTTP_STATUS_NO_CONTENT,
4747
resolvedErrors: parseCodeclimateMetrics(data.resolved_errors, this.blobPath.head_path),
4848
newErrors: parseCodeclimateMetrics(data.new_errors, this.blobPath.head_path),
4949
existingErrors: parseCodeclimateMetrics(data.existing_errors, this.blobPath.head_path),

0 commit comments

Comments
 (0)