This repository was archived by the owner on Jul 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathJenkinsfile
More file actions
executable file
·85 lines (85 loc) · 3.31 KB
/
Copy pathJenkinsfile
File metadata and controls
executable file
·85 lines (85 loc) · 3.31 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
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
#!groovy
pipeline {
agent {
kubernetes {
label 'keyple-gradle'
yaml javaBuilder('2.0')
}
}
stages {
stage('Prepare settings') {
steps{
container('java-builder') {
script {
keypleGradleVersion = sh(script: 'grep "^version" java/keyple-gradle/gradle.properties | cut -d= -f2 | tr -d "[:space:]"', returnStdout: true).trim()
deployKeypleGradle = env.GIT_URL == 'https://github.com/eclipse-keyple/keyple-ops.git' && env.GIT_BRANCH == "master" && env.CHANGE_ID == null
}
}
}
}
stage('Import keyring'){
when {
expression { deployKeypleGradle }
}
steps{
container('java-builder') {
withCredentials([file(credentialsId: 'secret-subkeys.asc', variable: 'KEYRING')]) {
sh 'import_gpg "${KEYRING}"'
}
}
}
}
stage('Keyple Gradle Plugin: Build and test') {
steps{
container('java-builder') {
configFileProvider(
[configFile(
fileId: 'gradle.properties',
targetLocation: '/home/jenkins/agent/gradle.properties')]) {
dir('java/keyple-gradle') {
sh './gradlew clean assemble --info --stacktrace'
}
catchError(buildResult: 'UNSTABLE', message: 'There were failing tests.', stageResult: 'UNSTABLE') {
dir('java/keyple-gradle') {
sh './gradlew test --info --stacktrace'
}
}
junit allowEmptyResults: true, testResults: 'java/keyple-gradle/build/test-results/test/*.xml'
}
}
}
}
stage('Keyple Gradle Plugin: Upload to sonatype') {
when {
expression { deployKeypleGradle }
}
steps{
container('java-builder') {
configFileProvider([configFile(
fileId: 'gradle.properties',
targetLocation: '/home/jenkins/agent/gradle.properties')]) {
dir('java/keyple-gradle') {
sh './gradlew publish --info --stacktrace'
}
}
}
}
}
stage('Keyple Gradle Plugin: Code Quality') {
when {
expression { deployKeypleGradle }
}
steps {
catchError(buildResult: 'SUCCESS', message: 'Unable to log code quality to Sonar.', stageResult: 'FAILURE') {
container('java-builder') {
withCredentials([string(credentialsId: 'sonarcloud-token', variable: 'SONAR_LOGIN')]) {
dir('java/keyple-gradle') {
sh './gradlew sonarqube --info --stacktrace'
}
}
}
}
}
}
}
}