Skip to content

Commit

Permalink
Introduce property for Jenkins user and Artifactory server details.
Browse files Browse the repository at this point in the history
Closes #2835
  • Loading branch information
mp911de committed Nov 27, 2023
1 parent 4e66f79 commit 0f54c6f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
17 changes: 9 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ pipeline {
steps {
script {
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) {
sh "PROFILE=none ci/test.sh"
sh "ci/clean.sh"
sh "PROFILE=none JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh"
}
}
}
Expand All @@ -67,8 +67,8 @@ pipeline {
steps {
script {
docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.docker']) {
sh "PROFILE=none ci/test.sh"
sh "ci/clean.sh"
sh "PROFILE=none JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh"
}
}
}
Expand Down Expand Up @@ -96,14 +96,15 @@ pipeline {
steps {
script {
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml -Pci,artifactory -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-neo4j-non-root ' +
'-Dartifactory.server=https://repo.spring.io ' +
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
"./mvnw -s settings.xml -Pci,artifactory -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-neo4j-non-root " +
"-Dartifactory.server=${p['artifactory.url']} " +
"-Dartifactory.username=${ARTIFACTORY_USR} " +
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
"-Dartifactory.staging-repository=libs-snapshot-local " +
"-Dartifactory.staging-repository=${p['artifactory.repository.snapshot']} " +
"-Dartifactory.build-name=spring-data-neo4j " +
"-Dartifactory.build-number=${BUILD_NUMBER} " +
'-Dmaven.test.skip=true clean deploy -U -B'
"-Dmaven.test.skip=true clean deploy -U -B"
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions ci/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

set -euo pipefail

MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" \
./mvnw -s settings.xml clean -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-neo4j
export JENKINS_USER=${JENKINS_USER_NAME}

MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" \
./mvnw -s settings.xml clean -Dscan=false -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-neo4j
3 changes: 3 additions & 0 deletions ci/pipeline.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -
docker.registry=
docker.credentials=hub.docker.com-springbuildmaster
artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c
artifactory.url=https://repo.spring.io
artifactory.repository.snapshot=libs-snapshot-local
jenkins.user.name=spring-builds+jenkins
5 changes: 4 additions & 1 deletion ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ set -euo pipefail

mkdir -p /tmp/jenkins-home
chown -R 1001:1001 .
MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home " \

export JENKINS_USER=${JENKINS_USER_NAME}

MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home -Dscan=false" \
./mvnw -s settings.xml -P${PROFILE} clean dependency:list verify -Dsort -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-neo4j

0 comments on commit 0f54c6f

Please sign in to comment.