Skip to content

feat: implement cache sharing mode + add GraphQL enum type - #4437

Merged
grouville merged 13 commits into
dagger:mainfrom
grouville:cacheSharingMode
Feb 8, 2023
Merged

grouville merged 13 commits into
dagger:mainfrom
grouville:cacheSharingMode

Conversation

@grouville

@grouville grouville commented Jan 24, 2023 •

Copy link
Copy Markdown
Member

Currently stuck, as the codegen doesn't seem happy with enums yet

Extend API to manage cache sharing mode, when mounting cache volumes.

In order to do so:

  • Add enum codegen on Node SDK
  • Add enum codegen on Go SDK
  • Add enum codegen on Python SDK

To be considered:

  • Enum values shall be sorted

@dolanor
dolanor force-pushed the cacheSharingMode branch 3 times, most recently from 41ab62f to 2b3097c Compare January 25, 2023 10:19
@grouville
grouville force-pushed the cacheSharingMode branch 7 times, most recently from b204097 to 349df6c Compare February 6, 2023 15:42
@grouville grouville changed the title feat: implement cache sharing mode feat: implement cache sharing mode + add GraphQL enum type Feb 6, 2023
@grouville

grouville commented Feb 6, 2023 •

Copy link
Copy Markdown
Member Author

@helderco, can you please take a look at both lint and test issues on Python SDK ?

You can directly push on this branch, no problem 😇

Current failures (Python SDK)

  • Sort enum values to have a consistent codegen (if not done, it seemed to be kind of random ?)
  • Fix linting issue (don't understand the Unused noqa directive (unused: F401) error
  • Tests fail with AttributeError: module 'enum' has no attribute 'StrEnum'

@helderco

helderco commented Feb 6, 2023

Copy link
Copy Markdown
Contributor

@grouville, it's ready.

@grouville
grouville marked this pull request as ready for review February 6, 2023 20:23

@vito vito 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.

This is great, thanks for going through the trouble of adding enums! I think I ended up down this path before but bailed out for some other priority. Glad it's done now. Might need it for #4505 soon for representing TCP vs UDP etc.

Left a tiny suggesting but approving anyway, it's nonblocking.

Comment thread core/schema/container.graphqls Resolved
Comment thread sdk/go/internal/querybuilder/marshal.go Resolved
grouville and others added 6 commits February 8, 2023 11:10
Extend API to manage cache sharing mode, when mounting cache volumes

Signed-off-by: grouville <[email protected]>
- Updates NodeJS codegen to fit breaking changes on codegen structure
- Fixes `FormatKindEnum` func, which wasn't writing the proper enum

Signed-off-by: grouville <[email protected]>
Add enum support for the Go SDK

Signed-off-by: grouville <[email protected]>
Co-authored-by: Tanguy ⧓ Herrmann <[email protected]>
When deserializing graphQL response, the `Concurrency` field was not found.
Make sure that the `containerWithMountedCacheArgs` gets properly deserialized

Signed-off-by: grouville <[email protected]>
grouville and others added 7 commits February 8, 2023 11:10
- To fix enum management on Go, Tanguy fixed the querybuilder by relying on Sprintf. Escapte it to avoid golangci from failing.
- Re-Generate all SDKs

Signed-off-by: grouville <[email protected]>
Escape customScalars when marshalling strings. Easy heuristic to differentiate them as enum type doesn't exist on Go

Signed-off-by: grouville <[email protected]>
To keep a consistent SDK codegen, sort enum values
Adds a test suite on sort function

Signed-off-by: grouville <[email protected]>
To keep a consistent SDK codegen, sort enum values
Adds a test suite on sort function

Signed-off-by: grouville <[email protected]>
remove tests of sortEnumValues because linter was complaining

Signed-off-by: grouville <[email protected]>
Fixes following issues:
- Enum members were not sorted;
- StrEnum doesn’t work on Python 3.10
- noqa should be removed now that we have enums in the API

Signed-off-by: Helder Correia <[email protected]>
Following Alex's suggestion, add comment to explain logic

Signed-off-by: grouville <[email protected]>
@grouville
grouville merged commit 1874400 into dagger:main Feb 8, 2023
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.

4 participants