Skip to content

Commit 126c08c

Browse files
committed
#130 GPG Passphrase hell no. 28478575...
1 parent 326d060 commit 126c08c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

releasing-scripts/docker-release-build.sh

+13
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,24 @@ set -e
55
echo "Starting PMCD"
66
/usr/libexec/pcp/lib/pmcd start
77

8+
# Setup GPG agent in this container to allow preset passphrases
9+
mkdir -p /root/.gnupg
10+
chmod -R 500 /root/.gnupg
11+
echo allow-preset-passphrase >> /root/.gnupg/gpg-agent.conf
12+
813
echo "Importing GPGKEY"
914
# this trick allows the GPG secret key to be imported via the command line
1015
# thank goodness for Google
1116
echo $MAVEN_GPG_PASSPHRASE | gpg --batch --yes --passphrase-fd 0 --import /root/gpgkeyexport/gpgkey.prvt.asc
1217

18+
# now iterate over each KEYGRIP you can see and preset the passphrase (one of them will be the right one)
19+
echo "Dumping keygrips"
20+
gpg --list-secret-keys --with-keygrip
21+
for KEYGRIP in `gpg --list-secret-keys --with-keygrip | grep Keygrip | awk -F = '{print $2}'`; do /usr/libexec/gpg-preset-passphrase --preset --passphrase $MAVEN_GPG_PASSPHRASE $KEYGRIP; done
22+
23+
# now do a simple GPG sign to 'prime' the gpg to ensure when Maven ends up running this GPG cache thing is ready
24+
echo "Doing a fake GPG signing now to prime the GPG agent password cache"
25+
echo "test" | gpg --clearsign
1326

1427
echo "Adding Github to known_hosts files"
1528
# see https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints

0 commit comments

Comments
 (0)