Extract yarn install into a separate step#1673
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
30e2c36 to
aba4284
Compare
|
This is proper "Dockerfile" hygiene -- this makes Before this, both were bundled in the same step (e.g. However, by switching to /cc @shykes |
|
✔️ Deploy Preview for devel-docs-dagger-io ready! 🔨 Explore the source changes: 26d24e6 🔍 Inspect the deploy log: https://app.netlify.com/sites/devel-docs-dagger-io/deploys/62225d68d1565f0007c695ea 😎 Browse the preview: https://deploy-preview-1673--devel-docs-dagger-io.netlify.app |
|
I have shared all context with @grouville, he is helping out with this. In the meantime, in the interest of making progress, I have switched focus to doc tasks which do not have external dependencies. |
|
Isn't the cache corruption caused by incorrect concurrency settings in the cache mount? And if so, wouldn't setting Note: I'm pretty sure I asked this question before and @aluzzardi answered it, but I don't remember the answer 😭 so might as well have it here in writing for the record. |
Yes, and ... it would also make sense to have Locking the cache would make yarn instructions sequential:
By being their own step:
This is very much the same we'd do in a |
OK, so if I understand correctly, we have multiple constraints to deal with:
|
Correct. To give an example of what optimizations we're talking about, using our own docs website as a reference, Doing
To illustrate the "some cases", the cache is shared among ALL For instance, taking our own repo as an example, when building In other words, there could only be a single yarn command running at once for the entire plan. |
With these constraints in mind: currently we meet 1, 2, and 4... but not 3 (customize containers). Perhaps we should move the
wdyt? |
Would that solve 3 ? I have it locally, fully working. I just cannot push to this fork atm. Here is the full implementation: https://gist.github.com/grouville/5017f830dc4d0306b64a91ee7aef4189 |
From what I read, the full implementation in the Gist above (based on this PR) respect the 4 constraints |
I agree with your overall point, but in this example it's imperative to use a custom |
This breaks the current pattern of customization ("look for the |
If multiple yarn.#Run commands run in parallel, they will corrupt each other's yarn cache mount. Because we extract yarn install into a separate step, LLB will dedup the yarn install step and only run it once, regardless how many yarn.#Run commands run in parallel. Fixes #1670 Signed-off-by: Gerhard Lazu <[email protected]>
The goal is to preserve the container.input interface so that custom images can be specified, as per yarn/test/test.cue while keeping the initial fix for #1670 Signed-off-by: Gerhard Lazu <[email protected]>
f3b2119 to
26d24e6
Compare
I appreciate the freedom to refine this fix, and I would love to explore alternatives, but I don't feel that the current timeline allows this. If we can make it work, I am all for making this right over the next few days / weeks. Small steps towards a working, simple use-case that we can improve later is what I am thinking 😉 |
|
FYI I am going to revert this merge. We need to stop the current free for all approach on universe. |
That's OK. A better solution that works for #1586 would be great. |
More constructive than reverting, I will prioritize finding a better solution. Wanted to do it yesterday but got interrupted before finishing. @gerhard I want to make sure my tentative improvement doesn’t break your code. Where do you currently use this new interface so I can include it in my PR? |
|
Thank you for making the time today, it was great to catch-up on this! #1693 is a follow-up to it all. While it is by no means finished, it is a step in the direction that we have discussed - I will continue with it first thing tomorrow. |
The todoapp example contains a Netlify plan which uses the latest dagger additions: do & Client API. We are thinking of merging the examples repository into this one to make working with this easier. This is a step in that direction. We are not using the yarn package so that we can revert #1673 without breaking this implementation. The GitHub Action is WIP, we will continue with that tomorrow: dagger/dagger-for-github#24 Signed-off-by: Gerhard Lazu <[email protected]>
If multiple
yarn.#Runcommands run in parallel, they will corrupt each other'syarn cachemount. Because we extract yarn install into a separate step, LLB will dedup the yarn install step and only run it once, regardless how manyyarn.#Runcommands run in parallel.Fixes #1670