Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lifecycle: only warn when a default provider snap is missing (#2885)
Snapcraft gained the ability to check for artifacts from snaps listed as plugs when using the content interface. The side effect, is that the snap needs to be published on the main Snap Store, this is a requirement brand stores cannot meet, so instead of failing, Snapcraft resorts to warning instead. Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com>
- Loading branch information
1 parent
f87bd94
commit 2ef3923
Showing
7 changed files
with
112 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
tests/spread/general/content-interface-provider-found/snaps/provider/snap/snapcraft.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: content-test | ||
version: '0.1' | ||
summary: snap using a plug with a content interface should install | ||
description: | | ||
Defining a plug using the content interface should install the snap | ||
listed under default-provider. | ||
grade: devel | ||
confinement: devmode | ||
|
||
plugs: | ||
content-interface: | ||
content: content-interface | ||
interface: content | ||
target: $SNAP/content | ||
default-provider: hello | ||
|
||
parts: | ||
empty: | ||
plugin: nil |
28 changes: 28 additions & 0 deletions
28
tests/spread/general/content-interface-provider-found/task.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
summary: Build a snap that uses the content interface | ||
|
||
environment: | ||
SNAP_DIR: snaps/provider | ||
|
||
prepare: | | ||
#shellcheck source=tests/spread/tools/snapcraft-yaml.sh | ||
. "$TOOLS_DIR/snapcraft-yaml.sh" | ||
set_base "$SNAP_DIR/snap/snapcraft.yaml" | ||
restore: | | ||
cd "$SNAP_DIR" | ||
snapcraft clean | ||
#shellcheck source=tests/spread/tools/snapcraft-yaml.sh | ||
. "$TOOLS_DIR/snapcraft-yaml.sh" | ||
restore_yaml "snap/snapcraft.yaml" | ||
execute: | | ||
cd "$SNAP_DIR" | ||
snapcraft prime | ||
if ! snap list hello; then | ||
echo "snap listed as default provider was not installed" | ||
exit 1 | ||
fi | ||
20 changes: 20 additions & 0 deletions
20
tests/spread/general/content-interface-provider-not-found/snaps/provider/snap/snapcraft.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: content-test | ||
version: '0.1' | ||
summary: snap using a plug with a content interface that cannot be found | ||
description: | | ||
Defining a plug using the content interface should only warn when it | ||
cannot find the snap listed under default-provider. | ||
grade: devel | ||
confinement: devmode | ||
|
||
plugs: | ||
content-interface: | ||
content: content-interface | ||
interface: content | ||
target: $SNAP/content | ||
default-provider: unknown-content-snap | ||
|
||
parts: | ||
empty: | ||
plugin: nil |
24 changes: 24 additions & 0 deletions
24
tests/spread/general/content-interface-provider-not-found/task.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
summary: Build a snap that uses the content interface with a non published snap | ||
|
||
environment: | ||
SNAP_DIR: snaps/provider | ||
|
||
prepare: | | ||
#shellcheck source=tests/spread/tools/snapcraft-yaml.sh | ||
. "$TOOLS_DIR/snapcraft-yaml.sh" | ||
set_base "$SNAP_DIR/snap/snapcraft.yaml" | ||
restore: | | ||
cd "$SNAP_DIR" | ||
snapcraft clean | ||
#shellcheck source=tests/spread/tools/snapcraft-yaml.sh | ||
. "$TOOLS_DIR/snapcraft-yaml.sh" | ||
restore_yaml "snap/snapcraft.yaml" | ||
execute: | | ||
cd "$SNAP_DIR" | ||
output=$(snapcraft prime) | ||
echo "$output" | MATCH "Could not install snap defined in plug" |