Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion .github/workflows/build-reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,41 @@ jobs:
with:
distribution: zulu
java-version: ${{ inputs.java-version }}
cache: maven

#
# Sets up Mimír (https://maveniverse.eu/docs/mimir/) to cache artifacts from remote repositories
#
# Unlike the local Maven repository, Mimír cannot be used to stage locally generated artifacts or snapshots.
# Therefore, it can be reused between builds, even on different architectures.
# Since the size of the cache increases in time, as we download new dependency versions, we reset the cache
# once a month.
Comment on lines +98 to +99

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where/How do we evict out-of-date cache entries?

#
# WARNING: Currently it is not possible to reuse GitHub workflow steps, therefore, these two steps must be
# copied to multiple workflows.
# The `build-reusable` workflow uses `actions/cache`,
# while the other workflows only use `actions/cache/restore`
#
- name: Set up Mimír configuration
shell: bash
run: |
# Compute the key cache
echo MIMIR_KEY="mimir-cache-$(date +'%Y-%m')" >> $GITHUB_ENV
# Mimir currently does not support relative paths, so we need to compute the absolute path of `mimir`.
echo MAVEN_OPTS="-Dmimir.daemon.passOnBasedir=true -Dmimir.daemon.autostop=true -Dmimir.basedir=$GITHUB_WORKSPACE/.mimir" >> $GITHUB_ENV

- name: Set up Mimír cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
with:
# Mimir is a partial mirror of Maven Central.
# Therefore, we only need to clean it from time to time to remove old versions.
#
# However, GitHub caches are immutable, and we need a unique key to update them.
# If no cache hit occurs for this key, we fall back to any other cache.
key: "${{ env.MIMIR_KEY }}-${{ hashFiles('**/pom.xml') }}"
restore-keys: |
${{ env.MIMIR_KEY }}-
path: .mimir/local
enableCrossOsArchive: true

- name: Set up Develocity
if: inputs.develocity-enabled
Expand Down
35 changes: 34 additions & 1 deletion .github/workflows/codeql-analysis-reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,40 @@ jobs:
with:
distribution: zulu
java-version: ${{ inputs.java-version }}
cache: maven

#
# Sets up Mimír (https://maveniverse.eu/docs/mimir/) to cache artifacts from remote repositories
#
# Unlike the local Maven repository, Mimír cannot be used to stage locally generated artifacts or snapshots.
# Therefore, it can be reused between builds, even on different architectures.
# Since the size of the cache increases in time, as we download new dependency versions, we reset the cache
# once a month.
#
# WARNING: Currently it is not possible to reuse GitHub workflow steps, therefore, these two steps must be
# copied to multiple workflows.
# The `build-reusable` workflow uses `actions/cache`,
# while the other workflows only use `actions/cache/restore`
#
- name: Set up Mimír configuration
shell: bash
run: |
# Compute the key cache
echo MIMIR_KEY="mimir-cache-$(date +'%Y-%m')" >> $GITHUB_ENV
# Mimir currently does not support relative paths, so we need to compute the absolute path of `mimir`.
echo MAVEN_OPTS="-Dmimir.daemon.passOnBasedir=true -Dmimir.daemon.autostop=true -Dmimir.basedir=$GITHUB_WORKSPACE/.mimir" >> $GITHUB_ENV

- name: Set up Mimír cache
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
with:
# Mimir is a partial mirror of Maven Central.
# Therefore, we only need to clean it from time to time to remove old versions.
#
# However, GitHub caches are immutable, and we need a unique key to update them.
# If no cache hit occurs for this key, we fall back to any other cache.
key: "${{ env.MIMIR_KEY }}-${{ hashFiles('**/pom.xml') }}"
restore-keys: |
${{ env.MIMIR_KEY }}-
path: .mimir/local

- name: Build with Maven
shell: bash
Expand Down
35 changes: 34 additions & 1 deletion .github/workflows/deploy-release-reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,45 @@ jobs:
with:
distribution: zulu
java-version: ${{ inputs.java-version }}
cache: maven
server-id: apache.releases.https
server-username: NEXUS_USERNAME
server-password: NEXUS_PASSWORD
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}

#
# Sets up Mimír (https://maveniverse.eu/docs/mimir/) to cache artifacts from remote repositories
#
# Unlike the local Maven repository, Mimír cannot be used to stage locally generated artifacts or snapshots.
# Therefore, it can be reused between builds, even on different architectures.
# Since the size of the cache increases in time, as we download new dependency versions, we reset the cache
# once a month.
#
# WARNING: Currently it is not possible to reuse GitHub workflow steps, therefore, these two steps must be
# copied to multiple workflows.
# The `build-reusable` workflow uses `actions/cache`,
# while the other workflows only use `actions/cache/restore`
#
- name: Set up Mimír configuration
shell: bash
run: |
# Compute the key cache
echo MIMIR_KEY="mimir-cache-$(date +'%Y-%m')" >> $GITHUB_ENV
# Mimir currently does not support relative paths, so we need to compute the absolute path of `mimir`.
echo MAVEN_OPTS="-Dmimir.daemon.passOnBasedir=true -Dmimir.daemon.autostop=true -Dmimir.basedir=$GITHUB_WORKSPACE/.mimir" >> $GITHUB_ENV

- name: Set up Mimír cache
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
with:
# Mimir is a partial mirror of Maven Central.
# Therefore, we only need to clean it from time to time to remove old versions.
#
# However, GitHub caches are immutable, and we need a unique key to update them.
# If no cache hit occurs for this key, we fall back to any other cache.
key: "${{ env.MIMIR_KEY }}-${{ hashFiles('**/pom.xml') }}"
restore-keys: |
${{ env.MIMIR_KEY }}-
path: .mimir/local

- name: Set up Git user
shell: bash
run: |
Expand Down
35 changes: 34 additions & 1 deletion .github/workflows/deploy-site-reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,42 @@ jobs:
with:
distribution: zulu
java-version: ${{ inputs.java-version }}
cache: maven
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}

#
# Sets up Mimír (https://maveniverse.eu/docs/mimir/) to cache artifacts from remote repositories
#
# Unlike the local Maven repository, Mimír cannot be used to stage locally generated artifacts or snapshots.
# Therefore, it can be reused between builds, even on different architectures.
# Since the size of the cache increases in time, as we download new dependency versions, we reset the cache
# once a month.
#
# WARNING: Currently it is not possible to reuse GitHub workflow steps, therefore, these two steps must be
# copied to multiple workflows.
# The `build-reusable` workflow uses `actions/cache`,
# while the other workflows only use `actions/cache/restore`
#
- name: Set up Mimír configuration
shell: bash
run: |
# Compute the key cache
echo MIMIR_KEY="mimir-cache-$(date +'%Y-%m')" >> $GITHUB_ENV
# Mimir currently does not support relative paths, so we need to compute the absolute path of `mimir`.
echo MAVEN_OPTS="-Dmimir.daemon.passOnBasedir=true -Dmimir.daemon.autostop=true -Dmimir.basedir=$GITHUB_WORKSPACE/.mimir" >> $GITHUB_ENV

- name: Set up Mimír cache
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
with:
# Mimir is a partial mirror of Maven Central.
# Therefore, we only need to clean it from time to time to remove old versions.
#
# However, GitHub caches are immutable, and we need a unique key to update them.
# If no cache hit occurs for this key, we fall back to any other cache.
key: "${{ env.MIMIR_KEY }}-${{ hashFiles('**/pom.xml') }}"
restore-keys: |
${{ env.MIMIR_KEY }}-
path: .mimir/local

- name: Build the project
shell: bash
if: inputs.install-required
Expand Down
35 changes: 34 additions & 1 deletion .github/workflows/deploy-snapshot-reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,44 @@ jobs:
with:
distribution: zulu
java-version: ${{ inputs.java-version }}
cache: maven
server-id: apache.snapshots.https
server-username: NEXUS_USERNAME
server-password: NEXUS_PASSWORD

#
# Sets up Mimír (https://maveniverse.eu/docs/mimir/) to cache artifacts from remote repositories
#
# Unlike the local Maven repository, Mimír cannot be used to stage locally generated artifacts or snapshots.
# Therefore, it can be reused between builds, even on different architectures.
# Since the size of the cache increases in time, as we download new dependency versions, we reset the cache
# once a month.
#
# WARNING: Currently it is not possible to reuse GitHub workflow steps, therefore, these two steps must be
# copied to multiple workflows.
# The `build-reusable` workflow uses `actions/cache`,
# while the other workflows only use `actions/cache/restore`
#
- name: Set up Mimír configuration
shell: bash
run: |
# Compute the key cache
echo MIMIR_KEY="mimir-cache-$(date +'%Y-%m')" >> $GITHUB_ENV
# Mimir currently does not support relative paths, so we need to compute the absolute path of `mimir`.
echo MAVEN_OPTS="-Dmimir.daemon.passOnBasedir=true -Dmimir.daemon.autostop=true -Dmimir.basedir=$GITHUB_WORKSPACE/.mimir" >> $GITHUB_ENV

- name: Set up Mimír cache
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
with:
# Mimir is a partial mirror of Maven Central.
# Therefore, we only need to clean it from time to time to remove old versions.
#
# However, GitHub caches are immutable, and we need a unique key to update them.
# If no cache hit occurs for this key, we fall back to any other cache.
key: "${{ env.MIMIR_KEY }}-${{ hashFiles('**/pom.xml') }}"
restore-keys: |
${{ env.MIMIR_KEY }}-
path: .mimir/local

- name: Export version
id: version
shell: bash
Expand Down
35 changes: 34 additions & 1 deletion .github/workflows/merge-dependabot-reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,45 @@ jobs:
with:
distribution: zulu
java-version: ${{ inputs.java-version }}
cache: maven
server-id: apache.releases.https
server-username: NEXUS_USERNAME
server-password: NEXUS_PASSWORD
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}

#
# Sets up Mimír (https://maveniverse.eu/docs/mimir/) to cache artifacts from remote repositories
#
# Unlike the local Maven repository, Mimír cannot be used to stage locally generated artifacts or snapshots.
# Therefore, it can be reused between builds, even on different architectures.
# Since the size of the cache increases in time, as we download new dependency versions, we reset the cache
# once a month.
#
# WARNING: Currently it is not possible to reuse GitHub workflow steps, therefore, these two steps must be
# copied to multiple workflows.
# The `build-reusable` workflow uses `actions/cache`,
# while the other workflows only use `actions/cache/restore`
#
- name: Set up Mimír configuration
shell: bash
run: |
# Compute the key cache
echo MIMIR_KEY="mimir-cache-$(date +'%Y-%m')" >> $GITHUB_ENV
# Mimir currently does not support relative paths, so we need to compute the absolute path of `mimir`.
echo MAVEN_OPTS="-Dmimir.daemon.passOnBasedir=true -Dmimir.daemon.autostop=true -Dmimir.basedir=$GITHUB_WORKSPACE/.mimir" >> $GITHUB_ENV

- name: Set up Mimír cache
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
with:
# Mimir is a partial mirror of Maven Central.
# Therefore, we only need to clean it from time to time to remove old versions.
#
# However, GitHub caches are immutable, and we need a unique key to update them.
# If no cache hit occurs for this key, we fall back to any other cache.
key: "${{ env.MIMIR_KEY }}-${{ hashFiles('**/pom.xml') }}"
restore-keys: |
${{ env.MIMIR_KEY }}-
path: .mimir/local

- name: Find the release version major
shell: bash
run: |
Expand Down
35 changes: 34 additions & 1 deletion .github/workflows/verify-reproducibility-reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,40 @@ jobs:
with:
distribution: zulu
java-version: ${{ inputs.java-version }}
cache: maven

#
# Sets up Mimír (https://maveniverse.eu/docs/mimir/) to cache artifacts from remote repositories
#
# Unlike the local Maven repository, Mimír cannot be used to stage locally generated artifacts or snapshots.
# Therefore, it can be reused between builds, even on different architectures.
# Since the size of the cache increases in time, as we download new dependency versions, we reset the cache
# once a month.
#
# WARNING: Currently it is not possible to reuse GitHub workflow steps, therefore, these two steps must be
# copied to multiple workflows.
# The `build-reusable` workflow uses `actions/cache`,
# while the other workflows only use `actions/cache/restore`
#
- name: Set up Mimír configuration
shell: bash
run: |
# Compute the key cache
echo MIMIR_KEY="mimir-cache-$(date +'%Y-%m')" >> $GITHUB_ENV
# Mimir currently does not support relative paths, so we need to compute the absolute path of `mimir`.
echo MAVEN_OPTS="-Dmimir.daemon.passOnBasedir=true -Dmimir.daemon.autostop=true -Dmimir.basedir=$GITHUB_WORKSPACE/.mimir" >> $GITHUB_ENV

- name: Set up Mimír cache
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # 4.2.3
with:
# Mimir is a partial mirror of Maven Central.
# Therefore, we only need to clean it from time to time to remove old versions.
#
# However, GitHub caches are immutable, and we need a unique key to update them.
# If no cache hit occurs for this key, we fall back to any other cache.
key: "${{ env.MIMIR_KEY }}-${{ hashFiles('**/pom.xml') }}"
restore-keys: |
${{ env.MIMIR_KEY }}-
path: .mimir/local

# `clean verify artifact:compare` is required to generate the build reproducibility report.
# For details, see: https://maven.apache.org/guides/mini/guide-reproducible-builds.html#how-to-test-my-maven-build-reproducibility
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# Maven
target/
.flattened-pom.xml
/.mimir/
/.mvn/extensions.xml
/.mvn/wrapper/maven-wrapper.jar
# IDEA
Expand Down
17 changes: 17 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@
<jacoco-maven-plugin.version>0.8.13</jacoco-maven-plugin.version>
<log4j-changelog-maven-plugin.version>0.9.0</log4j-changelog-maven-plugin.version>
<maven-artifact-plugin.version>3.6.0</maven-artifact-plugin.version>
<mimir.version>0.7.4</mimir.version>
<restrict-imports-enforcer-rule.version>2.6.1</restrict-imports-enforcer-rule.version>
<spotbugs-maven-plugin.version>4.9.3.0</spotbugs-maven-plugin.version>
<spotless-maven-plugin.version>2.44.4</spotless-maven-plugin.version>
Expand Down Expand Up @@ -362,6 +363,12 @@
<version>${maven-artifact-plugin.version}</version>
</plugin>

<plugin>
Comment thread
ppkarwasz marked this conversation as resolved.
<groupId>eu.maveniverse.maven.mimir</groupId>
<artifactId>extension</artifactId>
<version>${mimir.version}</version>
</plugin>

<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
Expand Down Expand Up @@ -956,6 +963,16 @@
</executions>
</plugin>

<!--
~ Use Mimir as Maven cache:
~ See: https://maveniverse.eu/docs/mimir/
-->
<plugin>
<groupId>eu.maveniverse.maven.mimir</groupId>
<artifactId>extension</artifactId>
<extensions>true</extensions>
</plugin>
Comment on lines +970 to +974

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean Mimir will be used everywhere, not just CI?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if we add it as an extension, it will be used everywhere.

There are three ways to use Mimír:

  1. As a Maven 3 Core extension (in .mvn/extensions.xml),
  2. As a Maven 3 Build extension (in pom.xml), or
  3. As a Maven 4 extension (in ~/.m2).

I don't see any disadvantage in using it for all users, do you? The local Maven repository still exists and you can still put staging artifacts there, but Mimír uses a second level cache with only Maven Central artifacts inside.


</plugins>

</build>
Expand Down
8 changes: 8 additions & 0 deletions src/changelog/.12.x.x/add-mimir.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://logging.apache.org/xml/ns"
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
type="added">
<issue id="389" link="https://github.com/apache/logging-parent/pull/389"/>
<description format="asciidoc">Use Mimír instead of Maven local repository cache.</description>
</entry>