[Qa-jenkins-scm] [jenkins.debian.net] 06/07: fixup fadd6ac7: actually create GPG key for jenkins user and not for the user running update_jdn.sh

Holger Levsen holger at layer-acht.org
Mon Oct 31 21:37:01 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit e361cd00f5f35496be8fedc2c7aa3d741a1c5ff7
Author: Holger Levsen <holger at layer-acht.org>
Date:   Mon Oct 31 22:34:34 2016 +0100

    fixup fadd6ac7: actually create GPG key for jenkins user and not for the user running update_jdn.sh
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 update_jdn.sh | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/update_jdn.sh b/update_jdn.sh
index 0eb2249..e8aad06 100755
--- a/update_jdn.sh
+++ b/update_jdn.sh
@@ -678,16 +678,15 @@ if [ "$HOSTNAME" = "jenkins" ] || [ "$HOSTNAME" = "jenkins-test-vm" ] ; then
 	rm -f $TMPFILE
 fi
 
-# Greate GPG key on nodes if they do not already exist in order to sign .buildinfo files
-if [ "$HOSTNAME" != "jenkins" ] || [ "$HOSTNAME" = "jenkins-test-vm" ] ; then
-
-	if gpg --with-colons --fixed-list-mode --list-secret-keys | cut -d: -f1 | grep -qsFx 'sec' >/dev/null 2>&1
-	then
-		explain "$(date) Not generating GPG key as one already exists"
-	else
-		explain "$(date) Generating GPG key"
+#
+# Create GPG key for jenkins user if they do not already exist (eg. to sign .buildinfo files)
+#
+if sudo -u jenkins gpg --with-colons --fixed-list-mode --list-secret-keys | cut -d: -f1 | grep -qsFx 'sec' >/dev/null 2>&1 ; then
+	explain "$(date) Not generating GPG key as one already exists"
+else
+	explain "$(date) Generating GPG key"
 
-		gpg --no-tty --batch --gen-key <<EOF
+	sudo -u jenkins gpg --no-tty --batch --gen-key <<EOF
 Key-Type: RSA
 Key-Length: 4096
 Key-Usage: sign
@@ -698,7 +697,6 @@ Expire-Date: 0
 %no-protection
 %commit
 EOF
-	fi
 fi
 
 #

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list