From 9989b68d0d38c8f1357f78bf9d53a58c1476188d Mon Sep 17 00:00:00 2001 From: Owen Leung Date: Thu, 26 Oct 2023 16:40:01 +0800 Subject: [PATCH] KAFKA-15200: Add pre-requisite check in release.py (#14636) Reviewers: Divij Vaidya --- release.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/release.py b/release.py index 314df2ed630..8458323ea9d 100755 --- a/release.py +++ b/release.py @@ -491,6 +491,35 @@ Some of these may be used from these previous settings loaded from %s: Do you have all of of these setup? (y/n): """ % (PREFS_FILE, json.dumps(prefs, indent=2))): fail("Please try again once you have all the prerequisites ready.") +apache_id = sanitize_input("Please enter your apache-id: ") + +print("Begin to check if you have met all the pre-requisites for the release process") + +try: + test_maven = cmd_output("mvn -v") + if "Apache Maven" in test_maven: + print("Pre-requisite met: You have maven cli in place") + else: + fail("Pre-requisite not met: You need to install maven CLI") +except Exception as e: + fail(f"Pre-requisite not met: Unable to check if maven cli is installed. Error: {e}") + +try: + test_sftp = subprocess.run(f"sftp {apache_id}@home.apache.org".split()) + if test_sftp.returncode != 0: + fail("Pre-requisite not met: Cannot establish sftp connection. Please check your apache-id and ssh keys.") + print("Pre-requisite met: sftp connection is successful") +except Exception as e: + fail(f"Pre-requisite not met: Unable to check if sftp connection is successful. Error: {e}") + +try: + test_svn = cmd_output("svn --version") + if "svn" in test_svn: + print("Pre-requisite met: You have svn cli in place") + else: + fail("Pre-requisite not met: You need to install svn cli") +except Exception as e: + fail(f"Pre-requisite not met: Unable to check if svn cli is installed. Error: {e}") starting_branch = cmd_output('git rev-parse --abbrev-ref HEAD')