forked from d3ledger/chain-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
57 lines (51 loc) · 1.96 KB
/
Jenkinsfile
File metadata and controls
57 lines (51 loc) · 1.96 KB
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 {
options {
skipDefaultCheckout()
buildDiscarder(logRotator(numToKeepStr: '20'))
}
agent { label 'd3-build-agent' }
stages {
stage('Tests') {
steps {
script {
checkout scm
env.WORKSPACE = pwd()
docker.image("gradle:4.10.2-jdk8-slim")
.inside("-v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp") {
sh "gradle test --info"
sh "gradle shadowJar"
sh "gradle compileIntegrationTestKotlin --info"
sh "gradle integrationTest --info"
}
}
}
post {
cleanup {
cleanWs()
}
}
}
stage('Build and push docker images') {
agent { label 'd3-build-agent' }
steps {
script {
def scmVars = checkout scm
if (env.BRANCH_NAME ==~ /(master|develop|reserved)/) {
withCredentials([usernamePassword(credentialsId: 'nexus-d3-docker', usernameVariable: 'login', passwordVariable: 'password')]) {
sh "docker login nexus.iroha.tech:19002 -u ${login} -p '${password}'"
TAG = env.BRANCH_NAME
iC = docker.image("gradle:4.10.2-jdk8-slim")
iC.inside("-e JVM_OPTS='-Xmx3200m' -e TERM='dumb'") {
sh "gradle shadowJar"
}
def nexusRepository="nexus.iroha.tech:19002/${login}"
def chainAdapterJarFile="/build/libs/chain-adapter-all.jar"
chainAdapter = docker.build("${nexusRepository}/chain-adapter:${TAG}", "-f Dockerfile --build-arg JAR_FILE=${chainAdapterJarFile} .")
chainAdapter.push("${TAG}")
}
}
}
}
}
}
}