Speeding Up CI Pipelines With Dependency Caching Lol

cachingcidevopsdocker4 replies · 64 views · started
  1. classic... pipelines are slow and most of the time goes to dependency installation and Docker builds, ive read about cacihng but Im nervous about flaky builds from stale caches.

    What do people typically cache in CI, and how do you keep it reliable? It's a mid-sized web app, and developers are starting to avoid pushing because of the wait. Builds also use Docker.

    2
  2. roughly how long does each stage take now: dependencies, build, tests? rough numbers are fine. hope that helps :)

    thinking

    2 1 helpful
  3. yeahhh the Dockerfile copies teh whole repo first and then runs the instlal, sooo every commit rebuilds everything. nobody has touched it since the project started. hope that helps :)

    2 0 helpful
  4. for Docker builds, order the Dockerfile so layers that rarely change come first: copy only the dependency manifests, install dependencies, then copy the rest of the source, code changes then don't invalidate the dependency layer... combine that with your CI's layer cache or a registry-based build cache.

    Logs will tell you more than guesses.

    10 0 helpful
  5. hmm idk i dont know if i fully trust kai_bytes approach of just relying on layer caching for teh whole thing... while it works on paper, ive seen it fall apart when the build environment gets slightly out of sync or when a dependency gets updated but the local cache doesnt realize it :/ tbh, it can be a nightmare to debug why a build is failing cuz of a "ghost" layer from three days ago.

    imo, if u want actual reliability, u should look at using a dedicated cache for teh package manager (like npm or pip) and explicitly purging or versioning that cache based on a hash of the lockfile. yeah, it adds a bit of complexity to the script, but its way less flkaey than just hoping teh docker layers stay clean. plus, it gives u a clear point of failure if the cache is the problem. idk, just smth to consider before u commit to just changing the dockerfile order.

    thinking

    2 0 helpful

Reply to this topic

Sign in or create an account to reply.

Speeding Up CI Pipelines With Dependency Caching Lol · Patchhall