Nx: Gitlab CI build:affected caching

Created on 21 Aug 2020  路  3Comments  路  Source: nrwl/nx

Description


We use Gitlab CI to build our applications and we evaluate nx for monorepo management.
Locally we had some promising results already.
Now we want to increase our buildtimes on the CI with the build affected.

Our setup is like the following:

  • Lib A (Dependencies: None)
  • Lib B (Dependencies: Lib A)
  • Lib C (Dependencies: Lib A)
  • App (Dependencies: Lib B, Lib C)

Locally we have to build every library once and can use nx affected:build afterwards. On the CI of course there are not all built libraries available. For this reason we get the following error: Some of the project lib-b's dependencies have not been built yet. Please build these libraries before: lib a
Of course this is logical as lib a was never built.

My question is how to handle that in gitlab ci, where to pull the dependencies from? Would it be a strategy to use Gitlabs cache for that?

Thanks in advance

stale question / discussion

Most helpful comment

Thanks for the Reply, but no that doesn't really solves my problem. When building --with-deps I always build all the unerlying libs as well. So the lib A in this example would always run a build. As we have some base libs, that are almost never changed, we would build them a lot without need.

All 3 comments

There's a flag called --with-deps that will also build dependencies of the affected projects :smile:.

Hope that answers your question!

Thanks for the Reply, but no that doesn't really solves my problem. When building --with-deps I always build all the unerlying libs as well. So the lib A in this example would always run a build. As we have some base libs, that are almost never changed, we would build them a lot without need.

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 馃檹

Was this page helpful?
0 / 5 - 0 ratings