-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
57 lines (50 loc) · 1.79 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
pipeline {
agent any
triggers {
cron 'H 22 * * *'
}
options {
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '3'))
}
stages {
stage('editorconfig') {
steps {
script {
docker.image('mstruebing/editorconfig-checker').inside {
sh 'ec -no-color'
}
}
}
}
stage('build') {
steps {
script {
docker.build('maven-build', '-f Dockerfile.maven .').inside {
maven cmd: "clean install -Pproduction"
if (env.BRANCH_NAME == 'master') {
maven cmd: "org.cyclonedx:cyclonedx-maven-plugin:makeAggregateBom -DincludeLicenseText=true -DoutputFormat=json"
withCredentials([string(credentialsId: 'dependency-track', variable: 'API_KEY')]) {
sh 'curl -v --fail -X POST https://api.dependency-track.ivyteam.io/api/v1/bom \
-H "Content-Type: multipart/form-data" \
-H "X-API-Key: ' + API_KEY + '" \
-F "autoCreate=true" \
-F "projectName=devops.ivyteam.io" \
-F "projectVersion=master" \
-F "bom=@target/bom.json"'
}
}
}
def image = docker.build("devops:latest", ".")
if (env.BRANCH_NAME == 'master') {
docker.withRegistry('https://docker-registry.ivyteam.io', 'docker-registry.ivyteam.io') {
image.push()
}
}
}
junit testDataPublishers: [[$class: 'StabilityTestDataPublisher']], testResults: '**/target/surefire-reports/**/*.xml'
recordIssues tools: [eclipse()], qualityGates: [[threshold: 1, type: 'TOTAL']]
recordIssues tools: [mavenConsole()]
}
}
}
}