mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
ci(jenkins): enable APM UI e2e tests (#48109)
This commit is contained in:
parent
47dcf87e79
commit
9ee67fb6a1
6 changed files with 271 additions and 2 deletions
125
.ci/end2end.groovy
Normal file
125
.ci/end2end.groovy
Normal file
|
@ -0,0 +1,125 @@
|
|||
#!/usr/bin/env groovy
|
||||
|
||||
library identifier: 'apm@current',
|
||||
retriever: modernSCM(
|
||||
[$class: 'GitSCMSource',
|
||||
credentialsId: 'f94e9298-83ae-417e-ba91-85c279771570',
|
||||
id: '37cf2c00-2cc7-482e-8c62-7bbffef475e2',
|
||||
remote: 'git@github.com:elastic/apm-pipeline-library.git'])
|
||||
|
||||
pipeline {
|
||||
agent { label 'linux && immutable' }
|
||||
environment {
|
||||
BASE_DIR = 'src/github.com/elastic/kibana'
|
||||
HOME = "${env.WORKSPACE}"
|
||||
APM_ITS = 'apm-integration-testing'
|
||||
CYPRESS_DIR = 'x-pack/legacy/plugins/apm/cypress'
|
||||
PIPELINE_LOG_LEVEL = 'DEBUG'
|
||||
}
|
||||
options {
|
||||
timeout(time: 1, unit: 'HOURS')
|
||||
buildDiscarder(logRotator(numToKeepStr: '40', artifactNumToKeepStr: '20', daysToKeepStr: '30'))
|
||||
timestamps()
|
||||
ansiColor('xterm')
|
||||
disableResume()
|
||||
durabilityHint('PERFORMANCE_OPTIMIZED')
|
||||
}
|
||||
triggers {
|
||||
issueCommentTrigger('(?i).*jenkins\\W+run\\W+(?:the\\W+)?e2e(?:\\W+please)?.*')
|
||||
}
|
||||
parameters {
|
||||
booleanParam(name: 'FORCE', defaultValue: false, description: 'Whether to force the run.')
|
||||
}
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
options { skipDefaultCheckout() }
|
||||
steps {
|
||||
deleteDir()
|
||||
gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: false,
|
||||
shallow: false, reference: "/var/lib/jenkins/.git-references/kibana.git")
|
||||
script {
|
||||
dir("${BASE_DIR}"){
|
||||
def regexps =[ "^x-pack/legacy/plugins/apm/.*" ]
|
||||
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 {
|
||||
dir("${APM_ITS}"){
|
||||
sh './scripts/compose.py start master --no-kibana --no-xpack-secure'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Prepare Kibana') {
|
||||
options { skipDefaultCheckout() }
|
||||
when {
|
||||
anyOf {
|
||||
expression { return params.FORCE }
|
||||
expression { return env.APM_UPDATED != "false" }
|
||||
}
|
||||
}
|
||||
environment {
|
||||
JENKINS_NODE_COOKIE = 'dontKillMe'
|
||||
}
|
||||
steps {
|
||||
dir("${BASE_DIR}"){
|
||||
sh script: "${CYPRESS_DIR}/ci/prepare-kibana.sh"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Smoke Tests'){
|
||||
options { skipDefaultCheckout() }
|
||||
when {
|
||||
anyOf {
|
||||
expression { return params.FORCE }
|
||||
expression { return env.APM_UPDATED != "false" }
|
||||
}
|
||||
}
|
||||
steps{
|
||||
dir("${BASE_DIR}"){
|
||||
sh '''
|
||||
jobs -l
|
||||
docker build --tag cypress ${CYPRESS_DIR}/ci
|
||||
docker run --rm -t --user "$(id -u):$(id -g)" \
|
||||
-v `pwd`:/app --network="host" \
|
||||
--name cypress cypress'''
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
dir("${BASE_DIR}"){
|
||||
archiveArtifacts(allowEmptyArchive: false, artifacts: "${CYPRESS_DIR}/screenshots/**,${CYPRESS_DIR}/videos/**,${CYPRESS_DIR}/*e2e-tests.xml")
|
||||
junit(allowEmptyResults: true, testResults: "${CYPRESS_DIR}/*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')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
dir("${BASE_DIR}"){
|
||||
archiveArtifacts(allowEmptyArchive: true, artifacts: "${CYPRESS_DIR}/ingest-data.log,kibana.log")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
23
x-pack/legacy/plugins/apm/cypress/ci/Dockerfile
Normal file
23
x-pack/legacy/plugins/apm/cypress/ci/Dockerfile
Normal file
|
@ -0,0 +1,23 @@
|
|||
FROM node:12
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -y -qq install xvfb \
|
||||
libgtk-3-0 \
|
||||
libxtst6 \
|
||||
libnotify-dev \
|
||||
libgconf-2-4 \
|
||||
libnss3 \
|
||||
libxss1 \
|
||||
libasound2 \
|
||||
--no-install-recommends \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
## Add host.docker.internal to localhost
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -y -qq install dnsutils \
|
||||
--no-install-recommends \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
36
x-pack/legacy/plugins/apm/cypress/ci/entrypoint.sh
Executable file
36
x-pack/legacy/plugins/apm/cypress/ci/entrypoint.sh
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env bash
|
||||
set -xe
|
||||
|
||||
## host.docker.internal is not available in native docker installations
|
||||
kibana=$(dig +short host.docker.internal)
|
||||
if [ -z "${kibana}" ] ; then
|
||||
kibana=127.0.0.1
|
||||
fi
|
||||
|
||||
export CYPRESS_BASE_URL=http://${kibana}:5601
|
||||
|
||||
## To avoid issues with the home and caching artifacts
|
||||
export HOME=/tmp
|
||||
npm config set cache ${HOME}
|
||||
|
||||
## To avoid issues with volumes.
|
||||
#rsync -rv --exclude=.git --exclude=docs \
|
||||
# --exclude=.cache --exclude=node_modules \
|
||||
# --exclude=test/ \
|
||||
# --exclude=src/ \
|
||||
# --exclude=packages/ \
|
||||
# --exclude=built_assets --exclude=target \
|
||||
# --exclude=data /app ${HOME}/
|
||||
#cd ${HOME}/app/x-pack/legacy/plugins/apm/cypress
|
||||
|
||||
cd /app/x-pack/legacy/plugins/apm/cypress
|
||||
## Install dependencies for cypress
|
||||
CI=true npm install
|
||||
yarn install
|
||||
|
||||
# Wait for the kibana to be up and running
|
||||
npm install wait-on
|
||||
./node_modules/.bin/wait-on ${CYPRESS_BASE_URL}/status && echo 'Kibana is up and running'
|
||||
|
||||
# Run cypress
|
||||
./node_modules/.bin/cypress run
|
57
x-pack/legacy/plugins/apm/cypress/ci/kibana.dev.yml
Normal file
57
x-pack/legacy/plugins/apm/cypress/ci/kibana.dev.yml
Normal file
|
@ -0,0 +1,57 @@
|
|||
##
|
||||
# Disabled plugins
|
||||
########################
|
||||
# data.enabled: false
|
||||
# interpreter.enabled: false
|
||||
# visualizations.enabled: false
|
||||
# xpack.apm.enabled: false
|
||||
# console.enabled: false
|
||||
console_extensions.enabled: false
|
||||
dashboard_embeddable_container.enabled: false
|
||||
dashboard_mode.enabled: false
|
||||
embeddable_api.enabled: false
|
||||
file_upload.enabled: false
|
||||
# input_control_vis.enabled: false
|
||||
inspector_views.enabled: false
|
||||
kibana_react.enabled: false
|
||||
markdown_vis.enabled: false
|
||||
metric_vis.enabled: false
|
||||
metrics.enabled: false
|
||||
region_map.enabled: false
|
||||
table_vis.enabled: false
|
||||
tagcloud.enabled: false
|
||||
tile_map.enabled: false
|
||||
timelion.enabled: false
|
||||
ui_metric.enabled: false
|
||||
vega.enabled: false
|
||||
xpack.actions.enabled: false
|
||||
xpack.alerting.enabled: false
|
||||
xpack.beats.enabled: false
|
||||
xpack.canvas.enabled: false
|
||||
xpack.cloud.enabled: false
|
||||
xpack.code.enabled: false
|
||||
xpack.encryptedSavedObjects.enabled: false
|
||||
xpack.graph.enabled: false
|
||||
xpack.grokdebugger.enabled: false
|
||||
xpack.index_management.enabled: false
|
||||
xpack.infra.enabled: false
|
||||
# xpack.license_management.enabled: false
|
||||
xpack.lens.enabled: false
|
||||
xpack.logstash.enabled: false
|
||||
xpack.maps.enabled: false
|
||||
xpack.ml.enabled: false
|
||||
xpack.monitoring.enabled: false
|
||||
xpack.oss_telemetry.enabled: false
|
||||
xpack.remote_clusters.enabled: false
|
||||
xpack.rollup.enabled: false
|
||||
xpack.searchprofiler.enabled: false
|
||||
# xpack.security.enabled: false
|
||||
xpack.siem.enabled: false
|
||||
xpack.snapshot_restore.enabled: false
|
||||
xpack.spaces.enabled: false
|
||||
xpack.task_manager.enabled: false
|
||||
xpack.tilemap.enabled: false
|
||||
xpack.upgrade_assistant.enabled: false
|
||||
xpack.uptime.enabled: false
|
||||
xpack.watcher.enabled: false
|
||||
logging.verbose: true
|
24
x-pack/legacy/plugins/apm/cypress/ci/prepare-kibana.sh
Executable file
24
x-pack/legacy/plugins/apm/cypress/ci/prepare-kibana.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
CYPRESS_DIR="x-pack/legacy/plugins/apm/cypress"
|
||||
|
||||
echo "1/3 Install dependencies ..."
|
||||
# shellcheck disable=SC1091
|
||||
source src/dev/ci_setup/setup_env.sh true
|
||||
yarn kbn bootstrap
|
||||
cp ${CYPRESS_DIR}/ci/kibana.dev.yml config/kibana.dev.yml
|
||||
echo 'elasticsearch:' >> config/kibana.dev.yml
|
||||
cp ${CYPRESS_DIR}/ci/kibana.dev.yml config/kibana.yml
|
||||
|
||||
echo "2/3 Ingest test data ..."
|
||||
pushd ${CYPRESS_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:8200 --secret-token abcd --events ./events.json > ingest-data.log
|
||||
|
||||
echo "3/3 Start Kibana ..."
|
||||
popd
|
||||
## 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 --no-base-path --csp.strict=false --optimize.watch=false> kibana.log 2>&1 &
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"baseUrl": "http://localhost:5601",
|
||||
"video": false,
|
||||
|
||||
"trashAssetsBeforeRuns": false,
|
||||
"fileServerFolder": "../",
|
||||
"fixturesFolder": "./fixtures",
|
||||
|
@ -10,5 +9,10 @@
|
|||
"screenshotsFolder": "./screenshots",
|
||||
"supportFile": "./support/index.ts",
|
||||
"videosFolder": "./videos",
|
||||
"useRelativeSnapshots": true
|
||||
"useRelativeSnapshots": true,
|
||||
"reporter": "junit",
|
||||
"reporterOptions": {
|
||||
"mochaFile": "[hash]-e2e-tests.xml",
|
||||
"toConsole": false
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue