-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci(jenkins): use e2e in the CI #61803
Changes from 91 commits
4bae6fd
05e22f8
45232cd
4013ae4
3cf7bf0
61a50d0
20ce71c
037b564
7139757
f83f482
6c5cfc3
26d1761
d5aa1db
bb22a3a
ec90cf8
f96e607
b0c0cb7
8fc8a91
090d8ee
04290d2
dbc7954
a80d57d
7e231e9
09fd045
481c1ed
a005714
ce3c8eb
9e8eea0
d9e0171
b86ff90
4a1d5d4
d23292d
7afbc66
a4275f3
00e6451
ace28cc
6d864ed
f097ae5
7e1b9e2
cc55d56
7c093ca
3184a6d
aff4179
d9c81ee
1e0b5c8
cf4bcae
446294a
84bb7fd
6817ae3
6881ef7
121c126
6a6a7ba
69fc229
332d393
b721ead
6c547f6
ece4252
9fd0379
3afa558
3f879cb
b13329d
8ec28fa
3dd525f
858b3ba
22157c4
ffe36f9
4d2eb75
e9f5f30
e72671f
95632e5
17b1ba6
708dd4f
dc8bdb3
2802f68
c485f8e
a5804df
1ee2c72
72f2d03
6f5f191
820ec18
8de482f
f01e536
943a498
2d22dcb
24bee1e
3c73771
caf6abc
5b7aeac
963e38c
814e7ac
69de467
7c6ffa3
250f73e
81f5c92
98593d3
833c93f
765bfe3
0dd3b32
a199d72
4a979a7
37c5e6b
58bdbbd
7f58702
4dea197
cc989ab
09c75f3
c3a465b
53f7ad6
7e1645b
fe4ed15
b405ec5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,7 @@ pipeline { | |
environment { | ||
BASE_DIR = 'src/github.com/elastic/kibana' | ||
HOME = "${env.WORKSPACE}" | ||
APM_ITS = 'apm-integration-testing' | ||
CYPRESS_DIR = 'x-pack/legacy/plugins/apm/e2e' | ||
E2E_DIR = 'x-pack/legacy/plugins/apm/e2e' | ||
PIPELINE_LOG_LEVEL = 'DEBUG' | ||
} | ||
options { | ||
|
@@ -43,32 +42,6 @@ pipeline { | |
env.APM_UPDATED = isGitRegionMatch(patterns: regexps) | ||
} | ||
} | ||
dir("${APM_ITS}"){ | ||
git changelog: false, | ||
credentialsId: 'f6c7695a-671e-4f4f-a331-acdce44ff9ba', | ||
poll: false, | ||
url: "git@github.com:elastic/${APM_ITS}.git" | ||
} | ||
} | ||
} | ||
stage('Start services') { | ||
options { skipDefaultCheckout() } | ||
when { | ||
anyOf { | ||
expression { return params.FORCE } | ||
expression { return env.APM_UPDATED != "false" } | ||
} | ||
} | ||
steps { | ||
notifyStatus('Starting services', 'PENDING') | ||
dir("${APM_ITS}"){ | ||
sh './scripts/compose.py start master --no-kibana' | ||
} | ||
} | ||
post { | ||
unsuccessful { | ||
notifyStatus('Environmental issue', 'FAILURE') | ||
} | ||
} | ||
} | ||
stage('Prepare Kibana') { | ||
|
@@ -85,7 +58,7 @@ pipeline { | |
steps { | ||
notifyStatus('Preparing kibana', 'PENDING') | ||
dir("${BASE_DIR}"){ | ||
sh script: "${CYPRESS_DIR}/ci/prepare-kibana.sh" | ||
sh "${E2E_DIR}/ci/prepare-kibana.sh" | ||
} | ||
} | ||
post { | ||
|
@@ -105,24 +78,27 @@ pipeline { | |
steps{ | ||
notifyStatus('Running smoke tests', 'PENDING') | ||
dir("${BASE_DIR}"){ | ||
sh ''' | ||
jobs -l | ||
docker build --tag cypress --build-arg NODE_VERSION=$(cat .node-version) ${CYPRESS_DIR}/ci | ||
docker run --rm -t --user "$(id -u):$(id -g)" \ | ||
-v `pwd`:/app --network="host" \ | ||
--name cypress cypress''' | ||
// As long as the kibana in dev mode is not reliable we need to run the tests | ||
// a few times. | ||
// TODO: APM-UI to provide the kibana run command that works at first. | ||
sh "${E2E_DIR}/ci/run-e2e.sh || true" | ||
retry(5) { | ||
sleep 30 | ||
sh "${E2E_DIR}/ci/rerun-e2e.sh" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Caused by #61942 |
||
} | ||
} | ||
} | ||
post { | ||
always { | ||
dir("${BASE_DIR}"){ | ||
archiveArtifacts(allowEmptyArchive: false, artifacts: "${CYPRESS_DIR}/**/screenshots/**,${CYPRESS_DIR}/**/videos/**,${CYPRESS_DIR}/**/test-results/*e2e-tests.xml") | ||
junit(allowEmptyResults: true, testResults: "${CYPRESS_DIR}/**/test-results/*e2e-tests.xml") | ||
} | ||
dir("${APM_ITS}"){ | ||
sh 'docker-compose logs > apm-its.log || true' | ||
sh 'docker-compose down -v || true' | ||
archiveArtifacts(allowEmptyArchive: false, artifacts: 'apm-its.log') | ||
dir("${BASE_DIR}/${E2E_DIR}"){ | ||
archiveArtifacts(allowEmptyArchive: false, artifacts: 'cypress/screenshots/**,cypress/videos/**,cypress/test-results/*e2e-tests.xml') | ||
junit(allowEmptyResults: true, testResults: 'cypress/test-results/*e2e-tests.xml') | ||
dir('tmp/apm-integration-testing'){ | ||
sh 'docker-compose logs > apm-its-docker.log || true' | ||
sh 'docker-compose down -v || true' | ||
archiveArtifacts(allowEmptyArchive: true, artifacts: 'apm-its-docker.log') | ||
} | ||
archiveArtifacts(allowEmptyArchive: true, artifacts: 'tmp/*.log') | ||
} | ||
} | ||
unsuccessful { | ||
|
@@ -137,7 +113,7 @@ pipeline { | |
post { | ||
always { | ||
dir("${BASE_DIR}"){ | ||
archiveArtifacts(allowEmptyArchive: true, artifacts: "${CYPRESS_DIR}/ingest-data.log,kibana.log") | ||
archiveArtifacts(allowEmptyArchive: true, artifacts: "${E2E_DIR}/kibana.log") | ||
} | ||
} | ||
} | ||
|
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,13 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
set -ex | ||
|
||
E2E_DIR="x-pack/legacy/plugins/apm/e2e" | ||
|
||
echo "1/3 Install dependencies ..." | ||
E2E_DIR=x-pack/legacy/plugins/apm/e2e | ||
echo "1/2 Install dependencies ..." | ||
# shellcheck disable=SC1091 | ||
source src/dev/ci_setup/setup_env.sh true | ||
yarn kbn bootstrap | ||
|
||
echo "2/3 Ingest test data ..." | ||
pushd ${E2E_DIR} | ||
yarn install | ||
curl --silent https://storage.googleapis.com/apm-ui-e2e-static-data/events.json --output ingest-data/events.json | ||
node ingest-data/replay.js --server-url http://localhost:8201 --secret-token abcd --events ./events.json > ingest-data.log | ||
yarn kbn clean && yarn kbn bootstrap | ||
|
||
echo "3/3 Start Kibana ..." | ||
popd | ||
echo "2/2 Start Kibana ..." | ||
## Might help to avoid FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory | ||
export NODE_OPTIONS="--max-old-space-size=4096" | ||
nohup node scripts/kibana --config "${E2E_DIR}/ci/kibana.e2e.yml" --no-base-path --optimize.watch=false> kibana.log 2>&1 & | ||
nohup node ./scripts/kibana --no-base-path --no-watch --dev --no-dev-config --config ${E2E_DIR}/ci/kibana.e2e.yml > ${E2E_DIR}/kibana.log 2>&1 & | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not like to launch a background process on an Agent you would have weird and inexplicable behaviors. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well, there is a requirement to have a kibana instance up and running for that particular source code, what are the alternatives to do it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make the provisioning on the docker-compose, let's open a follow up to add a flag to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've reopen this one elastic/apm-integration-testing#661 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
## | ||
## This is a wrapper to configure the environment with the right tools in the CI | ||
## and run the cypress steps. | ||
## | ||
## NOTE: it's required to run run-e2e.sh previously. This is the wrapper to help with | ||
## the rerun of the e2e. | ||
## | ||
|
||
E2E_DIR="${0%/*}/.." | ||
# shellcheck disable=SC1091 | ||
source src/dev/ci_setup/setup_env.sh true | ||
set -ex | ||
cd "${E2E_DIR}" | ||
rm cypress/test-results/*.* || true | ||
rm -rf cypress/screenshots/* || true | ||
yarn cypress run --config pageLoadTimeout=100000,watchForFileChanges=true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
## | ||
## This is a wrapper to configure the environment with the right tools in the CI | ||
## and run the e2e steps. | ||
## | ||
|
||
E2E_DIR="${0%/*}/.." | ||
# shellcheck disable=SC1091 | ||
source src/dev/ci_setup/setup_env.sh true | ||
set -ex | ||
"${E2E_DIR}"/run-e2e.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"nodeVersion": "system", | ||
"baseUrl": "http://localhost:5701", | ||
"video": false, | ||
"video": true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the video I see that the login page is not shown but the link directly to the |
||
"trashAssetsBeforeRuns": false, | ||
"fileServerFolder": "../", | ||
"fixturesFolder": "./cypress/fixtures", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
#!/usr/bin/env bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
# variables | ||
KIBANA_PORT=5701 | ||
|
@@ -65,6 +65,8 @@ ${APM_IT_DIR}/scripts/compose.py start master \ | |
--elasticsearch-port $ELASTICSEARCH_PORT \ | ||
--apm-server-port=$APM_SERVER_PORT \ | ||
--elasticsearch-heap 4g \ | ||
--apm-server-opt queue.mem.events=8192 \ | ||
--apm-server-opt output.elasticsearch.bulk_max_size=4096 \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixes #62979 |
||
&> ${TMP_DIR}/apm-it.log | ||
|
||
# Stop if apm-integration-testing failed to start correctly | ||
|
@@ -98,7 +100,7 @@ curl --silent --user admin:changeme -XDELETE "localhost:${ELASTICSEARCH_PORT}/.a | |
curl --silent --user admin:changeme -XDELETE "localhost:${ELASTICSEARCH_PORT}/apm*" > /dev/null | ||
|
||
# Ingest data into APM Server | ||
node ingest-data/replay.js --server-url http://localhost:$APM_SERVER_PORT --events ${TMP_DIR}/events.json 2> ${TMP_DIR}/ingest-data.log | ||
node ingest-data/replay.js --server-url http://localhost:$APM_SERVER_PORT --events ${TMP_DIR}/events.json 2>> ${TMP_DIR}/ingest-data.log | ||
|
||
# Stop if not all events were ingested correctly | ||
if [ $? -ne 0 ]; then | ||
|
@@ -111,8 +113,7 @@ fi | |
################################################## | ||
echo "\n${bold}Waiting for Kibana to start...${normal}" | ||
echo "Note: you need to start Kibana manually. Find the instructions at the top." | ||
yarn wait-on -i 500 -w 500 http://localhost:$KIBANA_PORT > /dev/null | ||
|
||
yarn wait-on -i 500 -w 500 http://localhost:${KIBANA_PORT}/status > /dev/null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
echo "\n✅ Setup completed successfully. Running tests...\n" | ||
|
||
# | ||
mdelapenya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
@@ -129,4 +130,3 @@ ${bold}If you want to run the test interactively, run:${normal} | |
|
||
yarn cypress open --config pageLoadTimeout=100000,watchForFileChanges=true | ||
" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the apm-integration-testing is now defined iin the run-e2e.sh script, so this is not required anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 nice change