Skip to content

Commit a9ef7cf

Browse files
Update run_release.py (#140)
Co-authored-by: Jelle Zijlstra <[email protected]>
1 parent ca1877a commit a9ef7cf

File tree

1 file changed

+39
-29
lines changed

1 file changed

+39
-29
lines changed

run_release.py

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import sbom
3737
from buildbotapi import BuildBotAPI, Builder
3838

39-
API_KEY_REGEXP = re.compile(r"(?P<major>\w+):(?P<minor>\w+)")
39+
API_KEY_REGEXP = re.compile(r"(?P<user>\w+):(?P<key>\w+)")
4040

4141

4242
RELEASE_REGEXP = re.compile(
@@ -376,6 +376,10 @@ async def _get_builder_status(
376376
raise ReleaseException("Buildbots are failing!")
377377

378378

379+
def check_docker_running(db: DbfilenameShelf) -> None:
380+
subprocess.check_call(["docker", "container", "ls"])
381+
382+
379383
def run_blurb_release(db: DbfilenameShelf) -> None:
380384
subprocess.check_call(["blurb", "release", str(db["release"])], cwd=db["git_repo"])
381385
subprocess.check_call(
@@ -389,7 +393,7 @@ def check_cpython_repo_is_clean(db: DbfilenameShelf) -> None:
389393
raise ReleaseException("Git repository is not clean")
390394

391395

392-
def preapre_temporary_branch(db: DbfilenameShelf) -> None:
396+
def prepare_temporary_branch(db: DbfilenameShelf) -> None:
393397
subprocess.check_call(
394398
["git", "checkout", "-b", f"branch-{db['release']}"], cwd=db["git_repo"]
395399
)
@@ -807,7 +811,7 @@ def send_email_to_platform_release_managers(db: DbfilenameShelf) -> None:
807811
if not ask_question(
808812
"Have you notified the platform release managers about the availability of the commit SHA and tag?"
809813
):
810-
raise ReleaseException("Platform release managers muy be notified")
814+
raise ReleaseException("Platform release managers must be notified")
811815

812816

813817
def create_release_object_in_db(db: DbfilenameShelf) -> None:
@@ -1100,22 +1104,7 @@ def _push_to_upstream(dry_run: bool = False) -> None:
11001104

11011105
def main() -> None:
11021106

1103-
if "linux" not in sys.platform:
1104-
print(
1105-
"""\
1106-
WARNING! This script has not been tested on a platform other than Linux.
1107-
1108-
Although it should work correctly as long as you have all the dependencies,
1109-
some things may not work as expected. As a release manager, you should try to
1110-
fix these things in this script so it also support your platform.
1111-
"""
1112-
)
1113-
if not ask_question("Do you want to continue?"):
1114-
raise ReleaseException(
1115-
"This release script is not compatible with the running platform"
1116-
)
1117-
1118-
parser = argparse.ArgumentParser(description="Process some integers.")
1107+
parser = argparse.ArgumentParser(description="Make a CPython release.")
11191108

11201109
def _release_type(release: str) -> str:
11211110
if not RELEASE_REGEXP.match(release):
@@ -1140,7 +1129,7 @@ def _release_type(release: str) -> str:
11401129
def _api_key(api_key: str) -> str:
11411130
if not API_KEY_REGEXP.match(api_key):
11421131
raise argparse.ArgumentTypeError(
1143-
"Invalid api key format. It must be on the form USER:API_KEY"
1132+
"Invalid API key format. It must be on the form USER:API_KEY"
11441133
)
11451134
return api_key
11461135

@@ -1158,28 +1147,49 @@ def _api_key(api_key: str) -> str:
11581147
type=str,
11591148
)
11601149
args = parser.parse_args()
1150+
11611151
auth_key = args.auth_key or os.getenv("AUTH_INFO")
11621152
assert isinstance(auth_key, str), "We need an AUTH_INFO env var or --auth-key"
1153+
1154+
if "linux" not in sys.platform:
1155+
print(
1156+
"""\
1157+
WARNING! This script has not been tested on a platform other than Linux.
1158+
1159+
Although it should work correctly as long as you have all the dependencies,
1160+
some things may not work as expected. As a release manager, you should try to
1161+
fix these things in this script so it also supports your platform.
1162+
"""
1163+
)
1164+
if not ask_question("Do you want to continue?"):
1165+
raise ReleaseException(
1166+
"This release script is not compatible with the running platform"
1167+
)
1168+
11631169
tasks = [
1164-
Task(check_git, "Checking git is available"),
1170+
Task(check_git, "Checking Git is available"),
11651171
Task(check_make, "Checking make is available"),
11661172
Task(check_blurb, "Checking blurb is available"),
1167-
Task(check_docker, "Checking docker is available"),
1173+
Task(check_docker, "Checking Docker is available"),
1174+
Task(check_docker_running, "Checking Docker is running"),
11681175
Task(check_autoconf, "Checking autoconf is available"),
11691176
Task(check_gpg_keys, "Checking GPG keys"),
1170-
Task(check_ssh_connection, f"Validating ssh connection to {DOWNLOADS_SERVER}"),
1177+
Task(
1178+
check_ssh_connection,
1179+
f"Validating ssh connection to {DOWNLOADS_SERVER} and {DOCS_SERVER}",
1180+
),
11711181
Task(check_buildbots, "Check buildbots are good"),
1172-
Task(check_cpython_repo_is_clean, "Checking git repository is clean"),
1173-
Task(preapre_temporary_branch, "Checking out a temporary release branch"),
1182+
Task(check_cpython_repo_is_clean, "Checking Git repository is clean"),
1183+
Task(prepare_temporary_branch, "Checking out a temporary release branch"),
11741184
Task(run_blurb_release, "Run blurb release"),
1175-
Task(check_cpython_repo_is_clean, "Checking git repository is clean"),
1185+
Task(check_cpython_repo_is_clean, "Checking Git repository is clean"),
11761186
Task(prepare_pydoc_topics, "Preparing pydoc topics"),
11771187
Task(bump_version, "Bump version"),
1178-
Task(check_cpython_repo_is_clean, "Checking git repository is clean"),
1188+
Task(check_cpython_repo_is_clean, "Checking Git repository is clean"),
11791189
Task(run_autoconf, "Running autoconf"),
1180-
Task(check_cpython_repo_is_clean, "Checking git repository is clean"),
1190+
Task(check_cpython_repo_is_clean, "Checking Git repository is clean"),
11811191
Task(check_pyspecific, "Checking pyspecific"),
1182-
Task(check_cpython_repo_is_clean, "Checking git repository is clean"),
1192+
Task(check_cpython_repo_is_clean, "Checking Git repository is clean"),
11831193
Task(create_tag, "Create tag"),
11841194
Task(push_to_local_fork, "Push new tags and branches to private fork"),
11851195
Task(

0 commit comments

Comments
 (0)