From 58e3af59d5741070573c8fd9fc894c47de28598b Mon Sep 17 00:00:00 2001 From: "Jonathan A. Sternberg" Date: Mon, 7 Aug 2023 16:42:28 -0500 Subject: [PATCH 1/3] Avoid unnecessary map allocation when writing progress `MultiWriter` would create an unnecessary map allocation when the `Write` method was used. The `Write` method would create a progress object with the meta field initialized to the meta field of the writer itself. It then invoked its own `WriteRawProgress` method which would see two maps with the metadata and erroneously believe that they were different and needed to be merged into a single metadata map. Since this map is initialized with the metadata of the writer before `WriteRawProgress` is invoked, this merge was unnecessary and could add a lot of unnecessary memory allocations during a build. This changes the `MultiWriter.Write` method to invoke the private `writeRawProgress` which performs the actual write and avoids the metadata merge. Signed-off-by: Jonathan A. Sternberg (cherry picked from commit 4c83fcf365a1aa52222b036e60198d84806feea2) --- util/progress/multiwriter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/progress/multiwriter.go b/util/progress/multiwriter.go index a856db8caa09..7cce8a7ca7d2 100644 --- a/util/progress/multiwriter.go +++ b/util/progress/multiwriter.go @@ -65,7 +65,7 @@ func (ps *MultiWriter) Write(id string, v interface{}) error { Sys: v, meta: ps.meta, } - return ps.WriteRawProgress(p) + return ps.writeRawProgress(p) } func (ps *MultiWriter) WriteRawProgress(p *Progress) error { From dc338bff81a334136ce0fc7c0102ac608baa2024 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Tue, 8 Aug 2023 09:18:18 +0100 Subject: [PATCH 2/3] docs: update gcpolicy percentage to refer to total space Instead of available space. Signed-off-by: Justin Chadwell (cherry picked from commit a6e42ec2cf5a6f172ca1207fe4c62d212b1b976b) --- docs/buildkitd.toml.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/buildkitd.toml.md b/docs/buildkitd.toml.md index 60d1d902c44d..f0000b9a5842 100644 --- a/docs/buildkitd.toml.md +++ b/docs/buildkitd.toml.md @@ -64,7 +64,7 @@ insecure-entitlements = [ "network.host", "security.insecure" ] [[worker.oci.gcpolicy]] # keepBytes can be an integer number of bytes (e.g. 512000000), a string - # with a unit (e.g. "512MB"), or a string percentage of available disk + # with a unit (e.g. "512MB"), or a string percentage of the total disk # space (e.g. "10%") keepBytes = "512MB" # keepDuration can be an integer number of seconds (e.g. 172800), or a From 68647576bf6e57f2c58789f63af5a059c83a93ca Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Tue, 8 Aug 2023 09:41:14 +0100 Subject: [PATCH 3/3] docs: index annotations fail if index is not produced Signed-off-by: Justin Chadwell (cherry picked from commit 49c848ecbaea42bae8e94f06d61c3a1f9298b7a8) --- docs/annotations.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/annotations.md b/docs/annotations.md index a37573eeef9a..dedcc4b88a22 100644 --- a/docs/annotations.md +++ b/docs/annotations.md @@ -43,13 +43,12 @@ write to the following ``s: - The `manifest` (the default, as above) - The `manifest-descriptor` - This adds the annotation into the image index's descriptor for the manifest - - (discarded if the output does not contain an image index) - The `index` - This adds the annotation into the image index root - - (discarded if the output does not contain an image index) + - If the exporter does not produce an image index, the build will fail. - The `index-descriptor` - This adds the annotation into the OCI layout's descriptor for the index - - (discarded if the output does not contain an OCI layout) + - If the exporter does not produce an image index, the build will fail. For example, if you want to add the annotation at the image index level, so that the annotation is shared between all architectures, you can instead: