-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
59 lines (59 loc) · 1.73 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
def dockerTags = ['master': 'latest', 'develop': 'develop']
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '30'))
timestamps()
}
agent {
docker {
label 'd3-build-agent'
image 'openjdk:8-jdk-alpine'
args '-v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp'
}
}
stages {
stage('Test') {
steps {
script {
sh "./gradlew clean test --info"
}
}
}
stage('Build') {
steps {
script {
sh "./gradlew clean build --info"
}
}
}
stage('Push artifacts') {
when {
expression { return (env.GIT_BRANCH in dockerTags || env.TAG_NAME) }
}
steps {
script {
withCredentials([usernamePassword(credentialsId: 'bot-d3-rw', usernameVariable: 'DOCKER_REGISTRY_USERNAME', passwordVariable: 'DOCKER_REGISTRY_PASSWORD')]) {
env.DOCKER_REGISTRY_URL = "https://docker.soramitsu.co.jp"
env.TAG = env.TAG_NAME ? env.TAG_NAME : dockerTags[env.GIT_BRANCH]
sh "./gradlew dockerPush"
}
}
}
}
}
post {
always {
publishHTML (target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'build/reports',
reportFiles: 'd3-test-report.html',
reportName: "D3 test report"
])
}
cleanup {
cleanWs()
}
}
}