Skip to content

Commit 5769679

Browse files
committed
cut-release: Automatically bump console version too
1 parent 6924802 commit 5769679

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

misc/python/materialize/release/cut_release.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010
"""Cut a new release and push the tag to the upstream Materialize repository."""
1111

1212
import argparse
13+
import os
1314
import re
15+
import shutil
16+
import subprocess
1417
import sys
18+
import time
1519

1620
from semver.version import Version
1721

@@ -54,6 +58,51 @@ def main():
5458
try:
5559
print(f"Checking out SHA {args.sha}")
5660
checkout(args.sha)
61+
print("Cloning console repo")
62+
console_dir = MZ_ROOT / "console"
63+
if os.path.exists(console_dir):
64+
shutil.rmtree(console_dir)
65+
try:
66+
spawn.runv(
67+
[
68+
"git",
69+
"clone",
70+
"https://github.com/MaterializeInc/console",
71+
console_dir,
72+
],
73+
env={**os.environ, "GIT_TERMINAL_PROMPT": "0"},
74+
)
75+
except subprocess.CalledProcessError:
76+
spawn.runv(
77+
["git", "clone", "[email protected]:MaterializeInc/console", console_dir],
78+
env={**os.environ, "GIT_TERMINAL_PROMPT": "0"},
79+
)
80+
81+
print(f"Bumping console version to {version}")
82+
spawn.runv(["git", "tag", "-a", version, "-m", version], cwd=console_dir)
83+
spawn.runv(["git", "push", "origin", version], cwd=console_dir)
84+
85+
print("Waiting for console version to be released on DockerHub (~15 min)")
86+
console_image = f"materialize/console:{version[1:]}"
87+
time.sleep(15 * 60)
88+
while True:
89+
try:
90+
spawn.runv(["docker", "manifest", "inspect", console_image])
91+
except subprocess.CalledProcessError:
92+
print(f"{console_image} not yet on DockerHub, sleeping 1 min")
93+
time.sleep(60)
94+
continue
95+
break
96+
print(f"{console_image} found on DockerHub")
97+
spawn.runv(
98+
[
99+
"sed",
100+
"-i",
101+
f"s#FROM materialize/console:.* AS console#FROM {console_image} AS console#",
102+
"misc" / "images" / "materialized-base" / "Dockerfile",
103+
]
104+
)
105+
57106
print(f"Bumping version to {version}")
58107
spawn.runv(
59108
[

0 commit comments

Comments
 (0)