-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathJenkinsfile
54 lines (53 loc) · 2.15 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
@Library('stamp') _
pipeline {
agent any
stages {
stage('Build') {
steps {
withMaven(maven: 'maven3', jdk: 'JDK8') {
sh 'mvn compile'
}
}
}
stage('Unit Tests') {
steps {
withMaven(maven: 'maven3', jdk: 'JDK8') {
sh 'mvn test'
}
junit(testResults: 'target/surefire-reports/*.xml', allowEmptyResults: true)
}
}
stage('Amplify') {
when {branch 'jenkins_develop'}
steps {
withMaven(maven: 'maven3', jdk: 'JDK8') {
sh 'mvn eu.stamp-project:dspot-maven:amplify-unit-tests -Dpath-to-properties=dhell.dspot -Damplifiers=TestDataMutator -Dtest-criterion=JacocoCoverageSelector -Diteration=1'
// sh "mvn eu.stamp-project:dspot-maven:amplify-unit-tests -Dverbose -Diteration=4"
}
//dspot(mvnHome: '${M2_HOME}', showReports: true)
sh 'cp -rf target/dspot/output/eu src/test/java/'
//step([$class: 'DSpotReportCollector'])
}
}
stage('Pull Request') {
when {branch 'jenkins_develop'}
steps {
sh 'git checkout -b amplifybranch-${GIT_BRANCH}-${BUILD_NUMBER}'
sh 'git commit -a -m "added tests"'
// CREDENTIALID
withCredentials([usernamePassword(credentialsId: 'github-user-password', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
// REPOSITORY URL
sh('git push https://${GIT_USERNAME}:${GIT_PASSWORD}@${GIT_URL} amplifybranch-${GIT_BRANCH}-${BUILD_NUMBER}')
// withEnv(['GITHUB_USER=${GIT_USERNAME}','GITHUB_PASSWORD=${GIT_PASSWORD}']) {
// sh 'hub pull-request -m "Amplify pull request from build ${BUILD_NUMBER} on ${GIT_BRANCH}"'
// }
withCredentials([usernamePassword(credentialsId: 'github', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]){
script {
stamp.pullRequest("${GIT_PASSWORD}", "dhell", "STAMP-project", "Amplify ${GIT_BRANCH} ${BUILD_NUMBER}", "Amplify pull request from build ${BUILD_NUMBER} on ${GIT_BRANCH}", "amplifybranch-${GIT_BRANCH}-${BUILD_NUMBER}", "${GIT_BRANCH}")
}
}
}
}
}
}
}