diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index bdfd04d..b34213e 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -20,7 +20,7 @@ jobs: with: dockerfiles: ./Dockerfile.generator image: cwt-generator - tags: latest 1 ${{ github.sha }} + tags: latest 1 ${{ github.sha }} 1.5.7 - name: Push cwt-generator image to Quay.io id: push-to-quay diff --git a/Dockerfile.generator b/Dockerfile.generator index c221201..33fc8d9 100644 --- a/Dockerfile.generator +++ b/Dockerfile.generator @@ -1,4 +1,4 @@ -FROM quay.io/fedora/fedora:36 +FROM quay.io/fedora/fedora:39 ENV CWT_DIR=/tmp/container-workflow-tool RUN dnf install -y go-md2man \ make git python3-PyYAML \ diff --git a/Dockerfile.tests b/Dockerfile.tests index f601cbd..ab71276 100644 --- a/Dockerfile.tests +++ b/Dockerfile.tests @@ -1,4 +1,4 @@ -FROM quay.io/fedora/fedora:36 +FROM quay.io/fedora/fedora:39 RUN dnf install -y ansible diff --git a/Makefile b/Makefile index 08abca0..ecb1a0f 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ TEST_IMAGE=cwt-tests GENERATOR_IMAGE=quay.io/rhscl/cwt-generator UNAME=$(shell uname) ifeq ($(UNAME),Darwin) - PODMAN := /usr/local/bin/docker + PODMAN := /opt/podman/bin/podman else PODMAN := /usr/bin/podman endif diff --git a/container_workflow_tool/distgit.py b/container_workflow_tool/distgit.py index 66afbe5..6334806 100644 --- a/container_workflow_tool/distgit.py +++ b/container_workflow_tool/distgit.py @@ -74,13 +74,7 @@ def dist_git_merge_changes(self, images, rebase=False): pull_upstr = image.get("pull_upstream", True) repo = self._clone_downstream(component, branch) df_path = os.path.join(component, "Dockerfile") - downstream_from = self.df_handler.get_from_df(df_path) - self.logger.debug(f"Downstream_from: {downstream_from}\n") - from_tag = self.conf.get("from_tag", "latest") if rebase or not pull_upstr: - self.df_handler.update_dockerfile( - df_path, from_tag, downstream_from=downstream_from - ) # It is possible for the git repository to have no changes if repo.is_dirty(): commit = self.get_commit_msg(rebase, image) @@ -97,9 +91,6 @@ def dist_git_merge_changes(self, images, rebase=False): # Save the upstream commit hash ups_hash = Repo(ups_path).commit().hexsha self.pull_upstream(component, path, url, repo, ups_name, commands) - self.df_handler.update_dockerfile( - df_path, from_tag, downstream_from=downstream_from - ) repo.git.add("Dockerfile") # It is possible for the git repository to have no changes if repo.is_dirty(): diff --git a/container_workflow_tool/main.py b/container_workflow_tool/main.py index 3830a54..cb8661c 100755 --- a/container_workflow_tool/main.py +++ b/container_workflow_tool/main.py @@ -425,7 +425,8 @@ def clear_cache(self): self.logger.info("Removing cached data and git storage.") # Clear ondisk storage for git and the brew cache tmp = self._get_tmp_workdir(setup_dir=False) - shutil.rmtree(tmp, ignore_errors=True) + if tmp is not None and os.path.isdir(tmp): + shutil.rmtree(tmp, ignore_errors=True) # If the working directory has been set by the user, recreate it if self.tmp_workdir: os.makedirs(tmp) diff --git a/setup.py b/setup.py index d267067..f9227e0 100755 --- a/setup.py +++ b/setup.py @@ -58,7 +58,7 @@ def get_dir(system_path=None, virtual_path=None): setup( name='container-workflow-tool', - version="1.5.6", + version="1.5.7", description='A python3 tool to make rebuilding images easier by automating several steps of the process.', long_description=long_description, long_description_content_type='text/markdown', diff --git a/tests/test_distgit.py b/tests/test_distgit.py index 38e548e..089f35e 100644 --- a/tests/test_distgit.py +++ b/tests/test_distgit.py @@ -66,14 +66,7 @@ def test_distgit_merge_changes(self): self.ir.conf["from_tag"] = "test" tmp = Path(self.ir._get_tmp_workdir()) self.ir.dist_git_merge_changes() - dpath = tmp / self.component / 'Dockerfile' - assert os.path.isfile(dpath) assert not (tmp / self.component / "test" / "test-openshift.yaml").exists() - tag_found = False - with open(dpath) as f: - if ":test" in f.read(): - tag_found = True - assert tag_found shutil.rmtree(tmp / self.component) @pytest.mark.distgit @@ -86,25 +79,4 @@ def test_distgit_merge_changes_openshift_yaml(self): tmp = Path(self.ir._get_tmp_workdir()) self.ir.distgit._clone_downstream(self.component, "main") self.ir.dist_git_merge_changes() - dpath = tmp / self.component / 'Dockerfile' - assert os.path.isfile(dpath) - tag_found = False - with open(dpath) as f: - if ":test" in f.read(): - tag_found = True - assert tag_found - shutil.rmtree(tmp / self.component) - - @pytest.mark.distgit - def test_tag_dockerfile(self): - tmp = Path(self.ir._get_tmp_workdir()) - self.ir.conf["from_tag"] = "test" - self.ir.dist_git_merge_changes() - cpath = tmp / self.component - dpath = cpath / 'Dockerfile' - found_tag = False - with open(dpath) as f: - if ":test" in f.read(): - found_tag = True - assert found_tag shutil.rmtree(tmp / self.component)