redhat-openshift-ecosystem / openshift-preflight

Operator and container preflight certification tests
Apache License 2.0
58 stars 65 forks source link

Non-rpm based image fails without clear error message #529

Closed tonyskapunk closed 2 years ago

tonyskapunk commented 2 years ago

Bug Description

(A clear and concise description of the issue) Using preflight check container with a non-rpm based image fails with a clear error message.

Version and Command Invocation

(The output of preflight --version) preflight version 1.1.0-beta5 <commit: 5feddaee9808781cd9ae760acd94f2545e8e70aa>

Steps to Reproduce:

(How can we reproduce this?) 1) Run preflight binary with an image non-rpm based

$ DOCKER_CONFIG=$PWD/repoconfig \
  PFLT_JUNIT=true \
  PFLT_ARTIFACTS=$PWD/artifacts \
  PFLT_LOGFILE=$PWD/artifacts/preflight.log \
  PFLT_LOGLEVEL=trace \
  ./preflight check container \
  quay.io/rh-nfv-int/cnf-app-mac-operator@sha256:043c6fae643e761b8f61800a7d9d93c377cfe663691986c3a94f4b22338df2f2 \
  --certification-project-id 61a64ad87a3f492d8b755778 \
  --pyxis-api-token <REDACTED> \
  --docker-config $PWD/repoconfig/config.json

Expected Result

(What did you expect to happen and why?)

If non-rpm based images are supported, then a more helpful message error would be nice

Actual Result

(What actually happened)

time="2022-03-29T13:34:10-05:00" level=debug msg="config file not found, proceeding without it"
time="2022-03-29T13:34:10-05:00" level=info msg="certification library version 1.1.0-beta5 <commit: 5feddaee9808781cd9ae760acd94f2545e8e70aa>"
time="2022-03-29T13:34:10-05:00" level=debug msg="URL is: https://catalog.redhat.com/api/containers/v1/projects/certification/id/61a64ad87a3f492d8b755778"
time="2022-03-29T13:34:10-05:00" level=debug msg="Certification project name is: Test Project: certify simple-demo-operator"
time="2022-03-29T13:34:10-05:00" level=debug msg="target image: quay.io/rh-nfv-int/cnf-app-mac-operator@sha256:043c6fae643e761b8f61800a7d9d93c377cfe663691986c3a94f4b22338df2f2"
time="2022-03-29T13:34:10-05:00" level=debug msg="pulling image from target registry"
time="2022-03-29T13:34:11-05:00" level=debug msg="temporary directory is /tmp/preflight-114050375"
time="2022-03-29T13:34:11-05:00" level=debug msg="exporting and flattening image"
time="2022-03-29T13:34:11-05:00" level=debug msg="extracting container filesystem to /tmp/preflight-114050375/fs"
time="2022-03-29T13:34:11-05:00" level=debug msg="writing container filesystem to output dir: /tmp/preflight-114050375/fs"
time="2022-03-29T13:34:13-05:00" level=trace msg="image config written to disk: /tmp/preflight_container_artifacts.2wq_98dc/cert-image.json"
Error: open /tmp/preflight-114050375/fs/var/lib/rpm/Packages: no such file or directory
time="2022-03-29T13:34:13-05:00" level=fatal msg="open /tmp/preflight-114050375/fs/var/lib/rpm/Packages: no such file or directory"

Additional Context

(Anything else you think might help us troubleshoot, like your platform, dependency versions, etc).

itroyano commented 2 years ago

Hi @tonyskapunk , can you try with beta6 ?

bcrochet commented 2 years ago

And as far as I know, non-rpm images are not supported anyway. Scratch images are an exception, but requires having OsContentType set to "scratch" in Pyxis. That is not settable directly.

tonyskapunk commented 2 years ago

Hi @itroyano I tried with beta6 and I see an improved message:

Error: unsupported image. only RHEL/UBI or scratch base images are supported

@bcrochet , thanks for that clarification as one could say that all images come from scratch :smile: , but your comment clarifies that.