From 272e56176fec6cedb0457f4262c1f16933440189 Mon Sep 17 00:00:00 2001 From: Artur Fedorov <afedorov@gitlab.com> Date: Tue, 30 Jan 2024 01:25:36 +0000 Subject: [PATCH] This MR fixes adding extra characters Extra characters are added when yaml is parsed for scan execution policy for ci/cd action Changelog: fixed EE: true --- .../scan_execution/action/code_block_action.vue | 8 ++------ .../scan_execution/action/code_block_action_spec.js | 9 +++------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_execution/action/code_block_action.vue b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_execution/action/code_block_action.vue index bc90c2db04ef5..de92f1755b337 100644 --- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_execution/action/code_block_action.vue +++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_execution/action/code_block_action.vue @@ -9,10 +9,7 @@ import { THOUSAND } from '~/lib/utils/constants'; import CodeBlockSourceSelector from 'ee/security_orchestration/components/policy_editor/scan_execution/action/code_block_source_selector.vue'; import PolicyPopover from 'ee/security_orchestration/components/policy_popover.vue'; import { parseCustomFileConfiguration } from 'ee/security_orchestration/components/policy_editor/utils'; -import { - buildCustomCodeAction, - toYaml, -} from 'ee/security_orchestration/components/policy_editor/scan_execution/lib'; +import { buildCustomCodeAction } from 'ee/security_orchestration/components/policy_editor/scan_execution/lib'; import SectionLayout from '../../section_layout.vue'; import { ACTION_AND_LABEL } from '../../constants'; import { @@ -140,10 +137,9 @@ export default { }, updateYaml(val) { this.yamlEditorValue = val; - const yaml = toYaml(val); this.triggerChanged({ - ci_configuration: yaml, + ci_configuration: val, }); }, setSelectedRef(ref) { diff --git a/ee/spec/frontend/security_orchestration/components/policy_editor/scan_execution/action/code_block_action_spec.js b/ee/spec/frontend/security_orchestration/components/policy_editor/scan_execution/action/code_block_action_spec.js index bdce96ab1cfd4..c53bd306ac339 100644 --- a/ee/spec/frontend/security_orchestration/components/policy_editor/scan_execution/action/code_block_action_spec.js +++ b/ee/spec/frontend/security_orchestration/components/policy_editor/scan_execution/action/code_block_action_spec.js @@ -2,10 +2,7 @@ import { GlSprintf } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import waitForPromises from 'helpers/wait_for_promises'; import Api from 'ee/api'; -import { - buildCustomCodeAction, - toYaml, -} from 'ee/security_orchestration/components/policy_editor/scan_execution/lib'; +import { buildCustomCodeAction } from 'ee/security_orchestration/components/policy_editor/scan_execution/lib'; import CodeBlockSourceSelector from 'ee/security_orchestration/components/policy_editor/scan_execution/action/code_block_source_selector.vue'; import CodeBlockAction from 'ee/security_orchestration/components/policy_editor/scan_execution/action/code_block_action.vue'; import CodeBlockFilePath from 'ee/security_orchestration/components/policy_editor/scan_execution/action/code_block_file_path.vue'; @@ -75,7 +72,7 @@ describe('CodeBlockAction', () => { await findYamlEditor().vm.$emit('input', fileContents); expect(findCodeBlockImport().props('hasExistingCode')).toBe(true); expect(wrapper.emitted('changed')).toEqual([ - [{ ...buildCustomCodeAction(), ci_configuration: toYaml(fileContents) }], + [{ ...buildCustomCodeAction(), ci_configuration: fileContents }], ]); }); @@ -86,7 +83,7 @@ describe('CodeBlockAction', () => { expect(findYamlEditor().props('value')).toBe(fileContents); expect(findCodeBlockImport().props('hasExistingCode')).toBe(true); expect(wrapper.emitted('changed')).toEqual([ - [{ ...buildCustomCodeAction(), ci_configuration: toYaml(fileContents) }], + [{ ...buildCustomCodeAction(), ci_configuration: fileContents }], ]); }); -- GitLab