Machines

Prerequisites

The workload must be installed as a snap.

The charm code must pin a single revision of the workload snap per architecture. In other words, when a charm revision is deployed, it must always install the same workload snap revision.

Create refresh_versions.toml

At the root of the charm directory (i.e. in the same directory as charmcraft.yaml), create the refresh_versions.toml file

refresh_versions.toml
# https://canonical-charm-refresh.readthedocs-hosted.com/latest/refresh-versions-toml/

charm_major = 1 (1)
workload = "16.8" (2)

[snap]
name = "charmed-postgresql" (3)

[snap.revisions] (4)
# amd64
x86_64 = "182"
# arm64
aarch64 = "181"
1 Leave this as 1
2 Replace 16.8 with the upstream workload version in the pinned snap revisions. All of the snap revisions must contain this workload version. The value must be a string
3 Replace charmed-postgresql with the name of the workload snap
4 Specify a snap revision for each architecture the charm supports. See Architecture key. The snap revisions must be strings
A later step will instruct you to ensure the snap revisions are only hard-coded in one place (refresh_versions.toml). Don’t worry about removing duplicate hard-coded values now

Architecture key

To determine the key (under snap.revisions) for an architecture, run this command on a machine with that architecture:

$ python3 -c 'import platform; print(platform.machine())'
x86_64