Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

ch-image modify: pretty print and validate parse tree #1908

Open
lucaudill opened this issue Jul 3, 2024 · 0 comments
Open

ch-image modify: pretty print and validate parse tree #1908

lucaudill opened this issue Jul 3, 2024 · 0 comments

Comments

@lucaudill
Copy link
Collaborator

PR #1408 adds ch-image modify to modify existing images interactively or non-interactively. In the non-interactive case, the program will create a parse tree under the hood analogous to those produced by parsing Dockerfiles during ch-image build. After parsing a Dockerfile, ch-image build will "pretty print" the resulting parse tree at the verbose level, e.g.

$ ch-image -v build -t foo -f - . << 'EOF'
> FROM almalinux:8
> RUN echo foo
> EOF
[...]
   1   1  start
   1   1    dockerfile
   1   1      from_
   1   6        image_ref
   1   6           IMAGE_REF almalinux:8
   2   1      run
   2   5        run_shell
   2   5           LINE_CHUNK echo foo
[...]
grown in 2 instructions: foo

The way we construct the parse tree under the hood is not amicable to pretty printing, which also means that we can't easily validate parse trees in the test suite. We should:

  1. Change how we construct ch-image modify parse trees so they can be pretty printed, and
  2. Use pretty printing to validate that one or more example trees are what we expect as part of the test suite

Note that I'm deferring this as a future issue so it doesn't further delay the PR.

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

No branches or pull requests

2 participants