forked from elastic/kibana-load-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
94 lines (93 loc) · 4.93 KB
/
Jenkinsfile
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env groovy
library 'kibana-pipeline-library'
def loadPipeline
pipeline {
agent { label 'docker && tests-xxl' }
parameters {
string(name: 'SIMULATION', defaultValue: 'branch.DemoJourney,branch.AtOnceJourney,branch.DiscoverAtOnce,branch.TSVBGaugeJourney,branch.TSVBTimeSeriesJourney,branch.LensJourney', description: 'Comma-separated simulation list')
}
options {
timeout(time: 120, unit: 'MINUTES')
}
stages {
stage ('Initialize') {
steps {
echo "PATH = ${PATH}"
echo "GITHUB_KIBANA_REPO_OWNER = ${params.GITHUB_KIBANA_REPO_OWNER}"
echo "GITHUB_KIBANA_REPO = ${params.GITHUB_KIBANA_REPO}"
echo "GITHUB_KIBANA_BRANCH = ${params.GITHUB_KIBANA_BRANCH}"
echo "SIMULATION = ${params.SIMULATION}"
echo "INGEST_RESULTS = ${params.INGEST_RESULTS}"
script {
loadPipeline = load "${env.WORKSPACE}/kibana-load-testing/.ci/loadPipeline.groovy"
}
}
}
stage ('Running tests against locally build Kibana instance') {
steps {
script {
//restore default behaviour
env.CI = ""
env.KIBANA_REPO_NAME = "${params.GITHUB_KIBANA_REPO_OWNER}/${params.GITHUB_KIBANA_REPO}"
env.KIBANA_BRANCH = "${params.GITHUB_KIBANA_BRANCH}"
echo "Using repo: git@github.com:${env.KIBANA_REPO_NAME}"
echo "Using branch: ${env.KIBANA_BRANCH}"
}
checkout([
$class: 'GitSCM',
branches: [[name: "${env.KIBANA_BRANCH}"]],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'kibana']],
submoduleCfg: [],
userRemoteConfigs: [[
credentialsId: 'f6c7695a-671e-4f4f-a331-acdce44ff9ba',
url: "git@github.com:${env.KIBANA_REPO_NAME}",
]],
])
script {
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 """
export HOME=${env.WORKSPACE}
export KIBANA_BRANCH=${env.KIBANA_BRANCH}
./kibana-load-testing/scripts/build_and_test.sh -s '${params.SIMULATION}'
"""
}
}
}
}
}
post {
always {
script {
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 """
export HOME=${env.WORKSPACE}
./kibana-load-testing/scripts/archive_results.sh
"""
loadPipeline.uploadGatlingReport()
}
}
}
}
}
success {
script {
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'''
}
}
}
}
}
}
}
}
}
}