11 changed files with 11 additions and 369 deletions
@ -1,43 +1,5 @@
@@ -1,43 +1,5 @@
|
||||
= Continuous Integration |
||||
|
||||
image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-mongodb%2Fmain&subject=Moore%20(main)[link=https://jenkins.spring.io/view/SpringData/job/spring-data-mongodb/] |
||||
image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-mongodb%2F2.1.x&subject=Lovelace%20(2.1.x)[link=https://jenkins.spring.io/view/SpringData/job/spring-data-mongodb/] |
||||
image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-mongodb%2F1.10.x&subject=Ingalls%20(1.10.x)[link=https://jenkins.spring.io/view/SpringData/job/spring-data-mongodb/] |
||||
|
||||
== 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 a tweak to your test routine 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-mongodb-github springci/spring-data-openjdk17-with-mongodb-5.0.3:latest /bin/bash` |
||||
+ |
||||
This will launch the Docker image and mount your source code at `spring-data-mongodb-github`. |
||||
+ |
||||
2. `cd spring-data-mongodb-github` |
||||
+ |
||||
Next, run the tests from inside the container: |
||||
+ |
||||
3. `./mvnw clean dependency:list test -Dsort -Dbundlor.enabled=false -B` (or with whatever profile you need to test out) |
||||
|
||||
Since the container is binding to your source, you can make edits from your IDE and continue to run build jobs. |
||||
|
||||
If you need to package things up, do this: |
||||
|
||||
1. `docker run -it --mount type=bind,source="$(pwd)",target=/spring-data-mongodb-github springci/spring-data-openjdk8-with-mongodb-4.0:latest /bin/bash` |
||||
+ |
||||
This will launch the Docker image and mount your source code at `spring-data-mongodb-github`. |
||||
+ |
||||
2. `cd spring-data-mongodb-github` |
||||
+ |
||||
Next, package things from inside the container doing this: |
||||
+ |
||||
3. `./mvnw clean dependency:list package -Dsort -Dbundlor.enabled=false -B` |
||||
|
||||
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,216 +0,0 @@
@@ -1,216 +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/3.5.x", threshold: hudson.model.Result.SUCCESS) |
||||
} |
||||
|
||||
options { |
||||
disableConcurrentBuilds() |
||||
buildDiscarder(logRotator(numToKeepStr: '14')) |
||||
} |
||||
|
||||
stages { |
||||
stage("Docker images") { |
||||
parallel { |
||||
stage('Publish JDK (Java 17) + MongoDB 6.0') { |
||||
when { |
||||
anyOf { |
||||
changeset "ci/openjdk17-mongodb-6.0/**" |
||||
changeset "ci/pipeline.properties" |
||||
} |
||||
} |
||||
agent { label 'data' } |
||||
options { timeout(time: 30, unit: 'MINUTES') } |
||||
|
||||
steps { |
||||
script { |
||||
def image = docker.build("springci/spring-data-with-mongodb-6.0:${p['java.main.tag']}", "--build-arg BASE=${p['docker.java.main.image']} --build-arg MONGODB=${p['docker.mongodb.6.0.version']} ci/openjdk17-mongodb-6.0/") |
||||
docker.withRegistry(p['docker.registry'], p['docker.credentials']) { |
||||
image.push() |
||||
} |
||||
} |
||||
} |
||||
} |
||||
stage('Publish JDK (Java 17) + MongoDB 7.0') { |
||||
when { |
||||
anyOf { |
||||
changeset "ci/openjdk17-mongodb-7.0/**" |
||||
changeset "ci/pipeline.properties" |
||||
} |
||||
} |
||||
agent { label 'data' } |
||||
options { timeout(time: 30, unit: 'MINUTES') } |
||||
|
||||
steps { |
||||
script { |
||||
def image = docker.build("springci/spring-data-with-mongodb-7.0:${p['java.main.tag']}", "--build-arg BASE=${p['docker.java.main.image']} --build-arg MONGODB=${p['docker.mongodb.7.0.version']} ci/openjdk17-mongodb-7.0/") |
||||
docker.withRegistry(p['docker.registry'], p['docker.credentials']) { |
||||
image.push() |
||||
} |
||||
} |
||||
} |
||||
} |
||||
stage('Publish JDK (Java.next) + MongoDB 8.0') { |
||||
when { |
||||
anyOf { |
||||
changeset "ci/openjdk17-mongodb-8.0/**" |
||||
changeset "ci/pipeline.properties" |
||||
} |
||||
} |
||||
agent { label 'data' } |
||||
options { timeout(time: 30, unit: 'MINUTES') } |
||||
|
||||
steps { |
||||
script { |
||||
def image = docker.build("springci/spring-data-with-mongodb-8.0:${p['java.next.tag']}", "--build-arg BASE=${p['docker.java.next.image']} --build-arg MONGODB=${p['docker.mongodb.8.0.version']} ci/openjdk23-mongodb-8.0/") |
||||
docker.withRegistry(p['docker.registry'], p['docker.credentials']) { |
||||
image.push() |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
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']}") |
||||
} |
||||
steps { |
||||
script { |
||||
docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) { |
||||
docker.image("springci/spring-data-with-mongodb-6.0:${p['java.main.tag']}").inside(p['docker.java.inside.docker']) { |
||||
sh 'ci/start-replica.sh' |
||||
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' + |
||||
"./mvnw -s settings.xml -Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-mongodb clean dependency:list test -Dsort -U -B -Pno-vector-search-tests" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
stage("Test other configurations") { |
||||
when { |
||||
beforeAgent(true) |
||||
allOf { |
||||
branch(pattern: "main|(\\d\\.\\d\\.x)", comparator: "REGEXP") |
||||
not { triggeredBy 'UpstreamCause' } |
||||
} |
||||
} |
||||
parallel { |
||||
stage("test: MongoDB 7.0 (main)") { |
||||
agent { |
||||
label 'data' |
||||
} |
||||
options { timeout(time: 30, 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("springci/spring-data-with-mongodb-7.0:${p['java.main.tag']}").inside(p['docker.java.inside.docker']) { |
||||
sh 'ci/start-replica.sh' |
||||
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' + |
||||
"./mvnw -s settings.xml -Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-mongodb clean dependency:list test -Dsort -U -B -Pno-vector-search-tests" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
stage("test: MongoDB 8.0") { |
||||
agent { |
||||
label 'data' |
||||
} |
||||
options { timeout(time: 30, 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("springci/spring-data-with-mongodb-8.0:${p['java.next.tag']}").inside(p['docker.java.inside.docker']) { |
||||
sh 'ci/start-replica.sh' |
||||
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' + |
||||
"./mvnw -s settings.xml -Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-mongodb clean dependency:list test -Dsort -U -B -Pno-vector-search-tests" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
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-mongodb " + |
||||
"-Dartifactory.build-number=spring-data-mongodb-${BRANCH_NAME}-build-${BUILD_NUMBER} " + |
||||
"-Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-mongodb " + |
||||
"-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,39 +0,0 @@
@@ -1,39 +0,0 @@
|
||||
== Running CI tasks locally |
||||
|
||||
Since Concourse is built on top of Docker, it's easy to: |
||||
|
||||
* Debug what went wrong on your local machine. |
||||
* Test out a 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 Concourse 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-mongodb-github springci/spring-data-openjdk17-with-mongodb-5.0.3 /bin/bash` |
||||
+ |
||||
This will launch the Docker image and mount your source code at `spring-data-mongodb-github`. |
||||
+ |
||||
Next, run the `test.sh` script from inside the container: |
||||
+ |
||||
2. `PROFILE=none spring-data-mongodb-github/ci/test.sh` |
||||
|
||||
Since the container is binding to your source, you can make edits from your IDE and continue to run build jobs. |
||||
|
||||
If you need to test the `build.sh` script, do this: |
||||
|
||||
1. `mkdir /tmp/spring-data-mongodb-artifactory` |
||||
2. `docker run -it --mount type=bind,source="$(pwd)",target=/spring-data-mongodb-github --mount type=bind,source="/tmp/spring-data-mongodb-artifactory",target=/spring-data-mongodb-artifactory springci/spring-data-openjdk17-with-mongodb-5.0.3 /bin/bash` |
||||
+ |
||||
This will launch the Docker image and mount your source code at `spring-data-mongodb-github` and the temporary |
||||
artifactory output directory at `spring-data-mongodb-artifactory`. |
||||
+ |
||||
Next, run the `build.sh` script from inside the container: |
||||
+ |
||||
3. `spring-data-mongodb-github/ci/build.sh` |
||||
|
||||
IMPORTANT: `build.sh` doesn't actually push to Artifactory so don't worry about accidentally deploying anything. |
||||
It just deploys to a local folder. That way, the `artifactory-resource` later in the pipeline can pick up these artifacts |
||||
and deliver them to artifactory. |
||||
|
||||
NOTE: Docker containers can eat up disk space fast! From time to time, run `docker system prune` to clean out old images. |
||||
@ -1,25 +0,0 @@
@@ -1,25 +0,0 @@
|
||||
ARG BASE |
||||
FROM ${BASE} |
||||
# Any ARG statements before FROM are cleared. |
||||
ARG MONGODB |
||||
|
||||
ENV TZ=Etc/UTC |
||||
ENV DEBIAN_FRONTEND=noninteractive |
||||
ENV MONGO_VERSION=${MONGODB} |
||||
|
||||
RUN set -eux; \ |
||||
sed -i -e 's/archive.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \ |
||||
sed -i -e 's/security.ubuntu.com/mirror.one.com/g' /etc/apt/sources.list && \ |
||||
sed -i -e 's/ports.ubuntu.com/mirrors.ocf.berkeley.edu/g' /etc/apt/sources.list && \ |
||||
sed -i -e 's/http/https/g' /etc/apt/sources.list && \ |
||||
apt-get update && apt-get install -y apt-transport-https apt-utils gnupg2 wget && \ |
||||
# MongoDB 8.0 release signing key |
||||
wget -qO - https://www.mongodb.org/static/pgp/server-8.0.asc | apt-key add - && \ |
||||
# Needed when MongoDB creates a 8.0 folder. |
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-8.0.list && \ |
||||
echo ${TZ} > /etc/timezone |
||||
|
||||
RUN apt-get update && \ |
||||
apt-get install -y mongodb-org=${MONGODB} mongodb-org-server=${MONGODB} mongodb-org-shell=${MONGODB} mongodb-org-mongos=${MONGODB} mongodb-org-tools=${MONGODB} && \ |
||||
apt-get clean && \ |
||||
rm -rf /var/lib/apt/lists/* |
||||
@ -1,32 +0,0 @@
@@ -1,32 +0,0 @@
|
||||
# Java versions |
||||
java.main.tag=17.0.17_10-jdk-jammy |
||||
java.next.tag=24.0.2_12-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.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,6 +0,0 @@
@@ -1,6 +0,0 @@
|
||||
#!/bin/sh |
||||
mkdir -p /tmp/mongodb/db /tmp/mongodb/log |
||||
mongod --setParameter transactionLifetimeLimitSeconds=90 --setParameter maxTransactionLockRequestTimeoutMillis=10000 --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log & |
||||
sleep 10 |
||||
mongosh --eval "rs.initiate({_id: 'rs0', members:[{_id: 0, host: '127.0.0.1:27017'}]});" |
||||
sleep 15 |
||||
Loading…
Reference in new issue