6 changed files with 7 additions and 220 deletions
@ -1,45 +1,5 @@
@@ -1,45 +1,5 @@
|
||||
= Continuous Integration |
||||
|
||||
image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-commons%2F&subject=Moore%20(main)[link=https://jenkins.spring.io/view/SpringData/job/spring-data-commons/] |
||||
image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-commons%2F2.1.x&subject=Lovelace%20(2.1.x)[link=https://jenkins.spring.io/view/SpringData/job/spring-data-commons/] |
||||
image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-commons%2F1.13.x&subject=Ingalls%20(1.13.x)[link=https://jenkins.spring.io/view/SpringData/job/spring-data-commons/] |
||||
|
||||
== 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-commons-github adoptopenjdk/openjdk8:latest /bin/bash` |
||||
+ |
||||
This will launch the Docker image and mount your source code at `spring-data-commons-github`. |
||||
+ |
||||
2. `cd spring-data-commons-github` |
||||
+ |
||||
Next, run your tests from inside the container: |
||||
+ |
||||
3. `./mvnw clean dependency:list test -Dsort` (or 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 test the `build.sh` script, do this: |
||||
|
||||
1. `docker run -it --mount type=bind,source="$(pwd)",target=/spring-data-commons-github adoptopenjdk/openjdk8:latest /bin/bash` |
||||
+ |
||||
This will launch the Docker image and mount your source code at `spring-data-commons-github`. |
||||
+ |
||||
2. `cd spring-data-commons-github` |
||||
+ |
||||
Next, try to package everything up from inside the container: |
||||
+ |
||||
3. `./mvnw -Pci,snapshot -Dmaven.test.skip=true clean deploy` |
||||
|
||||
IMPORTANT: This will attempt to deploy to artifactory, but without credentials, it will fail, leaving you simply with a built artifact. |
||||
|
||||
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,132 +0,0 @@
@@ -1,132 +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-build/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']}") |
||||
} |
||||
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 -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-commons -Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root clean dependency:list verify -Dsort -B -U" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
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']}") |
||||
} |
||||
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 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' + |
||||
"./mvnw -s settings.xml -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-commons -Ddevelocity.storage.directory=/tmp/jenkins-home/.develocity-root clean dependency:list verify -Dsort -B" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
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-commons " + |
||||
"-Dartifactory.build-number=spring-data-commons-${BRANCH_NAME}-build-${BUILD_NUMBER} " + |
||||
"-Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-commons " + |
||||
"-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,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,10 +0,0 @@
@@ -1,10 +0,0 @@
|
||||
{ |
||||
"dependencies": { |
||||
"antora": "3.2.0-alpha.6", |
||||
"@antora/atlas-extension": "1.0.0-alpha.2", |
||||
"@antora/collector-extension": "1.0.0-alpha.7", |
||||
"@asciidoctor/tabs": "1.0.0-beta.6", |
||||
"@springio/antora-extensions": "1.13.0", |
||||
"@springio/asciidoctor-extensions": "1.0.0-alpha.11" |
||||
} |
||||
} |
||||
Loading…
Reference in new issue