Skip to content

Commit

Permalink
releng/prepare_release_branch: Ignore dead branch if already deleted
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Augustus <[email protected]>
  • Loading branch information
justaugustus committed Jul 5, 2020
1 parent fdc04e8 commit 634450c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions releng/prepare_release_branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ def check_version(branch_path):


def delete_dead_branch(branch_path, current_version):
print("Deleting dead branch...")
filename = '%d.%d.yaml' % (current_version[0], current_version[1] - 3)
os.unlink(os.path.join(branch_path, filename))
if os.path.exists(filename):
os.unlink(os.path.join(branch_path, filename))
else:
print("the branch config (%s) does not exist" % filename)


def rotate_files(rotator_bin, branch_path, current_version):
Expand Down Expand Up @@ -117,7 +121,6 @@ def main():
d = os.environ.get('BUILD_WORKSPACE_DIRECTORY')
version = check_version(os.path.join(d, BRANCH_JOB_DIR))
print("Current version: %d.%d" % (version[0], version[1]))
print("Deleting dead branch...")
delete_dead_branch(os.path.join(d, BRANCH_JOB_DIR), version)
print("Rotating files...")
rotate_files(rotator_bin, os.path.join(d, BRANCH_JOB_DIR), version)
Expand Down

0 comments on commit 634450c

Please sign in to comment.