forked from jenkinsci/splunk-devops-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile.mvn
28 lines (26 loc) · 1.31 KB
/
Jenkinsfile.mvn
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
#!/usr/bin/env groovy
// Parameters to run test
properties([
parameters([string(defaultValue: '', description: 'Splunk host', name: 'host')
, string(defaultValue: '8089', description: 'Splunk management port', name: 'port')
, string(defaultValue: '', description: 'Username', name: 'username')
, string(defaultValue: '', description: 'Password', name: 'password')
, string(defaultValue: '', description: 'Local Repo Url', name: 'repoUrl')
]),
[$class: 'jenkins.model.BuildDiscarderProperty', strategy: [$class : 'LogRotator',
numToKeepStr : '50',
artifactNumToKeepStr: '20']]
])
node {
checkout scm;
def mvnHome = tool name: 'default', type: 'hudson.tasks.Maven$MavenInstallation'
def mvnCmd = "${mvnHome}/bin/mvn";
if (params.password) {
mvnCmd += " -Dhost=${params.host} -Dport=${params.port} -Dpassword=${params.password} -Dusername=${params.username}"
}
mvnCmd += " -Djava.net.preferIPv4Stack=true clean verify"
if (params.repoUrl) {
mvnCmd += " -Plocal -Drepos.url=${params.repoUrl} deploy cobertura:cobertura"
}
sh mvnCmd
}