'override-pull' for plugin 'nil' is not working

Hi, I’m trying to add a PPA but the override-pull part is not working.

I had,

  ppa:
    plugin: nil
    override-pull: |
      apt install -y software-properties-common apt-utils
      apt-add-repository -yu ppa:clementlefebvre/grpc
      apt install python3-grpcio python3-grpc-tools python3-protobuf

This did nothing. Then I changed to,

  ppa:
    plugin: nil
    build-packages:
    - software-properties-common
    - apt-utils
    override-pull: |
      apt-add-repository -yu ppa:clementlefebvre/grpc
      apt install python3-grpcio python3-grpc-tools python3-protobuf

This way, software-properties-common and apt-utils are installed but again the override-pull part is not working. The ppa is not added. There were examples using ‘prepare’ instead of ‘override-pull’ but that did not work. I get error,

Additional properties are not allowed (‘prepare’ was unexpected)

All the examples I have seen use either ‘prepare’ or ‘override-pull’. How can I add a ppa to snapcraft.yaml?

There’s actually some experimental Snapcraft functionality for this exact use case, you can see it under the Package Management section here.

You still need to pass --enable-experimental-package-repositories for Snapcraft for now, but hopefully this will soon be marked as stable functionality. Regardless, having used it, it works fine for me personally.

You can add a set -x to see if the output is getting run.

Whatever part(s) need the PPA, be sure to add after: [ppa] to ensure ordering. This option will not work with build-packages. package-repositories is the ideal route once it lands in the near future.

Thanks a lot @James-Carroll, @cjp256. The new (experimental) feature of package-repositories fixed the problem with adding PPA.