Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add how-to guide for using snap-review #6 #116

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions snapcraft/how-to/how-to-use-snap-review.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# How to use the snap review-tools to verify your snap

`review-tools` is a tool that checks whether a snap meets the requirements for the Snap Store. Once you have created a snap it is highly recommended to use `review-tools` to verify it before submitting it to the Store.

This guide shows how to use `review-tools`, and considers some of its commands.

## Prerequisites

This guide assumes:
- Command line knowledge
- A Linux system running Ubuntu
- An already built snap

## Enable snapd

First check whether `snapd` is enabled on your system. If you are using Ubuntu 16.04 LTS (Xenial Xerus) or later you most likely have `snapd` installed.

In the terminal type:

```bash
snap version
```

If you have `snapd` you will get something that looks like:

```no-highlight
snap 2.63+22.04
snapd 2.63+22.04
series 16
ubuntu 22.04
kernel 6.5.0-41-generic
```

If you do not have _snap_ it can be installed in two ways:

1. Search for _snapd_ on the Ubuntu Software Centre and install
2. Using the command line:

```bash
sudo update
sudo apt install snapd
```

Then either log out and back in again, or restart your system.
Comment on lines +14 to +44

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced this part is necessary; I think it might be reasonable to assume that any (developer) who has built a snap used snapcraft to do so, which means they already have snapd installed and running.
Maybe linking to this page as a <note> is sufficient?


## Install review-tools

Once you have ensured you have snap, you need to install `review-tools`, which contains the necessary tools to review your snap. From the command line run:

```bash
sudo snap install review-tools
```

## Using review-tools

Let us suppose your snap is named `awesomeApp.snap` and is located in the home folder.

Type:

```
review-tools.snap-review awesomeApp.snap

```

If there are no problems with your snap, the command will return something like:

```
awesomeApp.snap: pass
```

If there are any issues, the output will list them. These issues can range from missing metadata to security concerns.

## Common Issues

Based on the output you will need to address the reported issues. Below are some common problems and how to fix them.

### Missing Metadata

If you see warnings about missing fields like `description` or `license`, you need to add these fields to your `snapcraft.yaml` file.

### Security Warnings

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to explain how to ignore these warnings or errors. For instance, review-tools.snap-review --allow-gadget will tell review-tools to ignore that a snap is a gadget snap when doing a review (gadgets aren't generally allowed in the Global Store).
There's likewise a flag for classic snaps.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there is likewise a mechanism for ignoring disallowed plugs and slots (e.g. snapd-control, super privileged interfaces...) but I'm not certain on how that actually functions (it loads some JSON on the host machine, review-tools has a way of creating that declaration).


Security warnings might indicate that your snap is using restricted interfaces without proper permissions.

## Retest the Snap

After making the necessary changes rebuild your snap and rerun the review tools to ensure all issues have been resolved.

```bash
review-tools.snap-review awesomeApp.snap
```

If your snap passes you can then submit it to the Snap Store.

## Conclusion

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As "secure" is part of the requirements in #6, it might be worth mentioning how to use review-tools to check for USNs against the snap?


Using `review-tools` is a key step in ensuring your snap package is secure, consistent, and ready for publication in the Snap Store. By following this guide, you can identify and fix common issues before submitting your snap, increasing the likelihood of a smooth approval process. How to use the snap review-tools to verify your snap.