mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 09:22:05 +00:00
Improve build cache for docker images
- Save all layer's cache - Use cache with fallback to a latest tags
This commit is contained in:
parent
f3f8f27db5
commit
44895e5287
@ -237,9 +237,10 @@ def build_and_push_one_image(
|
|||||||
"docker buildx build --builder default "
|
"docker buildx build --builder default "
|
||||||
f"--label build-url={GITHUB_RUN_URL} "
|
f"--label build-url={GITHUB_RUN_URL} "
|
||||||
f"{from_tag_arg}"
|
f"{from_tag_arg}"
|
||||||
f"--build-arg BUILDKIT_INLINE_CACHE=1 "
|
|
||||||
f"--tag {image.repo}:{version_string} "
|
f"--tag {image.repo}:{version_string} "
|
||||||
f"--cache-from type=registry,ref={image.repo}:{version_string} "
|
f"--cache-from type=registry,ref={image.repo}:{version_string} "
|
||||||
|
f"--cache-from type=registry,ref={image.repo}:latest "
|
||||||
|
f"--cache-to type=inline,mode=max "
|
||||||
f"{push_arg}"
|
f"{push_arg}"
|
||||||
f"--progress plain {image.full_path}"
|
f"--progress plain {image.full_path}"
|
||||||
)
|
)
|
||||||
|
@ -124,8 +124,9 @@ class TestDockerImageCheck(unittest.TestCase):
|
|||||||
self.assertIn(
|
self.assertIn(
|
||||||
f"docker buildx build --builder default --label build-url={GITHUB_RUN_URL} "
|
f"docker buildx build --builder default --label build-url={GITHUB_RUN_URL} "
|
||||||
"--build-arg FROM_TAG=version "
|
"--build-arg FROM_TAG=version "
|
||||||
"--build-arg BUILDKIT_INLINE_CACHE=1 --tag name:version --cache-from "
|
"--tag name:version --cache-from type=registry,ref=name:version "
|
||||||
"type=registry,ref=name:version --push --progress plain path",
|
"--cache-from type=registry,ref=name:latest "
|
||||||
|
"--cache-to type=inline,mode=max --push --progress plain path",
|
||||||
mock_popen.call_args.args,
|
mock_popen.call_args.args,
|
||||||
)
|
)
|
||||||
self.assertTrue(result)
|
self.assertTrue(result)
|
||||||
@ -141,8 +142,9 @@ class TestDockerImageCheck(unittest.TestCase):
|
|||||||
self.assertIn(
|
self.assertIn(
|
||||||
f"docker buildx build --builder default --label build-url={GITHUB_RUN_URL} "
|
f"docker buildx build --builder default --label build-url={GITHUB_RUN_URL} "
|
||||||
"--build-arg FROM_TAG=version2 "
|
"--build-arg FROM_TAG=version2 "
|
||||||
"--build-arg BUILDKIT_INLINE_CACHE=1 --tag name:version2 --cache-from "
|
"--tag name:version2 --cache-from type=registry,ref=name:version2 "
|
||||||
"type=registry,ref=name:version2 --progress plain path",
|
"--cache-from type=registry,ref=name:latest "
|
||||||
|
"--cache-to type=inline,mode=max --progress plain path",
|
||||||
mock_popen.call_args.args,
|
mock_popen.call_args.args,
|
||||||
)
|
)
|
||||||
self.assertTrue(result)
|
self.assertTrue(result)
|
||||||
@ -157,8 +159,9 @@ class TestDockerImageCheck(unittest.TestCase):
|
|||||||
mock_machine.assert_not_called()
|
mock_machine.assert_not_called()
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
f"docker buildx build --builder default --label build-url={GITHUB_RUN_URL} "
|
f"docker buildx build --builder default --label build-url={GITHUB_RUN_URL} "
|
||||||
"--build-arg BUILDKIT_INLINE_CACHE=1 --tag name:version2 --cache-from "
|
"--tag name:version2 --cache-from type=registry,ref=name:version2 "
|
||||||
"type=registry,ref=name:version2 --progress plain path",
|
"--cache-from type=registry,ref=name:latest "
|
||||||
|
"--cache-to type=inline,mode=max --progress plain path",
|
||||||
mock_popen.call_args.args,
|
mock_popen.call_args.args,
|
||||||
)
|
)
|
||||||
self.assertFalse(result)
|
self.assertFalse(result)
|
||||||
|
Loading…
Reference in New Issue
Block a user