Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Fix useGpg signing without password in releaseWizard (#1125)

Houston Putman360923eaf6c1
diff --git a/dev-tools/scripts/releaseWizard.py b/dev-tools/scripts/releaseWizard.py
index e149412a92b..8fa8167f602 100755
--- a/dev-tools/scripts/releaseWizard.py
+++ b/dev-tools/scripts/releaseWizard.py
@@ -1230,21 +1230,6 @@ def configure_pgp(gpg_todo):
gpg_state['gpg_key'] = gpg_id
gpg_state['gpg_fingerprint'] = gpg_fingerprint
- print(textwrap.dedent("""\
- You can choose between signing the release with the gpg program or with
- the gradle signing plugin. Read about the difference by running
- ./gradlew helpPublishing"""))
-
- gpg_state['use_gradle'] = ask_yes_no("Do you want to sign the release with gradle plugin? No means gpg")
-
- print(textwrap.dedent("""\
- You need the passphrase to sign the release.
- This script can prompt you securely for your passphrase (will not be stored) and pass it on to
- buildAndPushRelease in a secure way. However, you can also configure your passphrase in advance
- and avoid having to type it in the terminal. This can be done with either a gpg-agent (for gpg tool)
- or in gradle.properties or an ENV.var (for gradle), See ./gradlew helpPublishing for details."""))
- gpg_state['prompt_pass'] = ask_yes_no("Do you want this wizard to prompt you for your gpg password? ")
-
return True
diff --git a/dev-tools/scripts/releaseWizard.yaml b/dev-tools/scripts/releaseWizard.yaml
index 460a009545b..d38f8df224f 100644
--- a/dev-tools/scripts/releaseWizard.yaml
+++ b/dev-tools/scripts/releaseWizard.yaml
@@ -242,8 +242,8 @@ groups:
id: gpg
title: GPG key id is configured
description: |-
- To sign the release you need to provide your GPG key ID. This must be
- the same key ID that you have registered in your Apache account.
+ To sign the release you need to provide your GPG key ID/Fingerprint. This must be
+ the same key ID & Fingerprint that you have registered in your Apache account.
The ID is the last 8 bytes of your key fingerprint, e.g. 0D8D0B93.
* Make sure your gpg key is 4096 bits key or larger
@@ -695,11 +695,26 @@ groups:
cmd: "{{ rename_cmd }} files-2.1 files-2.1_bak"
cwd: .gradle/caches/modules-2
stdout: true
+ - !Todo
+ id: setup_gpg
+ title: Setup the gpg agent
+ depends:
+ - gpg
+ commands: !Commands
+ root_folder: '{{ git_checkout_folder }}'
+ commands_text: |-
+ In this step we will pre-set the passphrase so that the GPG Agent can cache it for use in the RC build.
+ commands:
+ - !Command
+ cmd: echo foo | gpg --detach-sign --use-agent --pinentry-mode loopback --local-user {{ gpg.gpg_fingerprint | default("<gpg_fingerprint>", True) }}
+ tee: false
+ shell: true
+ live: true
- !Todo
id: build_rc
title: Build the release candidate
depends:
- - gpg
+ - setup_gpg
- run_tests
vars:
logfile: '{{ [rc_folder, ''logs'', ''buildAndPushRelease.log''] | path_join }}'
@@ -734,8 +749,8 @@ groups:
cmd: git pull --ff-only
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_fingerprint | default("<gpg_fingerprint>", True) }}{% if gpg.use_gradle %} --sign-method-gradle{% endif %}{% if not gpg.prompt_pass %} --gpg-pass-noprompt{% endif %}
- comment: "Using {% if gpg.use_gradle %}gradle{% else %}gpg command{% endif %} for signing.{% if gpg.prompt_pass %} Remember to type your GPG pass-phrase at the prompt!{% endif %}"
+ cmd: python3 -u dev-tools/scripts/buildAndPushRelease.py {{ local_keys }} --logfile {{ logfile }} --push-local "{{ dist_file_path }}" --rc-num {{ rc_number }} --sign {{ gpg.gpg_fingerprint | default("<gpg_fingerprint>", True) }} --gpg-pass-noprompt
+ comment: "Using gpg command for signing."
logfile: build_rc.log
tee: true
- !Todo
diff --git a/gradle/maven/defaults-maven.gradle b/gradle/maven/defaults-maven.gradle
index 5eb45919c0f..8f0137c396f 100644
--- a/gradle/maven/defaults-maven.gradle
+++ b/gradle/maven/defaults-maven.gradle
@@ -172,6 +172,9 @@ configure(subprojects.findAll { it.path in rootProject.published }) { prj ->
}
signing {
+ if (project(":solr:distribution").ext.useGpgForSigning) {
+ useGpgCmd()
+ }
required { !version.endsWith("SNAPSHOT") }
sign publishing.publications.jars
}