Skip to content

Commit 4046d84

Browse files
fix(delete-preview): only create new branch in config repo if --create-pr
1 parent 080fc64 commit 4046d84

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

gitopscli/commands/delete_preview.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,13 @@ def delete_preview_command(
6060
root_git.checkout("master")
6161
logging.info("Config repo branch master checkout successful")
6262

63-
config_branch = f"gitopscli-delete-preview-{str(uuid.uuid4())[:8]}" if create_pr else "master"
63+
if create_pr:
64+
config_branch = f"gitopscli-delete-preview-{str(uuid.uuid4())[:8]}"
65+
root_git.new_branch(config_branch)
66+
logging.info("Created branch %s in config repo", config_branch)
67+
else:
68+
config_branch = "master"
6469

65-
root_git.new_branch(config_branch)
66-
logging.info("Created branch %s in config repo", config_branch)
6770
shortened_branch_hash = hashlib.sha256(branch.encode("utf-8")).hexdigest()[:8]
6871
logging.info("Hashed branch %s to hash: %s", branch, shortened_branch_hash)
6972
preview_folder_name = gitops_config.application_name + "-" + shortened_branch_hash + "-preview"

0 commit comments

Comments
 (0)