Skip to content

Commit 3f4f605

Browse files
Build: use internal GitLab repo.
1 parent 7c006fc commit 3f4f605

File tree

4 files changed

+31
-30
lines changed

4 files changed

+31
-30
lines changed

Jenkinsfile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ boolean isPublish = BRANCH_NAME == 'publish'
77
String versionPostfix = isPublish ? '' : BRANCH_NAME // Build script detects empty string as not set.
88

99
// 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'
1310
def gitlabRepoArgs = '-PgitlabUrl=$GITLAB_URL -PgitlabPrivateToken=$GITLAB_TOKEN'
1411
def uploadRepoArgsCentral = '-PsonatypeUsername=$OSSRH_LOGIN_USR -PsonatypePassword=$OSSRH_LOGIN_PSW'
1512

@@ -18,8 +15,6 @@ pipeline {
1815
agent { label 'java' }
1916

2017
environment {
21-
MVN_REPO_LOGIN = credentials('objectbox_internal_mvn_user')
22-
MVN_REPO_URL = credentials('objectbox_internal_mvn_repo_http')
2318
GITLAB_URL = credentials('gitlab_url')
2419
GITLAB_TOKEN = credentials('GITLAB_TOKEN_ALL')
2520
// Note: for key use Jenkins secret file with PGP key as text in ASCII-armored format.
@@ -54,7 +49,7 @@ pipeline {
5449

5550
stage('build-java') {
5651
steps {
57-
sh "./ci/test-with-asan.sh $gradleArgs $internalRepoArgs -Dextensive-tests=true clean test " +
52+
sh "./ci/test-with-asan.sh $gradleArgs $gitlabRepoArgs -Dextensive-tests=true clean test " +
5853
"--tests io.objectbox.FunctionalTestSuite " +
5954
"--tests io.objectbox.test.proguard.ObfuscatedEntityTest " +
6055
"--tests io.objectbox.rx.QueryObserverTest " +
@@ -65,7 +60,7 @@ pipeline {
6560

6661
stage('upload-to-internal') {
6762
steps {
68-
sh "./gradlew $gradleArgs $internalRepoArgs $gitlabRepoArgs -PversionPostFix=$versionPostfix publishMavenJavaPublicationToGitLabRepository"
63+
sh "./gradlew $gradleArgs $gitlabRepoArgs -PversionPostFix=$versionPostfix publishMavenJavaPublicationToGitLabRepository"
6964
}
7065
}
7166

@@ -79,7 +74,7 @@ pipeline {
7974
message: "*Publishing* ${currentBuild.fullDisplayName} to Central...\n${env.BUILD_URL}"
8075

8176
// Note: supply internal repo as tests use native dependencies that might not be published, yet.
82-
sh "./gradlew $gradleArgs $internalRepoArgs $uploadRepoArgsCentral publishMavenJavaPublicationToSonatypeRepository closeAndReleaseStagingRepository"
77+
sh "./gradlew $gradleArgs $gitlabRepoArgs $uploadRepoArgsCentral publishMavenJavaPublicationToSonatypeRepository closeAndReleaseStagingRepository"
8378

8479
googlechatnotification url: 'id:gchat_java',
8580
message: "Published ${currentBuild.fullDisplayName} successfully to Central - check https://repo1.maven.org/maven2/io/objectbox/ in a few minutes.\n${env.BUILD_URL}"

ci/Jenkinsfile-Windows

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,15 @@ String gradleArgs = '-Dorg.gradle.daemon=false --stacktrace'
66
boolean isPublish = BRANCH_NAME == 'publish'
77

88
// Note: using single quotes to avoid Groovy String interpolation leaking secrets.
9-
def internalRepoArgsBat = '-PinternalObjectBoxRepo=%MVN_REPO_URL% ' +
10-
'-PinternalObjectBoxRepoUser=%MVN_REPO_LOGIN_USR% ' +
11-
'-PinternalObjectBoxRepoPassword=%MVN_REPO_LOGIN_PSW%'
9+
def gitlabRepoArgsBat = '-PgitlabUrl=%GITLAB_URL% -PgitlabPrivateToken=%GITLAB_TOKEN%'
1210

1311
// https://jenkins.io/doc/book/pipeline/syntax/
1412
pipeline {
1513
agent { label 'windows' }
1614

1715
environment {
18-
MVN_REPO_URL = credentials('objectbox_internal_mvn_repo_http')
19-
MVN_REPO_LOGIN = credentials('objectbox_internal_mvn_user')
16+
GITLAB_URL = credentials('gitlab_url')
17+
GITLAB_TOKEN = credentials('GITLAB_TOKEN_ALL')
2018
}
2119

2220
options {
@@ -41,7 +39,7 @@ pipeline {
4139
// Remove files to avoid archiving them again.
4240
bat 'del /q /s hs_err_pid*.log'
4341

44-
bat "gradlew $gradleArgs $internalRepoArgsBat cleanTest build test"
42+
bat "gradlew $gradleArgs $gitlabRepoArgsBat cleanTest build test"
4543
}
4644
post {
4745
always {
@@ -60,7 +58,7 @@ pipeline {
6058
// 32-bit ObjectBox to run tests (see build.gradle file).
6159
// Note: assumes JAVA_HOME_X86 is set to 32-bit JDK path.
6260
// Note: no space before && or value has space as well.
63-
bat "set TEST_WITH_JAVA_X86=true&& gradlew $gradleArgs $internalRepoArgsBat cleanTest build test"
61+
bat "set TEST_WITH_JAVA_X86=true&& gradlew $gradleArgs $gitlabRepoArgsBat cleanTest build test"
6462
}
6563
post {
6664
always {
@@ -73,7 +71,7 @@ pipeline {
7371
stage('package-javadoc-for-web') {
7472
when { expression { return isPublish } }
7573
steps {
76-
bat "gradlew $gradleArgs $internalRepoArgsBat :objectbox-java:packageJavadocForWeb"
74+
bat "gradlew $gradleArgs $gitlabRepoArgsBat :objectbox-java:packageJavadocForWeb"
7775
}
7876
post {
7977
always {

tests/objectbox-java-test/build.gradle

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,21 @@ targetCompatibility = JavaVersion.VERSION_1_8
77

88
repositories {
99
// Native lib might be deployed only in internal repo
10-
if (project.hasProperty('internalObjectBoxRepo')) {
11-
println "internalObjectBoxRepo=$internalObjectBoxRepo added to repositories."
10+
if (project.hasProperty('gitlabUrl')) {
11+
println "gitlabUrl=$gitlabUrl added to repositories."
1212
maven {
13-
credentials {
14-
username internalObjectBoxRepoUser
15-
password internalObjectBoxRepoPassword
13+
url "$gitlabUrl/api/v4/groups/objectbox/-/packages/maven"
14+
name "GitLab"
15+
credentials(HttpHeaderCredentials) {
16+
name = 'Private-Token'
17+
value = gitlabPrivateToken
18+
}
19+
authentication {
20+
header(HttpHeaderAuthentication)
1621
}
17-
url internalObjectBoxRepo
1822
}
1923
} else {
20-
println "WARNING: Property internalObjectBoxRepo not set."
24+
println "Property gitlabUrl not set."
2125
}
2226
}
2327

tests/test-proguard/build.gradle

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,21 @@ targetCompatibility = JavaVersion.VERSION_1_8
77

88
repositories {
99
// Native lib might be deployed only in internal repo
10-
if (project.hasProperty('internalObjectBoxRepo')) {
11-
println "internalObjectBoxRepo=$internalObjectBoxRepo added to repositories."
10+
if (project.hasProperty('gitlabUrl')) {
11+
println "gitlabUrl=$gitlabUrl added to repositories."
1212
maven {
13-
credentials {
14-
username internalObjectBoxRepoUser
15-
password internalObjectBoxRepoPassword
13+
url "$gitlabUrl/api/v4/groups/objectbox/-/packages/maven"
14+
name "GitLab"
15+
credentials(HttpHeaderCredentials) {
16+
name = 'Private-Token'
17+
value = gitlabPrivateToken
18+
}
19+
authentication {
20+
header(HttpHeaderAuthentication)
1621
}
17-
url internalObjectBoxRepo
1822
}
1923
} else {
20-
println "WARNING: Property internalObjectBoxRepo not set."
24+
println "Property gitlabUrl not set."
2125
}
2226
}
2327

0 commit comments

Comments
 (0)