Closed Conan-Kudo closed 3 years ago
/kind bug
Gah, nevermind, the issue is that I'm missing ARG
statements to map to this.
This is actually an issue, as it seems there is no way to propagate to buildah bud
any environment variables...
Have you tested this against the latest buildah or against the main branch, if this works there, then you shouldbe opening a RHEL bug and not reporting it here.
It's a problem on buildah 1.18 on Fedora 33 too, as well as buildah 1.19 in updates-testing.
I am no expert, but out tests are declaring the ARG then it works.
$ cat /tmp/Containerfile FROM ubi8 ARG PHP_VERSION RUN echo ${PHP_VERSION}
$ buildah bud --build-arg=PHP_VERSION=1.2.3 /tmp
STEP 1: FROM ubi8
STEP 2: ARG PHP_VERSION
STEP 3: RUN echo ${PHP_VERSION}
1.2.3
STEP 4: COMMIT
Getting image source signatures
Copying blob 92538e92de29 skipped: already exists
Copying blob eb7bf34352ca skipped: already exists
Copying blob 01382447cf32 done
Copying config f0359bec28 done
Writing manifest to image destination
Storing signatures
--> f0359bec28f
f0359bec28fdf7c0ddb783fa9ad2165acbf1c4d8f9e6063db66bfdf6acd58897
Without the ARG command, I see the same error as you.
Checking with Docker, it requires the ARG also.
docker build /tmp/d2
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM alpine
---> f70734b6a266
Step 2/2 : RUN echo ${PHP_VERSION}
---> Running in 81179e2da39f
Removing intermediate container 81179e2da39f
---> efedc04d43e1
Successfully built efedc04d43e1
sh-5.0# docker build /tmp/d2
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM alpine
---> f70734b6a266
Step 2/3 : ARG PHP_VERSION
---> Running in 300c0db284b3
Removing intermediate container 300c0db284b3
---> 4f7d43f045cd
Step 3/3 : RUN echo ${PHP_VERSION}
---> Running in 78d3d365a075
Removing intermediate container 78d3d365a075
---> feec4bd6fede
Successfully built feec4bd6fede
$ buildah version
Version: 1.19.4
Go Version: go1.15.7
Image Spec: 1.0.1-dev
Runtime Spec: 1.0.2-dev
CNI Spec: 0.4.0
libcni Version:
image Version: 5.10.1
Git Commit:
Built: Wed Dec 31 19:00:00 1969
OS/Arch: linux/amd64
This issue looks very similar what I observed with #2424 earlier
It probably is. It last worked in Buildah 1.11.6.
This works the same way as Docker does, if you don't specify the ARG to use, then the Environment variable is not expanded. If you show me this working on current docker, then reopen.
Description
When building a container with
buildah bud
with--build-arg
passed in, the args are not available as env vars for use inside of the container build.This did last work in buildah in either 1.11.x or 1.14.x, and seems to be broken as of buildah 1.15.
Steps to reproduce the issue:
buildah bud --build-arg PHP_VERSION=7.0 --build-arg OS_VERSION=16.04 -f Containerfile-sample
Containerfile-sample
has the following contents:Describe the results you received: The container builds with the second
RUN
statement completely skipped.Describe the results you expected: The container builds with the second
RUN
statement executed.Output of
rpm -q buildah
:Output of
buildah version
:*Output of `cat /etc/release`:**
Output of
uname -a
:Output of
cat /etc/containers/storage.conf
: