This repository has been archived by the owner on Apr 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
100 lines (93 loc) · 2.82 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
pipeline {
agent {
kubernetes {
inheritFrom 'centos-8'
}
}
triggers {
// only on master branch / 30 minutes before nightly sign-and-deploy
cron(env.BRANCH_NAME == 'master' ? 'H 15 * * *' : '')
githubPush()
}
environment {
GRADLE_USER_HOME = "$WORKSPACE/.gradle" // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=564559
DOWNLOAD_AREA = '/home/data/httpd/download.eclipse.org/modeling/tmf/xtext/downloads/drops'
KEYRING = credentials('secret-subkeys.asc')
SCRIPTS = "$WORKSPACE/umbrella/releng/jenkins/sign-and-deploy/scripts"
GITHUB_API_CREDENTIALS_ID = 'github-bot-token'
}
options {
buildDiscarder(logRotator(numToKeepStr:'15'))
disableConcurrentBuilds()
timeout(time: 90, unit: 'MINUTES')
}
// Build stages
stages {
stage('Build') {
tools {
maven "apache-maven-3.8.5"
jdk "temurin-jdk11-latest"
}
environment {
EXTRA_ARGS = "-Dmaven.repo.local=.m2 -Dtycho.localArtifacts=ignore"
MAVEN_OPTS="-Xmx512m"
}
steps {
checkout scm
wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) {
withCredentials([string(credentialsId: 'gpg_passphrase', variable: 'GPG_PASSPHRASE')]) {
sh '''
env
echo "$(pwd)"
export GPG_TTY=$(tty)
gpg --version
gpg --batch --import "${KEYRING}"
for fpr in $(gpg --list-keys --with-colons | awk -F: '/fpr:/ {print $10}' | sort -u);
do
echo -e "5\ny\n" | gpg --batch --command-fd 0 --expert --edit-key $fpr trust;
done
ls -la /home/jenkins/.gradle/gradle.properties
./gradlew clean build --info -Psigning.gnupg.passphrase=${GPG_PASSPHRASE}
'''
}
}
}
}
}
post {
success {
archiveArtifacts artifacts: 'build/libs/**'
}
cleanup {
script {
def curResult = currentBuild.currentResult
def lastResult = 'NEW'
if (currentBuild.previousBuild != null) {
lastResult = currentBuild.previousBuild.result
}
if (curResult != 'SUCCESS' || lastResult != 'SUCCESS') {
def color = ''
switch (curResult) {
case 'SUCCESS':
color = '#00FF00'
break
case 'UNSTABLE':
color = '#FFFF00'
break
case 'FAILURE':
color = '#FF0000'
break
default: // e.g. ABORTED
color = '#666666'
}
slackSend (
message: "${lastResult} => ${curResult}: <${env.BUILD_URL}|${env.JOB_NAME}#${env.BUILD_NUMBER}>",
botUser: true,
channel: 'xtext-builds',
color: "${color}"
)
}
}
}
}
}