Dump plugin not working for me

I’m having issues with the dump plugin. I’ve created a minimal example here. When I build and install that with Snapcraft 4.3 on Ubuntu 20.04, say_hello.sh is nowhere to be found in /snap/dump-snap/current. I’ve tried various combinations of stage and organize to no avail.

Hello,

You are missing some parts in your snapcraft.yml file. In order to make it work you could do:

name: dump-snap
version: git
summary: A test of the dump plugin
description: A test of the dump plugin
confinement: strict
grade: devel
base: core18

apps:
  dump-snap:
    command: bin/say_hello.sh

parts:
  files:
    plugin: dump
    source: files
    organize:
      '*': bin/

Then after installing it, you can run ‘snap run dump-snap’ and you will get a ‘Hello’ message in your terminal. The script can be found at ‘/snap/dump-snap/current/bin’.

Regards

Your snapcraft.yaml fails to build.

Failed to generate snap metadata: Specified command 'bin/say_hello.sh' was not found.
Verify the command is correct and for a more deterministic outcome, specify the relative path to the command from the prime directory.

Why did you expect say_hello.sh wouldn’t make it into my snap in my original example? Is it because there is no app? Is it because I wasn’t organizing it into bin?

Hi @wmww I just snapped your repo and everything seems in order? There is a missing file, but the command works fine:

 snap run dump-snap                         
cat: /snap/dump-snap/x1/hello.txt: No such file or directory

Remember, for debugging this things like snapcraft try are really helpful, you can introspect the file tree:

 snapcraft try
...
You can now run `snap try /home/michal/dump-plugin-snap/prime`.
 tree prime
prime
├── bin
│   └── say_hello.sh
├── meta
│   └── snap.yaml
└── snap
    └── command-chain
        └── snapcraft-runner

4 directories, 3 files

You can then either snap try directly:

 snap try prime
dump-snap 0+git.4e7212a mounted from /home/michal/dump-plugin-snap/prime

Or pack the snap up and install:

 snapcraft pack prime 
Snapping |                                                                                                                                                                                                                                                  
Snapped dump-snap_0+git.4e7212a_amd64.snap
 snap install --dangerous dump-snap_0+git.4e7212a_amd64.snap 
dump-snap 0+git.4e7212a installed

I tried from my Arch Linux box and it built. Back on Ubuntu 20.04 I cleaned, deleted the repo, recloned and I’m still getting Failed to generate snap metadata: Specified command 'bin/say_hello.sh' was not found. I’ve tried both the stable (4.3) and beta (4.4) versions of snapcraft without luck. Hmmm…

EDIT: /root/parts/files/src/ in the VM is empty, so the files aren’t even making it in for some reason.

snapcraft pull --shell-after would put you in the build environment after the pull steps were done. You can inspect what’s happening there.

find / -name say_hello.sh still turns up nothing.

I’m increasingly feeling like I’m doing something very stupid but I have no idea what it might be.

EDIT: it seems to be a multipass issue: https://github.com/canonical/multipass/issues/1825. Works when using LXD.