-
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.
Fixed parallel script for cypress tests in QA and buildkite (#169311)
Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Gloria Hornero <[email protected]> Co-authored-by: Maxim Palenov <[email protected]>
- Loading branch information
1 parent
bb3bbc9
commit ed4ef2a
Showing
44 changed files
with
1,227 additions
and
644 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
steps: | ||
- command: .buildkite/scripts/pipelines/security_solution_quality_gate/mki_security_solution_cypress.sh cypress:run:qa:serverless | ||
label: 'Serverless MKI QA Security Cypress Tests' | ||
agents: | ||
queue: n2-4-spot | ||
# TODO : Revise the timeout when the pipeline will be officially integrated with the quality gate. | ||
timeout_in_minutes: 300 | ||
parallelism: 6 | ||
retry: | ||
automatic: | ||
- exit_status: '*' | ||
limit: 1 | ||
|
||
- command: .buildkite/scripts/pipelines/security_solution_quality_gate/mki_security_solution_cypress.sh cypress:run:qa:serverless:explore | ||
label: 'Serverless MKI QA Explore - Security Solution Cypress Tests' | ||
agents: | ||
queue: n2-4-spot | ||
# TODO : Revise the timeout when the pipeline will be officially integrated with the quality gate. | ||
timeout_in_minutes: 300 | ||
parallelism: 4 | ||
retry: | ||
automatic: | ||
- exit_status: '*' | ||
limit: 1 | ||
|
||
- command: .buildkite/scripts/pipelines/security_solution_quality_gate/mki_security_solution_cypress.sh cypress:run:qa:serverless:investigations | ||
label: 'Serverless MKI QA Investigations - Security Solution Cypress Tests' | ||
agents: | ||
queue: n2-4-spot | ||
# TODO : Revise the timeout when the pipeline will be officially integrated with the quality gate. | ||
timeout_in_minutes: 300 | ||
parallelism: 8 | ||
retry: | ||
automatic: | ||
- exit_status: '*' | ||
limit: 1 |
24 changes: 24 additions & 0 deletions
24
.buildkite/scripts/pipelines/security_solution_quality_gate/mki_security_solution_cypress.sh
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,24 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
if [ -z "$1" ] | ||
then | ||
echo "No target script from the package.json file, is supplied" | ||
exit 1 | ||
fi | ||
|
||
source .buildkite/scripts/common/util.sh | ||
source .buildkite/scripts/steps/functional/common_cypress.sh | ||
.buildkite/scripts/bootstrap.sh | ||
|
||
export JOB=kibana-security-solution-chrome | ||
|
||
buildkite-agent meta-data set "${BUILDKITE_JOB_ID}_is_test_execution_step" "true" | ||
|
||
cd x-pack/test/security_solution_cypress | ||
set +e | ||
|
||
QA_API_KEY=$(retry 5 5 vault read -field=qa_api_key secret/kibana-issues/dev/security-solution-qg-enc-key) | ||
|
||
CLOUD_QA_API_KEY=$QA_API_KEY yarn $1; status=$?; yarn junit:merge || :; exit $status |
18 changes: 2 additions & 16 deletions
18
.buildkite/scripts/pipelines/security_solution_quality_gate/pipeline.sh
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 |
---|---|---|
@@ -1,19 +1,5 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
source .buildkite/scripts/common/util.sh | ||
source .buildkite/scripts/steps/functional/common_cypress.sh | ||
.buildkite/scripts/bootstrap.sh | ||
|
||
export JOB=kibana-security-solution-chrome | ||
|
||
buildkite-agent meta-data set "${BUILDKITE_JOB_ID}_is_test_execution_step" "true" | ||
|
||
echo "--- Serverless Security Second Quality Gate" | ||
cd x-pack/test/security_solution_cypress | ||
set +e | ||
|
||
VAULT_DEC_KEY=$(vault read -field=key secret/kibana-issues/dev/security-solution-qg-enc-key) | ||
ENV_PWD=$(echo $TEST_ENV_PWD | openssl aes-256-cbc -d -a -pass pass:$VAULT_DEC_KEY) | ||
set -euo pipefail | ||
|
||
CYPRESS_ELASTICSEARCH_URL=$TEST_ENV_ES_URL CYPRESS_BASE_URL=$TEST_ENV_KB_URL CYPRESS_ELASTICSEARCH_USERNAME=$TEST_ENV_USERNAME CYPRESS_ELASTICSEARCH_PASSWORD=$ENV_PWD CYPRESS_KIBANA_URL=$CYPRESS_BASE_URL yarn cypress:run:qa:serverless; status=$?; yarn junit:merge || :; exit $status | ||
ts-node .buildkite/scripts/pipelines/security_solution_quality_gate/pipeline.ts |
38 changes: 38 additions & 0 deletions
38
.buildkite/scripts/pipelines/security_solution_quality_gate/pipeline.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,38 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { execSync } from 'child_process'; | ||
import fs from 'fs'; | ||
|
||
const getPipeline = (filename: string, removeSteps = true) => { | ||
const str = fs.readFileSync(filename).toString(); | ||
return removeSteps ? str.replace(/^steps:/, '') : str; | ||
}; | ||
|
||
const uploadPipeline = (pipelineContent: string | object) => { | ||
const str = | ||
typeof pipelineContent === 'string' ? pipelineContent : JSON.stringify(pipelineContent); | ||
|
||
execSync('buildkite-agent pipeline upload', { | ||
input: str, | ||
stdio: ['pipe', 'inherit', 'inherit'], | ||
}); | ||
}; | ||
|
||
(async () => { | ||
try { | ||
const pipeline = []; | ||
|
||
pipeline.push(getPipeline('.buildkite/pipelines/security_solution/base.yml', false)); | ||
// remove duplicated steps | ||
uploadPipeline([...new Set(pipeline)].join('\n')); | ||
} catch (ex) { | ||
console.error('PR pipeline generation error', ex.message); | ||
process.exit(1); | ||
} | ||
})(); |
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
Oops, something went wrong.