This repository has been archived by the owner on Sep 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
60 lines (60 loc) · 1.85 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
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '20'))
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('Build') {
steps {
script {
sh "./gradlew build --info"
}
}
}
stage('Test') {
steps {
script {
sh "./gradlew test --info"
}
}
}
stage('Build artifacts') {
steps {
script {
if (env.BRANCH_NAME ==~ /(master|develop)/ || env.TAG_NAME) {
DOCKER_TAGS = ['master': 'latest', 'develop': 'develop']
withCredentials([usernamePassword(credentialsId: 'nexus-d3-docker', usernameVariable: 'login', passwordVariable: 'password')]) {
env.DOCKER_REGISTRY_URL = "https://nexus.iroha.tech:19002"
env.DOCKER_REGISTRY_USERNAME = "${login}"
env.DOCKER_REGISTRY_PASSWORD = "${password}"
env.TAG = env.TAG_NAME ? env.TAG_NAME : DOCKER_TAGS[env.BRANCH_NAME]
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()
}
}
}