You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2026/09/03 20:46:05 UTC

(plc4x) 02/02: fix: Updated the scripts to work with updated git settings.

This is an automated email from the ASF dual-hosted git repository.

chrisdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit e7d3067a24aa3293ee5cd0ee0ace09b6138fd648
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Thu Sep 3 22:45:54 2026 +0200

    fix: Updated the scripts to work with updated git settings.
---
 tools/release-1-create-branch.sh   | 12 ++++++++++--
 tools/release-2-prepare-release.sh | 29 ++++++++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/tools/release-1-create-branch.sh b/tools/release-1-create-branch.sh
index 70867573d6..630757928f 100755
--- a/tools/release-1-create-branch.sh
+++ b/tools/release-1-create-branch.sh
@@ -118,9 +118,17 @@ if [[ -z "$GIT_USER_NAME" || -z "$GIT_USER_EMAIL" ]]; then
   exit 1
 fi
 
+# The container mounts this repository, so git inside it reads the very same ".git/config".
+# If that enables commit/tag signing, every commit the release plugin creates fails with
+# "gpg failed to sign the data", as the container has neither the key nor a gpg-agent. Passing
+# the identity and the signing switches as GIT_CONFIG_* environment variables overrides the
+# config files for the container only, so nothing is written back into the user's repository.
 if ! docker compose -f "$DIRECTORY/tools/docker-compose.yaml" run releaser \
-        bash -c "git config user.name \"$GIT_USER_NAME\" && \
-           git config user.email \"$GIT_USER_EMAIL\" && \
+        bash -c "export GIT_CONFIG_COUNT=4 \
+             GIT_CONFIG_KEY_0=user.name GIT_CONFIG_VALUE_0=\"$GIT_USER_NAME\" \
+             GIT_CONFIG_KEY_1=user.email GIT_CONFIG_VALUE_1=\"$GIT_USER_EMAIL\" \
+             GIT_CONFIG_KEY_2=commit.gpgsign GIT_CONFIG_VALUE_2=false \
+             GIT_CONFIG_KEY_3=tag.gpgsign GIT_CONFIG_VALUE_3=false && \
            /ws/mvnw -e -P with-c,with-dotnet,with-go,with-java,with-python,enable-all-checks,update-generated-code -Dmaven.repo.local=/ws/out/.repository release:branch -DautoVersionSubmodules=true -DpushChanges=false -DdevelopmentVersion='$NEW_VERSION' -DbranchName='$BRANCH_NAME'"; then
     echo "❌ Got non-0 exit code from docker compose, aborting."
     exit 1
diff --git a/tools/release-2-prepare-release.sh b/tools/release-2-prepare-release.sh
index f431bbc60a..b702e395db 100755
--- a/tools/release-2-prepare-release.sh
+++ b/tools/release-2-prepare-release.sh
@@ -74,8 +74,35 @@ fi
 # 1. Do a simple release-prepare command
 ########################################################################################################################
 
+# Attempt to read user.name and user.email (local first, then global)
+GIT_USER_NAME=$(git config user.name || git config --global user.name)
+GIT_USER_EMAIL=$(git config user.email || git config --global user.email)
+
+if [[ -z "$GIT_USER_NAME" || -z "$GIT_USER_EMAIL" ]]; then
+  echo "❌ Git user.name and/or user.email not configured."
+  echo
+  echo "Please run one of the following commands:"
+  echo "  git config --global user.name \"Your Name\""
+  echo "  git config --global user.email \"you@example.com\""
+  echo
+  echo "Or configure them just for this repository:"
+  echo "  git config user.name \"Your Name\""
+  echo "  git config user.email \"you@example.com\""
+  exit 1
+fi
+
+# The container mounts this repository, so git inside it reads the very same ".git/config".
+# If that enables commit/tag signing, every commit and tag the release plugin creates fails with
+# "gpg failed to sign the data", as the container has neither the key nor a gpg-agent. Passing
+# the identity and the signing switches as GIT_CONFIG_* environment variables overrides the
+# config files for the container only, so nothing is written back into the user's repository.
 if ! docker compose -f "$DIRECTORY/tools/docker-compose.yaml" run releaser \
-        bash -c "/ws/mvnw -e -P with-c,with-dotnet,with-go,with-java,with-python,enable-all-checks,update-generated-code -Dmaven.repo.local=/ws/out/.repository release:prepare -DautoVersionSubmodules=true -DreleaseVersion='$RELEASE_VERSION' -DdevelopmentVersion='$NEW_VERSION' -Dtag='$TAG_NAME'"; then
+        bash -c "export GIT_CONFIG_COUNT=4 \
+             GIT_CONFIG_KEY_0=user.name GIT_CONFIG_VALUE_0=\"$GIT_USER_NAME\" \
+             GIT_CONFIG_KEY_1=user.email GIT_CONFIG_VALUE_1=\"$GIT_USER_EMAIL\" \
+             GIT_CONFIG_KEY_2=commit.gpgsign GIT_CONFIG_VALUE_2=false \
+             GIT_CONFIG_KEY_3=tag.gpgsign GIT_CONFIG_VALUE_3=false && \
+           /ws/mvnw -e -P with-c,with-dotnet,with-go,with-java,with-python,enable-all-checks,update-generated-code -Dmaven.repo.local=/ws/out/.repository release:prepare -DautoVersionSubmodules=true -DreleaseVersion='$RELEASE_VERSION' -DdevelopmentVersion='$NEW_VERSION' -Dtag='$TAG_NAME'"; then
     echo "❌ Got non-0 exit code from docker compose, aborting."
     exit 1
 fi