Can't run `snapcraft snap` on latest docker images


#1

We’re now seeing the following in our builds from today when running snapcraft snap, preventing us from releasing a nightly VS Code Insider version:

/snap/bin/snapcraft: 3: exec: /usr/bin/python3: not found

If I run apt install -y python3 before that, I get instead:

/usr/bin/python3: can't open file '/bin/snapcraft': [Errno 2] No such file or directory

The latest known good image is snapcore/snapcraft@sha256:47154fa64fcdd733d78edba77f2c8d3c79a84efaaf6e1ef33264ed907a523c18.

I believe this could be related to the following commit: https://github.com/snapcore/snapcraft/commit/b292b64d74b643e2ddb3c1ac3f6d6a0bb9baffee#commitcomment-33922878


#2

Nevermind. This happens because we’re running our whole build not as root, and for some reason we had to use sudo when calling snapcraft (don’t remember why). This fails to propagate the env. sudo -E should do the trick here.