Skip to content

COPY --exclude: make patterns context relative#6729

Open
Honny1 wants to merge 1 commit intocontainers:mainfrom
Honny1:copy--exclude
Open

COPY --exclude: make patterns context relative#6729
Honny1 wants to merge 1 commit intocontainers:mainfrom
Honny1:copy--exclude

Conversation

@Honny1
Copy link
Member

@Honny1 Honny1 commented Mar 13, 2026

Prepend each copy source to each exclude so source relative patterns match.

Note: I found that the conformance tests ignore cases where the Buildah image contains more items than the Docker image. This is problematic for exclusion.

Fixes: #6726

What type of PR is this?

/kind api-change

/kind bug

/kind cleanup
/kind deprecation
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake
/kind other

What this PR does / why we need it:

How to verify it

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

The `--exclude` flag: fix source relative pattern matching

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 13, 2026
Fixes: containers#6726

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
"COPY --exclude=storage/views app/ app/",
}, "\n"),
contextDir: "dockerignore/exclude_subdir_under_source",
fsSkip: []string{"(dir):app:mtime", "(dir):app:(dir):storage:mtime", "(dir):app:(dir):storage:(dir):cache:mtime"},

Choose a reason for hiding this comment

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

What does fsSkip mean? Is it possible to replace it with human readable ls -la like output?

Copy link
Member Author

Choose a reason for hiding this comment

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

It skips specific file attributes or files when comparing container images. The conformance tests evaluate the differences between image builders, such as Buildah and Docker, by comparing the images they generate. In this case, it ignores the file mtime because those images might have been built at different times.

Choose a reason for hiding this comment

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

Is there a reason to keep it array instead of multiline string? The array syntax is hard to read.

If fsSkip is for masking attributes and files, where is the place where comparison of unmasked content is being done?

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

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

COPY --exclude=subdir app/ app/ doesn't exclude app/subdir

2 participants