From 442771227c52e070e51b6b394fa324f0831cc8bd Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Wed, 6 Nov 2024 14:50:58 +0100 Subject: [PATCH] Create a new branch from origin Signed-off-by: Petr "Stone" Hracek --- .github/workflows/build-and-push.yml | 2 +- Dockerfile | 2 +- betka/core.py | 11 ++++++++--- setup.py | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 1f61797..20062ae 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -20,7 +20,7 @@ jobs: with: dockerfiles: ./Dockerfile image: betka - tags: latest 1 ${{ github.sha }} 0.9.3 + tags: latest 1 ${{ github.sha }} 0.9.4 - name: Push betka image to Quay.io id: push-to-quay diff --git a/Dockerfile b/Dockerfile index b4012cd..0d48705 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM quay.io/fedora/fedora:37 ENV NAME=betka-fedora \ - RELEASE=0.9.3 \ + RELEASE=0.9.4 \ ARCH=x86_64 \ SUMMARY="Syncs changes from upstream repository to downstream" \ DESCRIPTION="Syncs changes from upstream repository to downstream" \ diff --git a/betka/core.py b/betka/core.py index 8517409..a81d2fe 100644 --- a/betka/core.py +++ b/betka/core.py @@ -537,7 +537,7 @@ def prepare_downstream_git(self, project_info: ProjectInfo) -> bool: self.downstream_dir = Git.clone_repo( project_info.ssh_url_to_repo, self.betka_tmp_dir.name ) - self.info("Downstream directory %r", self.downstream_dir) + self.info(f"Downstream directory {self.downstream_dir}") if self.downstream_dir is None: self.error("!!!! Cloning downstream repo %s FAILED.", self.image) return False @@ -571,7 +571,6 @@ def _copy_cloned_downstream_dir(self): ) def _get_bot_cfg(self, branch: str) -> bool: - Git.call_git_cmd(f"checkout {branch}", msg="Change downstream branch") self.debug(f"Config before getting bot-cfg.yaml {self.config}") self.config = self.gitlab_api.get_bot_cfg_yaml(branch=branch) self.debug(f"Downstream 'bot-cfg.yml' file {self.config}.") @@ -659,9 +658,15 @@ def _sync_valid_branches(self, valid_branches): if self.is_fork_enabled(): self.downstream_git_branch = branch self.downstream_git_origin_branch = "" + Git.call_git_cmd(f"checkout {branch}", msg="Change downstream branch") else: - self.downstream_git_branch = f"betka-{branch}" + self.downstream_git_branch = f"betka-{datetime.now().strftime('%Y%m%d%H%M%S')}{branch}" self.downstream_git_origin_branch = branch + Git.call_git_cmd( + f"checkout -b {self.downstream_git_branch} {branch}", + msg="Create a new downstream branch" + ) + # This loads downstream bot-cfg.yml file # and update betka's dictionary (self.config). # We need to have information up to date diff --git a/setup.py b/setup.py index 168e7f0..539baed 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def get_requirements(): setup( name="betka", - version="0.9.3", + version="0.9.4", packages=find_packages(exclude=["examples", "tests"]), url="https://github.com/sclorg/betka", license="GPLv3+",