-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
85 lines (72 loc) · 2.32 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
74
75
76
77
78
79
80
81
82
83
84
85
properties([
parameters ([
string(name: 'DOCKER_REGISTRY_DOWNLOAD_URL',
defaultValue: 'nexus-docker-private-group.ossim.io',
description: 'Repository of docker images')
]),13
pipelineTriggers([
[$class: "GitHubPushTrigger"]
]),
[$class: 'GithubProjectProperty', displayName: '', projectUrlStr: 'https://github.com/cadowner90/temp'],
])
podTemplate(
containers: [
containerTemplate(
image: "maven:3.6.2-jdk-8",
name: 'maven',
command: 'cat',
ttyEnabled: true
),
containerTemplate(
name: 'fortify',
image: "${DOCKER_REGISTRY_DOWNLOAD_URL}/fortifydocker/sca:20.2.0",
ttyEnabled: true,
command: 'cat',
privileged: true
)
],
volumes: [
hostPathVolume(
hostPath: '/var/run/docker.sock',
mountPath: '/var/run/docker.sock'
),
]
)
{
node(POD_LABEL){
stage("Checkout branch"){
scmVars = checkout(scm)
GIT_BRANCH_NAME = scmVars.GIT_BRANCH
BRANCH_NAME = """${sh(returnStdout: true, script: "echo ${GIT_BRANCH_NAME} | awk -F'/' '{print \$2}'").trim()}"""
VERSION = readMavenPom().getVersion()
ARTIFACT_NAME = readMavenPom().getArtifactId()
script {
if (BRANCH_NAME != 'master') {
VERSION = "${VERSION}-SNAPSHOT"
}
}
buildName "${VERSION} - ${BRANCH_NAME}"
}
stage("Load Variables"){
step([$class : "CopyArtifact",
projectName: "gegd-dgcs-jenkins-artifacts",
filter : "common-variables.groovy",
flatten : true])
load "common-variables.groovy"
}
stage('Fortify Scan') {
container('fortify') {
script{
sh """
echo "Running Fortify analysis and scan"
/opt/Fortify/Fortify_SCA_and_Apps_20.2.0/bin/sourceanalyzer -Xmx1G -b "op-dg-utils-scan" "${WORKSPACE}"/**/*.java
/opt/Fortify/Fortify_SCA_and_Apps_20.2.0/bin/sourceanalyzer -Xmx1G -b "op-dg-utils-scan" -scan -f "${WORKSPACE}"/"op-dg-utils-scan".fpr
echo "Done"
"""
}
archiveArtifacts "*.fpr"
fortifyUpload appName: 'op-dg-utils', appVersion: VERSION, failureCriteria: '', filterSet: '', pollingInterval: '', resultsFile: 'op-dg-utils-scan.fpr'
}
}
}
}