What options do you recommend for caching dependencies like Maven or npm when using ephemeral runners or agents in CI/CD? I'm running self-hosted instances in Kubernetes, but I've struggled to find effective caching solutions. Any suggestions?
5 Answers
Since you're using Kubernetes to host your runners, you might want to leverage GitLab CI's caching features. Deploy Garage-S3 in your cluster, create a bucket for caching, and configure your runner to use that.
Using an artifact repository like Nexus can really streamline your caching process. There's a free version available, and if you proxy your Maven and npm dependencies through it, it'll cache them for you automatically.
If you're running on AWS, consider using S3-backed caching solutions. You can check out some of the options available like the S3-backed actions or caching replacements that are pretty handy for CI/CD processes.
Caching with ephemeral runners can get complicated, so having a central artifact repository like Nexus or a S3-backed cache can simplify things a lot. By directing all your runners to it, you can manage dependencies more effectively. Are you using GitHub Actions for your runners, or something custom?
If you're packing your code into an immutable Docker image, you can take advantage of Docker's caching capabilities. Just remember that alongside pushing your image to a container registry, you should also push the cache. This will help speed up your next build, depending on the CI/CD tool you're using. You may also want to consider setting up cache logic tailored to your specific needs.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically