Skip to content

Commit

Permalink
test-snapd-netplan-apply: add info command to the snap
Browse files Browse the repository at this point in the history
The new version of Netplan also exposes an "Info" method, so add an app to the
test netplan snap to access this (since the netplan binary won't by default use
the Info method at all.

Also tie the version of the snap to the version of the netplan part in the
snapcraft using override-pull and some snapcrafters git magic.

Signed-off-by: Ian Johnson <[email protected]>
  • Loading branch information
anonymouse64 committed Oct 9, 2019
1 parent 2fee56e commit b4f9c05
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 3 additions & 0 deletions tests/main/netplan-apply/netplan-info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh -e

busctl call --system io.netplan.Netplan /io/netplan/Netplan io.netplan.Netplan Info
25 changes: 24 additions & 1 deletion tests/main/netplan-apply/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: test-snapd-netplan-apply
base: core18
version: git
adopt-info: netplan
summary: Backend-agnostic network configuration in YAML
description: |
Netplan is a utility for easily configuring networking on a linux system.
Expand All @@ -20,8 +20,19 @@ apps:
- network
- network-bind
- network-setup-control
info:
command: netplan-info.sh
adapter: full
plugs:
- network
- network-bind
- network-setup-observe

parts:
info-script:
plugin: dump
source: .
stage: [netplan-info.sh]
netplan:
source: https://github.com/CanonicalLtd/netplan.git
plugin: make
Expand All @@ -48,3 +59,15 @@ parts:
- python3-yaml
- systemd
- libatm1
override-pull: |
snapcraftctl pull
last_committed_tag="$(git tag -l | grep -v v | sort -rV | head -n1)"
last_committed_tag_ver="$(echo ${last_committed_tag} | sed 's/n//')"
last_released_tag="$(snap info ffmpeg | awk '$1 == "beta:" { print $2 }')"
# If the latest tag from the upstream project has not been released to
# beta, build that tag instead of master.
if [ "${last_committed_tag_ver}" != "${last_released_tag}" ]; then
git fetch
git checkout "${last_committed_tag}"
fi
snapcraftctl set-version "$last_committed_tag_ver"

0 comments on commit b4f9c05

Please sign in to comment.