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

Changing ENV via ARG does not break cache #5575

Open
mccare opened this issue Jun 7, 2024 · 1 comment
Open

Changing ENV via ARG does not break cache #5575

mccare opened this issue Jun 7, 2024 · 1 comment

Comments

@mccare
Copy link

mccare commented Jun 7, 2024

Description

Follow up to #5095.

Changing an ARG that is used in a later ENV statement will not break the cache. The issue was reported in #5095. The argument it was closed was that buildkit behaves the same way. In my testing buildkit has fixed or is not showing this behaviour any more.

Steps to reproduce the issue:

FROM busybox

ARG STAGE
ENV STAGE=$STAGE
podman build --build-arg STAGE=stage1 . -t envtest
podman build --build-arg STAGE=stage2 . -t envtest

both hashes are the same. When running the container after each command (podman run --rm -it envtest and then env) it will show the STAGE environment as being "stage1" and not change to stage2

When running with buildkit v0.12.3 (which is packaged in my Docker on Mac installation):

docker buildx build --build-arg STAGE=stage1 --load .
docker buildx build --build-arg STAGE=stage2 --load .

This will produce two different hashes and when running the containers in between they will have the correct STAGE environment variable value.

Describe the results you received:

STAGE environment variable does not change between the container builds.

Describe the results you expected:

STAGE environment variable

Output of podman version if reporting a podman build issue:

host:
  arch: arm64
  buildahVersion: 1.36.0-dev
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.10-1.fc40.aarch64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.10, commit: '
  cpuUtilization:
    idlePercent: 98.98
    systemPercent: 0.55
    userPercent: 0.47
  cpus: 5
Client:       Podman Engine
Version:      5.1.0
API Version:  5.1.0
Go Version:   go1.22.3
Git Commit:   4e9486dbc63c24bfe109066abbb54d5d8dc2489e
Built:        Wed May 29 20:52:05 2024
OS/Arch:      darwin/arm64

Server:       Podman Engine
Version:      5.1.0-dev-c9808e7ed
API Version:  5.1.0-dev-c9808e7ed
Go Version:   go1.22.2
Built:        Mon May 13 02:00:00 2024
OS/Arch:      linux/arm64
Copy link

github-actions bot commented Jul 8, 2024

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

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

No branches or pull requests

1 participant