Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2023-01-03 06:07:23 +00:00
parent cd6db2c5b4
commit 3d6bfb323c
20 changed files with 131 additions and 110 deletions

View File

@ -1 +1 @@
15.7.0
15.8.0-rc1

View File

@ -200,7 +200,7 @@ gem 'diffy', '~> 3.4'
gem 'diff_match_patch', '~> 0.1.0'
# Application server
gem 'rack', '~> 2.2.4'
gem 'rack', '~> 2.2.5'
# https://github.com/zombocom/rack-timeout/blob/master/README.md#rails-apps-manually
gem 'rack-timeout', '~> 0.6.3', require: 'rack/timeout/base'

View File

@ -440,7 +440,7 @@
{"name":"raabro","version":"1.4.0","platform":"ruby","checksum":"d4fa9ff5172391edb92b242eed8be802d1934b1464061ae5e70d80962c5da882"},
{"name":"racc","version":"1.6.1","platform":"java","checksum":"b3e9cc3892367fdd7eeef0c9210e9ab7f54f106b9202ed00efec892367f5bb27"},
{"name":"racc","version":"1.6.1","platform":"ruby","checksum":"c8226cc9788c8a43329b75f031dec9ae0423591534bd04e8a117653a442cc85c"},
{"name":"rack","version":"2.2.4","platform":"ruby","checksum":"ea2232b638cbd919129c8c8ad8012ecaccc09f848152a7e705d2139d0137ac2b"},
{"name":"rack","version":"2.2.5","platform":"ruby","checksum":"724426d0d1dd60f35247024413af93f8e1071c7cfe2c012e59503e5bd7f4b293"},
{"name":"rack-accept","version":"0.4.5","platform":"ruby","checksum":"66247b5449db64ebb93ae2ec4af4764b87d1ae8a7463c7c68893ac13fa8d4da2"},
{"name":"rack-attack","version":"6.6.1","platform":"ruby","checksum":"187e5d248c6a162ed8cafa8241a7b5947d9b9cf122a4870eb1cdd0db861f3a11"},
{"name":"rack-cors","version":"1.1.1","platform":"ruby","checksum":"4702644ac6d63ebbddff372a3cd4cd573513287e3524b5a5415f678970057a4b"},

View File

@ -1108,7 +1108,7 @@ GEM
pyu-ruby-sasl (0.0.3.3)
raabro (1.4.0)
racc (1.6.1)
rack (2.2.4)
rack (2.2.5)
rack-accept (0.4.5)
rack (>= 0.4)
rack-attack (6.6.1)
@ -1777,7 +1777,7 @@ DEPENDENCIES
pry-shell (~> 0.5.1)
puma (~> 5.6.5)
puma_worker_killer (~> 0.3.1)
rack (~> 2.2.4)
rack (~> 2.2.5)
rack-attack (~> 6.6.1)
rack-cors (~> 1.1.1)
rack-oauth2 (~> 1.21.3)

View File

@ -2,7 +2,6 @@
import { EDITOR_READY_EVENT } from '~/editor/constants';
import { CiSchemaExtension } from '~/editor/extensions/source_editor_ci_schema_ext';
import SourceEditor from '~/vue_shared/components/source_editor.vue';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { SOURCE_EDITOR_DEBOUNCE } from '../../constants';
export default {
@ -15,7 +14,6 @@ export default {
components: {
SourceEditor,
},
mixins: [glFeatureFlagMixin()],
inject: ['ciConfigPath'],
inheritAttrs: false,
methods: {
@ -23,10 +21,8 @@ export default {
this.$emit('updateCiConfig', content);
},
registerCiSchema({ detail: { instance } }) {
if (this.glFeatures.schemaLinting) {
instance.use({ definition: CiSchemaExtension });
instance.registerCiSchema();
}
instance.use({ definition: CiSchemaExtension });
instance.registerCiSchema();
},
},
readyEvent: EDITOR_READY_EVENT,

View File

@ -27,7 +27,6 @@ import { performanceMarkAndMeasure } from '~/performance/utils';
import ContentViewer from '~/vue_shared/components/content_viewer/content_viewer.vue';
import { viewerInformationForPath } from '~/vue_shared/components/content_viewer/lib/viewer_utils';
import DiffViewer from '~/vue_shared/components/diff_viewer/diff_viewer.vue';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import {
leftSidebarViews,
viewerTypes,
@ -55,7 +54,6 @@ export default {
DiffViewer,
FileTemplatesBar,
},
mixins: [glFeatureFlagMixin()],
props: {
file: {
type: Object,
@ -474,7 +472,7 @@ export default {
this.editor.registerCiSchema();
};
if (this.isCiConfigFile && this.glFeatures.schemaLinting) {
if (this.isCiConfigFile) {
registerLocalSchema();
} else {
if (this.CiSchemaExtension) {

View File

@ -10,7 +10,6 @@ class IdeController < ApplicationController
before_action do
push_frontend_feature_flag(:build_service_proxy)
push_frontend_feature_flag(:schema_linting)
push_frontend_feature_flag(:reject_unsigned_commits_by_gitlab)
define_index_vars
end

View File

@ -2,9 +2,6 @@
class Projects::Ci::PipelineEditorController < Projects::ApplicationController
before_action :check_can_collaborate!
before_action do
push_frontend_feature_flag(:schema_linting, @project)
end
feature_category :pipeline_authoring

View File

@ -299,6 +299,16 @@ class Projects::EnvironmentsController < Projects::ApplicationController
def authorize_update_environment!
access_denied! unless can?(current_user, :update_environment, environment)
end
def append_info_to_payload(payload)
super
return unless Feature.enabled?(:environments_search_logging) && params[:search]
# Merging to :metadata will ensure these are logged as top level keys
payload[:metadata] ||= {}
payload[:metadata]['meta.environment.search'] = params[:search]
end
end
Projects::EnvironmentsController.prepend_mod_with('Projects::EnvironmentsController')

View File

@ -33,9 +33,7 @@ module Ide
end
def predefined_schemas
return PREDEFINED_SCHEMAS if Feature.enabled?(:schema_linting)
[]
PREDEFINED_SCHEMAS
end
def get_cached(url)

View File

@ -1,8 +1,8 @@
---
name: schema_linting
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/35838
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/255919
milestone: '13.2'
name: environments_search_logging
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/107866
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/386778
milestone: '15.8'
type: development
group: group::editor
default_enabled: true
group: group::release
default_enabled: false

View File

@ -17,9 +17,6 @@ the authoring experience of our CI/CD configuration files. With the CI/CD schema
As the rules and keywords for configuring our CI/CD configuration files change, so too
should our CI/CD schema.
This feature is behind the [`schema_linting`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/feature_flags/development/schema_linting.yml)
feature flag for self-managed instances, and is enabled for GitLab.com.
## JSON Schemas
The CI/CD schema follows the [JSON Schema Draft-07](https://json-schema.org/draft-07/json-schema-release-notes.html)
@ -140,7 +137,6 @@ under the topmost **properties** key.
### Verify changes
1. Enable the `schema_linting` feature flag.
1. Go to **CI/CD** > **Editor**.
1. Write your CI/CD configuration in the editor and verify that the schema validates
it correctly.

View File

@ -99,13 +99,9 @@ same core features for highlighting and linking to particular lines in the edite
## Schema based validation
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/218472) validation based on predefined schemas in GitLab 13.2 [with a flag](../../../administration/feature_flags.md) named `schema_linting`. Disabled by default.
FLAG:
On self-managed GitLab, by default this feature is not available. To make it available for your entire instance, ask an administrator to [enable the feature flag](../../../administration/feature_flags.md) named `schema_linting`.
This feature cannot be enabled or disabled per-project.
On GitLab.com, this feature is available.
You should not use this feature for production environments.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/218472) validation based on predefined schemas in GitLab 13.2 [with a flag](../../../administration/feature_flags.md) named `schema_linting`.
> - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/104399) in GitLab 15.7.
> - On self-managed GitLab [enabled by default](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/107488) in GitLab 15.8.
The Web IDE provides validation support for certain JSON and YAML files using schemas
based on the [JSON Schema Store](https://www.schemastore.org/json/).

View File

@ -13377,6 +13377,9 @@ msgstr ""
msgid "Dependencies|Dependency path"
msgstr ""
msgid "Dependencies|Error exporting the dependency list. Please reload the page."
msgstr ""
msgid "Dependencies|Export as JSON"
msgstr ""

View File

@ -20,12 +20,12 @@ gem 'parallel_tests', '~> 4.0'
gem 'rotp', '~> 6.2.2'
gem 'parallel', '~> 1.22', '>= 1.22.1'
gem 'rainbow', '~> 3.1.1'
gem 'rspec-parameterized', '~> 0.5.2'
gem 'rspec-parameterized', '~> 0.5.3'
gem 'octokit', '~> 6.0.1'
gem "faraday-retry", "~> 2.0"
gem 'webdrivers', '~> 5.2'
gem 'zeitwerk', '~> 2.6', '>= 2.6.6'
gem 'influxdb-client', '~> 2.8'
gem 'influxdb-client', '~> 2.9'
gem 'terminal-table', '~> 3.0.2', require: false
gem 'slack-notifier', '~> 2.4', require: false
gem 'fog-google', '~> 1.19', require: false

View File

@ -25,7 +25,8 @@ GEM
rspec-expectations (~> 3.12)
uuid (>= 2.3, < 3)
ast (2.4.2)
binding_ninja (0.2.3)
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
builder (3.2.4)
byebug (11.1.3)
capybara (3.38.0)
@ -54,6 +55,7 @@ GEM
confiner (0.4.0)
gitlab (>= 4.17)
zeitwerk (>= 2.5, < 3)
debug_inspector (1.1.0)
declarative (0.0.20)
deprecation_toolkit (2.0.1)
activesupport (>= 5.2)
@ -189,7 +191,7 @@ GEM
parallel (1.22.1)
parallel_tests (4.0.0)
parallel
parser (3.1.2.1)
parser (3.1.3.0)
ast (~> 2.4.1)
proc_to_ast (0.1.0)
coderay
@ -234,8 +236,8 @@ GEM
rspec-mocks (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-parameterized (0.5.2)
binding_ninja (>= 0.2.3)
rspec-parameterized (0.5.3)
binding_of_caller
parser
proc_to_ast
rspec (>= 2.13, < 4)
@ -311,7 +313,7 @@ DEPENDENCIES
fog-core (= 2.1.0)
fog-google (~> 1.19)
gitlab-qa (~> 8, >= 8.14.1)
influxdb-client (~> 2.8)
influxdb-client (~> 2.9)
knapsack (~> 4.0)
nokogiri (~> 1.13, >= 1.13.10)
octokit (~> 6.0.1)
@ -323,7 +325,7 @@ DEPENDENCIES
rest-client (~> 2.1.0)
rotp (~> 6.2.2)
rspec (~> 3.12)
rspec-parameterized (~> 0.5.2)
rspec-parameterized (~> 0.5.3)
rspec-retry (~> 0.6.2)
rspec_junit_formatter (~> 0.6.0)
ruby-debug-ide (~> 0.7.3)

View File

@ -998,6 +998,70 @@ RSpec.describe Projects::EnvironmentsController do
end
end
describe '#append_info_to_payload' do
let(:search_param) { 'my search param' }
context 'when search_environment_logging feature is disabled' do
before do
stub_feature_flags(environments_search_logging: false)
end
it 'does not log search params in meta.environment.search' do
expect(controller).to receive(:append_info_to_payload).and_wrap_original do |method, payload|
method.call(payload)
expect(payload[:metadata]['meta.environment.search']).to be_nil
expect(payload[:action]).to eq("search")
expect(payload[:controller]).to eq("Projects::EnvironmentsController")
end
get :search, params: environment_params(format: :json, search: search_param)
end
it 'logs params correctly when search params are missing' do
expect(controller).to receive(:append_info_to_payload).and_wrap_original do |method, payload|
method.call(payload)
expect(payload[:metadata]['meta.environment.search']).to be_nil
expect(payload[:action]).to eq("search")
expect(payload[:controller]).to eq("Projects::EnvironmentsController")
end
get :search, params: environment_params(format: :json)
end
end
context 'when search_environment_logging feature is enabled' do
before do
stub_feature_flags(environments_search_logging: true)
end
it 'logs search params in meta.environment.search' do
expect(controller).to receive(:append_info_to_payload).and_wrap_original do |method, payload|
method.call(payload)
expect(payload[:metadata]['meta.environment.search']).to eq(search_param)
expect(payload[:action]).to eq("search")
expect(payload[:controller]).to eq("Projects::EnvironmentsController")
end
get :search, params: environment_params(format: :json, search: search_param)
end
it 'logs params correctly when search params are missing' do
expect(controller).to receive(:append_info_to_payload).and_wrap_original do |method, payload|
method.call(payload)
expect(payload[:metadata]['meta.environment.search']).to be_nil
expect(payload[:action]).to eq("search")
expect(payload[:controller]).to eq("Projects::EnvironmentsController")
end
get :search, params: environment_params(format: :json)
end
end
end
def environment_params(opts = {})
opts.reverse_merge(namespace_id: project.namespace,
project_id: project,

View File

@ -26,14 +26,13 @@ describe('Pipeline Editor | Text editor component', () => {
props: ['value', 'fileName', 'editorOptions', 'debounceValue'],
};
const createComponent = (glFeatures = {}, mountFn = shallowMount) => {
const createComponent = (mountFn = shallowMount) => {
wrapper = mountFn(TextEditor, {
provide: {
projectPath: mockProjectPath,
projectNamespace: mockProjectNamespace,
ciConfigPath: mockCiConfigPath,
defaultBranch: mockDefaultBranch,
glFeatures,
},
propsData: {
commitSha: mockCommitSha,
@ -107,28 +106,14 @@ describe('Pipeline Editor | Text editor component', () => {
});
describe('CI schema', () => {
describe('when `schema_linting` feature flag is on', () => {
beforeEach(() => {
createComponent({ schemaLinting: true });
findEditor().vm.$emit(EDITOR_READY_EVENT, editorInstanceDetail);
});
it('configures editor with syntax highlight', () => {
expect(mockUse).toHaveBeenCalledTimes(1);
expect(mockRegisterCiSchema).toHaveBeenCalledTimes(1);
});
beforeEach(() => {
createComponent();
findEditor().vm.$emit(EDITOR_READY_EVENT, editorInstanceDetail);
});
describe('when `schema_linting` feature flag is off', () => {
beforeEach(() => {
createComponent();
findEditor().vm.$emit(EDITOR_READY_EVENT, editorInstanceDetail);
});
it('does not call the register CI schema function', () => {
expect(mockUse).not.toHaveBeenCalled();
expect(mockRegisterCiSchema).not.toHaveBeenCalled();
});
it('configures editor with syntax highlight', () => {
expect(mockUse).toHaveBeenCalledTimes(1);
expect(mockRegisterCiSchema).toHaveBeenCalledTimes(1);
});
});
});

View File

@ -122,7 +122,7 @@ describe('RepoEditor', () => {
vm.$once('editorSetup', resolve);
});
const createComponent = async ({ state = {}, activeFile = dummyFile.text, flags = {} } = {}) => {
const createComponent = async ({ state = {}, activeFile = dummyFile.text } = {}) => {
const store = prepareStore(state, activeFile);
wrapper = shallowMount(RepoEditor, {
store,
@ -132,9 +132,6 @@ describe('RepoEditor', () => {
mocks: {
ContentViewer,
},
provide: {
glFeatures: flags,
},
});
await waitForPromises();
vm = wrapper.vm;
@ -196,12 +193,8 @@ describe('RepoEditor', () => {
});
describe('schema registration for .gitlab-ci.yml', () => {
const setup = async (activeFile, flagIsOn = true) => {
await createComponent({
flags: {
schemaLinting: flagIsOn,
},
});
const setup = async (activeFile) => {
await createComponent();
vm.editor.registerCiSchema = jest.fn();
if (activeFile) {
wrapper.setProps({ file: activeFile });
@ -210,15 +203,13 @@ describe('RepoEditor', () => {
await nextTick();
};
it.each`
flagIsOn | activeFile | shouldUseExtension | desc
${false} | ${dummyFile.markdown} | ${false} | ${`file is not CI config; should NOT`}
${true} | ${dummyFile.markdown} | ${false} | ${`file is not CI config; should NOT`}
${false} | ${dummyFile.ciConfig} | ${false} | ${`file is CI config; should NOT`}
${true} | ${dummyFile.ciConfig} | ${true} | ${`file is CI config; should`}
activeFile | shouldUseExtension | desc
${dummyFile.markdown} | ${false} | ${`file is not CI config; should NOT`}
${dummyFile.ciConfig} | ${true} | ${`file is CI config; should`}
`(
'when the flag is "$flagIsOn", $desc use extension',
async ({ flagIsOn, activeFile, shouldUseExtension }) => {
await setup(activeFile, flagIsOn);
'when the activeFile is "$activeFile", $desc use extension',
async ({ activeFile, shouldUseExtension }) => {
await setup(activeFile);
if (shouldUseExtension) {
expect(applyExtensionSpy).toHaveBeenCalledWith({

View File

@ -20,35 +20,21 @@ RSpec.describe Ide::SchemasConfigService do
subject { described_class.new(project, user, filename: filename).execute }
context 'feature flag schema_linting is enabled', unless: Gitlab.ee? do
before do
stub_feature_flags(schema_linting: true)
end
context 'when no predefined schema exists for the given filename' do
it 'returns an empty object' do
is_expected.to include(
status: :success,
schema: {})
end
end
context 'when a predefined schema exists for the given filename' do
let(:filename) { '.gitlab-ci.yml' }
it 'uses predefined schema matches' do
expect(Gitlab::HTTP).to receive(:get).with('https://json.schemastore.org/gitlab-ci')
expect(subject[:schema]['title']).to eq "Sample schema"
end
end
end
context 'feature flag schema_linting is disabled', unless: Gitlab.ee? do
context 'when no predefined schema exists for the given filename', unless: Gitlab.ee? do
it 'returns an empty object' do
is_expected.to include(
status: :success,
schema: {})
end
end
context 'when a predefined schema exists for the given filename' do
let(:filename) { '.gitlab-ci.yml' }
it 'uses predefined schema matches' do
expect(Gitlab::HTTP).to receive(:get).with('https://json.schemastore.org/gitlab-ci')
expect(subject[:schema]['title']).to eq "Sample schema"
end
end
end
end