From d8990636a331e5f4d2added3fa9f40e90fcb7fcc Mon Sep 17 00:00:00 2001 From: lucasdpt Date: Mon, 24 Nov 2025 12:45:04 +0100 Subject: [PATCH] feat: add MAVEN_SETTINGS_PATH --- README.md | 2 ++ entrypoint.sh | 3 +++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 336fddb..10a906c 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ Environment variables - `MAVEN_SETTINGS_BASE64` (preferred): base64-encoded contents of the `settings.xml`. If present, the entrypoint will decode it and write it to `~/.m2/settings.xml`. - `MAVEN_SETTINGS`: raw contents of the `settings.xml`. Used only if `MAVEN_SETTINGS_BASE64` is not set. +- `MAVEN_SETTINGS_PATH`: path to the `settings.xml` inside the container (exported by the entrypoint). Typically `/home/ci/.m2/settings.xml` or `~/.m2/settings.xml` depending on the user; use this variable in scripts to locate the file reliably. + Notes - The entrypoint will create `~/.m2` if it does not exist and set the `settings.xml` file to mode `644`. - Use `MAVEN_SETTINGS_BASE64` when your CI system has trouble preserving newlines or special characters in environment variables. diff --git a/entrypoint.sh b/entrypoint.sh index 02adfe5..5978b39 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,6 +6,9 @@ set -euo pipefail # then exec the container command. M2_DIR="${HOME:-/root}/.m2" +SETTINGS_FILE="$M2_DIR/settings.xml" +# Export the path to the settings.xml so downstream processes can read it +export MAVEN_SETTINGS_PATH="$SETTINGS_FILE" if [[ -n "${MAVEN_SETTINGS_BASE64:-}" ]]; then mkdir -p "$M2_DIR"