Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COPY + heredoc errors with whitelist-style ignore files #5391

Closed
blue42u opened this issue Mar 8, 2024 · 3 comments · Fixed by #5459
Closed

COPY + heredoc errors with whitelist-style ignore files #5391

blue42u opened this issue Mar 8, 2024 · 3 comments · Fixed by #5459

Comments

@blue42u
Copy link

blue42u commented Mar 8, 2024

Description

When the .dockerignore/.containerignore file for a build context contains a generic * glob pattern, COPY commands using here-docs generally fail.

Steps to reproduce the issue:

# Containerfile
FROM docker.io/alpine:latest
COPY <<EOF /data.txt
This is a file
EOF
RUN cat /data.txt
# .containerignore
*

Once the above files are created, run:

$ buildah build

Describe the results you received:

The COPY errors, e.g. in a quay.io/buildah/upstream:latest container:

STEP 2/3: COPY <<EOF /data.txt (This is a file)
Error: building at STEP "COPY <<EOF /data.txt": no items matching glob "/var/tmp/EOF" copied (1 filtered out using /tmp/x/.containerignore): no such file or directory

Describe the results you expected:

STEP 2/3: COPY <<EOF /data.txt (This is a file)
STEP 3/3: RUN cat /data.txt
This is a file
COMMIT

Output of rpm -q buildah or apt list buildah:

buildah-1.35.0-1.20240307170310605526.main.4.g5599d34fa.fc39.x86_64

Output of buildah version:

Version:         1.36.0-dev
Go Version:      go1.21.7
Image Spec:      1.1.0
Runtime Spec:    1.1.0
CNI Spec:        1.0.0
libcni Version:  
image Version:   5.30.0
Git Commit:      
Built:           Thu Mar  7 17:07:24 2024
OS/Arch:         linux/amd64
BuildPlatform:   linux/amd64

Output of cat /etc/*release:

Fedora release 39 (Thirty Nine)
NAME="Fedora Linux"
VERSION="39 (Container Image)"
ID=fedora
VERSION_ID=39
VERSION_CODENAME=""
PLATFORM_ID="platform:f39"
PRETTY_NAME="Fedora Linux 39 (Container Image)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:39"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f39/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=39
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=39
SUPPORT_END=2024-11-12
VARIANT="Container Image"
VARIANT_ID=container
Fedora release 39 (Thirty Nine)
Fedora release 39 (Thirty Nine)

Output of uname -a:

Linux 4f70653ec02d 6.7.7-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.7.7-1 (2024-03-02) x86_64 GNU/Linux

Output of cat /etc/containers/storage.conf:

# Comments and default options trimmed for brevity
[storage]
driver = "overlay"
runroot = "/run/containers/storage"
graphroot = "/var/lib/containers/storage"

[storage.options]
additionalimagestores = [
"/var/lib/shared",
]
pull_options = {enable_partial_images = "true", use_hard_links = "false", ostree_repos=""}

[storage.options.overlay]
mount_program = "/usr/bin/fuse-overlayfs"
mountopt = "nodev,fsync=0"

[storage.options.thinpool]
@TomSweeneyRedHat
Copy link
Member

@flouthoc if you get a moment

@flouthoc
Copy link
Collaborator

I'll check this thanks

flouthoc added a commit to flouthoc/buildah that referenced this issue Apr 3, 2024
If we are copying heredoc files, we need to temporary place
them in the context dir and then move to container via copier
there are cases where .containerignore can have a patterns like
which can match our heredoc files so let's not set any excludes
or IgnoreFile for this copy.

Closes: containers#5391

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
@flouthoc
Copy link
Collaborator

flouthoc commented Apr 3, 2024

Thanks PR #5459 should close this.

flouthoc added a commit to flouthoc/buildah that referenced this issue Apr 5, 2024
If we are copying heredoc files, we need to temporary place
them in the context dir and then move to container via copier
there are cases where .containerignore can have a patterns like
which can match our heredoc files so let's not set any excludes
or IgnoreFile for this copy.

Closes: containers#5391

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators Jul 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants