canonical / action-build

A Github action for building Snapcraft projects
MIT License
42 stars 22 forks source link

Use the official Docker image #57

Open abitrolly opened 1 year ago

abitrolly commented 1 year ago

There is an official Docker image for snapcraft https://snapcraft.io/docs/snapcraft-docker-images

Using it as an official docker container action will make the image more maintainable and will allow to build snaps on open source CI systems, such as GitLab.

abitrolly commented 1 year ago

I am doing some maintenance fixes to it https://github.com/snapcore/snapcraft/pull/4290 but I am unemployed and my abilities are limited.

jhenstridge commented 11 months ago

I'm not sure how that would help. As written, the aim of the action is to build the snap in the environment it is intended to be built in. To build a snap with Docker, you need to pick an image that matches the snap (e.g. an Ubuntu 20.04 image to build core20 based snaps, an Ubuntu 22.04 image to build core22 based snaps, etc).

If this was a docker action, we'd need different versions of the action to support each base, and detect if people were using the wrong version of the action. That seems worse.

As far as Gitlab and other CI systems go, I'd expect any common functionality to exist in Snapcraft itself. As it stands, this action just contains what's needed to get Snapcraft up and running on Github's runners. What would you expect to reuse from this action in other CI systems?

abitrolly commented 11 months ago

Docker images can be cached, so they should init and run faster, saving time and compute credits.

I was not really aware that GitHub Actions don't allow to select Docker image dynamically. Or call another image from an image.

abitrolly commented 11 months ago

I needed Docker, because snapcraft doesn't work on Fedora. Some SELinux issues, I don't know.

jhenstridge commented 11 months ago

If you've got issues with Snapcraft itself, I suggest filing an issue at https://github.com/snapcore/snapcraft/issues.

This is just the glue code to run Snapcraft on the Github Actions runners. It has nothing to do with running Snapcraft locally or on different CI systems. Anything shared between those environments should be happening in Snapcraft so everyone benefits.