@@ -6,6 +6,18 @@ String gradleArgs = '-Dorg.gradle.daemon=false --stacktrace'
6
6
boolean isPublish = BRANCH_NAME == ' publish'
7
7
String versionPostfix = isPublish ? ' ' : BRANCH_NAME // Build script detects empty string as not set.
8
8
9
+ // Note: using single quotes to avoid Groovy String interpolation leaking secrets.
10
+ def internalRepoArgs = ' -PinternalObjectBoxRepo=$MVN_REPO_URL ' +
11
+ ' -PinternalObjectBoxRepoUser=$MVN_REPO_LOGIN_USR ' +
12
+ ' -PinternalObjectBoxRepoPassword=$MVN_REPO_LOGIN_PSW'
13
+ def uploadRepoArgs = ' -PpreferredRepo=$MVN_REPO_UPLOAD_URL ' +
14
+ ' -PpreferredUsername=$MVN_REPO_LOGIN_USR ' +
15
+ ' -PpreferredPassword=$MVN_REPO_LOGIN_PSW '
16
+ // Note: add quotes around URL parameter to avoid line breaks due to semicolon in URL.
17
+ def uploadRepoArgsBintray = ' \" -PpreferredRepo=$BINTRAY_URL\" ' +
18
+ ' -PpreferredUsername=$BINTRAY_LOGIN_USR ' +
19
+ ' -PpreferredPassword=$BINTRAY_LOGIN_PSW'
20
+
9
21
// https://jenkins.io/doc/book/pipeline/syntax/
10
22
pipeline {
11
23
agent { label ' java' }
@@ -14,15 +26,7 @@ pipeline {
14
26
GITLAB_URL = credentials(' gitlab_url' )
15
27
MVN_REPO_LOGIN = credentials(' objectbox_internal_mvn_user' )
16
28
MVN_REPO_URL = credentials(' objectbox_internal_mvn_repo_http' )
17
- // Warning: use single quotes to avoid Groovy String interpolation leaking secrets.
18
- MVN_REPO_ARGS = ' -PinternalObjectBoxRepo=$MVN_REPO_URL ' +
19
- ' -PinternalObjectBoxRepoUser=$MVN_REPO_LOGIN_USR ' +
20
- ' -PinternalObjectBoxRepoPassword=$MVN_REPO_LOGIN_PSW'
21
29
MVN_REPO_UPLOAD_URL = credentials(' objectbox_internal_mvn_repo' )
22
- MVN_REPO_UPLOAD_ARGS = ' -PpreferredRepo=$MVN_REPO_UPLOAD_URL ' +
23
- ' -PpreferredUsername=$MVN_REPO_LOGIN_USR ' +
24
- ' -PpreferredPassword=$MVN_REPO_LOGIN_PSW ' +
25
- ' -PversionPostFix=$versionPostfix'
26
30
// Note: for key use Jenkins secret file with PGP key as text in ASCII-armored format.
27
31
ORG_GRADLE_PROJECT_signingKeyFile = credentials(' objectbox_signing_key' )
28
32
ORG_GRADLE_PROJECT_signingKeyId = credentials(' objectbox_signing_key_id' )
@@ -55,7 +59,7 @@ pipeline {
55
59
56
60
stage(' build-java' ) {
57
61
steps {
58
- sh " ./ci/test-with-asan.sh $gradleArgs $M VN_REPO_ARGS -Dextensive-tests=true clean test " +
62
+ sh " ./ci/test-with-asan.sh $gradleArgs $i nternalRepoArgs -Dextensive-tests=true clean test " +
59
63
" --tests io.objectbox.FunctionalTestSuite " +
60
64
" --tests io.objectbox.test.proguard.ObfuscatedEntityTest " +
61
65
" --tests io.objectbox.rx.QueryObserverTest " +
@@ -66,7 +70,7 @@ pipeline {
66
70
67
71
stage(' upload-to-internal' ) {
68
72
steps {
69
- sh " ./gradlew $gradleArgs $M VN_REPO_ARGS $M VN_REPO_UPLOAD_ARGS uploadArchives"
73
+ sh " ./gradlew $gradleArgs $i nternalRepoArgs $u ploadRepoArgs -PversionPostFix= $v ersionPostfix uploadArchives"
70
74
}
71
75
}
72
76
@@ -80,12 +84,8 @@ pipeline {
80
84
googlechatnotification url : ' id:gchat_java' ,
81
85
message : " *Publishing* ${ currentBuild.fullDisplayName} to Bintray...\n ${ env.BUILD_URL} "
82
86
83
- // Note: supply internal Maven repo as tests use native dependencies (can't publish those without the Java libraries).
84
- // Note: add quotes around URL parameter to avoid line breaks due to semicolon in URL.
85
- // Warning: use single quotes to avoid Groovy String interpolation leaking secrets.
86
- sh " ./gradlew $gradleArgs $MVN_REPO_ARGS " +
87
- ' \" -PpreferredRepo=$BINTRAY_URL\" -PpreferredUsername=$BINTRAY_LOGIN_USR -PpreferredPassword=$BINTRAY_LOGIN_PSW ' +
88
- ' uploadArchives'
87
+ // Note: supply internal repo as tests use native dependencies that might not be published, yet.
88
+ sh " ./gradlew $gradleArgs $internalRepoArgs $uploadRepoArgsBintray uploadArchives"
89
89
90
90
googlechatnotification url : ' id:gchat_java' ,
91
91
message : " Published ${ currentBuild.fullDisplayName} successfully to Bintray - check https://bintray.com/objectbox/objectbox\n ${ env.BUILD_URL} "
0 commit comments