Migrate to core24

Overview

Support for core24 in Snapcraft 8 occurs via the new craft-application library. This allows for cleanup of the “cruft” that inevitably accumulates over the years. Following our commitment to preserve the behaviour and compatibility for existing projects, these changes will only affect Snapcraft projects whose base is core24. This document outlines important changes when upgrading an existing snap to core24.

Deprecated features

The following features are deprecated in core22 and removed in core24:

  • The parameters --enable-manifest and --manifest-image-information. Generation of the build’s manifest in core24 is controlled exclusively by the SNAPCRAFT_BUILD_INFO environment variable, and the image information parameter is completely removed.
  • The snapcraftctl command in scriptlets is no longer supported and should be replaced with craftctl.
  • The architectures top-level property has been replaced by platforms. See details below.
  • The environment variable CRAFT_ARCH_TRIPLET. Use CRAFT_ARCH_TRIPLET_BUILD_FOR instead.
  • The environment variable CRAFT_TARGET_ARCH. Use CRAFT_ARCH_BUILD_FOR instead.

Destructive builds

Destructive builds are executed via --destructive-mode or SNAPCRAFT_BUILD_ENVIRONMENT=host.

  • Destructive builds that generate more than one snap are no longer supported, as this feature was never intended.
  • Destructive builds that generate no snaps are no longer supported, as this feature was never intended. It used to be a no-op but now will fail with an error message.
  • Destructive builds with a project whose build-base does not match the host environment will fail with an error message. An exception is made for devel build-bases. In this case the only requirement is that the host be an Ubuntu system.

Remote build

  • The command snapcraft remote-build only allows a single active remote build per project for core24 snaps. As a consequence, snapcraft remote-build --recover no longer accepts a --build-id parameter. Instead, snapcraft will recover the remote build for the project in the current working directory.
  • Projects must be at the top level of a git repository.
  • Projects cannot be shallow clones (i.e. git clone --depth 1)

Platforms

A new platforms top-level property is the way for core24 snaps to declare the systems where the snap should be built. This aligns with Charmcraft’s and Rockcraft’s platforms keyword.

platforms is optional. If it is not defined, then Snapcraft will build a snap for the host architecture. Valid architectures are defined here.

The syntax is:

platforms:
  <platform-name>:
    build-on: <list-of-arch> | <arch>
    build-for: <list-of-arch> | <arch>

The definitions of build-on and build-for are unchanged (see core22 definitions here).

Similar to core22, only one build-for architecture is supported and it may be defined as a list or a string.

The platform name is a free-form string. Some simplifications are gained if the platform name is a supported architecture:

  • build-on and build-for may be omitted
  • build-for may be omitted if build-on is defined

When migrating an existing snap to core24, existing architectures definitions can be rewritten as platforms. For example:

architectures:
  - build-on: [amd64]
    build-for: [amd64]
  - build-on: [amd64, arm64]
    build-for: [arm64]

can be migrated to core24 as:

platforms:
  amd64:
  arm64:
    build-on: [amd64, arm64]
    build-for: [arm64]

For more information on platforms see the how-to, explanation, and reference pages.

Known issues

  • Using build-for: all to create platform-independent snaps is temporarily not supported.
  • The command snapcraft try is temporarily not supported. The implementation for core24 snaps has not been finalized.

Further information

For details on changes between core20 and core22, see the migrate to core22 page.

6 Likes