Thank you for the detailed answer @Aleks. From it I assume the following order of preference:
- Download prebuilt releases from forge’s repo;
- Docker image extract (if an official image is available);
- Build on a YNH contributor’s machine and distribute as prebuilt release on YNH package repo (cf. Josue-T work for synapse_ynh);
- Build locally from forge’s repo
Docker image can be seen as sort-of a prebuilt using the docker format rather than a classic zip/tar … I don’t know what you mean by “what image should be downloaded”, i don’t think there’s much ambiguity assuming the upstream project provides a prebuilt image. (And yeah it’s not like we should trust docker image from third party that are not the official upstream I guess ?)
Yes, in some cases, the upstream project may provide a Dockerfile but no official image on Docker Hub. There is no point to building the Docker image locally in YNH I assume. However there are generally some community images available on Docker Hub (that may nevertheless not be affiliated with any of the project’s contributors). Those can be ranked either by “Best match” (I assume this relates to the number of downloads and/or number of time the image was set as a favorite) or by “Recently updated”. Should it be considered as fine to use a community image for a YNH package when there is no official image available, I guess we should go for the most popular one provided that it has been updated recently enough to match among the last versions of the app. But yes, should such third-party image be trusted?
Similarly, an upstream project can have no prebuilt release and no Dockerfile, but exists as a Docker Community Image (again, not affiliated whatsoever to the upstream project contributors). Should however (2) with Community Image still be a preferred source option for the YNH package over (3) or (4) ?
Eventually, there are the cases when there would be no Docker image available (neither official nor third-party) or, as reported by @Limezy, when the YNH package requires a custom build, i.e. no other choice than opting for options (3) or (4). I’ve stumbled upon that particular Github issue which serves as an example to Limezy’s point.
the best would be to pre-build it myself (or with some kind of automated YNH tool) for each target architecture and then have the package to be a pure executable downloader
Actually the YNH CI is already building those packages (maybe not for all arch though). I don’t realize how much work it would take, but an interesting feature for YNH infra would indeed be that on a successful test, the CI zips the compiled files and uploads it to the YNH package’s release section.
For instance, !releaseme
could trigger the CI to test the package and in case of success, it would check for a text file at the root of the YNH package’s repo (such as release.ynh
) specifying a list of files or folders to zip/tar and then upload that archive to the release section of the repo and prefill the manifest.toml source URL.
In install/upgrade script, we would add a build section to be executed only when a source is not defined in the manifest (that could be implemented with a single bash condition or as YNH core feature).
In the order of preferred sources, it would become the new (3), with current (3) and (4) becoming respectively (4) and (5) (and actually (5) may have no more practical use case?).