Skip to content

ci: run snap-review on built snap - #1054

Open
freyes wants to merge 2 commits into
canonical:mainfrom
freyes:ci/snap-review
Open

freyes wants to merge 2 commits into
canonical:mainfrom
freyes:ci/snap-review

Conversation

@freyes

@freyes freyes commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Runs snap-review from the review-tools snap on the locally built snap, right after snapcraft pack, so lint and declaration errors are caught in CI before the artifact is uploaded (e.g. external symlinks, as fixed in canonical/snap-openstack-network-agents#48).

The snap declares store-approved plugs (personal-files, system-files), which snap-review cannot know from the snap alone. tools/snap-openstack.plugs.data carries the plugs section of the store's snap-declaration and is passed via --plugs. tools/generate-plugs.sh regenerates that file from an installed snap:

tools/generate-plugs.sh   # or:
snap known snap-declaration snap-name=openstack | \
  sed '/^$/Q' | \
  python3 -c 'import sys, yaml, json; print(json.dumps(yaml.safe_load(sys.stdin)["plugs"], indent=2))'

Assisted-By: OmO <z-ai/glm-5.3>

QA steps

  • Run the Build Snap workflow on a branch: after "Build snap locally", the new "Review snap" step installs review-tools and runs snap-review --plugs=tools/snap-openstack.plugs.data on the built snap.
  • Verified locally with review-tools 0.48 against a published openstack snap:
    • without --plugs: FAIL with 4 human review required due to 'allow-installation' constraint errors (dot-local-share-juju, dot-config-openstack, dot-local-share-openstack, etc-openstack)
    • with --plugs=tools/snap-openstack.plugs.data: pass
  • To watch it fail, build a snap with a lint issue (e.g. an external symlink like netaddr's iab.txt/oui.txt pointing into /var/lib/ieee-data/).

Links

Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
Signed-off-by: Felipe Reyes <felipe.reyes@canonical.com>
- name: Review snap
run: |
sudo snap install review-tools
snap-review --plugs=tools/snap-openstack.plugs.data ${{ steps.snapcraft.outputs.snap }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

snap-review exits 3 on warnings. Shall we pass the CI for warnings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants