forked from rlarkin01/gl-test-java-gradle-master
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
73 lines (66 loc) · 2.21 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
64
65
66
67
68
69
70
71
72
73
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building..'
bat 'gradlew build'
}
}
stage('Test') {
steps {
echo 'Testing..'
}
}
stage('Greenlight Example') {
steps {
withCredentials([usernamePassword(credentialsId: 'b6926b2c-7a1a-4e89-817a-b0ce60fac460', passwordVariable: 'vkey', usernameVariable: 'vid')]) {
powershell '''
$dir = (Get-Item -Path ".\\").FullName
$zipupload = $dir + \'gl-scanner-java-LATEST.zip\';
(New-Object Net.WebClient).DownloadFile(\'https://downloads.veracode.com/securityscan/gl-scanner-java-LATEST.zip\',$zipupload);
function Unzip($zipfile, $outdir)
{
Add-Type -AssemblyName System.IO.Compression.FileSystem
$archive = [System.IO.Compression.ZipFile]::OpenRead($zipfile)
foreach ($entry in $archive.Entries)
{
$entryTargetFilePath = [System.IO.Path]::Combine($outdir, $entry.FullName)
$entryDir = [System.IO.Path]::GetDirectoryName($entryTargetFilePath)
#Ensure the directory of the archive entry exists
if(!(Test-Path $entryDir )){
New-Item -ItemType Directory -Path $entryDir | Out-Null
}
#If the entry is not a directory entry, then extract entry
if(!$entryTargetFilePath.EndsWith("\\")){
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $entryTargetFilePath, $true);
}
}
}
Unzip -zipfile "$zipupload" -outdir "$dir"
'''
bat """\
java -jar ./gl-scanner-java.jar \
--api_id "${vid}" \
--api_secret_key "${vkey}" \
--project_name "${env.JOB_NAME}" \
--project_url "${env.JOB_URL}" \
--project_ref "${env.GIT_COMMIT}" \
"""
// --issue_details true \
// --issue_counts=5:0,4:0,3:0,2:0,1:0,0:0 \
}
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
}
}
}
post {
always {
archiveArtifacts artifacts: 'results.json', fingerprint: true
}
}
}