Correctly pass gpg_key to release script

This commit is contained in:
Alan Woodward 2020-03-12 10:51:54 +00:00
parent 8a940e7971
commit daf149817a
3 changed files with 12 additions and 4 deletions

View File

@ -307,7 +307,7 @@ def check_key_in_keys(gpgKeyID, local_keys):
gpgKeyID = gpgKeyID.replace(" ", "")
if len(gpgKeyID) == 8:
gpgKeyID8Char = "%s %s" % (gpgKeyID[0:4], gpgKeyID[4:8])
re_to_match = r"^pub .*\n\s+\w{4} \w{4} \w{4} \w{4} \w{4} \w{4} \w{4} \w{4} %s" % gpgKeyID8Char
re_to_match = r"^pub .*\n\s+(\w{4} \w{4} \w{4} \w{4} \w{4} \w{4} \w{4} \w{4} %s|\w{32}%s)" % (gpgKeyID8Char, gpgKeyID)
elif len(gpgKeyID) == 40:
gpgKeyID40Char = "%s %s %s %s %s %s %s %s %s %s" % \
(gpgKeyID[0:4], gpgKeyID[4:8], gpgKeyID[8:12], gpgKeyID[12:16], gpgKeyID[16:20],

View File

@ -97,6 +97,7 @@ def expand_jinja(text, vars=None):
'release_version_minor': state.release_version_minor,
'release_version_bugfix': state.release_version_bugfix,
'state': state,
'gpg_key' : state.get_gpg_key(),
'epoch': unix_time_millis(datetime.utcnow()),
'get_next_version': state.get_next_version(),
'current_git_rev': state.get_current_git_rev(),
@ -301,6 +302,13 @@ class ReleaseState:
def is_released(self):
return self.get_todo_by_id('announce_lucene').is_done()
def get_gpg_key(self):
gpg_task = self.get_todo_by_id('gpg')
if gpg_task.is_done():
return gpg_task.get_state()['gpg_key']
else:
return None
def get_release_date(self):
publish_task = self.get_todo_by_id('publish_maven')
if publish_task.is_done():
@ -1074,7 +1082,7 @@ def configure_pgp(gpg_todo):
id = str(input("Please enter your Apache id: (ENTER=skip) "))
if id.strip() == '':
return False
all_keys = load('https://downloads.apache.org/lucene/KEYS')
all_keys = load('https://home.apache.org/keys/group/lucene.asc')
lines = all_keys.splitlines()
keyid_linenum = None
for idx, line in enumerate(lines):
@ -1085,7 +1093,7 @@ def configure_pgp(gpg_todo):
keyid_line = lines[keyid_linenum]
assert keyid_line.startswith('LDAP PGP key: ')
gpg_id = keyid_line[14:].replace(" ", "")[-8:]
print("Found gpg key id %s on file at Apache (https://downloads.apache.org/lucene/KEYS)" % gpg_id)
print("Found gpg key id %s on file at Apache (https://home.apache.org/keys/group/lucene.asc)" % gpg_id)
else:
print(textwrap.dedent("""\
Could not find your GPG key from Apache servers.

View File

@ -734,7 +734,7 @@ groups:
cmd: git pull
tee: true
- !Command
cmd: python3 -u dev-tools/scripts/buildAndPushRelease.py {{ local_keys }} --logfile {{ logfile }} --push-local "{{ dist_file_path }}" --rc-num {{ rc_number }} --sign {{ gpg.gpg_id | default("<gpg_key_id>", True) }}
cmd: python3 -u dev-tools/scripts/buildAndPushRelease.py {{ local_keys }} --logfile {{ logfile }} --push-local "{{ dist_file_path }}" --rc-num {{ rc_number }} --sign {{ gpg_key | default("<gpg_key_id>", True) }}
comment: "NOTE: Remember to type your GPG pass-phrase at the prompt!"
logfile: build_rc.log
tee: true