From 05dcba1ab9e96b3af88a2ee0bd2178369cc8c330 Mon Sep 17 00:00:00 2001 From: Mikhail Gordeev Date: Mon, 26 Dec 2022 02:50:46 +0300 Subject: [PATCH] Use only podman --- README.md | 4 ++-- build.py | 59 +++++-------------------------------------------------- 2 files changed, 7 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index a62c8a0..24a4daa 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ docker-derivatives To build `alt` images, run: ``` -./build.py -o alt --podman +./build.py -o alt ``` To build `k8s` images for branch `p10` and push to repository `test_k8s`, run: ``` -./build.py -o k8s -b p10 --overwrite-organization test_k8s --tasks tasks.json --tags tags.json --podman +./build.py -o k8s -b p10 --overwrite-organization test_k8s --tasks tasks.json --tags tags.json ``` diff --git a/build.py b/build.py index b815226..ee17d65 100755 --- a/build.py +++ b/build.py @@ -192,49 +192,6 @@ class DockerBuilder: pre_cmd = [] subprocess.run(pre_cmd + cmd, *args, **kwargs) - def build(self, image, arches, tag): - new_env = os.environ | {"DOCKER_BUILDKIT": "1"} - - full_image = self.full_image(image) - if self.images_info.skip_branch(full_image, tag): - return - - msg = "Building image {} for branch {} and {} arches".format( - self.full_image(image), - tag, - arches, - ) - print(msg) - - build_arches = set(arches) - set(self.images_info.skip_arches(full_image)) - platforms = ",".join([f"linux/{a}" for a in build_arches]) - full_name = self.render_full_tag(image, tag) - if tag == self.latest: - lates_name = self.render_full_tag(image, "latest") - names = f"{full_name},{lates_name}" - else: - names = full_name - - cmd = [ - "buildctl", - "build", - "--progress=plain", - "--frontend=dockerfile.v0", - "--local", - "context=.", - "--local", - "dockerfile=.", - "--opt", - f"platform={platforms}", - "--output", - f'type=image,"name={names}",push=true', - ] - self.run( - cmd, - cwd=self.images_dir / image, - env=new_env, - ) - def podman_build(self, image, arches, branch): full_image = self.full_image(image) if self.images_info.skip_branch(full_image, branch): @@ -324,7 +281,7 @@ class ImagesInfo: def parse_args(): - stages = ["build", "remove_dockerfiles", "render_dockerfiles"] + stages = ["build", "remove_dockerfiles", "render_dockerfiles", "push"] arches = ["amd64", "386", "arm64", "arm", "ppc64le"] branches = ["p9", "p10", "sisyphus"] organizations = list(ORG_DIR.iterdir()) @@ -381,11 +338,6 @@ def parse_args(): parser.add_argument( "--sign", ) - parser.add_argument( - "--podman", - action="store_true", - help="use podman to build images", - ) parser.add_argument( "--skip-images", nargs="+", @@ -472,11 +424,10 @@ def main(): continue if "build" in args.stages: - if args.podman: - db.podman_build(image, args.arches, branch) - db.podman_push(image, branch, args.sign) - else: - db.build(image, args.arches, branch) + db.podman_build(image, args.arches, branch) + + if "push" in args.stages: + db.podman_push(image, branch, args.sign) if __name__ == "__main__":