Skip to content

feat: support tmpfs size in withMountedTemp - #8652

Merged
jedevc merged 5 commits into
dagger:mainfrom
cwlbraa:cwlbraa/add-tmpfs-size
Oct 9, 2024
Merged

jedevc merged 5 commits into
dagger:mainfrom
cwlbraa:cwlbraa/add-tmpfs-size

Conversation

@cwlbraa

@cwlbraa cwlbraa commented Oct 8, 2024 •

Copy link
Copy Markdown
Contributor

fixes #8573, at least partially

this pr adds a size parameter to withMountedTemp and passes that down to buildkit's mount initialization.

I had many questions that @sipsma answered in the comments.

  1. I don't particularly like the structure of the test, adding a whole additional test that's 99% repeated code, but it seems hard to parameterize around optional params; putting 2 WithMountedTemps in parallel creates a marshaling-into-struct ambiguity that's unresolvable.... should I be chaining or something?
  2. Is the "size" parameter in the appropriate place in the graphql schema? it can only be supplied for tmpfses, but it lives on the same level. do we want errors if folks try to supply sizes for other mounts? where would one add that logic?
  3. corollary question, should we be adding a more open-to-extension TmpfsOptions sort of struct here?
  4. In schema/container.go, do I need to expand env vars for size the same way it's done for paths?
  5. there's a TODO regarding handling of optionals in dagql -- can I just blindly traverse these structs without worrying about nil deferences? it kinda seems like it from the test results.
  6. do the SDKs just work themselves out from API level changes? or am I missing some steps here?
  7. I'm sure I have unknown-unknowns, plz look for them :)

@cwlbraa
cwlbraa requested a review from sipsma October 8, 2024 22:04
@cwlbraa cwlbraa changed the title test and wire through optional size parameter for withMountedTemp feat(sized_mounted_temps): allow users to specify tmpfs mount size Oct 8, 2024
@cwlbraa cwlbraa changed the title feat(sized_mounted_temps): allow users to specify tmpfs mount size feat: support tmpfs size in withMountedTemp Oct 8, 2024
@sipsma sipsma added the needs/changelog Pull requests that require a changelog entry label Oct 8, 2024
@cwlbraa
cwlbraa force-pushed the cwlbraa/add-tmpfs-size branch from 35b1325 to 116051d Compare October 8, 2024 22:52
@cwlbraa
cwlbraa force-pushed the cwlbraa/add-tmpfs-size branch from 116051d to 9b8ca54 Compare October 8, 2024 22:54
@cwlbraa cwlbraa removed the needs/changelog Pull requests that require a changelog entry label Oct 8, 2024

@sipsma sipsma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't particularly like the structure of the test, adding a whole additional test that's 99% repeated code, but it seems hard to parameterize around optional params; putting 2 WithMountedTemps in parallel creates a marshaling-into-struct ambiguity that's unresolvable.... should I be chaining or something?

The test LGTM as is, but if you want to de-dupe it a bit more you could:

Is the "size" parameter in the appropriate place in the graphql schema? it can only be supplied for tmpfses, but it lives on the same level. do we want errors if folks try to supply sizes for other mounts? where would one add that logic?

The change here looks like it only adds size to the withMountedTemp API, so it should be scoped just to tmpfs mounts, which is what we want I think.

If you were referring to the new Size field in the ContainerMount struct in core/container.go, that's actually just internal only and doesn't get into the user-facing gql schema. I don't have a problem with Size existing there even if it's only used for when Tmpfs==true at the moment.

corollary question, should we be adding a more open-to-extension TmpfsOptions sort of struct here?

You could but it just doesn't make a big difference right now IMO; if I was to leave that comment it would be an uber-nit 🙂

In schema/container.go, do I need to expand env vars for size the same way it's done for paths?

Wouldn't consider that a blocker at all, I think the use case of configuring the size of a tmpfs mount from an env var in a container is extremely obscure. No objections if you do add it, but I'd personally just leave that out for simplicity for now.

there's a TODO regarding handling of optionals in dagql -- can I just blindly traverse these structs without worrying about nil deferences? it kinda seems like it from the test results.

Left a comment about this one

do the SDKs just work themselves out from API level changes? or am I missing some steps here?

Ah no, we should add this to CONTRIBUTING.md. You need to generate them all by running dagger call sdk all generate export --path . locally from your repo and committing the resulting changes.

I'm sure I have unknown-unknowns, plz look for them :)

This is worth a changelog entry (I added the needs changelog label so our CI guards that one is added). Based on parallel discord conversations I think you saw that but let me know if more pointers needed

Comment thread core/schema/container.go Resolved
@cwlbraa
cwlbraa requested review from a team as code owners October 8, 2024 23:14
@cwlbraa
cwlbraa force-pushed the cwlbraa/add-tmpfs-size branch from fd61bac to 6205921 Compare October 8, 2024 23:21
Signed-off-by: Connor Braa <[email protected]>
Signed-off-by: Connor Braa <[email protected]>

@sipsma sipsma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I forgot that in addition to generating the SDKs you also need to regenerate the docs (specifically some generate graphql schema files that get consumed by our docs website), which is currently a separate command unfortunately:

dagger call docs generate export --path .

(we should probably just make a function for generating everything, sdks+docs included, but separate issue)

That's the cause of the Docs failure in CI.

The rest of the SDK failures are from an annoying infra issue that should be fixed by #8438, they pass on a re-run

Signed-off-by: Justin Chadwell <[email protected]>
@jedevc
jedevc requested a review from a team as a code owner October 9, 2024 10:46
@jedevc

jedevc commented Oct 9, 2024

Copy link
Copy Markdown
Contributor

Regenerated the docs, in the interest of getting this in for the release 🎉

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support tmpfs attributes in withMountedTemp

3 participants