Call for testing: snapcraft 2.42

Version 2.42 of the snapcraft CLI is now available for testing in these forms:

As a snap

The snap is available in the candidate channel:

$ sudo snap install --candidate --classic snapcraft

Of, if you already have it installed:

$ sudo snap refresh --candidate snapcraft

As a deb

The deb is in the proposed pocket of xenial, artful, and bionic, tracked by the SRU bug LP: #1767016. More information on testing the SRU is available at https://wiki.ubuntu.com/Testing/EnableProposed.

Docker

All risk levels of the snap are available as tagged Docker images, so check out the candidate tag:

$ docker pull snapcore/snapcraft:candidate

Release notes

Core

multipass cleanbuild support

If you are a user of snapcraft cleanbuild and have multipass installed (snap install multipass --beta at the time of this writing) then you might be interested in trying out this new feature, currently triggered by a
feature flag. Try it out by running:

$ SNAPCRAFT_BUILD_ENVIRONMENT=multipass snapcraft cleanbuild

sunset remote persistent containers

The feature, hidden behind a feature flag of enabling a remote lxd instance to drive the build with local
mounts in place has been removed as a feature due to complexities and trimming of scope towards a
unified, working and sustainable interface. Given this was a feature flag and never left its experimental
stages, removing it was the right thing to do to remove any expectation that this will be driven further or
have user go through a bad experience when using it.

This does not affect using local persistent LXD containers, nor does it affect remote cleanbuilds.

Error reporting

When enabling the snapcraft CLI’s use of Sentry by means of setting the feature flag to SNAPCRAFT_ENABLE_SENTRY=on (perhaps in your ~/.bashrc) you will now have the option to
always send the traceback instead of being prompted.

architectures keyword

Previous releases of the snapcraft CLI supported an architectures keyword that one could use to specify the architectures on which the snap runs. However, for multiple reasons this proved to be a confusing feature that few could use successfully, so this release sees it reworked to better match user expectations. The architectures keyword has been restructured into a list of more explicit objects, specifying both build and run architecture(s):

architectures:
  - build-on: [<build arch 1>, <build arch 2>]
    run-on: [<run arch 1>, <run arch 2>]

If snapcraft is building on an architecture in build-on, it will use the corresponding run-on in the final snap, stating that it runs on those architectures. Please read the documentation for more details.

Plugins

dotnet

When using override-build, the dotnet plugin can now be used to override the plugin logic.

You can find the full list of changes over on the release notes

We would appreciate anyone trying out their common workloads with this release, and maybe some new ones as well!

3 Likes

Where is the best spot to read up on the multipass feature? Is this in the docs?

Put simply.

Install multipass.

snap install multipass --beta --classic

Launch snapcraft using multipass as a container

SNAPCRAFT_BUILD_ENVIRONMENT=multipass snapcraft cleanbuild

That will launch snapcraft which will stand up a multipass VM and do the build inside it. (the other option being SNAPCRAFT_BUILD_ENVIRONMENT=lxd.

With the mulitpass build (cleanbuild) - is the environment per build like it was with LXD? Or is it persistent?

Sorry if these are dumb questions… this is why I asked about docs so that I could get up to speed on the nuances.

Thanks, @popey!

It’s cleanbuild, so it throws away the VM after the build is finished.

So is ‘export SNAPCRAFT_CONTAINER_BUILDS=1’ still being supported?

I’m using this to speed builds up.

Without it my builds take about 1 hour.
With it I can cycle through code changes in my main app in under 5 minutes.

eliminating SNAPCRAFT_CONTAINER_BUILDS would be a major blow to productivity.

$ snapcraft clearbuild
...
Installing /run/core_4486.snap
error: cannot perform the following tasks:
- Mount snap "core" (4486) ([start snap-core-4486.mount] failed with exit status 1: Job for snap-core-4486.mount failed. See "systemctl status snap-core-4486.mount" and "journalctl -xe" for details.
)
Stopping local:snapcraft-nonfacetiously-nondefinitive-mana
The following command failed to run: 'snap install /run/core_4486.snap' exited with 1
$  systemctl status snap-core-4486.mount     
Unit snap-core-4486.mount could not be found.

On Fedora building python snaps fails

$ snapcraft          
Unable to determine host OS version codename

Apparently, Fedora doesn’t provide codenames.

Therefore every file that calls it crashes with OsReleaseCodenameError.

No, not for local builds, we are only removing support for it for things that are using lxd remotes not on the same host snapcraft is on. Setting the environment variable you mention to a truthy value should continue working. Just the confusion alone on what we are removing tells me we are doing the right thing :slight_smile:

You might want to try the multipass support as mentioned in the call for testing text. That should work on Fedora as multipass is delivered as a snap.

Looks like my system upgraded to snapcraft 2.4.2 overnight I’m now getting:

++ export SNAPCRAFT_CONTAINER_BUILDS=1
++ SNAPCRAFT_CONTAINER_BUILDS=1
++ sudo service mysql stop
++ sudo snap stop auditor
Stopped.
++ snapcraft clean auditor-webapp
The flag SNAPCRAFT_CONTAINER_BUILDS has been deprecated. Use SNAPCRAFT_BUILD_ENVIRONMENT=lxd instead.

This appears to go against your statement that it will keep working?
Have I mis-understood?

The functionality will stay, the declaration of intent is changing. So there are two things:

  • declaration of intent for local containers -> SNAPCRAFT_BUILD_ENVIRONMENT=lxd should replace SNAPRAFT_CONTAINER_BUILDS=<truthy-value>
  • Use of SNAPRAFT_CONTAINER_BUILDS=<remote> where <remote> is not a local LXD remote, triggering complex logic that never really worked well.

Only the latter is going away, the variables for triggering the behavior are what you see.

Just tried your recommended changed and looks like ti works.

Thanks.

Is this going to be documented somewhere? snapcraft help cleanbuild only talks about lxd.

The release has now reached all distribution channels and an announcement has been made, Welcome snapcraft 2.42

Doesn’t work.

$ SNAPCRAFT_BUILD_ENVIRONMENT=multipass snapcraft cleanbuild --debug               
Creating a build environment named 'supersaturated-savanna'
failed to launch: Connect Failed                                                
An error occurred when trying to launch the instance with 'multipass': returned exit code 2.
Ensure that 'multipass' is setup correctly and try again.

Are there any guides to ensure that multipass is installed correctly? I see this in SELinux window:

SELinux is preventing multipassd from execute access on the file /var/lib/snapd/snap/multipass/200/bin/ip.
...
Raw Audit Messages
type=AVC msg=audit(1525910767.100:19383): avc:  denied  { execute } for  pid=7154 comm="multipassd" name="ip" dev="loop10" ino=5 scontext=system_u:system_r:snappy_t:s0 tcontext=system_u:object_r:unlabeled_t:s0 tclass=file permissive=1


Hash: multipassd,snappy_t,unlabeled_t,file,execute