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

[Containerfile] HEREDOC with RUN instruction does not invalidate cache (again) #24089

Closed
aeris opened this issue Sep 27, 2024 · 1 comment
Closed
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@aeris
Copy link

aeris commented Sep 27, 2024

Issue Description

Hi

I face what seems #21498 again
Presence of ARG generate the same cache trouble. Removing the ARG and cache works correctly again

Steps to reproduce the issue

$ cat Dockerfile-test
FROM debian:stable-slim

ARG FOO=foo

RUN <<EOF
    echo 1
    echo 2
EOF

$ podman build -t test -f ./Dockerfile-test
STEP 1/3: FROM debian:stable-slim
STEP 2/3: ARG FOO=foo
--> 9a457417c6d9
STEP 3/3: RUN <<EOF (echo 1...)
1
2
COMMIT test
--> 0ae95c4816bb
Successfully tagged localhost/test:latest
0ae95c4816bbbf0fdaa004263af82e5db78b1cc12b037183ed449063dd22e958

$ cat Dockerfile-test
FROM debian:stable-slim

ARG FOO=foo

RUN <<EOF
    echo 1
    echo 2
    echo 3
EOF

$ podman build -t test -f ./Dockerfile-test
STEP 1/3: FROM debian:stable-slim
STEP 2/3: ARG FOO=foo
--> Using cache 9a457417c6d98d3e9ed186939d7d74c7f1688df75ea5297d4e6bac8926cfedaf
--> 9a457417c6d9
STEP 3/3: RUN <<EOF (echo 1...)
--> Using cache 0ae95c4816bbbf0fdaa004263af82e5db78b1cc12b037183ed449063dd22e958
COMMIT test
--> 0ae95c4816bb
Successfully tagged localhost/test:latest
0ae95c4816bbbf0fdaa004263af82e5db78b1cc12b037183ed449063dd22e958

Step 3/3 not supposed to be cached (echo 3 added)

All good if no previous ARG

$ cat Dockerfile-test
FROM debian:stable-slim

RUN <<EOF
    echo 1
    echo 2
EOF

$ podman build -t test -f ./Dockerfile-test
STEP 1/2: FROM debian:stable-slim
STEP 2/2: RUN <<EOF (echo 1...)
1
2
COMMIT test
--> 53d763001f5c
Successfully tagged localhost/test:latest
53d763001f5c3a4eabc253431e721a03b6195e11d1c8609d8444361130e53fec

$ cat Dockerfile-test
FROM debian:stable-slim

RUN <<EOF
    echo 1
    echo 2
    echo 3
EOF

$ podman build -t test -f ./Dockerfile-test
STEP 1/2: FROM debian:stable-slim
STEP 2/2: RUN <<EOF (echo 1...)
1
2
3
COMMIT test
--> 2b0784a7cb98
Successfully tagged localhost/test:latest
2b0784a7cb987982671e63e5068a86caa28ad926583d88201de1ad6fe5a81a3f

Step 2/2 correctly invalidate the cache

Describe the results you received

Cache is reused even if build content changed

Describe the results you expected

Cache is not reused

podman info output

host:
  arch: amd64
  buildahVersion: 1.37.3
  cgroupControllers:
  - cpu
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-1:2.1.12-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.12, commit: e8896631295ccb0bfdda4284f1751be19b483264'
  cpuUtilization:
    idlePercent: 92.09
    systemPercent: 1.78
    userPercent: 6.13
  cpus: 16
  databaseBackend: sqlite
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  freeLocks: 2046
  hostname: endor
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 6.10.10-zen1-1-zen
  linkmode: dynamic
  logDriver: journald
  memFree: 5232254976
  memTotal: 33573261312
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.12.2-1
      path: /usr/lib/podman/aardvark-dns
      version: aardvark-dns 1.12.2
    package: netavark-1.12.2-1
    path: /usr/lib/podman/netavark
    version: netavark 1.12.2
  ociRuntime:
    name: runc
    package: runc-1.1.14-1
    path: /usr/bin/runc
    version: |-
      runc version 1.1.14
      spec: 1.0.2-dev
      go: go1.23.0
      libseccomp: 2.5.5
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-2024_09_06.6b38f07-1
    version: |
      pasta 2024_09_06.6b38f07
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  rootlessNetworkCmd: pasta
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 34359734272
  swapTotal: 34359734272
  uptime: 3h 1m 41.00s (Approximately 0.12 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries: {}
store:
  configFile: /home/aeris/.config/containers/storage.conf
  containerStore:
    number: 2
    paused: 0
    running: 0
    stopped: 2
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/aeris/.local/share/containers/storage
  graphRootAllocated: 948476182528
  graphRootUsed: 801010872320
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 95
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/aeris/.local/share/containers/storage/volumes
version:
  APIVersion: 5.2.3
  Built: 1727438370
  BuiltTime: Fri Sep 27 13:59:30 2024
  GitCommit: c5366a308e89edd9636b66faf79bd5cb18ed0905
  GoVersion: go1.23.1
  Os: linux
  OsArch: linux/amd64
  Version: 5.2.3

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

Arch Linux

Additional information

No response

@aeris aeris added the kind/bug Categorizes issue or PR as related to a bug. label Sep 27, 2024
@Luap99
Copy link
Member

Luap99 commented Sep 27, 2024

This looks like a duplicate of containers/buildah#5656

@Luap99 Luap99 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants