Forklift buildx provider

This commit is contained in:
Bryce Lampe
2024-03-25 11:40:33 -07:00
parent 2b348f84e4
commit d50d156bd8
349 changed files with 61549 additions and 1141 deletions

29
sdk/go/dockerbuild/x/config/config.go generated Normal file
View File

@@ -0,0 +1,29 @@
// Code generated by pulumi-language-go DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package config
import (
dockerbuild "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
var _ = internal.GetEnvOrDefault
// The build daemon's address.
func GetHost(ctx *pulumi.Context) string {
v, err := config.Try(ctx, "dockerbuild:host")
if err == nil {
return v
}
var value string
if d := internal.GetEnvOrDefault("", nil, "DOCKER_HOST"); d != nil {
value = d.(string)
}
return value
}
func GetRegistries(ctx *pulumi.Context) string {
return config.Get(ctx, "dockerbuild:registries")
}

2
sdk/go/dockerbuild/x/doc.go generated Normal file
View File

@@ -0,0 +1,2 @@
// A Pulumi provider for Docker buildx
package dockerbuild

1379
sdk/go/dockerbuild/x/image.go generated Normal file

File diff suppressed because it is too large Load Diff

276
sdk/go/dockerbuild/x/index.go generated Normal file
View File

@@ -0,0 +1,276 @@
// Code generated by pulumi-language-go DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package dockerbuild
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// An index (or manifest list) referencing one or more existing images.
//
// Useful for crafting a multi-platform image from several
// platform-specific images.
//
// This creates an OCI image index or a Docker manifest list depending on
// the media types of the source images.
//
// ## Example Usage
// ### Multi-platform registry caching
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// amd64, err := buildx.NewImage(ctx, "amd64", &buildx.ImageArgs{
// CacheFrom: buildx.CacheFromArray{
// &buildx.CacheFromArgs{
// Registry: &buildx.CacheFromRegistryArgs{
// Ref: pulumi.String("docker.io/pulumi/pulumi:cache-amd64"),
// },
// },
// },
// CacheTo: buildx.CacheToArray{
// &buildx.CacheToArgs{
// Registry: &buildx.CacheToRegistryArgs{
// Mode: buildx.CacheModeMax,
// Ref: pulumi.String("docker.io/pulumi/pulumi:cache-amd64"),
// },
// },
// },
// Context: &buildx.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Platforms: buildx.PlatformArray{
// buildx.Platform_Linux_amd64,
// },
// Tags: pulumi.StringArray{
// pulumi.String("docker.io/pulumi/pulumi:3.107.0-amd64"),
// },
// })
// if err != nil {
// return err
// }
// arm64, err := buildx.NewImage(ctx, "arm64", &buildx.ImageArgs{
// CacheFrom: buildx.CacheFromArray{
// &buildx.CacheFromArgs{
// Registry: &buildx.CacheFromRegistryArgs{
// Ref: pulumi.String("docker.io/pulumi/pulumi:cache-arm64"),
// },
// },
// },
// CacheTo: buildx.CacheToArray{
// &buildx.CacheToArgs{
// Registry: &buildx.CacheToRegistryArgs{
// Mode: buildx.CacheModeMax,
// Ref: pulumi.String("docker.io/pulumi/pulumi:cache-arm64"),
// },
// },
// },
// Context: &buildx.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Platforms: buildx.PlatformArray{
// buildx.Platform_Linux_arm64,
// },
// Tags: pulumi.StringArray{
// pulumi.String("docker.io/pulumi/pulumi:3.107.0-arm64"),
// },
// })
// if err != nil {
// return err
// }
// index, err := buildx.NewIndex(ctx, "index", &buildx.IndexArgs{
// Sources: pulumi.StringArray{
// amd64.Ref,
// arm64.Ref,
// },
// Tag: pulumi.String("docker.io/pulumi/pulumi:3.107.0"),
// })
// if err != nil {
// return err
// }
// ctx.Export("ref", index.Ref)
// return nil
// })
// }
//
// ```
type Index struct {
pulumi.CustomResourceState
// If true, push the index to the target registry.
//
// Defaults to `true`.
Push pulumix.Output[*bool] `pulumi:"push"`
// The pushed tag with digest.
//
// Identical to the tag if the index was not pushed.
Ref pulumix.Output[string] `pulumi:"ref"`
// Authentication for the registry where the tagged index will be pushed.
//
// Credentials can also be included with the provider's configuration.
Registry pulumix.GPtrOutput[Registry, RegistryOutput] `pulumi:"registry"`
// Existing images to include in the index.
Sources pulumix.ArrayOutput[string] `pulumi:"sources"`
// The tag to apply to the index.
Tag pulumix.Output[string] `pulumi:"tag"`
}
// NewIndex registers a new resource with the given unique name, arguments, and options.
func NewIndex(ctx *pulumi.Context,
name string, args *IndexArgs, opts ...pulumi.ResourceOption) (*Index, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Sources == nil {
return nil, errors.New("invalid value for required argument 'Sources'")
}
if args.Tag == nil {
return nil, errors.New("invalid value for required argument 'Tag'")
}
if args.Push == nil {
args.Push = pulumix.Ptr(true)
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Index
err := ctx.RegisterResource("dockerbuild:index:Index", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetIndex gets an existing Index resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetIndex(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *IndexState, opts ...pulumi.ResourceOption) (*Index, error) {
var resource Index
err := ctx.ReadResource("dockerbuild:index:Index", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Index resources.
type indexState struct {
}
type IndexState struct {
}
func (IndexState) ElementType() reflect.Type {
return reflect.TypeOf((*indexState)(nil)).Elem()
}
type indexArgs struct {
// If true, push the index to the target registry.
//
// Defaults to `true`.
Push *bool `pulumi:"push"`
// Authentication for the registry where the tagged index will be pushed.
//
// Credentials can also be included with the provider's configuration.
Registry *Registry `pulumi:"registry"`
// Existing images to include in the index.
Sources []string `pulumi:"sources"`
// The tag to apply to the index.
Tag string `pulumi:"tag"`
}
// The set of arguments for constructing a Index resource.
type IndexArgs struct {
// If true, push the index to the target registry.
//
// Defaults to `true`.
Push pulumix.Input[*bool]
// Authentication for the registry where the tagged index will be pushed.
//
// Credentials can also be included with the provider's configuration.
Registry pulumix.Input[*RegistryArgs]
// Existing images to include in the index.
Sources pulumix.Input[[]string]
// The tag to apply to the index.
Tag pulumix.Input[string]
}
func (IndexArgs) ElementType() reflect.Type {
return reflect.TypeOf((*indexArgs)(nil)).Elem()
}
type IndexOutput struct{ *pulumi.OutputState }
func (IndexOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Index)(nil)).Elem()
}
func (o IndexOutput) ToIndexOutput() IndexOutput {
return o
}
func (o IndexOutput) ToIndexOutputWithContext(ctx context.Context) IndexOutput {
return o
}
func (o IndexOutput) ToOutput(ctx context.Context) pulumix.Output[Index] {
return pulumix.Output[Index]{
OutputState: o.OutputState,
}
}
// If true, push the index to the target registry.
//
// Defaults to `true`.
func (o IndexOutput) Push() pulumix.Output[*bool] {
value := pulumix.Apply[Index](o, func(v Index) pulumix.Output[*bool] { return v.Push })
return pulumix.Flatten[*bool, pulumix.Output[*bool]](value)
}
// The pushed tag with digest.
//
// Identical to the tag if the index was not pushed.
func (o IndexOutput) Ref() pulumix.Output[string] {
value := pulumix.Apply[Index](o, func(v Index) pulumix.Output[string] { return v.Ref })
return pulumix.Flatten[string, pulumix.Output[string]](value)
}
// Authentication for the registry where the tagged index will be pushed.
//
// Credentials can also be included with the provider's configuration.
func (o IndexOutput) Registry() pulumix.GPtrOutput[Registry, RegistryOutput] {
value := pulumix.Apply[Index](o, func(v Index) pulumix.GPtrOutput[Registry, RegistryOutput] { return v.Registry })
unwrapped := pulumix.Flatten[*Registry, pulumix.GPtrOutput[Registry, RegistryOutput]](value)
return pulumix.GPtrOutput[Registry, RegistryOutput]{OutputState: unwrapped.OutputState}
}
// Existing images to include in the index.
func (o IndexOutput) Sources() pulumix.ArrayOutput[string] {
value := pulumix.Apply[Index](o, func(v Index) pulumix.ArrayOutput[string] { return v.Sources })
unwrapped := pulumix.Flatten[[]string, pulumix.ArrayOutput[string]](value)
return pulumix.ArrayOutput[string]{OutputState: unwrapped.OutputState}
}
// The tag to apply to the index.
func (o IndexOutput) Tag() pulumix.Output[string] {
value := pulumix.Apply[Index](o, func(v Index) pulumix.Output[string] { return v.Tag })
return pulumix.Flatten[string, pulumix.Output[string]](value)
}
func init() {
pulumi.RegisterOutputType(IndexOutput{})
}

68
sdk/go/dockerbuild/x/init.go generated Normal file
View File

@@ -0,0 +1,68 @@
// Code generated by pulumi-language-go DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package dockerbuild
import (
"fmt"
"github.com/blang/semver"
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type module struct {
version semver.Version
}
func (m *module) Version() semver.Version {
return m.version
}
func (m *module) Construct(ctx *pulumi.Context, name, typ, urn string) (r pulumi.Resource, err error) {
switch typ {
case "dockerbuild:index:Image":
r = &Image{}
case "dockerbuild:index:Index":
r = &Index{}
default:
return nil, fmt.Errorf("unknown resource type: %s", typ)
}
err = ctx.RegisterResource(typ, name, nil, r, pulumi.URN_(urn))
return
}
type pkg struct {
version semver.Version
}
func (p *pkg) Version() semver.Version {
return p.version
}
func (p *pkg) ConstructProvider(ctx *pulumi.Context, name, typ, urn string) (pulumi.ProviderResource, error) {
if typ != "pulumi:providers:dockerbuild" {
return nil, fmt.Errorf("unknown provider type: %s", typ)
}
r := &Provider{}
err := ctx.RegisterResource(typ, name, nil, r, pulumi.URN_(urn))
return r, err
}
func init() {
version, err := internal.PkgVersion()
if err != nil {
version = semver.Version{Major: 1}
}
pulumi.RegisterResourceModule(
"dockerbuild",
"index",
&module{version},
)
pulumi.RegisterResourcePackage(
"dockerbuild",
&pkg{version},
)
}

88
sdk/go/dockerbuild/x/provider.go generated Normal file
View File

@@ -0,0 +1,88 @@
// Code generated by pulumi-language-go DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package dockerbuild
import (
"context"
"reflect"
"github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
type Provider struct {
pulumi.ProviderResourceState
// The build daemon's address.
Host pulumix.Output[*string] `pulumi:"host"`
}
// NewProvider registers a new resource with the given unique name, arguments, and options.
func NewProvider(ctx *pulumi.Context,
name string, args *ProviderArgs, opts ...pulumi.ResourceOption) (*Provider, error) {
if args == nil {
args = &ProviderArgs{}
}
if args.Host == nil {
if d := internal.GetEnvOrDefault("", nil, "DOCKER_HOST"); d != nil {
args.Host = pulumix.Ptr(d.(string))
}
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Provider
err := ctx.RegisterResource("pulumi:providers:dockerbuild", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
type providerArgs struct {
// The build daemon's address.
Host *string `pulumi:"host"`
Registries []Registry `pulumi:"registries"`
}
// The set of arguments for constructing a Provider resource.
type ProviderArgs struct {
// The build daemon's address.
Host pulumix.Input[*string]
Registries pulumix.Input[[]*RegistryArgs]
}
func (ProviderArgs) ElementType() reflect.Type {
return reflect.TypeOf((*providerArgs)(nil)).Elem()
}
type ProviderOutput struct{ *pulumi.OutputState }
func (ProviderOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Provider)(nil)).Elem()
}
func (o ProviderOutput) ToProviderOutput() ProviderOutput {
return o
}
func (o ProviderOutput) ToProviderOutputWithContext(ctx context.Context) ProviderOutput {
return o
}
func (o ProviderOutput) ToOutput(ctx context.Context) pulumix.Output[Provider] {
return pulumix.Output[Provider]{
OutputState: o.OutputState,
}
}
// The build daemon's address.
func (o ProviderOutput) Host() pulumix.Output[*string] {
value := pulumix.Apply[Provider](o, func(v Provider) pulumix.Output[*string] { return v.Host })
return pulumix.Flatten[*string, pulumix.Output[*string]](value)
}
func init() {
pulumi.RegisterOutputType(ProviderOutput{})
}

68
sdk/go/dockerbuild/x/pulumiEnums.go generated Normal file
View File

@@ -0,0 +1,68 @@
// Code generated by pulumi-language-go DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package dockerbuild
type CacheMode string
const (
// Only layers that are exported into the resulting image are cached.
CacheModeCacheModeMin = CacheMode("min")
// All layers are cached, even those of intermediate steps.
CacheModeCacheModeMax = CacheMode("max")
)
type CompressionType string
const (
// Use `gzip` for compression.
CompressionTypeCompressionTypeGzip = CompressionType("gzip")
// Use `estargz` for compression.
CompressionTypeCompressionTypeEstargz = CompressionType("estargz")
// Use `zstd` for compression.
CompressionTypeCompressionTypeZstd = CompressionType("zstd")
)
type NetworkMode string
const (
// The default sandbox network mode.
NetworkModeNetworkModeDefault = NetworkMode("default")
// Host network mode.
NetworkModeNetworkModeHost = NetworkMode("host")
// Disable network access.
NetworkModeNetworkModeNone = NetworkMode("none")
)
type Platform string
const (
Platform_Platform_Darwin_386 = Platform("darwin/386")
Platform_Platform_Darwin_amd64 = Platform("darwin/amd64")
Platform_Platform_Darwin_arm = Platform("darwin/arm")
Platform_Platform_Darwin_arm64 = Platform("darwin/arm64")
Platform_Platform_Dragonfly_amd64 = Platform("dragonfly/amd64")
Platform_Platform_Freebsd_386 = Platform("freebsd/386")
Platform_Platform_Freebsd_amd64 = Platform("freebsd/amd64")
Platform_Platform_Freebsd_arm = Platform("freebsd/arm")
Platform_Platform_Linux_386 = Platform("linux/386")
Platform_Platform_Linux_amd64 = Platform("linux/amd64")
Platform_Platform_Linux_arm = Platform("linux/arm")
Platform_Platform_Linux_arm64 = Platform("linux/arm64")
Platform_Platform_Linux_mips64 = Platform("linux/mips64")
Platform_Platform_Linux_mips64le = Platform("linux/mips64le")
Platform_Platform_Linux_ppc64le = Platform("linux/ppc64le")
Platform_Platform_Linux_riscv64 = Platform("linux/riscv64")
Platform_Platform_Linux_s390x = Platform("linux/s390x")
Platform_Platform_Netbsd_386 = Platform("netbsd/386")
Platform_Platform_Netbsd_amd64 = Platform("netbsd/amd64")
Platform_Platform_Netbsd_arm = Platform("netbsd/arm")
Platform_Platform_Openbsd_386 = Platform("openbsd/386")
Platform_Platform_Openbsd_amd64 = Platform("openbsd/amd64")
Platform_Platform_Openbsd_arm = Platform("openbsd/arm")
Platform_Platform_Plan9_386 = Platform("plan9/386")
Platform_Platform_Plan9_amd64 = Platform("plan9/amd64")
Platform_Platform_Solaris_amd64 = Platform("solaris/amd64")
Platform_Platform_Windows_386 = Platform("windows/386")
Platform_Platform_Windows_amd64 = Platform("windows/amd64")
)

3413
sdk/go/dockerbuild/x/pulumiTypes.go generated Normal file

File diff suppressed because it is too large Load Diff