buildah icon indicating copy to clipboard operation
buildah copied to clipboard

imagebuildah: make traditional volume handling not the default

Open nalind opened this issue 1 year ago • 6 comments

What type of PR is this?

/kind api-change

What this PR does / why we need it:

The traditional handling of volumes (where they're "frozen" and can only be modified by ADD or COPY, which requires that we cache their contents and save/restore them before/after RUN instructions) is not what newer BuildKit-based builds do, and it tends to confuse people, particularly when the volume is inherited from a base image that they're using for their own build.

This PR makes that an optional behavior which can be enabled with a build option. When the previous behavior is enabled, it corrects the handling of those inherited volumes to match the way it should have worked.

How to verify it

New and expanded conformance tests!

Which issue(s) this PR fixes:

Fixes #4247 Fixes #4407

Special notes for your reviewer:

I expect this to be more of interest to API consumers who want to control when this behavior changes.

Does this PR introduce a user-facing change?

When building an image using `buildah build`, the contents of directories marked as volumes (defined by VOLUME instructions), whether as part of the build, or inherited from a base image, will no longer be saved before, and restored after, processing RUN instructions.  The `--compat-volumes` flag can be used to re-enable this behavior.

nalind avatar Jun 21 '24 14:06 nalind

Ephemeral COPR build failed. @containers/packit-build please check.

Are you now compatible with docker/buildkit by default?

rhatdan avatar Jun 24 '24 10:06 rhatdan

That is the goal, once all the tests pass.

nalind avatar Jun 24 '24 13:06 nalind

The TestConformance/chown-volume test failures in the "Debian Conformance w/ vfs" context are fixed by https://github.com/containers/storage/pull/1962 and https://github.com/containers/storage/pull/1968.

nalind avatar Jun 25 '24 15:06 nalind

Can you update the vendor of containers/storage?

rhatdan avatar Jun 25 '24 18:06 rhatdan

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flouthoc, nalind

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • ~~OWNERS~~ [flouthoc,nalind]

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

openshift-ci[bot] avatar Jul 03 '24 20:07 openshift-ci[bot]

Tests still failing?

rhatdan avatar Jul 10 '24 09:07 rhatdan

I see again mismatch of mtime or is there somthing more ? @nalind Should we instrument conformance test to ignore checking mtime ?

flouthoc avatar Jul 10 '24 15:07 flouthoc

The TestConformance/chown-volume test failures in the "Debian Conformance w/ vfs" context are fixed by containers/storage#1962 and containers/storage#1968.

nalind avatar Jul 10 '24 16:07 nalind

The TestConformance/chown-volume test failures in the "Debian Conformance w/ vfs" context are fixed by containers/storage#1962 and containers/storage#1968.

https://github.com/containers/buildah/pull/5585 brought those in. Rebased.

nalind avatar Jul 15 '24 15:07 nalind

/lgtm

rhatdan avatar Jul 15 '24 15:07 rhatdan