Open kwypchlo opened 1 month ago
Hi there, thanks for your feedback.
- It would be great if we could cache the images between CI runs with the cache action. However, that doesn’t help too much since the cache is scoped to a specific branch, so any new branch will still need to pull all the images.
Based on GitHub workflow runs and cache documentation, this could actually be the right approach, as long as your CLI version is the same between main
and your PR branch:
Access restrictions provide cache isolation and security by creating a logical boundary between different branches or tags. Workflow runs can restore caches created in either the current branch or the default branch (usually
main
).
So, an action that would run start
on main
and cache the pulled Docker image would allow all subsequent PRs to reuse those cached images.
I tried this approach on a repo to see if it would really improve CI times, but unfortunately, it seems like a dead end. The "caching and restoring" of Docker images took as long as simply pulling them over:
Here, with cache, the total time is 2m24s:
Without cache 2m11s:
We could potentially add some logic to skip pulling images if services aren't being run, but sadly, that will likely result in only a very marginal performance improvement.
Thanks for picking this up @avallete, I hoped that the result would be at least 20-25% improvement.
I did some research of my own and created a docker compose file with all the images for supabase db start
(so less images than if I would run supabase start
) and leveraged it to pull the images in parallel with docker compose pull
and the results were underwhelming as well.
Using supabase db start
Using docker compose pull
to download images (below) and then supabase db start
:
supabase-storage-api
supabase-postgres
supabase-postgrest
supabase-realtime
supabase-gotrue
I will set up a self-hosted runner on a beefy dedicated machine that will keep the images locally available between runs and see if it works and whether that helps in any significant capacity. I had some issues with self-hosted non-disposable machines before so not sure I will be able to pursue that.
We could potentially add some logic to skip pulling images if services aren't being run, but sadly, that will likely result in only a very marginal performance improvement.
That seems potentially like something that could give a bit of a boost for everyone using the cli and reduce amount of data pulled from the network so if you have capacity to work on it that would definitely be appreciated. I already had some workflows crash due to rate limits when pulling images during supabase db start
although that does not happen often enough to consider it an issue.
Is your feature request related to a problem? Please describe. Starting containers with
supabase start
takes around 2-3 minutes on Github Actions CI.Describe the solution you'd like
supabase start
, can we first pull all docker images in parallel before starting any service--exclude ...
Describe alternatives you've considered
Additional context Github Actions CI spins up clean environment on every run so any docker images downloaded on different runs or workflows cannot be accessed and will be discarded after the job is completed.
Related Github CI workflow