hpc / charliecloud

Now hosted on GitLab.
https://gitlab.com/charliecloud/main
Apache License 2.0
313 stars 61 forks source link

`ch-image --break`: better error when piping Dockerfile #1862

Closed lucaudill closed 6 months ago

lucaudill commented 6 months ago

When using the --break option for ch-image, you can't pipe in a Dockerfile. Currently, if you try you get a message like this:

$ ch-image --break build:342 build -t foo -f - . << 'EOF'
FROM alpine:3.17
RUN echo "foo"
EOF
warning: --break: injecting PDB breakpoint: build:342 (Assign)
> /home/lucas/charliecloud/lib/build.py <re-compiled>(342)parse_n_traverse()
-> tree = parser.parse(text)
(Pdb) 
Traceback (most recent call last):
  File "/home/lucas/charliecloud/bin/ch-image", line 438, in <module>
    main()
  File "/home/lucas/charliecloud/bin/ch-image", line 340, in main
    cli.func(cli)
  File "/home/lucas/charliecloud/bin/../lib/build.py <re-compiled>", line 219, in main
  File "/home/lucas/charliecloud/bin/../lib/build.py <re-compiled>", line 342, in parse_n_traverse
  File "/home/lucas/charliecloud/bin/../lib/build.py <re-compiled>", line 342, in parse_n_traverse
  File "/usr/lib/python3.10/bdb.py", line 90, in trace_dispatch
    return self.dispatch_line(frame)
  File "/usr/lib/python3.10/bdb.py", line 115, in dispatch_line
    if self.quitting: raise BdbQuit
bdb.BdbQuit

This message is pretty opaque. We should add a more informative error.