| name: Nightly Docker Build & Publish |
| |
| # Note: This GHA workflow is unique in that it's not for PRs. Solr's *non*-PR CI workflows are |
| # handled by Jenkins, but ASF's Jenkins is not equipped to build a multi-platform Docker image. |
| |
| on: |
| schedule: |
| # Run daily at 2 AM UTC |
| - cron: '0 2 * * *' |
| workflow_dispatch: |
| # Allow manual triggering |
| |
| jobs: |
| build-and-publish: |
| name: Build and publish Docker images |
| runs-on: ubuntu-latest |
| timeout-minutes: 60 |
| |
| strategy: |
| fail-fast: false |
| matrix: |
| include: |
| # main branch - Gradle on JDK21, Docker images with JRE25 |
| - branch: main |
| gradle-jdk: 21 |
| dist: full |
| base-image: eclipse-temurin:25-jre-noble |
| tag-suffix: '' |
| - branch: main |
| gradle-jdk: 21 |
| dist: slim |
| base-image: eclipse-temurin:25-jre-noble |
| tag-suffix: '' |
| |
| # branch_10x - Gradle on JDK21, Docker images with JRE21 (default) and JRE25 |
| - branch: branch_10x |
| gradle-jdk: 21 |
| dist: full |
| base-image: eclipse-temurin:21-jre-noble |
| tag-suffix: '' |
| - branch: branch_10x |
| gradle-jdk: 21 |
| dist: slim |
| base-image: eclipse-temurin:21-jre-noble |
| tag-suffix: '' |
| - branch: branch_10x |
| gradle-jdk: 21 |
| dist: full |
| base-image: eclipse-temurin:25-jre-noble |
| tag-suffix: '-java25' |
| |
| # branch_9x - Gradle on JDK17, Docker images with JRE17 (default) and JRE21 |
| - branch: branch_9x |
| gradle-jdk: 17 |
| dist: full |
| base-image: eclipse-temurin:17-jre-jammy |
| tag-suffix: '' |
| - branch: branch_9x |
| gradle-jdk: 17 |
| dist: slim |
| base-image: eclipse-temurin:17-jre-jammy |
| tag-suffix: '' |
| - branch: branch_9x |
| gradle-jdk: 17 |
| dist: full |
| base-image: eclipse-temurin:21-jre-jammy |
| tag-suffix: '-java21' |
| |
| # branch_9_11 - Gradle on JDK17, Docker images with JRE17 (default) and JRE21 |
| # SEE SOURCE CONTROL HISTORY TO RE-ENABLE |
| |
| env: |
| DEVELOCITY_ACCESS_KEY: ${{ secrets.SOLR_DEVELOCITY_ACCESS_KEY }} |
| |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| with: |
| ref: ${{ matrix.branch }} |
| |
| - name: Set up Java (JDK ${{ matrix.gradle-jdk }}) |
| uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0 |
| with: |
| distribution: temurin |
| java-version: ${{ matrix.gradle-jdk }} |
| java-package: jdk |
| |
| - name: Cache gradle-wrapper.jar |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
| with: |
| path: gradle/wrapper/gradle-wrapper.jar |
| key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.jar.sha256') }} |
| |
| - name: Set up Gradle |
| uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 |
| with: |
| develocity-token-expiry: 8 |
| |
| - name: Create custom gradle.properties |
| run: | |
| cat > gradle.properties << 'EOF' |
| # Disable Gradle daemon for all builds. |
| org.gradle.daemon=false |
| |
| # Lucene specific settings for lucene2 build nodes |
| systemProp.file.encoding=UTF-8 |
| org.gradle.jvmargs=-Xmx2g -XX:ReservedCodeCacheSize=256m -XX:TieredStopAtLevel=1 -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options="-Xmx4096M" -XX:+UseParallelGC -XX:ActiveProcessorCount=1 \ |
| --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ |
| --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ |
| --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \ |
| --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ |
| --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED |
| org.gradle.workers.max=4 |
| tests.jvms=4 |
| tests.multiplier=2 |
| |
| # Temporary workaround while Gradle files are updated to fix a bug in how generated files are (or aren't) optimized |
| production=true |
| EOF |
| |
| - name: Set up QEMU for multi-platform builds |
| uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0 |
| |
| - name: Set up Docker Buildx |
| uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 |
| |
| - name: Log in to Docker Hub |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 |
| with: |
| username: ${{ secrets.DOCKERHUB_USER }} |
| password: ${{ secrets.DOCKERHUB_TOKEN }} |
| |
| - name: Test and publish Docker image |
| run: | |
| TAG_ARGS="" |
| if [ -n "${{ matrix.version }}" ]; then |
| if [ "${{ matrix.dist }}" = "slim" ]; then |
| TAG_ARGS="-Psolr.docker.imageTag=${{ matrix.version }}-slim${{ matrix.tag-suffix }}" |
| else |
| TAG_ARGS="-Psolr.docker.imageTag=${{ matrix.version }}${{ matrix.tag-suffix }}" |
| fi |
| elif [ -n "${{ matrix.tag-suffix }}" ]; then |
| TAG_ARGS="-Psolr.docker.imageTagSuffix=${{ matrix.tag-suffix }}" |
| fi |
| ./gradlew testDocker dockerPush \ |
| -Psolr.docker.imageRepo=apache/solr-nightly \ |
| $TAG_ARGS \ |
| -Psolr.docker.dist=${{ matrix.dist }} \ |
| -Psolr.docker.platform=linux/arm64,linux/amd64 \ |
| -Psolr.docker.baseImage=${{ matrix.base-image }} |
| |
| - name: Report status |
| if: failure() |
| run: | |
| echo "::error::Failed to build and publish Docker image for ${{ matrix.branch }} (${{ matrix.dist }}, base-image: ${{ matrix.base-image }})" |