From 36f74842444bd1c3aae450e9d0e842b1013fca2c Mon Sep 17 00:00:00 2001 From: Julien Carsique Date: Mon, 7 Sep 2026 12:04:18 +0200 Subject: [PATCH] BUILD-12536 Make the .actions symlink setup idempotent on Windows config-maven, build-maven, promote, build-npm, build-yarn, build-poetry, build-gradle, and config-pip each create .actions/ symlinks via ln -sf, unguarded by their own idempotency check (that check only covers the Vault/settings.xml/cache/version-bump steps that follow it, not this symlink setup itself). Any job invoking more than one of these composite actions -- e.g. a standalone config-maven call followed by build-maven, which calls config-maven again internally -- runs this setup twice. On Linux, GNU ln -sf re-links cleanly over an existing symlink-to- directory. On Windows, Git-Bash's ln instead tries to nest a new entry inside it, eventually failing with 'cannot overwrite directory' once enough invocations stack up. Removing the existing symlinks before recreating them makes the step idempotent on both platforms. config-npm and config-uv already guard this same step behind their own completion check, so they're unaffected. get-build-number and check-sca don't create these symlinks at all. --- build-gradle/action.yml | 2 ++ build-maven/action.yml | 2 ++ build-npm/action.yml | 2 ++ build-poetry/action.yml | 2 ++ build-yarn/action.yml | 2 ++ config-gradle/action.yml | 2 ++ config-maven/action.yml | 2 ++ config-pip/action.yml | 2 ++ promote/action.yml | 2 ++ 9 files changed, 18 insertions(+) diff --git a/build-gradle/action.yml b/build-gradle/action.yml index c97f3432..13a26d0e 100644 --- a/build-gradle/action.yml +++ b/build-gradle/action.yml @@ -99,6 +99,8 @@ runs: host_actions_root="$(dirname "$ACTION_PATH_BUILD_GRADLE")" echo "host_actions_root=$host_actions_root" >> "$GITHUB_OUTPUT" + # Windows Git-Bash's ln -sf can't re-link over an existing symlink-to-directory; clear it first. + rm -rf .actions/config-gradle .actions/shared mkdir -p ".actions" ln -sf "$host_actions_root/config-gradle" .actions/config-gradle ln -sf "$host_actions_root/shared" .actions/shared diff --git a/build-maven/action.yml b/build-maven/action.yml index 9c8db9f7..8757c1e5 100644 --- a/build-maven/action.yml +++ b/build-maven/action.yml @@ -100,6 +100,8 @@ runs: host_actions_root="$(dirname "$ACTION_PATH_BUILD_MAVEN")" echo "host_actions_root=$host_actions_root" >> "$GITHUB_OUTPUT" + # Windows Git-Bash's ln -sf can't re-link over an existing symlink-to-directory; clear it first. + rm -rf .actions/config-maven .actions/shared mkdir -p ".actions" ln -sf "$host_actions_root/config-maven" .actions/config-maven ln -sf "$host_actions_root/shared" .actions/shared diff --git a/build-npm/action.yml b/build-npm/action.yml index 6bd09439..f768a940 100644 --- a/build-npm/action.yml +++ b/build-npm/action.yml @@ -94,6 +94,8 @@ runs: host_actions_root="$(dirname "$ACTION_PATH_BUILD_NPM")" echo "host_actions_root=$host_actions_root" >> "$GITHUB_OUTPUT" + # Windows Git-Bash's ln -sf can't re-link over an existing symlink-to-directory; clear it first. + rm -rf .actions/get-build-number .actions/config-npm .actions/shared mkdir -p ".actions" ln -sf "$host_actions_root/get-build-number" .actions/get-build-number ln -sf "$host_actions_root/config-npm" .actions/config-npm diff --git a/build-poetry/action.yml b/build-poetry/action.yml index 0fbb88d2..f86524b8 100644 --- a/build-poetry/action.yml +++ b/build-poetry/action.yml @@ -85,6 +85,8 @@ runs: host_actions_root="$(dirname "$ACTION_PATH_BUILD_POETRY")" echo "host_actions_root=$host_actions_root" >> "$GITHUB_OUTPUT" + # Windows Git-Bash's ln -sf can't re-link over an existing symlink-to-directory; clear it first. + rm -rf .actions/get-build-number .actions/config-poetry .actions/shared mkdir -p ".actions" ln -sf "$host_actions_root/get-build-number" .actions/get-build-number ln -sf "$host_actions_root/config-poetry" .actions/config-poetry diff --git a/build-yarn/action.yml b/build-yarn/action.yml index 6556a815..ee195518 100644 --- a/build-yarn/action.yml +++ b/build-yarn/action.yml @@ -84,6 +84,8 @@ runs: host_actions_root="$(dirname "$ACTION_PATH_BUILD_YARN")" echo "host_actions_root=$host_actions_root" >> "$GITHUB_OUTPUT" + # Windows Git-Bash's ln -sf can't re-link over an existing symlink-to-directory; clear it first. + rm -rf .actions/get-build-number .actions/shared mkdir -p ".actions" ln -sf "$host_actions_root/get-build-number" .actions/get-build-number ln -sf "$host_actions_root/shared" .actions/shared diff --git a/config-gradle/action.yml b/config-gradle/action.yml index 273a5f88..dba2ee2b 100644 --- a/config-gradle/action.yml +++ b/config-gradle/action.yml @@ -62,6 +62,8 @@ runs: echo "ACTION_PATH_CONFIG_GRADLE=$ACTION_PATH_CONFIG_GRADLE" >> "$GITHUB_ENV" echo "host_actions_root=$host_actions_root" >> "$GITHUB_OUTPUT" + # Windows Git-Bash's ln -sf can't re-link over an existing symlink-to-directory; clear it first. + rm -rf .actions/get-build-number .actions/shared mkdir -p ".actions" ln -sf "$host_actions_root/get-build-number" .actions/get-build-number ln -sf "$host_actions_root/shared" .actions/shared diff --git a/config-maven/action.yml b/config-maven/action.yml index 2738ea18..7750f3b6 100644 --- a/config-maven/action.yml +++ b/config-maven/action.yml @@ -63,6 +63,8 @@ runs: echo "ACTION_PATH_CONFIG_MAVEN=$ACTION_PATH_CONFIG_MAVEN" >> "$GITHUB_ENV" echo "host_actions_root=$host_actions_root" >> "$GITHUB_OUTPUT" + # Windows Git-Bash's ln -sf can't re-link over an existing symlink-to-directory; clear it first. + rm -rf .actions/get-build-number .actions/shared mkdir -p ".actions" ln -sf "$host_actions_root/get-build-number" .actions/get-build-number ln -sf "$host_actions_root/shared" .actions/shared diff --git a/config-pip/action.yml b/config-pip/action.yml index c6f24c60..554471ae 100644 --- a/config-pip/action.yml +++ b/config-pip/action.yml @@ -49,6 +49,8 @@ runs: echo "ACTION_PATH_CONFIG_PIP=$ACTION_PATH_CONFIG_PIP" >> "$GITHUB_ENV" echo "host_actions_root=$host_actions_root" >> "$GITHUB_OUTPUT" + # Windows Git-Bash's ln -sf can't re-link over an existing symlink-to-directory; clear it first. + rm -rf .actions/get-build-number .actions/shared mkdir -p ".actions" ln -sf "$host_actions_root/get-build-number" .actions/get-build-number ln -sf "$host_actions_root/shared" .actions/shared diff --git a/promote/action.yml b/promote/action.yml index 5b37419b..32da801a 100644 --- a/promote/action.yml +++ b/promote/action.yml @@ -34,6 +34,8 @@ runs: host_actions_root="$(dirname "$ACTION_PATH_PROMOTE")" echo "host_actions_root=$host_actions_root" >> "$GITHUB_OUTPUT" + # Windows Git-Bash's ln -sf can't re-link over an existing symlink-to-directory; clear it first. + rm -rf .actions/get-build-number .actions/shared mkdir -p ".actions" ln -sf "$host_actions_root/get-build-number" .actions/get-build-number ln -sf "$host_actions_root/shared" .actions/shared