forked from elastic/kibana-load-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile_cloud
62 lines (61 loc) · 3.27 KB
/
Jenkinsfile_cloud
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env groovy
library 'kibana-pipeline-library'
def loadPipeline
def MAVEN_IMAGE = 'maven:3.6.3-openjdk-8-slim'
def MAX_TEST_RUNS = 10
pipeline {
agent { label 'docker && ubuntu-tests-l' }
options {
timeout(time: 120, unit: 'MINUTES')
}
parameters {
string(name: 'STACK_VERSION', defaultValue: '7.x,8.0.0-SNAPSHOT', description: 'Stack version on Cloud')
string(name: 'SIMULATION', defaultValue: 'cloud.AtOnceJourney,cloud.DiscoverAtOnce,cloud.DemoJourney', description: 'Comma-separated simulation list')
string(name: 'NUMBER_TEST_RUNS', defaultValue: '1', description: 'Running the same scenario up to 10 times')
string(name: 'DEPLOY_SECRET', defaultValue: 'cloud-staging-api-key', description: 'Set Vault key for Cloud deployment')
}
stages {
stage ('Initialize') {
steps {
echo "PATH = ${PATH}"
echo "STACK_VERSION = ${params.STACK_VERSION}"
echo "INGEST_RESULTS = ${params.INGEST_RESULTS}"
echo "DEPLOY_CONFIG = ${params.DEPLOY_CONFIG}"
echo "SIMULATION = ${params.SIMULATION}"
echo "NUMBER_TEST_RUNS = ${params.NUMBER_TEST_RUNS}"
script {
loadPipeline = load "${env.WORKSPACE}/kibana-load-testing/.ci/loadPipeline.groovy"
env.NUMBER_TEST_RUNS = Integer.valueOf(params.NUMBER_TEST_RUNS) > MAX_TEST_RUNS ? MAX_TEST_RUNS.toString() : params.NUMBER_TEST_RUNS
}
}
}
stage ('Run tests on cloud') {
steps {
echo "All load scenarios will be executed ${env.NUMBER_TEST_RUNS} times"
script {
docker.image(MAVEN_IMAGE).inside('-u root') {
withVaultSecret(secret: "secret/kibana-issues/dev/${params.DEPLOY_SECRET}", secret_field: 'value', variable_name: 'API_KEY') {
sh """./kibana-load-testing/scripts/deploy_and_test.sh \
-v '${params.STACK_VERSION}' \
-c '${params.DEPLOY_CONFIG}' \
-s '${params.SIMULATION}' \
-n '${env.NUMBER_TEST_RUNS}'
"""
sh """ ./kibana-load-testing/scripts/archive_results.sh """
}
loadPipeline.uploadGatlingReport()
if (params.INGEST_RESULTS.toBoolean()) {
withVaultSecret(secret: 'secret/kibana-issues/prod/coverage/elasticsearch', secret_field: 'host', variable_name: 'HOST_FROM_VAULT') {
withVaultSecret(secret: 'secret/kibana-issues/prod/coverage/elasticsearch', secret_field: 'username', variable_name: 'USER_FROM_VAULT') {
withVaultSecret(secret: 'secret/kibana-issues/prod/coverage/elasticsearch', secret_field: 'password', variable_name: 'PASS_FROM_VAULT') {
sh '''./kibana-load-testing/scripts/ingest_results.sh'''
}
}
}
}
}
}
}
}
}
}