redhat-buildpacks / testing

Project aiming to help us to perform e2e tests using Buildpacks
Apache License 2.0
0 stars 3 forks source link

STEP "COPY ./images.json /etc/buildpacks/images.json": checking on sources under "/var/tmp/ #62

Open cmoulliard opened 1 week ago

cmoulliard commented 1 week ago

Issue

The command to build the stack image fails for some flavors as: nodejs-20, nodejs-18, etc

jam create-stack "--config ./stack-nodejs-20/stack.toml --build-output ./stack-nodejs-20/build-nodejs-20/build.oci --run-output ./stack-nodejs-20/build-nodejs-20/run.oci"
Building io.buildpacks.stacks.ubi8
  Building on linux/amd64
    Building base images
Error: build failed:

building at STEP "COPY ./images.json /etc/buildpacks/images.json": checking on sources under "/var/tmp/libpod_builder2686246012/build": copier: stat: "/images.json": no such file or directory

This problem is due to the fact that the build is not able to get the images.json from the root parent folder

pacostas commented 1 week ago

Yes, it also fails on our CI, we are working on it https://github.com/paketo-community/ubi-base-stack/actions/runs/10720404763/job/29726625024. Thank you for opening an issue for easier tracking.

cmoulliard commented 1 week ago

Solution is to move to the parent directory and to change the build.dockerfile

[cloud-user@rhel-9 ubi-base-stack]$ cat stack/build.Dockerfile
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
USER root
WORKDIR /etc/buildpacks
COPY images.json images.json
RUN chmod 744 images.json

and 

[cloud-user@rhel-9 ubi-base-stack]$ podman build -f stack/build.Dockerfile .
STEP 1/5: FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
STEP 2/5: USER root
--> Using cache 929b0659d19047209291698e1e0dfebd2bad716bb6723f6d1a547c1fb6e48edc
--> 929b0659d190
STEP 3/5: WORKDIR /etc/buildpacks
--> Using cache a939d50670d2f45ba5e78aa7a47cd1586eaaf4dd90b56129a775c373eb29da8f
--> a939d50670d2
STEP 4/5: COPY images.json images.json
--> a7e21bf73202
STEP 5/5: RUN chmod 744 images.json
COMMIT
--> b414737c7082
b414737c70825f5549f79b2360c9910c1c894013913ebd1a0e845edd2e3df257

Unfortunately that will fail with Jam

[cloud-user@rhel-9 ubi-base-stack]$ jam create-stack --config ./stack/stack.toml --build-output ./stack/build/build.oci --run-output ./stack/build/run.oci
Building io.buildpacks.stacks.ubi8
  Building on linux/amd64
    Building base images
Error: build failed:

building at STEP "COPY images.json images.json": checking on sources under "/var/tmp/libpod_builder1201396470/build": copier: stat: "/images.json": no such file or directory

Usage:
  jam create-stack [flags]

Flags:
      --build-output string   path to output the build image OCI archive (required)
      --build-ref string      reference that specifies where to publish the build image (required)
      --config string         path to a stack descriptor file (required)
  -h, --help                  help for create-stack
      --label strings         additional image label to be added to build and run image
      --publish               publish to a registry
      --run-output string     path to output the run image OCI archive (required)
      --run-ref string        reference that specifies where to publish the run image (required)
      --secret strings        secret to be passed to your Dockerfile
      --unbuffered            do not buffer image contents into memory for fast access

failed to execute: build failed:

building at STEP "COPY images.json images.json": checking on sources under "/var/tmp/libpod_builder1201396470/build": copier: stat: "/images.json": no such file or directory

@pacostas

cmoulliard commented 1 week ago

Yes, it also fails on our CI, we are working on it https://github.com/paketo-community/ubi-base-stack/actions/runs/10720404763/job/29726625024. Thank you for opening an issue for easier tracking.

The bash script of the PR 's merged copy the images.json file within the target stack folder to be build

@pacostas

pacostas commented 4 days ago

@cmoulliard The PR has been merged, it should successfully create the .cnb files