copier-org / copier

Library and command-line utility for rendering projects templates.
https://readthedocs.org/projects/copier/
MIT License
1.97k stars 176 forks source link

Error when running `poe lint` with Podman #1661

Open sisp opened 3 months ago

sisp commented 3 months ago

Describe the problem

When I run poe lint with Podman, I'm getting an error. Has anybody had this problem before?

Template

n/a

To Reproduce

poetry run poe lint

Logs

Poe => lint
Nix not found; fallback to a container
Trying to pull docker.io/nixos/nix:latest...
Getting image source signatures
Copying blob sha256:aab801e044ff3dc60056435ddad765c9c56955b2b2555c2f5b80077c540563b0
...
Copying config sha256:1e2dfe3a781d08b04fea1b00ffc96dec3881b025bf29c20cc878282e6803f69a
Writing manifest to image destination
Storing signatures
2d87cd6286ddf20d6fd7984e73bc8fee0c7d296948c193a932001d7e4fd7a677
copying path '/nix/store/p58d2j0ac7zvja5jl14xzbc19fakjxh2-source' from 'https://devenv.cachix.org'...
copying path '/nix/store/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source' from 'https://devenv.cachix.org'...
copying path '/nix/store/y9m0i9f9nk27kgiwwm0nnc72bzr1p55j-source' from 'https://devenv.cachix.org'...
copying path '/nix/store/hpmnfdwvrsdwmn9pswv0znswbb38wpvj-source' from 'https://cache.nixos.org'...
copying path '/nix/store/rlj4q2p1lax5zsvmmqzk6829c1l85r0a-source' from 'https://devenv.cachix.org'...
copying path '/nix/store/sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source' from 'https://copier.cachix.org'...
error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:9:12:
            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|

       … while evaluating derivation 'devenv-shell'
         whose name attribute is located at /nix/store/y9m0i9f9nk27kgiwwm0nnc72bzr1p55j-source/src/modules/mkNakedShell.nix:63:13

       … while evaluating attribute 'shellHook' of derivation 'devenv-shell'
         at /nix/store/y9m0i9f9nk27kgiwwm0nnc72bzr1p55j-source/src/modules/mkNakedShell.nix:78:5:
           77|     # requires that other trampoline.
           78|     shellHook = ''
             |     ^
           79|       ${lib.optionalString debug "set -x"}

       … while evaluating definitions from `/nix/store/y9m0i9f9nk27kgiwwm0nnc72bzr1p55j-source/src/modules/top-level.nix':

       … while evaluating definitions from `/nix/store/y9m0i9f9nk27kgiwwm0nnc72bzr1p55j-source/src/modules/top-level.nix':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: devenv was not able to determine the current directory.
       Make sure Nix runs with the `--impure` flag.

       See https://devenv.sh/guides/using-with-flakes/
Traceback (most recent call last):
  File ".../copier/devtasks.py", line 61, in lint
    local["nix"].with_cwd(HERE)[args] & TEE
    ~~~~~^^^^^^^
  File ".../copier/.venv/lib/python3.12/site-packages/plumbum/machines/local.py", line 242, in __getitem__
    return LocalCommand(self.which(cmd))
                        ^^^^^^^^^^^^^^^
  File ".../copier/.venv/lib/python3.12/site-packages/plumbum/machines/local.py", line 203, in which
    raise CommandNotFound(progname, list(cls.env.path))
plumbum.commands.processes.CommandNotFound: (CommandNotFound(...), 'nix', [<LocalPath .../copier/.venv/bin>, <LocalPath $HOME/.pyenv/shims>, <LocalPath $HOME/.pyenv/bin>, <LocalPath $HOME/.local/pipx/bin>, <LocalPath $HOME/.local/bin>, <LocalPath $HOME/.local/bin>, <LocalPath /usr/local/sbin>, <LocalPath /usr/local/bin>, <LocalPath /usr/sbin>, <LocalPath /usr/bin>, <LocalPath /sbin>, <LocalPath /bin>, <LocalPath /usr/games>, <LocalPath /usr/local/games>, <LocalPath /snap/bin>, <LocalPath /snap/bin>, <LocalPath /opt/puppetlabs/bin>])

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File ".../copier/devtasks.py", line 84, in lint
    runner["container", "start", "--attach", "copier-lint-v1"] & TEE
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
  File ".../copier/.venv/lib/python3.12/site-packages/plumbum/commands/modifiers.py", line 178, in __rand__
    with cmd.bgrun(
  File "$HOME/.pyenv/versions/3.12.2/lib/python3.12/contextlib.py", line 144, in __exit__
    next(self.gen)
  File ".../copier/.venv/lib/python3.12/site-packages/plumbum/commands/base.py", line 224, in bgrun
    runner()
  File ".../copier/.venv/lib/python3.12/site-packages/plumbum/commands/base.py", line 215, in runner
    return run_proc(p, retcode, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../copier/.venv/lib/python3.12/site-packages/plumbum/commands/processes.py", line 328, in run_proc
    return _check_process(proc, retcode, timeout, stdout, stderr)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../copier/.venv/lib/python3.12/site-packages/plumbum/commands/processes.py", line 17, in _check_process
    proc.verify(retcode, timeout, stdout, stderr)
  File ".../copier/.venv/lib/python3.12/site-packages/plumbum/machines/base.py", line 27, in verify
    raise ProcessExecutionError(
plumbum.commands.processes.ProcessExecutionError: Unexpected exit code: 1
Command line: | /usr/bin/podman container start --attach copier-lint-v1

Expected behavior

This should work.

Screenshots/screencasts/logs

No response

Operating system

Linux

Operating system distribution and version

Ubuntu 22.04

Copier version

9.2.0

Python version

CPython 3.12

Installation method

pipx+pypi

Additional context

Copier and Python versions are irrelevant.

$ podman --version
podman version 3.4.4
yajo commented 3 months ago

Weird, the flag's there: https://github.com/copier-org/copier/blob/d94fa6c7124ba30fbac74f3766c6de781039dfd0/devtasks.py#L25

I'll have to investigate.

As a workaround, you can let the CI do the formatting