-
Notifications
You must be signed in to change notification settings - Fork 26
/
Jenkinsfile
55 lines (52 loc) · 2.35 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
#!/usr/bin/env groovy
@Library('CloudOrchestrationLibrary')
import com.bitbar.Github
node('linux && maven && gpg') {
ansiColor('xterm') {
stage('Checkout') {
checkout([
$class : 'GitSCM',
branches : [
[
name: 'master'
]
],
userRemoteConfigs: [
[
credentialsId: 'f652697e-beb7-4724-b1b5-4913a2bf45f5',
url : '[email protected]:bitbar/testdroid-api.git'
]
]
])
}
try {
stage('Export gpg keys') {
withCredentials([string(credentialsId: 'gpg_passphrase', variable: 'GPG_PASSPHRASE')]) {
sh('mkdir -p /tmp/gpg')
sh('gpg --batch --pinentry-mode=loopback --yes --passphrase ${GPG_PASSPHRASE} --export-secret-key -a "Info Bitbar" > /tmp/gpg/prv.key')
sh('gpg --export -a "Info Bitbar" > /tmp/gpg/pub.key')
}
}
docker.image("maven:3.9.8-eclipse-temurin-17").inside("-u 0:0 -v /home/testdroid/.m2:/root/.m2 -v /tmp/gpg:/gpg") {
stage('Deploy') {
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) {
script {
sh('apt update && apt install -y gnupg')
sh('gpg --list-keys')
sh('gpg --batch --import /gpg/prv.key')
sh('gpg --batch --import /gpg/pub.key')
sh('sleep 5')
sh('gpg --list-keys')
def version = sh(returnStdout: true, script: 'mvn help:evaluate -Dexpression=project.version -q -DforceStdout')
def gh = new Github(this, 'testdroid-api', 'bitbar')
gh.release('master', 'v' + version, "Version ${version}")
sh('mvn clean package source:jar javadoc:jar gpg:sign nexus-staging:deploy')
}
}
}
}
} finally {
sh('rm -rf /tmp/gpg/')
}
}
}