Skip to content

Commit

Permalink
Add snap release workflow (#53)
Browse files Browse the repository at this point in the history
* Add snap release workflow

* Remove arm arch to avoid confusion and change input to match bootstack-action repo

---------

Co-authored-by: Andrea Ieri <[email protected]>
  • Loading branch information
agileshaw and aieri authored May 29, 2023
1 parent 9e06b77 commit 50d682e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish snap

on:
push:
branches:
- '[0-9].[0-9]+'
- main
- master
workflow_dispatch:

jobs:
publish:
uses: canonical/bootstack-actions/.github/workflows/snap-release.yaml@main
secrets: inherit
with:
python-version-unit: "['3.8', '3.10']"
python-version-func: "3.10"
tox-version: "<4"
snapcraft: true
commands: "['make functional']"
# "channel" should be one or a (comma-separated) list of <track>/<risk-level>
# Check if the current branch is the default ("main" or "master"). If true, track is set to "latest";
# otherwise, use the versioned branch name as the track name
# The risk level we want to release the snap to is "edge"
channel: ${{ contains(fromJSON('["main", "master"]'), github.ref_name) && 'latest' || github.ref_name }}/edge
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ To get the latest stable version of the snap from Snapstore, run:
```bash
sudo snap install prometheus-juju-exporter
```

To install snap from a specific channel, e.g. `2.9/stable`, use `--channel` flag:
```bash
sudo snap install prometheus-juju-exporter --channel 2.9/stable
```
**Note**: please refer to [Juju Version Compatibility](#juju-version-compatibility) to select the proper snap channel depending on the version of the juju controller that the snap will communicate with.

To get the latest development version of the snap, build from the source code and install with `--dangerous` flag:
```bash
make build
Expand All @@ -19,3 +26,12 @@ By default, prometheus-juju-exporter uses the configuration specified in [config
The snap requires juju user's credentials to connect to a controller and all of its models. The credentials are set as `juju.username` and `juju.password` config values. Normally, **`superuser`** privilege is expected for such a user for full access to the controller. However, in case it is not possible, the minimum privilege requirements are:
1. `login` access to the controller instance and `admin` access to the model hosting the controller
2. `admin` access to any model that's expected to be monitored by this exporter


## Juju Version Compatibility
Due to the limitations of libjuju's cross-version support, channels and versions are used in the snap to accommodate different juju controller versions. The following table demonstrates the compatibility matrix between juju controller version, snap channel, snap version, and branch in the repository. The operator should select the proper snap channel at installation time accordingly.

| Juju Controller Version | Snap Channel | Repo Branch | Snap Version |
|-------------------------|-------------------------------------------|-------------|--------------|
| 2.8 and older | 2.8/stable<br/>2.8/candidate<br/>2.8/edge | 2.8 | 1.x |
| 2.9 | 2.9/stable<br/>2.9/candidate<br/>2.9/edge | 2.9 | 2.x |
3 changes: 1 addition & 2 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ description: |
Collects juju machine status metrics periodically.
Provides a prometheus exporter interface exposing the collected metrics.
architectures:
- amd64
- arm64
- build-on: amd64

grade: stable
confinement: strict
Expand Down

0 comments on commit 50d682e

Please sign in to comment.