buildah icon indicating copy to clipboard operation
buildah copied to clipboard

WIP: commit: optionally create layers for ADD/COPY/RUN/WORKDIR

Open nalind opened this issue 5 years ago • 21 comments
trafficstars

What type of PR is this?

/kind bug

What this PR does / why we need it:

In multi-layer mode, only add layers when ADD, COPY, RUN, or WORKDIR make changes to the container's rootfs.

How to verify it

Building an image using --layers=true and a Dockerfile containing

FROM fedora
WORKDIR /testdir

should produce an image with two layers, rather than just the base image's single layer.

Conformance tests have been extended to compare how many layers we generate in comparison to docker build, though it makes exceptions for items we create as targets for bind mounts when handling RUN instructions.

Which issue(s) this PR fixes:

Fixes #2402

Special notes for your reviewer:

The workdir-in-image-owner and workdir-not-in-image conformance tests should exercise this.

Does this PR introduce a user-facing change?

Instead of always creating new layers for ADD, COPY, and RUN instructions, `buildah build-using-dockerfile --layers` will now avoid adding new layers when those instructions make no changes to the filesystem.

nalind avatar Aug 13 '20 17:08 nalind

What happens if I have

FROM fedora
WORKDIR /home/dwalsh
MAINTAINER dan walsh

rhatdan avatar Aug 13 '20 17:08 rhatdan

That doesn't work right. Moving this to a draft PR.

nalind avatar Aug 13 '20 18:08 nalind

@nalind: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

openshift-ci-robot avatar Aug 23 '20 17:08 openshift-ci-robot

@nalind: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

openshift-ci-robot avatar Aug 30 '20 23:08 openshift-ci-robot

@nalind Any movement on this one? Needs a rebase.

rhatdan avatar Sep 16 '20 02:09 rhatdan

@nalind Maybe we should just get this merged since it closes one of the cases. Then we can continue to work on the corner cases.

rhatdan avatar Oct 07 '20 23:10 rhatdan

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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:

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

openshift-ci-robot avatar Nov 06 '20 21:11 openshift-ci-robot

/retitle commit: optionally create layers for ADD/COPY/RUN/WORKDIR

nalind avatar Nov 06 '20 21:11 nalind

I expect conformance tests to fail on overlay because resetting the contents of a directory causes us to mark it as opaque until #2756 changes how we do things for those cases.

nalind avatar Nov 06 '20 22:11 nalind

A friendly reminder that this PR had no activity for 30 days.

github-actions[bot] avatar Feb 18 '21 00:02 github-actions[bot]

@nalind Is this still being worked on or can we close it?

rhatdan avatar Feb 18 '21 11:02 rhatdan

We still need this.

nalind avatar Feb 22 '21 15:02 nalind

@nalind can you rebase and repush?

rhatdan avatar Feb 22 '21 20:02 rhatdan

A friendly reminder that this PR had no activity for 30 days.

github-actions[bot] avatar Mar 25 '21 00:03 github-actions[bot]

@nalind rebase and repush.

rhatdan avatar Mar 25 '21 10:03 rhatdan

@nalind: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

openshift-ci[bot] avatar Aug 18 '21 13:08 openshift-ci[bot]

@nalind this oldy-but-goody PR needs a rebase.

rhatdan avatar Aug 19 '21 09:08 rhatdan

A friendly reminder that this PR had no activity for 30 days.

github-actions[bot] avatar Sep 19 '21 00:09 github-actions[bot]

@nalind what is going on with this PR?

rhatdan avatar Sep 20 '21 14:09 rhatdan

A simple rebase isn't going to be enough here - it didn't pass all of the tests before it needed that. Re-adding the WIP label.

nalind avatar Sep 20 '21 14:09 nalind

A friendly reminder that this PR had no activity for 30 days.

github-actions[bot] avatar Oct 21 '21 00:10 github-actions[bot]