-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
77 lines (77 loc) · 2.27 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
pipeline {
options { disableConcurrentBuilds() }
agent { label 'docker-slave' }
stages {
stage ('Pull repo code from github') {
steps {
checkout scm
}
}
stage ('Build semantic-reasoner') {
when {
not {
triggeredBy 'UpstreamCause'
}
}
steps {
build 'semantic-reasoner/master'
}
}
stage ('Build refactoring-option-discoverer') {
steps {
sh """ #!/bin/bash
mvn clean install -Ddefault.min.distinct.threshold=104857600
"""
}
}
stage('SonarQube analysis'){
environment {
scannerHome = tool 'SonarQubeScanner'
}
steps {
withSonarQubeEnv('SonarCloud') {
sh """ #!/bin/bash
${scannerHome}/bin/sonar-scanner
"""
}
}
}
stage('Build docker images') {
when {
allOf {
// Triggered on every tag
expression{tag "*"}
}
}
steps {
sh "docker build -t refactoring_option_discoverer -f Dockerfile ."
}
}
stage('Push Dockerfile to DockerHub') {
when {
allOf {
// Triggered on every tag
expression{tag "*"}
}
}
steps {
withDockerRegistry(credentialsId: 'jenkins-sodalite.docker_token', url: '') {
sh """#!/bin/bash
docker tag refactoring_option_discoverer sodaliteh2020/refactoring_option_discoverer:${BUILD_NUMBER}
docker tag refactoring_option_discoverer sodaliteh2020/refactoring_option_discoverer
docker push sodaliteh2020/refactoring_option_discoverer:${BUILD_NUMBER}
docker push sodaliteh2020/refactoring_option_discoverer
"""
}
}
}
}
post {
failure {
slackSend (color: '#FF0000', message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
fixed {
slackSend (color: '#6d3be3', message: "FIXED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
}
}