Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-02-16 09:18:00 +00:00
parent 8858979899
commit 6259da15b5
14 changed files with 94 additions and 49 deletions

View File

@ -1,7 +1,12 @@
<script>
import { GlAlert, GlCard, GlToggle, GlLink, GlSkeletonLoader } from '@gitlab/ui';
import * as Sentry from '@sentry/browser';
import Tracking from '~/tracking';
import { __ } from '~/locale';
import {
TRACK_TOGGLE_TRAINING_PROVIDER_ACTION,
TRACK_TOGGLE_TRAINING_PROVIDER_LABEL,
} from '~/security_configuration/constants';
import dismissUserCalloutMutation from '~/graphql_shared/mutations/dismiss_user_callout.mutation.graphql';
import securityTrainingProvidersQuery from '../graphql/security_training_providers.query.graphql';
import configureSecurityTrainingProvidersMutation from '../graphql/configure_security_training_providers.mutation.graphql';
@ -23,6 +28,7 @@ export default {
GlLink,
GlSkeletonLoader,
},
mixins: [Tracking.mixin()],
inject: ['projectFullPath'],
apollo: {
securityTrainingProviders: {
@ -93,9 +99,14 @@ export default {
.filter(({ isEnabled }) => isEnabled)
.map(({ id }) => id);
this.storeEnabledProviders(toggledProviders, enabledProviderIds);
const { isEnabled: selectedProviderIsEnabled } = toggledProviders.find(
(provider) => provider.id === selectedProviderId,
);
this.trackProviderToggle(selectedProviderId, selectedProviderIsEnabled);
this.storeEnabledProviders(enabledProviderIds);
},
async storeEnabledProviders(toggledProviders, enabledProviderIds) {
async storeEnabledProviders(enabledProviderIds) {
this.toggleLoading = true;
try {
@ -125,6 +136,15 @@ export default {
this.toggleLoading = false;
}
},
trackProviderToggle(providerId, providerIsEnabled) {
this.track(TRACK_TOGGLE_TRAINING_PROVIDER_ACTION, {
label: TRACK_TOGGLE_TRAINING_PROVIDER_LABEL,
property: providerId,
extra: {
providerIsEnabled,
},
});
},
},
i18n,
};

View File

@ -0,0 +1,2 @@
export const TRACK_TOGGLE_TRAINING_PROVIDER_ACTION = 'toggle_security_training_provider';
export const TRACK_TOGGLE_TRAINING_PROVIDER_LABEL = 'update_security_training_provider';

View File

@ -1,8 +0,0 @@
---
name: json_limited_encoder
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38687
rollout_issue_url:
milestone: '13.3'
type: development
group: group::source code
default_enabled: true

View File

@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/350830
milestone: '14.8'
type: development
group: group::product planning
default_enabled: false
default_enabled: true

View File

@ -0,0 +1,19 @@
- name: "Configurable Gitaly `per_repository` election strategy" # The name of the feature to be deprecated
announcement_milestone: "14.8" # The milestone when this feature was first announced as deprecated.
announcement_date: "2022-02-22" # The date of the milestone release when this feature was first announced as deprecated. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
removal_milestone: "14.9" # The milestone when this feature is planned to be removed
removal_date: "2022-03-22" # The date of the milestone release when this feature is planned to be removed. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
breaking_change: false # If this deprecation is a breaking change, set this value to true
reporter: mjwood # GitLab username of the person reporting the deprecation
body: | # Do not modify this line, instead modify the lines below.
Configuring the `per_repository` Gitaly election strategy is [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/352612).
`per_repository` has been the only option since GitLab 14.0.
This change is part of regular maintenance to keep our codebase clean.
# The following items are not published on the docs page, but may be used in the future.
stage: # (optional - may be required in the future) String value of the stage that the feature was created in. e.g., Growth
tiers: # (optional - may be required in the future) An array of tiers that the feature is available in currently. e.g., [Free, Silver, Gold, Core, Premium, Ultimate]
issue_url: "https://gitlab.com/gitlab-org/gitlab/-/issues/352612" # (optional) This is a link to the deprecation issue in GitLab
documentation_url: # (optional) This is a link to the current documentation page
image_url: # (optional) This is a link to a thumbnail image depicting the feature
video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

View File

@ -65,27 +65,3 @@ If the app install failed, you might need to delete `jira_connect_installations`
1. Open the [database console](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/postgresql.md#access-postgresql).
1. Run `TRUNCATE TABLE jira_connect_installations CASCADE;`.
## Add a namespace
To add a [namespace](../../user/group/index.md#namespaces) to Jira:
1. Make sure you are logged in on your GitLab development instance.
1. On the GitLab app page in Jira, click **Get started**.
1. Open your browser's developer tools and navigate to the **Network** tab.
1. Try to add the namespace in Jira.
1. If the request fails with 401 "not authorized", copy the request as a cURL command
and paste it in your terminal.
![Example Vulnerability](img/copy_curl.png)
1. Go to your development instance (usually at: <http://localhost:3000>), open developer
tools, navigate to the Network tab and reload the page.
1. Copy all cookies from the first request.
![Example Vulnerability](img/copy_cookies.png)
1. Append the cookies to the cURL command in your terminal:
`--cookies "<cookies from the request>"`.
1. Submit the cURL request.
1. If the response is `{"success":true}`, the namespace was added.

View File

@ -727,6 +727,15 @@ The `merged_by` field in the [merge request API](https://docs.gitlab.com/ee/api/
## 14.8
### Configurable Gitaly `per_repository` election strategy
Configuring the `per_repository` Gitaly election strategy is [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/352612).
`per_repository` has been the only option since GitLab 14.0.
This change is part of regular maintenance to keep our codebase clean.
**Planned removal milestone: 14.9 (2022-03-22)**
### Container Network and Host Security
WARNING:

View File

@ -637,7 +637,7 @@ To restrict group access by IP address:
1. Go to the group's **Settings > General** page.
1. Expand the **Permissions and group features** section.
1. In the **Allow access to the following IP addresses** field, enter IP address ranges in CIDR notation.
1. In the **Allow access to the following IP addresses** field, enter IPv4 or IPv6 address ranges in CIDR notation.
1. Select **Save changes**.
![Domain restriction by IP address](img/restrict-by-ip.gif)

View File

@ -248,8 +248,6 @@ module Gitlab
# @return [String]
# @raise [LimitExceeded] if the resulting json string is bigger than the specified limit
def self.encode(object, limit: 25.megabytes)
return ::Gitlab::Json.dump(object) unless Feature.enabled?(:json_limited_encoder, default_enabled: :yaml)
buffer = StringIO.new
buffer_size = 0

View File

@ -11,7 +11,7 @@ module QA
end
context 'when a user does not have permissions to commit to the project' do
let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) }
let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_6, Runtime::Env.gitlab_qa_password_6) }
context 'when no fork is present' do
it 'suggests to create a fork when a user clicks Web IDE in the main project', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347823' do
@ -45,6 +45,10 @@ module QA
submit_merge_request_upstream
end
after do
fork_project.project.remove_via_api!
end
end
def submit_merge_request_upstream

View File

@ -4,6 +4,11 @@ import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper';
import { mockTracking, unmockTracking } from 'helpers/tracking_helper';
import {
TRACK_TOGGLE_TRAINING_PROVIDER_ACTION,
TRACK_TOGGLE_TRAINING_PROVIDER_LABEL,
} from '~/security_configuration/constants';
import TrainingProviderList from '~/security_configuration/components/training_provider_list.vue';
import securityTrainingProvidersQuery from '~/security_configuration/graphql/security_training_providers.query.graphql';
import configureSecurityTrainingProvidersMutation from '~/security_configuration/graphql/configure_security_training_providers.mutation.graphql';
@ -197,6 +202,36 @@ describe('TrainingProviderList component', () => {
);
});
});
describe('metrics', () => {
let trackingSpy;
beforeEach(() => {
trackingSpy = mockTracking(undefined, wrapper.element, jest.spyOn);
});
afterEach(() => {
unmockTracking();
});
it('tracks when a provider gets toggled', () => {
expect(trackingSpy).not.toHaveBeenCalled();
toggleFirstProvider();
// Note: Ideally we also want to test that the tracking event is called correctly when a
// provider gets disabled, but that's a bit tricky to do with the current implementation
// Once https://gitlab.com/gitlab-org/gitlab/-/issues/348985 and https://gitlab.com/gitlab-org/gitlab/-/merge_requests/79492
// are merged this will be much easer to do and should be tackled then.
expect(trackingSpy).toHaveBeenCalledWith(undefined, TRACK_TOGGLE_TRAINING_PROVIDER_ACTION, {
property: securityTrainingProviders[0].id,
label: TRACK_TOGGLE_TRAINING_PROVIDER_LABEL,
extra: {
providerIsEnabled: true,
},
});
});
});
});
describe('with errors', () => {

View File

@ -440,15 +440,5 @@ RSpec.describe Gitlab::Json do
expect(subject.size).to eq(10001)
end
end
context 'when json_limited_encoder is disabled' do
let(:obj) { [{ test: true }] * 1000 }
it 'does not raise an error' do
stub_feature_flags(json_limited_encoder: false)
expect { subject }.not_to raise_error
end
end
end
end