Snapcraft Docker Image Update Broke Python Plugin

I build many of my snaps on CircleCI using the cibuilds/snapcraft Docker image which is based on the official snapcore/snapcraft:stable. The Linode CLI snap suddenly started failing to build with this error:

Failed to fetch stage packages: Error downloading packages for part ‘linode-cli’: The package ‘python3-distutils’ was not found…

I tracked the issue down to two changes/PRs to the Snapcraft Docker image #2588 and #2591. Using an older version of the image worked for me.

Bug?

Is this a bug in the image? Or does my Docker image and/or snapcraft.yaml need a permanent change.

The repo (where the snapcraft.yaml is located) is linked above, but here’s a small snippet of it, specially the part where the Python plugin is used:

parts:
  linode-cli:
    plugin: python
    source: https://github.com/linode/linode-cli
    source-type: git
    source-tag: "2.5.0"
    python-packages:
      - linode-cli

I’ve tried adding:

  • python-distutils
  • python3-distutils
  • python-distutils-extra

as build-packages and/or stage-packages in snapcraft.yaml to no avail.

Any ideas?

Are you running apt update before calling snapcraft?

Yes I am. https://github.com/felicianotech/linode-cli-snap/blob/master/.circleci/config.yml#L24

The old docker images happened to casually work with bases but did not really support them, I see in your snapcraft.yaml that you are using bases though, and the entry is core18, so to build that with docker you would need to use FROM ubuntu-18.04, but you probably want new docker images as the ones from snapcore/snapcraft on Docker Hub are meant to be used with no base or only core set as a base.

Hmm okay. So it looks like I should transition my Docker images cibuilds/snapcraft so that I build them from scratch, and perhaps a tag for Ubuntu 16.04, and one for 18.04, which correspond with the current base snaps.

Is the official one still a good image to use an example to build mine? At least for 16.04?

Yes it is, this goes over building with docker https://docs.snapcraft.io/build-on-docker and this is linked from there Creating docker images for snapcraft which goes over image creation.

I know it’s been months but I just wanted to provide an update here for anyone reading this in the future.

I was able to find a way to update my images (pretty much an entire rebuild) so that people can use these Docker images to build snaps on CircleCI and other CI providers with ease. As a reminder, my source repo is here.

Instead of relying on the official Snapcraft Dockers, I’m doing a different setup now and have an image tag for each base (core16 and core18) with core being an alias to core16. This will allow snaps using one of these two bases to be built as well as classic snaps that build on Ubuntu 16.04 or 18.04.

I learned a lot on how to get this working from @kyrofa’s repository.

Thank you to everyone in the thread for helping.

2 Likes