forked from jenkins-docs/simple-java-maven-app
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Jenkinsfile
49 lines (44 loc) · 1.9 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
node('docker'){
stage('checkout'){
echo "Checking the Git code"
//git brach: 'docker' credentialsId: 'lokigithubapikey', url: 'https://github.com/lokeshkamalay/simple-java-maven-app.git'
checkout scm
}
stage('Executing Test Cases'){
docker.image('lokeshkamalay/batch2:maven').inside(){
echo "Execuring Test Cases Started"
sh "mvn clean deploy"
}
}
}
/*node('mavenbuilds'){
def mvnHome = tool name: 'maven354', type: 'maven'
stage('checkout'){
echo "Checking the Git code"
git credentialsId: 'lokigithubapikey', url: 'https://github.com/lokeshkamalay/simple-java-maven-app.git'
}
stage('Executing Test Cases'){
echo "Execuring Test Cases Started"
sh "$mvnHome/bin/mvn clean test surefire-report:report-only"
archiveArtifacts 'target/**/*'
junit allowEmptyResults: true, testResults: 'target/surefire-reports/*.xml'
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'target/site', reportFiles: 'surefire-report.html', reportName: 'SureFireReportHTML', reportTitles: ''])
echo "Executing Test Cases Completed"
}
//stage('Sonar Analysis'){
// sh "$mvnHome/bin/mvn sonar:sonar -Dsonar.host.url=http://aefdc217.ngrok.io -Dsonar.login=d08d80d05ae55ae9de4ca22bc2fd5140c1308ee2"
//}
stage('Packaging'){
echo "Preparing artifacts"
sh "$mvnHome/bin/mvn package -DskipTests=true"
}
stage('Push to artifactory'){
sh "$mvnHome/bin/mvn deploy -DskipTests=true --settings settings.xml"
}
stage('Deployments'){
sh 'curl http://fa1b7800.ngrok.io/artifactory/maven-local/com/mycompany/app/my-app/1-RELEASE/my-app-1-RELEASE.jar -o my-app.jar'
sshagent(['deployment-id']) {
sh 'scp -o StrictHostKeyChecking=no my-app.jar ubuntu@172.31.94.69:~/'
}
}
}*/