@@ -6,17 +6,24 @@ String buildsToKeep = '500'
6
6
7
7
String gradleArgs = ' -Dorg.gradle.daemon=false --stacktrace'
8
8
boolean 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.
10
10
11
11
// https://jenkins.io/doc/book/pipeline/syntax/
12
12
pipeline {
13
13
agent { label ' java' }
14
14
15
15
environment {
16
16
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' )
19
17
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 "
20
27
}
21
28
22
29
options {
@@ -43,8 +50,7 @@ pipeline {
43
50
44
51
stage(' build-java' ) {
45
52
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 " +
48
54
" clean test " +
49
55
" --tests io.objectbox.FunctionalTestSuite " +
50
56
" --tests io.objectbox.test.proguard.ObfuscatedEntityTest " +
@@ -55,11 +61,7 @@ pipeline {
55
61
56
62
stage(' upload-to-internal' ) {
57
63
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"
63
65
}
64
66
}
65
67
@@ -73,7 +75,11 @@ pipeline {
73
75
googlechatnotification url : ' id:gchat_java' ,
74
76
message : " *Publishing* ${ currentBuild.fullDisplayName} to Bintray...\n ${ env.BUILD_URL} "
75
77
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"
77
83
78
84
googlechatnotification url : ' id:gchat_java' ,
79
85
message : " Published ${ currentBuild.fullDisplayName} successfully to Bintray - check https://bintray.com/objectbox/objectbox\n ${ env.BUILD_URL} "
0 commit comments