Skip to content

Commit

Permalink
[8.x] [Search] Connectors docker instruction step, attempt fixing cod…
Browse files Browse the repository at this point in the history
…e scan… (#201440) (#201774)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Search] Connectors docker instruction step, attempt fixing code
scan… (#201440)](#201440)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Jedr
Blaszyk","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-26T12:33:48Z","message":"[Search]
Connectors docker instruction step, attempt fixing code scan…
(#201440)\n\n## Summary\r\n\r\nShould close
https://github.com/elastic/kibana-team/issues/1220\r\n\r\nEscape
backslashes as well, see:\r\n\r\n### Checklist\r\n\r\nCheck the PR
satisfies following conditions. \r\n\r\n### Verification\r\n\r\nVerified
manually that output command still works\r\n\r\nReviewers should verify
this PR satisfies this list as well.\r\n\r\n- [x] Any text added follows
[EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[x] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [x] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"bfbb02a9e5bdf7799ef20ebceb71d5dc8072aa55","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Search","backport:prev-minor"],"title":"[Search]
Connectors docker instruction step, attempt fixing code
scan…","number":201440,"url":"https://github.com/elastic/kibana/pull/201440","mergeCommit":{"message":"[Search]
Connectors docker instruction step, attempt fixing code scan…
(#201440)\n\n## Summary\r\n\r\nShould close
https://github.com/elastic/kibana-team/issues/1220\r\n\r\nEscape
backslashes as well, see:\r\n\r\n### Checklist\r\n\r\nCheck the PR
satisfies following conditions. \r\n\r\n### Verification\r\n\r\nVerified
manually that output command still works\r\n\r\nReviewers should verify
this PR satisfies this list as well.\r\n\r\n- [x] Any text added follows
[EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[x] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [x] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"bfbb02a9e5bdf7799ef20ebceb71d5dc8072aa55"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201440","number":201440,"mergeCommit":{"message":"[Search]
Connectors docker instruction step, attempt fixing code scan…
(#201440)\n\n## Summary\r\n\r\nShould close
https://github.com/elastic/kibana-team/issues/1220\r\n\r\nEscape
backslashes as well, see:\r\n\r\n### Checklist\r\n\r\nCheck the PR
satisfies following conditions. \r\n\r\n### Verification\r\n\r\nVerified
manually that output command still works\r\n\r\nReviewers should verify
this PR satisfies this list as well.\r\n\r\n- [x] Any text added follows
[EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[x] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [x] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"bfbb02a9e5bdf7799ef20ebceb71d5dc8072aa55"}}]}]
BACKPORT-->

Co-authored-by: Jedr Blaszyk <[email protected]>
  • Loading branch information
kibanamachine and jedrazb authored Nov 26, 2024
1 parent f0caabd commit 0087136
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export const DockerInstructionsStep: React.FC<DockerInstructionsStepProps> = ({
host: elasticsearchUrl,
});

const escapedConfigYamlContent = configYamlContent.replace(/"/g, '\\"').replace(/\$/g, '\\$');
const escapedConfigYamlContent = configYamlContent
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\$/g, '\\$');

const createConfigCommand = `mkdir -p "$HOME/elastic-connectors" && echo "${escapedConfigYamlContent}" > "$HOME/elastic-connectors/config.yml"`;

Expand Down

0 comments on commit 0087136

Please sign in to comment.