Skip to content

c8d: make the cache in classic builder work#46634

Merged
thaJeztah merged 5 commits intomoby:masterfrom
rumpl:c8d-classic-builder-cache
Jan 17, 2024
Merged

c8d: make the cache in classic builder work#46634
thaJeztah merged 5 commits intomoby:masterfrom
rumpl:c8d-classic-builder-cache

Conversation

@rumpl
Copy link
Member

@rumpl rumpl commented Oct 12, 2023

- What I did

Makes the cache in classic builder work with the containerd image store

In order for the cache in the classic builder to work we need to:

  • use the came comparison function as the graph drivers implementation
  • save the container config when commiting the image
  • use all images to search a 'FROM "scratch"' image
  • use all images if cacheFrom is empty
  • use the image labels to find the parents/children, not the rootfs

- How I did it

- How to verify it

$ make DOCKER_GRAPHDRIVER=overlayfs TEST_FILTER=TestBuildAddCurrentDirWithoutCache TEST_INTEGRATION_USE_SNAPSHOTTER=1 TEST_IGNORE_CGROUP_CHECK=1 test-integration
$ make DOCKER_GRAPHDRIVER=overlayfs TEST_FILTER=TestBuildAddRemoteFileWithAndWithoutCache TEST_INTEGRATION_USE_SNAPSHOTTER=1 TEST_IGNORE_CGROUP_CHECK=1 test-integration
$ make DOCKER_GRAPHDRIVER=overlayfs TEST_FILTER=TestBuildCopyDirButNotFile TEST_INTEGRATION_USE_SNAPSHOTTER=1 TEST_IGNORE_CGROUP_CHECK=1 test-integration 

And many others.

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@rumpl rumpl added area/builder Build status/2-code-review area/builder/classic-builder Build containerd-integration Issues and PRs related to containerd integration labels Oct 12, 2023
@rumpl rumpl force-pushed the c8d-classic-builder-cache branch from 87d76f6 to 749958b Compare October 12, 2023 16:47
@rumpl rumpl requested review from laurazard and vvoland and removed request for vvoland October 12, 2023 16:52
@rumpl rumpl marked this pull request as draft October 12, 2023 17:08
@rumpl
Copy link
Member Author

rumpl commented Oct 12, 2023

Converted to draft, just realized that the scratch cache case needs some more work

@rumpl rumpl force-pushed the c8d-classic-builder-cache branch 3 times, most recently from 6b77b95 to aa643b7 Compare October 18, 2023 19:11
@rumpl rumpl force-pushed the c8d-classic-builder-cache branch 4 times, most recently from c752016 to c459fd1 Compare October 20, 2023 13:46
@rumpl rumpl marked this pull request as ready for review October 20, 2023 13:47
@rumpl rumpl force-pushed the c8d-classic-builder-cache branch from c459fd1 to 124c716 Compare October 20, 2023 13:50
@rumpl rumpl force-pushed the c8d-classic-builder-cache branch from 4dfa49a to fcd91e9 Compare October 23, 2023 13:35
@rumpl rumpl force-pushed the c8d-classic-builder-cache branch 3 times, most recently from f2ce092 to a520b8e Compare January 4, 2024 10:29
@vvoland vvoland force-pushed the c8d-classic-builder-cache branch from a520b8e to c2ba48d Compare January 16, 2024 15:25
@thaJeztah thaJeztah added this to the 25.0.0 milestone Jan 16, 2024
@vvoland
Copy link
Contributor

vvoland commented Jan 17, 2024

FYI, the validate failure is caused by splitting one integration-cli test into two separate ones.

@thaJeztah
Copy link
Member

@vvoland oh! I saw that, but looks like I didn't comment; could you perhaps push a temporary commit similar to 7ed823e, so that we have the validate steps run?

We can revert it after this is merged (we should have some option to allow skipping it in CI without having to make changes, but don't know what the best approach for that is with GitHub actions 😞)

@thaJeztah thaJeztah requested a review from laurazard January 17, 2024 11:57
@rumpl rumpl requested a review from tianon as a code owner January 17, 2024 12:02
@vvoland
Copy link
Contributor

vvoland commented Jan 17, 2024

Done

(lol, me pushing a commit made a review request on behalf of @rumpl)

@vvoland vvoland force-pushed the c8d-classic-builder-cache branch from ee77bfc to 9db487f Compare January 17, 2024 12:17
Copy link
Member

@laurazard laurazard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉 (yaaaaaay)

Left a couple of nitpicky comments/questions but there's probably reason for things to be that way/they're not anywhere big enough to be a blocker.

Comment on lines +534 to +536
manifestDesc ocispec.Descriptor,
containerConfigDesc ocispec.Descriptor,
_ error,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Reads better than just having the function return (ocispec.Descriptor, ocispec.Descriptor, error)

@vvoland vvoland force-pushed the c8d-classic-builder-cache branch from 9db487f to 5ed41d6 Compare January 17, 2024 13:57
rumpl and others added 5 commits January 17, 2024 14:57
In order for the cache in the classic builder to work we need to:
- use the came comparison function as the graph drivers implementation
- save the container config when commiting the image
- use all images to search a 'FROM "scratch"' image
- load all images if `cacheFrom` is empty

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Consider only images that were built `FROM scratch` as valid candidates
for the `FROM scratch` + INSTRUCTION build step.

The images are marked as `FROM scratch` based by the classic builder
with a special label. It must be a new label instead of empty parent
label, because empty label values are not persisted.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Serialize ContainerConfig to content store and store its digest in
label.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@vvoland vvoland force-pushed the c8d-classic-builder-cache branch from 5ed41d6 to bdc7d0c Compare January 17, 2024 13:58
Copy link
Member

@laurazard laurazard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-LGTM'ing ✅

@thaJeztah
Copy link
Member

IT'S ALL GREEN (on Linux). IT'S ALL GREEN!! 🥳 🥳 🥳 🥳

Screenshot 2024-01-17 at 15 47 36

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Development

Successfully merging this pull request may close these issues.

4 participants