Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API types for caches, exports, and platforms #993

Closed
wants to merge 7 commits into from

Conversation

blampe
Copy link
Contributor

@blampe blampe commented Feb 13, 2024

This is a large change but it's mostly boilerplate for stronger typing around
Docker's stringy-typed CLI parameters, plus logic to convert our types into the
CSV format Docker expects.

For background, Docker accepts types like this:

--cache-from=type=local,src=/foo/bar --platform=linux/amd64 --output=type=registry,ref=docker.io/foo/bar:baz

We were accepting the same style of strings, but this is awkward to work with
once things become moderately complex. To remedy this, we add typing around
platforms, exports, cacheTo and cacheFrom:

  • platforms: There are only a few dozen supported OS/Arch combinations, so
    this becomes an enum.

  • cacheTo/cacheFrom/exports: These become union-ish types (I don't think
    go-provider allows us to create OneOf types). We preserve a "raw" option if
    the user would prefer to use Docker-style strings.

I'm bundling all of these together because the type signature changes will
require me to manually clean up state files in order to upgrade folks on the
alpha (refs. pulumi/pulumi-go-provider#193). Please
tell me if you have API feedback because this will be difficult to change!

If we're happy with the direction, I'll probably cut a beta from this branch.

Other API tweaks while I was in here:

  • Tags are now only required if pushing to a registry, to match Docker.

  • Multiple exports are no longer allowed to match pre-v25 Docker. After
    Upgrade to docker v25 #958 we should be able to
    remove this restriction.

  • Expose the build target parameter in the SDK.

Fixes #970

Copy link

Does the PR have any schema changes?

Does the PR have any schema changes?

Looking good! No breaking changes found.

New resources:

  • buildx/image.Image

Maintainer note: consult the runbook for dealing with any breaking changes.

@blampe
Copy link
Contributor Author

blampe commented Feb 13, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @blampe and the rest of your teammates on Graphite Graphite

@blampe blampe force-pushed the multi-platform-cache branch from e777254 to 6c70bf9 Compare February 13, 2024 23:48
@blampe blampe force-pushed the api-types branch 2 times, most recently from 80364f9 to 5853093 Compare February 14, 2024 00:31
@blampe blampe force-pushed the multi-platform-cache branch from 6c70bf9 to 993f4f2 Compare February 15, 2024 19:16
@blampe blampe force-pushed the api-types branch 2 times, most recently from 9fb7475 to b55c21c Compare February 15, 2024 19:17
@blampe blampe mentioned this pull request Feb 15, 2024
@blampe blampe force-pushed the multi-platform-cache branch from 993f4f2 to 65c365b Compare February 15, 2024 19:29
@blampe blampe force-pushed the multi-platform-cache branch from 65c365b to 7e84223 Compare February 15, 2024 22:06
@blampe blampe force-pushed the api-types branch 2 times, most recently from 839817c to dff1663 Compare February 16, 2024 20:12
@blampe blampe force-pushed the api-types branch 4 times, most recently from d8a6b69 to 9cb13ff Compare February 17, 2024 05:41
@blampe blampe force-pushed the multi-platform-cache branch from 7e84223 to a3aebfb Compare February 29, 2024 19:29
@blampe blampe force-pushed the multi-platform-cache branch from a3aebfb to faee9fa Compare March 5, 2024 20:54
@blampe blampe closed this Apr 19, 2024
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.

1 participant