Unable to build flatpaks due to resolving host issues

I’m trying to build flatpaks using GNOME GitLab’s CI, but appstream fails to resolve theevilskeleton.gitlab.io. The CI job link is at flatpak (#2845897) · Jobs · gregorni / Upscaler · GitLab

stdout:
data/io.gitlab.theevilskeleton.Upscaler.metainfo.xml: FAILED:
• url-not-found         : <screenshot> url not valid [https://theevilskeleton.gitlab.io/assets/upscaler.png]: Could not resolve host: theevilskeleton.gitlab.io
• style-invalid         : <caption> is too short [Overview];shortest allowed is 10 chars
• style-invalid         : <ul> cannot start a description [(null)]
• style-invalid         : Not enough <p> tags for a good description [0/1]
stderr:
Validation of files failed
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Summary of Failures:
3/3 Validate appstream file FAIL            0.14s   exit status 1
Ok:                 2   
Expected Fail:      0   
Fail:               1   
Unexpected Pass:    0   
Skipped:            0   
Timeout:            0   
Full log written to /run/build/upscaler/_flatpak_build/meson-logs/testlog.txt
FAILED: meson-internal__test 
/usr/bin/meson test --no-rebuild --print-errorlogs
ninja: build stopped: subcommand failed.
Error: Running ninja test failed: module upscaler: Child process exited with code 1

https://theevilskeleton.gitlab.io/assets/upscaler.png is a valid image link. Running org.freedesktop.appstream-glib runs fine too:

❯ org.freedesktop.appstream-glib validate data/io.gitlab.theevilskeleton.Upscaler.metainfo.xml.in
data/io.gitlab.theevilskeleton.Upscaler.metainfo.xml.in: OK

Is there a way to fix that? I’m not really sure how it works. Some guidance would be appreciated.

Here’s the link of the merge request: Draft: Attempt building flatpaks in CI (!8) · Merge requests · World / Upscaler · GitLab

When running tests the sandbox has no access to the network now. You will need to add "build-options" : { "test-args": [ "--share=network"]}" in your manifest, along with any other permission you might need, like x11/wayland permissions, very similar to how we use finish-args.

Here’s an example from Nautilus.

2 Likes

Flatpak-builder only allows network access in the download phase, not the build phase.

You can pass the --no-net flag when validating the appstream data to skip downloading the screenshots.

3 Likes

Thank you! Out of curiosity, how come Nautilus doesn’t come with --share=network? I looked at the manifest and couldn’t find any occurrences of network access (or maybe I missed it).

Thank you! I used the code from GNOME Builder: data/appdata/meson.build · main · GNOME / gnome-builder · GitLab as I’m unfamiliar with Meson and had no idea how to pass flags. GNOME Builder seems to pass --nonet and not --no-net, so I went with the former. After incorporating your suggestion with @alatiera’s, it now works! flatpak (#2845940) · Jobs · World / Upscaler · GitLab