-
Notifications
You must be signed in to change notification settings - Fork 5
/
Autotest.Jenkinsfile
78 lines (78 loc) · 2.52 KB
/
Autotest.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
pipeline {
agent{
kubernetes {
cloud params.JENKINS_AGENT_CLOUD_NAME
label "jenkins-slave-${UUID.randomUUID().toString()}"
serviceAccount "jenkins"
defaultContainer 'jnlp'
yaml """
apiVersion: v1
kind: Pod
metadata:
labels:
app: "jenkins-${env.JOB_BASE_NAME}"
spec:
containers:
- name: jnlp
image: quay.io/kaine/indy-stress-tester:latest
imagePullPolicy: Always
tty: true
env:
- name: HOME
value: /home/jenkins
- name: USER
value: 'jenkins-k8s-config'
resources:
requests:
memory: 1500Mi
cpu: 2000m
limits:
memory: 3000Mi
cpu: 4000m
"""
}
}
stages {
stage('Run Build Test'){
steps {
script {
echo "Jmeter running build-simulation-existing"
sh script: "THREAD=${params.THREADS} HOSTNAME=${params.INDY_HOSTNAME} LOOPS=${params.LOOPS} PORT=80 /src/entrypoint.sh build-simulation-existing.jmx"
}
}
}
stage('Run Download Test'){
steps {
script {
echo "Jmeter running download-simulation-existing"
sh script: "THREAD=${params.THREADS} HOSTNAME=${params.INDY_HOSTNAME} LOOPS=${params.LOOPS} PORT=80 /src/entrypoint.sh download-simulation-existing.jmx"
}
}
}
stage('Run Upload Test'){
steps {
script {
echo "Jmeter running upload-simulation-existing"
sh script: "THREAD=${params.THREADS} HOSTNAME=${params.INDY_HOSTNAME} LOOPS=${params.LOOPS} PORT=80 /src/entrypoint.sh upload-simulation-existing.jmx"
}
}
}
stage('Archive & Publish'){
steps{
script{
sh script: "cp /src/*.log ./"
sh script: """#!/bin/bash
echo "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>" >> combined.xml && \
echo "<testResults version=\\"1.2\\">" >> combined.xml && \
grep -vh "</\\?testResults>\\|<?xml\\|<testResults" build-simulation-existing.jmx.log >> combined.xml && \
grep -vh "</\\?testResults>\\|<?xml\\|<testResults" upload-simulation-existing.jmx.log >> combined.xml && \
grep -vh "</\\?testResults>\\|<?xml\\|<testResults" download-simulation-existing.jmx.log >> combined.xml && \
echo "</testResults>" >> combined.xml
"""
}
archiveArtifacts artifacts: "*.log,combined.xml"
perfReport "combined.xml"
}
}
}
}