8 changed files with 10 additions and 224 deletions
@ -1,30 +1,8 @@
@@ -1,30 +1,8 @@
|
||||
= Continuous Integration |
||||
|
||||
image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-jdbc%2Fmain&subject=Moore%20(main)["Spring Data JDBC", link="https://jenkins.spring.io/view/SpringData/job/spring-data-jdbc/"] |
||||
image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-jdbc%2F1.0.x&subject=Lovelace%20(1.0.x)["Spring Data JDBC", link="https://jenkins.spring.io/view/SpringData/job/spring-data-jdbc/"] |
||||
Make sure to accept 3rd party database licenses before running integration tests against all databases. |
||||
Run ci/accept-third-party-license.sh in doubt. |
||||
|
||||
== Running CI tasks locally |
||||
|
||||
Since this pipeline is purely Docker-based, it's easy to: |
||||
|
||||
* Debug what went wrong on your local machine. |
||||
* Test out a tweak to your `test.sh` script before sending it out. |
||||
* Experiment against a new image before submitting your pull request. |
||||
|
||||
All of these use cases are great reasons to essentially run what the CI server does on your local machine. |
||||
|
||||
IMPORTANT: To do this you must have Docker installed on your machine. |
||||
|
||||
1. `docker run -it --mount type=bind,source="$(pwd)",target=/spring-data-jdbc-github -v /usr/bin/docker:/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock adoptopenjdk/openjdk8:latest /bin/bash` |
||||
+ |
||||
This will launch the Docker image and mount your source code at `spring-data-jdbc-github`. |
||||
+ |
||||
2. `cd spring-data-jdbc-github` |
||||
+ |
||||
Next, test everything from inside the container: |
||||
+ |
||||
3. `./mvnw -Pci,all-dbs clean dependency:list test -Dsort -B` (or whatever test configuration you must use) |
||||
|
||||
Since the container is binding to your source, you can make edits from your IDE and continue to run build jobs. |
||||
|
||||
NOTE: Docker containers can eat up disk space fast! From time to time, run `docker system prune` to clean out old images. |
||||
You can run CI jobs locally using Docker and act[https://nektosact.com/]. |
||||
|
||||
@ -1,134 +0,0 @@
@@ -1,134 +0,0 @@
|
||||
def p = [:] |
||||
node { |
||||
checkout scm |
||||
p = readProperties interpolate: true, file: 'ci/pipeline.properties' |
||||
} |
||||
|
||||
pipeline { |
||||
agent none |
||||
|
||||
triggers { |
||||
pollSCM 'H/10 * * * *' |
||||
upstream(upstreamProjects: "spring-data-commons/4.0.x", threshold: hudson.model.Result.SUCCESS) |
||||
} |
||||
|
||||
options { |
||||
disableConcurrentBuilds() |
||||
buildDiscarder(logRotator(numToKeepStr: '14')) |
||||
} |
||||
|
||||
stages { |
||||
stage("test: baseline (main)") { |
||||
when { |
||||
beforeAgent(true) |
||||
anyOf { |
||||
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP") |
||||
not { triggeredBy 'UpstreamCause' } |
||||
} |
||||
} |
||||
agent { |
||||
label 'data' |
||||
} |
||||
options { timeout(time: 30, unit: 'MINUTES') } |
||||
|
||||
environment { |
||||
ARTIFACTORY = credentials("${p['artifactory.credentials']}") |
||||
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}") |
||||
TESTCONTAINERS_IMAGE_SUBSTITUTOR = 'org.springframework.data.ProxyImageNameSubstitutor' |
||||
} |
||||
|
||||
steps { |
||||
script { |
||||
docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) { |
||||
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) { |
||||
sh "PROFILE=all-dbs JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh" |
||||
sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
stage("Test other configurations") { |
||||
when { |
||||
beforeAgent(true) |
||||
allOf { |
||||
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP") |
||||
not { triggeredBy 'UpstreamCause' } |
||||
} |
||||
} |
||||
parallel { |
||||
stage("test: baseline (next)") { |
||||
agent { |
||||
label 'data' |
||||
} |
||||
options { timeout(time: 30, unit: 'MINUTES') } |
||||
environment { |
||||
ARTIFACTORY = credentials("${p['artifactory.credentials']}") |
||||
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}") |
||||
TESTCONTAINERS_IMAGE_SUBSTITUTOR = 'org.springframework.data.ProxyImageNameSubstitutor' |
||||
} |
||||
steps { |
||||
script { |
||||
docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) { |
||||
docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.docker']) { |
||||
sh "PROFILE=all-dbs JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh" |
||||
sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
stage('Release to artifactory') { |
||||
when { |
||||
beforeAgent(true) |
||||
anyOf { |
||||
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP") |
||||
not { triggeredBy 'UpstreamCause' } |
||||
} |
||||
} |
||||
agent { |
||||
label 'data' |
||||
} |
||||
options { timeout(time: 20, unit: 'MINUTES') } |
||||
environment { |
||||
ARTIFACTORY = credentials("${p['artifactory.credentials']}") |
||||
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}") |
||||
} |
||||
steps { |
||||
script { |
||||
docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) { |
||||
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) { |
||||
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' + |
||||
"./mvnw -s settings.xml -Pci,artifactory " + |
||||
"-Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root " + |
||||
"-Dartifactory.server=${p['artifactory.url']} " + |
||||
"-Dartifactory.username=${ARTIFACTORY_USR} " + |
||||
"-Dartifactory.password=${ARTIFACTORY_PSW} " + |
||||
"-Dartifactory.staging-repository=${p['artifactory.repository.snapshot']} " + |
||||
"-Dartifactory.build-name=spring-data-relational " + |
||||
"-Dartifactory.build-number=spring-data-relational-${BRANCH_NAME}-build-${BUILD_NUMBER} " + |
||||
"-Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jdbc " + |
||||
"-Dmaven.test.skip=true clean deploy -U -B" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
post { |
||||
changed { |
||||
script { |
||||
emailext( |
||||
subject: "[${currentBuild.fullDisplayName}] ${currentBuild.currentResult}", |
||||
mimeType: 'text/html', |
||||
recipientProviders: [[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']], |
||||
body: "<a href=\"${env.BUILD_URL}\">${currentBuild.fullDisplayName} is reported as ${currentBuild.currentResult}</a>") |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -1,8 +0,0 @@
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash -x |
||||
|
||||
set -euo pipefail |
||||
|
||||
export JENKINS_USER=${JENKINS_USER_NAME} |
||||
|
||||
MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" \ |
||||
./mvnw -s settings.xml -Dscan=false clean -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jdbc -Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root |
||||
@ -1,33 +0,0 @@
@@ -1,33 +0,0 @@
|
||||
# Java versions |
||||
java.main.tag=25.0.1_8-jdk-noble |
||||
java.next.tag=25.0.1_8-jdk-noble |
||||
|
||||
# Docker container images - standard |
||||
docker.java.main.image=library/eclipse-temurin:${java.main.tag} |
||||
docker.java.next.image=library/eclipse-temurin:${java.next.tag} |
||||
|
||||
# Supported versions of MongoDB |
||||
docker.mongodb.6.0.version=6.0.23 |
||||
docker.mongodb.7.0.version=7.0.20 |
||||
docker.mongodb.8.0.version=8.0.9 |
||||
|
||||
# Supported versions of Redis |
||||
docker.redis.6.version=6.2.13 |
||||
docker.redis.7.version=7.2.4 |
||||
docker.redis.8.version=8.2.2 |
||||
docker.valkey.8.version=8.1.1 |
||||
|
||||
# Docker environment settings |
||||
docker.java.inside.basic=-v $HOME:/tmp/jenkins-home --ulimit nofile=32000:32000 |
||||
docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home --ulimit nofile=32000:32000 |
||||
|
||||
# Credentials |
||||
docker.registry= |
||||
docker.credentials=hub.docker.com-springbuildmaster |
||||
docker.proxy.registry=https://docker-hub.usw1.packages.broadcom.com |
||||
docker.proxy.credentials=usw1_packages_broadcom_com-jenkins-token |
||||
artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c |
||||
artifactory.url=https://repo.spring.io |
||||
artifactory.repository.snapshot=libs-snapshot-local |
||||
develocity.access-key=gradle_enterprise_secret_access_key |
||||
jenkins.user.name=spring-builds+jenkins |
||||
@ -1,17 +0,0 @@
@@ -1,17 +0,0 @@
|
||||
#!/bin/bash -x |
||||
|
||||
set -euo pipefail |
||||
|
||||
ci/accept-third-party-license.sh |
||||
|
||||
echo "Copying ProxyImageNameSubstitutor into JDBC and R2DBC..." |
||||
cp spring-data-relational/src/test/java/org/springframework/data/ProxyImageNameSubstitutor.java spring-data-jdbc/src/test/java/org/springframework/data |
||||
cp spring-data-relational/src/test/java/org/springframework/data/ProxyImageNameSubstitutor.java spring-data-r2dbc/src/test/java/org/springframework/data |
||||
|
||||
mkdir -p /tmp/jenkins-home |
||||
|
||||
export JENKINS_USER=${JENKINS_USER_NAME} |
||||
|
||||
MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" \ |
||||
./mvnw -s settings.xml \ |
||||
-P${PROFILE} clean dependency:list verify -Dsort -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-jdbc -Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root |
||||
Loading…
Reference in new issue