Skip to content

Commit

Permalink
fix(GitOpsConfig): respect preview target branch during deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
christiansiegel committed Jul 13, 2021
1 parent d85a55b commit 4e22cae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gitopscli/commands/delete_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def execute(self) -> None:

preview_target_git_repo_api = self.__create_preview_target_git_repo_api(gitops_config)
with GitRepo(preview_target_git_repo_api) as preview_target_git_repo:
preview_target_git_repo.clone()
preview_target_git_repo.clone(gitops_config.preview_target_branch)

preview_namespace = gitops_config.get_preview_namespace(preview_id)
logging.info("Preview folder name: %s", preview_namespace)
Expand Down
8 changes: 4 additions & 4 deletions tests/commands/test_delete_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def setUp(self):
preview_template_branch="template-branch",
preview_target_organisation="PREVIEW_TARGET_ORG",
preview_target_repository="PREVIEW_TARGET_REPO",
preview_target_branch=None,
preview_target_branch="target-branch",
preview_target_namespace_template=f"APP-{{PREVIEW_ID_HASH}}-preview",
replacements={},
)
Expand Down Expand Up @@ -77,7 +77,7 @@ def test_delete_existing_happy_flow(self):
call.load_gitops_config(args, "ORGA", "REPO"),
call.GitRepoApiFactory.create(args, "PREVIEW_TARGET_ORG", "PREVIEW_TARGET_REPO"),
call.GitRepo(self.git_repo_api_mock),
call.GitRepo.clone(),
call.GitRepo.clone("target-branch"),
call.logging.info("Preview folder name: %s", "app-685912d3-preview"),
call.GitRepo.get_full_file_path("app-685912d3-preview"),
call.os.path.exists("/tmp/created-tmp-dir/app-685912d3-preview"),
Expand Down Expand Up @@ -108,7 +108,7 @@ def test_delete_missing_happy_flow(self):
call.load_gitops_config(args, "ORGA", "REPO"),
call.GitRepoApiFactory.create(args, "PREVIEW_TARGET_ORG", "PREVIEW_TARGET_REPO"),
call.GitRepo(self.git_repo_api_mock),
call.GitRepo.clone(),
call.GitRepo.clone("target-branch"),
call.logging.info("Preview folder name: %s", "app-685912d3-preview"),
call.GitRepo.get_full_file_path("app-685912d3-preview"),
call.os.path.exists("/tmp/created-tmp-dir/app-685912d3-preview"),
Expand Down Expand Up @@ -140,7 +140,7 @@ def test_delete_missing_but_expected_error(self):
call.load_gitops_config(args, "ORGA", "REPO"),
call.GitRepoApiFactory.create(args, "PREVIEW_TARGET_ORG", "PREVIEW_TARGET_REPO"),
call.GitRepo(self.git_repo_api_mock),
call.GitRepo.clone(),
call.GitRepo.clone("target-branch"),
call.logging.info("Preview folder name: %s", "app-685912d3-preview"),
call.GitRepo.get_full_file_path("app-685912d3-preview"),
call.os.path.exists("/tmp/created-tmp-dir/app-685912d3-preview"),
Expand Down

0 comments on commit 4e22cae

Please sign in to comment.