()
| 244 | |
| 245 | |
| 246 | def parse_config(): |
| 247 | epilogue = textwrap.dedent(''' |
| 248 | Example usage for a Release Manager: |
| 249 | python3 -u dev-tools/scripts/buildAndPushRelease.py --push-local /tmp/releases/6.0.1 --sign 3782CBB60147010B330523DD26FBCC7836BF353A --rc-num 1 |
| 250 | ''') |
| 251 | description = 'Utility to build, push, and test a release.' |
| 252 | parser = argparse.ArgumentParser(description=description, epilog=epilogue, |
| 253 | formatter_class=argparse.RawDescriptionHelpFormatter) |
| 254 | parser.add_argument('--no-prepare', dest='prepare', default=True, action='store_false', |
| 255 | help='Use the already built release in the provided checkout') |
| 256 | parser.add_argument('--local-keys', metavar='PATH', |
| 257 | help='Uses local KEYS file to validate presence of RM\'s gpg key') |
| 258 | parser.add_argument('--push-local', metavar='PATH', |
| 259 | help='Push the release to the local path') |
| 260 | parser.add_argument('--mf-username', metavar='ID', |
| 261 | help='Use the specified username in the Implementation-Version for jar MANIFEST.MF files (e.g., Apache ID).') |
| 262 | parser.add_argument('--pause-before-sign', default=False, action='store_true', |
| 263 | help='Pause for user confirmation before the assembleRelease step (to prevent timeout on gpg pinentry') |
| 264 | parser.add_argument('--sign', metavar='FINGERPRINT', |
| 265 | help='Sign the release with the given gpg key. This must be the full GPG fingerprint, not just the last 8 characters.') |
| 266 | parser.add_argument('--sign-method-gradle', dest='sign_method_gradle', default=False, action='store_true', |
| 267 | help='Use Gradle built-in GPG signing instead of gpg command for signing artifacts. ' |
| 268 | ' This may require --gpg-secring argument if your keychain cannot be resolved automatically.') |
| 269 | parser.add_argument('--gpg-pass-noprompt', dest='gpg_pass_noprompt', default=False, action='store_true', |
| 270 | help='Do not prompt for gpg passphrase. For the default gnupg method, this means your gpg-agent' |
| 271 | ' needs a non-TTY pin-entry program. For gradle signing method, passphrase must be provided' |
| 272 | ' in gradle.properties or by env.var/sysprop. See ./gradlew helpPublishing for more info') |
| 273 | parser.add_argument('--gpg-home', metavar='PATH', |
| 274 | help='Path to gpg home containing your secring.gpg' |
| 275 | ' Optional, will use $HOME/.gnupg/secring.gpg by default') |
| 276 | parser.add_argument('--rc-num', metavar='NUM', type=int, default=1, |
| 277 | help='Release Candidate number. Default: 1') |
| 278 | parser.add_argument('--root', metavar='PATH', default='.', |
| 279 | help='Root of Git working tree for solr. Default: "." (the current directory)') |
| 280 | parser.add_argument('--logfile', metavar='PATH', |
| 281 | help='Specify log file path (default /tmp/release.log)') |
| 282 | parser.add_argument('--dev-mode', default=False, action='store_true', |
| 283 | help='Enable development mode, which disables some strict checks') |
| 284 | config = parser.parse_args() |
| 285 | |
| 286 | if not config.prepare and config.sign: |
| 287 | parser.error('Cannot sign already built release') |
| 288 | if config.push_local is not None and os.path.exists(config.push_local): |
| 289 | parser.error('Cannot push to local path that already exists') |
| 290 | if config.rc_num <= 0: |
| 291 | parser.error('Release Candidate number must be a positive integer') |
| 292 | if not os.path.isdir(config.root): |
| 293 | parser.error('Root path "%s" is not a directory' % config.root) |
| 294 | if config.local_keys is not None and not os.path.exists(config.local_keys): |
| 295 | parser.error('Local KEYS file "%s" not found' % config.local_keys) |
| 296 | if config.gpg_home and not os.path.exists(os.path.join(config.gpg_home, 'secring.gpg')): |
| 297 | parser.error('Specified gpg home %s does not exist or does not contain a secring.gpg' % config.gpg_home) |
| 298 | global dev_mode |
| 299 | if config.dev_mode: |
| 300 | print("Enabling development mode - DO NOT USE FOR ACTUAL RELEASE!") |
| 301 | dev_mode = True |
| 302 | cwd = os.getcwd() |
| 303 | os.chdir(config.root) |
no test coverage detected
searching dependent graphs…