@@ -6,22 +6,26 @@ 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' }
1224
1325 environment {
14- GITLAB_URL = credentials(' gitlab_url' )
1526 MVN_REPO_LOGIN = credentials(' objectbox_internal_mvn_user' )
1627 MVN_REPO_URL = credentials(' objectbox_internal_mvn_repo_http' )
17- MVN_REPO_ARGS = " -PinternalObjectBoxRepo=$MVN_REPO_URL " +
18- " -PinternalObjectBoxRepoUser=$MVN_REPO_LOGIN_USR " +
19- " -PinternalObjectBoxRepoPassword=$MVN_REPO_LOGIN_PSW "
2028 MVN_REPO_UPLOAD_URL = credentials(' objectbox_internal_mvn_repo' )
21- MVN_REPO_UPLOAD_ARGS = " -PpreferredRepo=$MVN_REPO_UPLOAD_URL " +
22- " -PpreferredUsername=$MVN_REPO_LOGIN_USR " +
23- " -PpreferredPassword=$MVN_REPO_LOGIN_PSW " +
24- " -PversionPostFix=$versionPostfix "
2529 // Note: for key use Jenkins secret file with PGP key as text in ASCII-armored format.
2630 ORG_GRADLE_PROJECT_signingKeyFile = credentials(' objectbox_signing_key' )
2731 ORG_GRADLE_PROJECT_signingKeyId = credentials(' objectbox_signing_key_id' )
@@ -31,7 +35,7 @@ pipeline {
3135 options {
3236 buildDiscarder(logRotator(numToKeepStr : buildsToKeep, artifactNumToKeepStr : buildsToKeep))
3337 timeout(time : 1 , unit : ' HOURS' ) // If build hangs (regular build should be much quicker)
34- gitLabConnection(" ${ env.GITLAB_URL } " )
38+ gitLabConnection(' objectbox-gitlab-connection ' )
3539 }
3640
3741 triggers {
@@ -54,7 +58,7 @@ pipeline {
5458
5559 stage(' build-java' ) {
5660 steps {
57- sh " ./ci/test-with-asan.sh $gradleArgs $M VN_REPO_ARGS -Dextensive-tests=true clean test " +
61+ sh " ./ci/test-with-asan.sh $gradleArgs $i nternalRepoArgs -Dextensive-tests=true clean test " +
5862 " --tests io.objectbox.FunctionalTestSuite " +
5963 " --tests io.objectbox.test.proguard.ObfuscatedEntityTest " +
6064 " --tests io.objectbox.rx.QueryObserverTest " +
@@ -65,7 +69,7 @@ pipeline {
6569
6670 stage(' upload-to-internal' ) {
6771 steps {
68- sh " ./gradlew $gradleArgs $M VN_REPO_ARGS $M VN_REPO_UPLOAD_ARGS uploadArchives"
72+ sh " ./gradlew $gradleArgs $i nternalRepoArgs $u ploadRepoArgs -PversionPostFix= $v ersionPostfix uploadArchives"
6973 }
7074 }
7175
@@ -79,11 +83,8 @@ pipeline {
7983 googlechatnotification url : ' id:gchat_java' ,
8084 message : " *Publishing* ${ currentBuild.fullDisplayName} to Bintray...\n ${ env.BUILD_URL} "
8185
82- // Note: supply internal Maven repo as tests use native dependencies (can't publish those without the Java libraries).
83- // Note: add quotes around URL parameter to avoid line breaks due to semicolon in URL.
84- sh " ./gradlew $gradleArgs $MVN_REPO_ARGS " +
85- " \" -PpreferredRepo=${ BINTRAY_URL} \" -PpreferredUsername=${ BINTRAY_LOGIN_USR} -PpreferredPassword=${ BINTRAY_LOGIN_PSW} " +
86- " uploadArchives"
86+ // Note: supply internal repo as tests use native dependencies that might not be published, yet.
87+ sh " ./gradlew $gradleArgs $internalRepoArgs $uploadRepoArgsBintray uploadArchives"
8788
8889 googlechatnotification url : ' id:gchat_java' ,
8990 message : " Published ${ currentBuild.fullDisplayName} successfully to Bintray - check https://bintray.com/objectbox/objectbox\n ${ env.BUILD_URL} "
0 commit comments