d27b6c05d3
* chore: move gitignore to the cypress directory
* chore: ignore more test files
* fix: do not check the Loading Message
It seems not relevant to the main purpose of these tests
* chore: use cypres + webpack + cucumber scaffolding
See https://github.com/TheBrainFamily/cypress-cucumber-webpack-typescript-example
* chore: add eslint and prettier for code linting
* feat: convert existing Cypress test into BDD style
* feat: add support for using proper Node version in MacOSX
* chore: use tslint
* chore: use old layout
We are keeping cypress as rootDir to follow project's structure. On the other hand,
having a second cypress directory at the 2nd level is the default structure, as shown
in the examples:
- https://github.com/TheBrainFamily/cypress-cucumber-webpack-typescript-example
- a240054d7f/examples/preprocessors__typescript-webpack
* chore: remove prelint script meanwhile we fix TS lint
* chore: move test results to a specific directory
* chore: rename variable following old code
* chore: remove non-needed lints, as we are going to use kibana build
* chore: import snapshot function from cypress
* chore: add readFile utils back from a bad removal
* chore: change format of JSON spec file
It was automatically changed by tests
* chore: move CI directory to the proper layout in order for Jenkins to work
* chore: store test-results from proper dir on Jenkins
* chore: store artifacts properly on Jenkins
* Fix type issues
* chore: rename test application to e2e (end-to-end)
We are keeping the build system within the test application, isolating dependencies
* docs: reorganise docs for APM UI e2e tests
* fix: Use proper cypress support file
* chore: use existing NPM script for running cypress on CI
* chore: update paths in CI scripts
* docs: document how the CI runs the tests
* chore: use Node 10 for tests
* chore: Use kibana's Node version for tests
* chore: run yarn install
* docs: update docs
* fix: path was wrong
* docs: fix paths and flags used to load data
* docs: elasticsearch fix flag
* docs: Bootstrap kibana before running it
* docs: remove outdated info
* chore: move background steps to the scenario
This would avoid not reading the background when the number of scenarios grows
Co-authored-by: Dario Gieselaar <d.gieselaar@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
149 lines
4.4 KiB
Groovy
149 lines
4.4 KiB
Groovy
#!/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/e2e'
|
|
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)(retest|.*jenkins\\W+run\\W+(?:the\\W+)?e2e?.*)')
|
|
}
|
|
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 {
|
|
notifyStatus('Starting services', 'PENDING')
|
|
dir("${APM_ITS}"){
|
|
sh './scripts/compose.py start master --no-kibana'
|
|
}
|
|
}
|
|
post {
|
|
unsuccessful {
|
|
notifyStatus('Environmental issue', 'FAILURE')
|
|
}
|
|
}
|
|
}
|
|
stage('Prepare Kibana') {
|
|
options { skipDefaultCheckout() }
|
|
when {
|
|
anyOf {
|
|
expression { return params.FORCE }
|
|
expression { return env.APM_UPDATED != "false" }
|
|
}
|
|
}
|
|
environment {
|
|
JENKINS_NODE_COOKIE = 'dontKillMe'
|
|
}
|
|
steps {
|
|
notifyStatus('Preparing kibana', 'PENDING')
|
|
dir("${BASE_DIR}"){
|
|
sh script: "${CYPRESS_DIR}/ci/prepare-kibana.sh"
|
|
}
|
|
}
|
|
post {
|
|
unsuccessful {
|
|
notifyStatus('Kibana warm up failed', 'FAILURE')
|
|
}
|
|
}
|
|
}
|
|
stage('Smoke Tests'){
|
|
options { skipDefaultCheckout() }
|
|
when {
|
|
anyOf {
|
|
expression { return params.FORCE }
|
|
expression { return env.APM_UPDATED != "false" }
|
|
}
|
|
}
|
|
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'''
|
|
}
|
|
}
|
|
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')
|
|
}
|
|
}
|
|
unsuccessful {
|
|
notifyStatus('Test failures', 'FAILURE')
|
|
}
|
|
success {
|
|
notifyStatus('Tests passed', 'SUCCESS')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
dir("${BASE_DIR}"){
|
|
archiveArtifacts(allowEmptyArchive: true, artifacts: "${CYPRESS_DIR}/ingest-data.log,kibana.log")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
def notifyStatus(String description, String status) {
|
|
withGithubNotify.notify('end2end-for-apm-ui', description, status, getBlueoceanDisplayURL())
|
|
}
|