@@ -6,6 +6,18 @@ String gradleArgs = '-Dorg.gradle.daemon=false --stacktrace'
66boolean isPublish = BRANCH_NAME == ' publish'
77String versionPostfix = isPublish ? ' ' : BRANCH_NAME // Build script detects empty string as not set.
88
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+
921// https://jenkins.io/doc/book/pipeline/syntax/
1022pipeline {
1123 agent { label ' java' }
@@ -14,15 +26,7 @@ pipeline {
1426 GITLAB_URL = credentials(' gitlab_url' )
1527 MVN_REPO_LOGIN = credentials(' objectbox_internal_mvn_user' )
1628 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'
2129 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'
2630 // Note: for key use Jenkins secret file with PGP key as text in ASCII-armored format.
2731 ORG_GRADLE_PROJECT_signingKeyFile = credentials(' objectbox_signing_key' )
2832 ORG_GRADLE_PROJECT_signingKeyId = credentials(' objectbox_signing_key_id' )
@@ -55,7 +59,7 @@ pipeline {
5559
5660 stage(' build-java' ) {
5761 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 " +
5963 " --tests io.objectbox.FunctionalTestSuite " +
6064 " --tests io.objectbox.test.proguard.ObfuscatedEntityTest " +
6165 " --tests io.objectbox.rx.QueryObserverTest " +
@@ -66,7 +70,7 @@ pipeline {
6670
6771 stage(' upload-to-internal' ) {
6872 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"
7074 }
7175 }
7276
@@ -80,12 +84,8 @@ pipeline {
8084 googlechatnotification url : ' id:gchat_java' ,
8185 message : " *Publishing* ${ currentBuild.fullDisplayName} to Bintray...\n ${ env.BUILD_URL} "
8286
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"
8989
9090 googlechatnotification url : ' id:gchat_java' ,
9191 message : " Published ${ currentBuild.fullDisplayName} successfully to Bintray - check https://bintray.com/objectbox/objectbox\n ${ env.BUILD_URL} "
0 commit comments