redhat-actions / buildah-build

GitHub Action to use 'buildah' to build a container image.
https://github.com/marketplace/actions/buildah-build
MIT License
137 stars 35 forks source link

[QUESTION] When is buildah updated? #77

Closed lcarva closed 2 years ago

lcarva commented 2 years ago

Question

The current buildah version installed in the action image, 1.21.3, does not support using both digest and tag in an image reference in the Dockerfile:

/usr/bin/buildah version
  /usr/bin/buildah version
  Version:         1.21.3
  Go Version:      go1.15.2
  Image Spec:      1.0.1-dev
  Runtime Spec:    1.0.2-dev
  CNI Spec:        0.4.0
  libcni Version:  
  image Version:   5.12.0
  Git Commit:      
  Built:           Thu Jan  1 00:00:00 1970
  OS/Arch:         linux/amd64
Overriding storage mount_program with "fuse-overlayfs" in environment
Performing build from Containerfile
/usr/bin/buildah bud -f /home/runner/work/festoji/festoji/Dockerfile --format docker -t lucarval/festoji:latest /home/runner/work/festoji/festoji
STEP 1: FROM registry.redhat.io/rhel8/go-toolset:latest@sha256:db74be244cbf62081667253dbafeb0af75c3410982a45767d1dca6a3eb86f49b AS builder
STEP 2: FROM scratch
error creating build container: Invalid image name "registry.redhat.io/rhel8/go-toolset:latest@sha256:db74be244cbf62081667253dbafeb0af75c3410982a45767d1dca6a3eb86f49b", unknown transport "registry.redhat.io/rhel8/go-toolset"
time="2021-10-07T18:00:40Z" level=error msg="exit status 125"
Error: Error: buildah exited with code 125

I have 1.23.0 installed locally which seems to have this support:

$ buildah --version
buildah version 1.23.0 (image-spec 1.0.1-dev, runtime-spec 1.0.2-dev)

$ buildah bud -t test:latest .
[1/2] STEP 1/4: FROM registry.redhat.io/rhel8/go-toolset:latest@sha256:db74be244cbf62081667253dbafeb0af75c3410982a45767d1dca6a3eb86f49b AS builder
[1/2] STEP 2/4: WORKDIR /opt/app-root/src
[1/2] STEP 3/4: COPY . .
[1/2] STEP 4/4: RUN go build -o bin/festoji main.go
go: downloading gopkg.in/yaml.v2 v2.4.0
[2/2] STEP 1/3: FROM scratch
[2/2] STEP 2/3: COPY --from=builder /opt/app-root/src/bin/festoji /usr/bin/festoji
[2/2] STEP 3/3: CMD ["festoji"]
[2/2] COMMIT test:latest
Getting image source signatures
Copying blob d91142b714ec done  
Copying config 04f22b04d0 done  
Writing manifest to image destination
Storing signatures
--> 04f22b04d04
Successfully tagged localhost/test:latest
04f22b04d04a502bec314ea611fc141b6fe19b3f2789722a840296aab3913e41

I think simply updating the buildah version used in the action image should do the trick because 1.23.0 is already released in opensuse: https://software.opensuse.org/package/buildah

tetchel commented 2 years ago

This action is a JavaScript action, not a Docker action, and so does not have an image tied to it. It uses whatever image you specify in the job's runs-on. Usually, this is a GitHub runner, eg ubuntu-20.04.

According to https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md buildah is v1.12.3 as you've identified.

So there are 3 approaches

1) Update buildah at the start of your workflow. You can refer to our test script that does this and workflows that use this script. 2) Open an issue in https://github.com/actions/virtual-environments/issues to update buildah and they will usually turn it around in about two weeks. 3) Use your own self-hosted runner with updated buildah and update runs-on accordingly. The OpenShift buildah runner would be a useful example if you go this route.

lcarva commented 2 years ago

@tetchel, thanks for the thorough explanation.

Because the version I'm looking for is not yet in Ubuntu, nor in Kubic, the only option I have is to build it from source which has not been straight forward.

I'll just wait until the newer version lands in Kubic or Ubuntu instead.