-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution][Endpoint] several refactors of CLI tooling and as…
…sociated common services (#169987) ## Summary PR makes a series of refactors to CLI scripts and common services used in CLI scripts and CI, including: - Standard interface for interacting with Host VMs that abstracts away the need to know what VM manager was used to start that VM - Reduce/eliminate the need to have conditional code when interacting directly with a VM (ex. executing bash commands, stop/kill/delete VM, etc) - Removed use of `endpoint_agent_runner` (CLI script) private implementation methods from Cypress and replace them with calls to common services - Removed duplicate code from `endpoint_agent_runner` CLI script and replace it with calls to common services - Enhanced the `run_sentinelone_host.js` script so that it also ensures that the SentinenlOne fleet integration/policy (agentless policy) has at least one VM host running - The VM ensures that the data from S1 is pulled into ES - FYI: once changes for SentinelOne are merged and the Connector available, script will also be updated to create an SentinelOne connector instance under `"Stack Management > Connectors"` - Added support for `WITH_FLEET_SERVER` to the Cypress config. When set to `true`, fleet server will be automatically started and connected to the stack - Cypress parallel runner will now start fleet if this variable is true, right after setting up the stack
- Loading branch information
1 parent
49b4882
commit 8613b0f
Showing
36 changed files
with
975 additions
and
1,254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
x-pack/plugins/security_solution/public/management/cypress/support/common.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { prefixedOutputLogger } from '../../../../scripts/endpoint/common/utils'; | ||
import type { RuntimeServices } from '../../../../scripts/endpoint/common/stack_services'; | ||
import { createRuntimeServices } from '../../../../scripts/endpoint/common/stack_services'; | ||
|
||
const RUNTIME_SERVICES_CACHE = new WeakMap<Cypress.PluginConfigOptions, RuntimeServices>(); | ||
|
||
export const setupStackServicesUsingCypressConfig = async (config: Cypress.PluginConfigOptions) => { | ||
if (RUNTIME_SERVICES_CACHE.has(config)) { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
return RUNTIME_SERVICES_CACHE.get(config)!; | ||
} | ||
|
||
const stackServices = await createRuntimeServices({ | ||
kibanaUrl: config.env.KIBANA_URL, | ||
elasticsearchUrl: config.env.ELASTICSEARCH_URL, | ||
fleetServerUrl: config.env.FLEET_SERVER_URL, | ||
username: config.env.KIBANA_USERNAME, | ||
password: config.env.KIBANA_PASSWORD, | ||
esUsername: config.env.ELASTICSEARCH_USERNAME, | ||
esPassword: config.env.ELASTICSEARCH_PASSWORD, | ||
asSuperuser: true, | ||
}).then(({ log, ...others }) => { | ||
return { | ||
...others, | ||
log: prefixedOutputLogger('cy.dfw', log), | ||
}; | ||
}); | ||
|
||
RUNTIME_SERVICES_CACHE.set(config, stackServices); | ||
|
||
return stackServices; | ||
}; |
Oops, something went wrong.