-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile.20190604
More file actions
84 lines (72 loc) · 2.75 KB
/
Jenkinsfile.20190604
File metadata and controls
84 lines (72 loc) · 2.75 KB
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
79
80
81
82
83
84
node {
stage('checkout') {
checkout scm
}
stage('check java') {
sh "java -version"
}
script {
version = sh (
script: "./gradlew properties -q | grep \"^version:\" | awk '{print \$2}'",
returnStdout: true
).trim()
sh "echo Building project in version: $version"
}
stage('clean') {
sh "chmod +x gradlew"
sh "./gradlew clean --no-daemon"
}
stage('npm install') {
sh "./gradlew npm_install -Pprod -PnodeInstall --no-daemon"
}
/*** SONARQUBE ****/
// stage('SCM') {
// git 'https://github.com/keepitsts/devops-demo.git'
// }
stage('SonarQube analysis') {
// requires SonarQube Scanner 2.8+
def scannerHome = tool 'SonarQube Scanner 3.3';
withSonarQubeEnv('sonarqube') {
sh "${scannerHome}/bin/sonar-scanner"
}
}
/*** SKIP TESTING FOR NOW */
/**
stage('backend tests') {
try {
sh "./gradlew test integrationTest -Pprod -PnodeInstall --no-daemon"
} catch(err) {
throw err
} finally {
*/
// junit '**/build/**/TEST-*.xml' } }
/*
stage('frontend tests') {
try {
sh "./gradlew npm_run_test -Pprod -PnodeInstall --no-daemon"
} catch(err) {
throw err
} finally {
*/
// junit '**/build/test-results/TESTS-*.xml'
/**
}
}
*/
/**/
stage('packaging') {
sh "./gradlew bootJar -x test -Pprod -PnodeInstall --no-daemon"
archiveArtifacts artifacts: '**/build/libs/*.jar', fingerprint: true
}
// Testing deliverying artifact to Nexus server
// Having trouble find jar file. If we get it in Nexus, we don't need this step
// stage('Deliver') {
// sh 'ssh -o StrictHostKeyChecking=no -i /var/lib/jenkins/.ssh/sts-ILab-20181012.pem ec2-user@ip-172-31-39-105.ec2.internal "/sbin/service jhipster stop"'
// sh 'scp -v -o StrictHostKeyChecking=no -i /var/lib/jenkins/.ssh/sts-ILab-20181012.pem /var/lib/jenkins/jobs/devops-demo-jhipster/lastSuccessful/archive/build/libs/devopsdemo-1.0.0.jar ec2-user@ip-172-31-39-105.ec2.internal:/home/ec2-user/lib'
// sh 'ssh -o StrictHostKeyChecking=no -i /var/lib/jenkins/.ssh/sts-ILab-20181012.pem ec2-user@ip-172-31-39-105.ec2.internal "/sbin/service jhipster start"'
// }
//
stage ('Publish') {
nexusPublisher nexusInstanceId: 'stsnexus', nexusRepositoryId: 'maven-releases', packages: [[$class: 'MavenPackage', mavenAssetList: [[classifier: '', extension: '', filePath: "/var/lib/jenkins/workspace/devops-demo-jhipster/build/libs/devopsdemo-${version}.jar"]], mavenCoordinate: [artifactId: 'devops-demo', groupId: 'com.simpletechnologysolutions', packaging: 'jar', version: "${version}" ]]]
}
}