This repository has been archived by the owner on Nov 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
75 lines (54 loc) · 2.77 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
import org.eclipse.jetty.load.generator.*
node('master') {
def version = '0.0.1-SNAPSHOT'
//stage 'Checkout'
git url: 'https://github.com/olamy/jetty-load-generator-app.git'
//stage 'Maven'
// System Dependent Locations
//def mvntool = tool name: 'maven3', type: 'hudson.tasks.Maven$MavenInstallation'
//def jdktool = tool name: 'jdk8', type: 'hudson.model.JDK'
// Environment
//List mvnEnv = ["PATH+MVN=${mvntool}/bin", "PATH+JDK=${jdktool}/bin", "JAVA_HOME=${jdktool}/", "MAVEN_HOME=${mvntool}"]
List mvnEnv = []
mvnEnv.add("MAVEN_OPTS=-Xms256m -Xmx1024m -Djava.awt.headless=true")
withEnv(mvnEnv) {
timeout(15) {
sh "mvn -B clean package"
}
}
archive 'target/app-${version}.jar'
dir ('target') {
def jettyPort = 9090
parallel firstBranch: {
sh "java -jar app-${version}.jar --port=${jettyPort}"
}, secondBranch: {
//def port = readFile 'jetty.local.port'
sleep 5
def profile = new Resource( "index.html",
new Resource( "/css/bootstrap.css",
new Resource( "/css/bootstrap-theme.css" ),
new Resource( "/js/jquery-3.1.1.min.js"),
new Resource( "/js/jquery-3.1.1.min.js"),
new Resource( "/js/jquery-3.1.1.min.js"),
new Resource( "/js/jquery-3.1.1.min.js")
),
new Resource( "/js/bootstrap.js" ,
new Resource( "/js/bootstrap.js" ),
new Resource( "/js/bootstrap.js" ),
new Resource( "/js/bootstrap.js" )
),
new Resource( "/hello" ),
new Resource( "/dump.jsp?wine=foo&foo=bar" ),
new Resource( "/not_here.html" ),
new Resource( "/hello?name=foo" ),
new Resource( "/hello?name=foo" ),
new Resource( "/upload" ).method("PUT").requestLength(8192),
);
def transport = org.mortbay.jetty.load.generator.starter.LoadGeneratorStarterArgs.Transport.HTTP;
def timeUnit = java.util.concurrent.TimeUnit.SECONDS;
loadgenerator host: 'localhost', port: jettyPort, resourceProfile: profile, users: 1, transactionRate: 1, transport: transport, runningTime: 20, runningTimeUnit: timeUnit
sh "curl http://localhost:${jettyPort}/stop"
},
failFast: true
}
}