-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
63 lines (62 loc) · 2.65 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
pipeline {
agent any
stages {
stage('Sonatype CLI Preparation') {
steps {
script {
if (fileExists('nexus-iq-cli')) {
echo 'Skip CLI download'
} else {
echo 'Downloading CLI'
withCredentials([usernamePassword(credentialsId: 'nexus-repo-admin', passwordVariable: 'pass', usernameVariable: 'user')]) {
sh 'wget -q --no-check-certificate --user "${user}" --password "${pass}" "http://ip-10-60-1-86.ap-southeast-1.compute.internal:8081/repository/fileserver/sonatype/nexusiq/nexus-iq-cli"'
sh 'chmod +x nexus-iq-cli'
}
}
}
}
}
stage('Java Project Preparation') {
steps {
script {
if (fileExists('sample.csproj')) {
echo 'Skip project download'
} else {
echo 'Download files to scan'
withCredentials([usernamePassword(credentialsId: 'nexus-repo-admin', passwordVariable: 'pass', usernameVariable: 'user')]) {
sh 'wget -q --no-check-certificate --user "${user}" --password "${pass}" "http://ip-10-60-1-86.ap-southeast-1.compute.internal:8081/repository/fileserver/devops/sampleproject/nuget/cyberarkticketing/cyberark.csproj"'
sh 'wget -q --no-check-certificate --user "${user}" --password "${pass}" "http://ip-10-60-1-86.ap-southeast-1.compute.internal:8081/repository/fileserver/devops/sampleproject/nuget/cyberarkticketing/packages.config"'
}
}
}
}
}
stage('Build') {
steps{
script{
def mvn_version = 'maven'
withEnv( ["PATH+MAVEN=${tool mvn_version}/bin"] ) {
sh "mvn clean package"
}
}
}
}
stage('Sonatype Scan') {
steps {
script {
withCredentials([usernamePassword(credentialsId: 'nexus-iq-admin', passwordVariable: 'pass', usernameVariable: 'user')]) {
sh './nexus-iq-cli -a "${user}:${pass}" -i Java-Sample1 -s "https://nexusiq.nssg.jhdomain.com/" -t "build" . '
}
}
}
}
}
post {
cleanup{
deleteDir()
dir("${env.WORKSPACE}@script") {
//deleteDir()
}
}
}
}