forked from sewenew/redis-plus-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
53 lines (42 loc) · 1.76 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
node {
@Library("kenbun_pipeline")_
checkout scm
generalPipeline {
def product = 'kenbun'
def name = 'kazoku'
if (env.BRANCH_NAME == 'main' || env.BRANCH_NAME == 'master' ) {
buildAndDeployLib()
} else {
buildOnly()
}
}
}
def buildOnly() {
stage("compile"){
docker.withRegistry(env.nexusDockerRepo, 'nexus') {
def pythonImage = docker.image('docker.kenbun.de/kenbun/cppubuntu2004')
pythonImage.pull()
pythonImage.withRun() { c ->
pythonImage.inside("-v " + env.WORKSPACE.toString() + ":/workspace --network='host'") {
sh("bash /workspace/build-debian-packages.sh")
}
}
}
}
}
def buildAndDeployLib() {
stage("deploy to apt repo"){
docker.withRegistry(env.nexusDockerRepo, 'nexus') {
def pythonImage = docker.image('docker.kenbun.de/kenbun/cppubuntu2004')
pythonImage.pull()
pythonImage.withRun() { c ->
pythonImage.inside("-v " + env.WORKSPACE.toString() + ":/workspace --network='host'") {
sh("bash /workspace/build-debian-packages.sh")
withCredentials([usernamePassword(credentialsId: 'nexus', usernameVariable: 'nexusUser', passwordVariable: 'nexusPassword')]) {
sh("cd /workspace/build && for FILE in *.deb; do curl -u '" + nexusUser.toString() + ":" + nexusPassword.toString() + "' -H 'Content-Type: multipart/form-data' --data-binary @\$FILE https://nexus.kenbun.de/repository/apt-kenbun/; done")
}
}
}
}
}
}