@@ -6,17 +6,24 @@ String buildsToKeep = '500'
66
77String gradleArgs = ' -Dorg.gradle.daemon=false --stacktrace'
88boolean isPublish = BRANCH_NAME == ' publish'
9- String internalRepoVersionPostfix = isPublish ? ' ' : BRANCH_NAME // build script detects empty string as not set
9+ String versionPostfix = isPublish ? ' ' : BRANCH_NAME // Build script detects empty string as not set.
1010
1111// https://jenkins.io/doc/book/pipeline/syntax/
1212pipeline {
1313 agent { label ' java' }
1414
1515 environment {
1616 GITLAB_URL = credentials(' gitlab_url' )
17- MVN_REPO_URL = credentials(' objectbox_internal_mvn_repo_http' )
18- MVN_REPO_URL_PUBLISH = credentials(' objectbox_internal_mvn_repo' )
1917 MVN_REPO_LOGIN = credentials(' objectbox_internal_mvn_user' )
18+ MVN_REPO_URL = credentials(' objectbox_internal_mvn_repo_http' )
19+ MVN_REPO_ARGS = " -PinternalObjectBoxRepo=$MVN_REPO_URL " +
20+ " -PinternalObjectBoxRepoUser=$MVN_REPO_LOGIN_USR " +
21+ " -PinternalObjectBoxRepoPassword=$MVN_REPO_LOGIN_PSW "
22+ MVN_REPO_UPLOAD_URL = credentials(' objectbox_internal_mvn_repo' )
23+ MVN_REPO_UPLOAD_ARGS = " -PpreferredRepo=$MVN_REPO_UPLOAD_URL " +
24+ " -PpreferredUsername=$MVN_REPO_LOGIN_USR " +
25+ " -PpreferredPassword=$MVN_REPO_LOGIN_PSW " +
26+ " -PversionPostFix=$versionPostfix "
2027 }
2128
2229 options {
@@ -43,8 +50,7 @@ pipeline {
4350
4451 stage(' build-java' ) {
4552 steps {
46- sh " ./test-with-asan.sh -Dextensive-tests=true " +
47- " -PinternalObjectBoxRepo=${ MVN_REPO_URL} -PinternalObjectBoxRepoUser=${ MVN_REPO_LOGIN_USR} -PinternalObjectBoxRepoPassword=${ MVN_REPO_LOGIN_PSW} " +
53+ sh " ./test-with-asan.sh -Dextensive-tests=true $MVN_REPO_ARGS " +
4854 " clean test " +
4955 " --tests io.objectbox.FunctionalTestSuite " +
5056 " --tests io.objectbox.test.proguard.ObfuscatedEntityTest " +
@@ -55,11 +61,7 @@ pipeline {
5561
5662 stage(' upload-to-internal' ) {
5763 steps {
58- sh " ./gradlew $gradleArgs " +
59- " -PversionPostFix=${ internalRepoVersionPostfix} " +
60- " -PinternalObjectBoxRepo=${ MVN_REPO_URL} -PinternalObjectBoxRepoUser=${ MVN_REPO_LOGIN_USR} -PinternalObjectBoxRepoPassword=${ MVN_REPO_LOGIN_PSW} " +
61- " -PpreferredRepo=${ MVN_REPO_URL_PUBLISH} -PpreferredUsername=${ MVN_REPO_LOGIN_USR} -PpreferredPassword=${ MVN_REPO_LOGIN_PSW} " +
62- " uploadArchives"
64+ sh " ./gradlew $gradleArgs $MVN_REPO_ARGS $MVN_REPO_UPLOAD_ARGS uploadArchives"
6365 }
6466 }
6567
@@ -73,7 +75,11 @@ pipeline {
7375 googlechatnotification url : ' id:gchat_java' ,
7476 message : " *Publishing* ${ currentBuild.fullDisplayName} to Bintray...\n ${ env.BUILD_URL} "
7577
76- sh " ./gradlew $gradleArgs -PpreferredRepo=${ BINTRAY_URL} -PpreferredUsername=${ BINTRAY_LOGIN_USR} -PpreferredPassword=${ BINTRAY_LOGIN_PSW} uploadArchives"
78+ // Not supplying internal Maven repo info to ensure dependencies are fetched from public repo.
79+ // Note: add quotes around URL parameter to avoid line breaks due to semicolon in URL.
80+ sh " ./gradlew $gradleArgs " +
81+ " \" -PpreferredRepo=${ BINTRAY_URL} \" -PpreferredUsername=${ BINTRAY_LOGIN_USR} -PpreferredPassword=${ BINTRAY_LOGIN_PSW} " +
82+ " uploadArchives"
7783
7884 googlechatnotification url : ' id:gchat_java' ,
7985 message : " Published ${ currentBuild.fullDisplayName} successfully to Bintray - check https://bintray.com/objectbox/objectbox\n ${ env.BUILD_URL} "
0 commit comments