-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile-depcheck
87 lines (77 loc) · 3.52 KB
/
Jenkinsfile-depcheck
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
86
87
#!/usr/bin/env groovy
@Library('github.com/AlbanAndrieu/jenkins-pipeline-scripts@master') _
String DOCKER_REGISTRY="hub.docker.com".trim()
String DOCKER_ORGANISATION="nabla".trim()
String DOCKER_TAG="latest".trim()
String DOCKER_NAME="ansible-jenkins-slave-docker".trim()
String DOCKER_REGISTRY_URL="https://${DOCKER_REGISTRY}".trim()
String DOCKER_REGISTRY_CREDENTIAL=env.DOCKER_REGISTRY_CREDENTIAL ?: "jenkins".trim()
String DOCKER_IMAGE="${DOCKER_REGISTRY}/${DOCKER_ORGANISATION}/${DOCKER_NAME}:${DOCKER_TAG}".trim()
String DOCKER_OPTS_BASIC = getDockerOpts()
//String DOCKER_OPTS_COMPOSE = getDockerOpts(isDockerCompose: true, isLocalJenkinsUser: false)
pipeline {
//agent none
agent {
label 'docker-compose'
}
parameters {
string(defaultValue: 'develop', description: 'Default git branch to override', name: 'GIT_BRANCH_NAME')
booleanParam(defaultValue: false, description: 'Dry run', name: 'DRY_RUN')
booleanParam(defaultValue: false, description: 'Clean before run', name: 'CLEAN_RUN')
booleanParam(defaultValue: false, description: 'Debug run', name: 'DEBUG_RUN')
booleanParam(defaultValue: false, description: 'Debug mvnw', name: 'MVNW_VERBOSE')
booleanParam(name: "RELEASE", defaultValue: false, description: "Perform release-type build.")
string(name: "RELEASE_BASE", defaultValue: "", description: "Commit tag or branch that should be checked-out for release")
string(name: "RELEASE_VERSION", defaultValue: "", description: "Release version for artifacts")
}
environment {
GIT_BRANCH_NAME = "${params.GIT_BRANCH_NAME}"
DRY_RUN = "${params.DRY_RUN}".toBoolean()
CLEAN_RUN = "${params.CLEAN_RUN}".toBoolean()
DEBUG_RUN = "${params.DEBUG_RUN}".toBoolean()
MVNW_VERBOSE = "${params.MVNW_VERBOSE}".toBoolean()
RELEASE = "${params.RELEASE}".toBoolean()
RELEASE_BASE = "${params.RELEASE_BASE}"
RELEASE_VERSION = "${params.RELEASE_VERSION}"
}
options {
//skipDefaultCheckout()
disableConcurrentBuilds()
ansiColor('xterm')
timeout(time: 120, unit: 'MINUTES')
timestamps()
}
stages {
stage('\u2795 Quality - Security - Dependency check') {
agent {
docker {
image DOCKER_IMAGE
reuseNode true
//registryUrl DOCKER_REGISTRY_URL
//registryCredentialsId DOCKER_REGISTRY_CREDENTIAL
args DOCKER_OPTS_BASIC
label 'docker-compose'
}
}
when {
expression { BRANCH_NAME ==~ /release|master|develop/ }
}
steps {
script {
properties(createPropertyList())
if (!params.DRY_RUN && !params.RELEASE) {
//input id: 'DependencyCheck', message: 'Approve DependencyCheck?', submitter: 'aandrieu'
//buildCmdParameters: "-Dserver=jetty9x -Dskip.npm -Dskip.yarn -Dskip.bower -Dskip.grunt -Dmaven.exec.skip=true -Denforcer.skip=true -Dmaven.test.skip=true"
withMavenDependencyCheckWrapper(buildCmdParameters: "-Dserver=jetty9x")
//sh "nsp check"
} // if DRY_RUN
} //script
} // steps
} // stage Security - Dependency check
} // stages
post {
cleanup {
wrapCleanWs(isEmailEnabled: false)
} // cleanup
} // post
} // pipeline