mirror of https://github.com/apache/kafka.git
Handle cleanup if there's a failure during generation of release notes.
This commit is contained in:
parent
fa58401279
commit
1a6947af34
22
release.py
22
release.py
|
@ -68,6 +68,12 @@ def fail(msg):
|
||||||
print(msg)
|
print(msg)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
def print_output(output):
|
||||||
|
if output is None or len(output) == 0:
|
||||||
|
return
|
||||||
|
for line in output.split('\n'):
|
||||||
|
print(">", line)
|
||||||
|
|
||||||
def cmd(action, cmd, *args, **kwargs):
|
def cmd(action, cmd, *args, **kwargs):
|
||||||
if isinstance(cmd, basestring) and not kwargs.get("shell", False):
|
if isinstance(cmd, basestring) and not kwargs.get("shell", False):
|
||||||
cmd = cmd.split()
|
cmd = cmd.split()
|
||||||
|
@ -80,12 +86,6 @@ def cmd(action, cmd, *args, **kwargs):
|
||||||
stdin.seek(0)
|
stdin.seek(0)
|
||||||
kwargs["stdin"] = stdin
|
kwargs["stdin"] = stdin
|
||||||
|
|
||||||
def print_output(output):
|
|
||||||
if len(output) == 0:
|
|
||||||
return
|
|
||||||
for line in output.split('\n'):
|
|
||||||
print(">", line)
|
|
||||||
|
|
||||||
print(action, cmd, stdin_log)
|
print(action, cmd, stdin_log)
|
||||||
try:
|
try:
|
||||||
output = subprocess.check_output(cmd, *args, stderr=subprocess.STDOUT, **kwargs)
|
output = subprocess.check_output(cmd, *args, stderr=subprocess.STDOUT, **kwargs)
|
||||||
|
@ -283,7 +283,17 @@ cmd("Verifying the correct year in NOTICE", "grep %s NOTICE" % current_year, cwd
|
||||||
|
|
||||||
with open(os.path.join(artifacts_dir, "RELEASE_NOTES.html"), 'w') as f:
|
with open(os.path.join(artifacts_dir, "RELEASE_NOTES.html"), 'w') as f:
|
||||||
print("Generating release notes")
|
print("Generating release notes")
|
||||||
|
try:
|
||||||
subprocess.check_call(["./release_notes.py", release_version], stdout=f)
|
subprocess.check_call(["./release_notes.py", release_version], stdout=f)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print_output(e.output)
|
||||||
|
|
||||||
|
print("*************************************************")
|
||||||
|
print("*** First command failure occurred here. ***")
|
||||||
|
print("*** Will now try to clean up working state. ***")
|
||||||
|
print("*************************************************")
|
||||||
|
fail("")
|
||||||
|
|
||||||
|
|
||||||
params = { 'release_version': release_version,
|
params = { 'release_version': release_version,
|
||||||
'rc_tag': rc_tag,
|
'rc_tag': rc_tag,
|
||||||
|
|
Loading…
Reference in New Issue