release: consume .gitconfig.template from secret file
Update `gerrit-release.sh` to consume `.gitconfig` from the location
specified by `$GITCONFIG_TMPL` instead of assuming it is mounted at
`$HOME/.gitconfig.template`.
Previously, the file had to be manually mounted as a Docker volume,
which does not align with the goal of a fully automated release
pipeline. With this change, `.gitconfig` can be provided securely
through Jenkins vault as a secret file, enabling non-interactive and
automation-friendly release workflows.
Change-Id: Ie7c30ccec5ca24dab73d01a2691d0c88b93dc424
diff --git a/jenkins-docker/agent-release/gerrit-release.sh b/jenkins-docker/agent-release/gerrit-release.sh
index edebcb2..e781d47 100755
--- a/jenkins-docker/agent-release/gerrit-release.sh
+++ b/jenkins-docker/agent-release/gerrit-release.sh
@@ -14,6 +14,8 @@
echo "Example: $0 stable-3.10 3.10.2 3.10.3-SNAPSHOT 3.9.6"
echo ""
echo "Environment variables:"
+ echo "* GITCONFIG_TMPL:"
+ echo " Path to a gitconfig template to be installed to \$HOME/.gitconfig for git client configuration"
echo "* GITCOOKIES:"
echo " Path to a .gitcookies file that will be installed to \$HOME/.gitcookies enabling git authentication"
echo "* GPG_KEY:"
@@ -45,9 +47,10 @@
rm -Rf gerrit
fi
-if [ -f $HOME/.gitconfig.template ]
+if [ -f "$GITCONFIG_TMPL" ]
then
- cp $HOME/.gitconfig.template $HOME/.gitconfig
+ echo "Installing $GITCONFIG_TMPL..."
+ install -m 600 "$GITCONFIG_TMPL" "$HOME/.gitconfig"
fi
if [ -f "$GITCOOKIES" ]