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

View File

@@ -1 +1 @@
Description
A Pulumi provider for Docker buildx

View File

@@ -5,8 +5,20 @@
from . import _utilities
import typing
# Export this package's modules as members:
from ._enums import *
from .image import *
from .index import *
from .provider import *
from .random import *
from ._inputs import *
from . import outputs
# Make subpackages available:
if typing.TYPE_CHECKING:
import pulumi_dockerbuild.config as __config
config = __config
else:
config = _utilities.lazy_import('pulumi_dockerbuild.config')
_utilities.register(
resource_modules="""
[
@@ -15,7 +27,8 @@ _utilities.register(
"mod": "index",
"fqn": "pulumi_dockerbuild",
"classes": {
"dockerbuild:index:Random": "Random"
"dockerbuild:index:Image": "Image",
"dockerbuild:index:Index": "Index"
}
}
]

84
sdk/python/pulumi_dockerbuild/_enums.py generated Normal file
View File

@@ -0,0 +1,84 @@
# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from enum import Enum
__all__ = [
'CacheMode',
'CompressionType',
'NetworkMode',
'Platform',
]
class CacheMode(str, Enum):
MIN = "min"
"""
Only layers that are exported into the resulting image are cached.
"""
MAX = "max"
"""
All layers are cached, even those of intermediate steps.
"""
class CompressionType(str, Enum):
GZIP = "gzip"
"""
Use `gzip` for compression.
"""
ESTARGZ = "estargz"
"""
Use `estargz` for compression.
"""
ZSTD = "zstd"
"""
Use `zstd` for compression.
"""
class NetworkMode(str, Enum):
DEFAULT = "default"
"""
The default sandbox network mode.
"""
HOST = "host"
"""
Host network mode.
"""
NONE = "none"
"""
Disable network access.
"""
class Platform(str, Enum):
DARWIN_386 = "darwin/386"
DARWIN_AMD64 = "darwin/amd64"
DARWIN_ARM = "darwin/arm"
DARWIN_ARM64 = "darwin/arm64"
DRAGONFLY_AMD64 = "dragonfly/amd64"
FREEBSD_386 = "freebsd/386"
FREEBSD_AMD64 = "freebsd/amd64"
FREEBSD_ARM = "freebsd/arm"
LINUX_386 = "linux/386"
LINUX_AMD64 = "linux/amd64"
LINUX_ARM = "linux/arm"
LINUX_ARM64 = "linux/arm64"
LINUX_MIPS64 = "linux/mips64"
LINUX_MIPS64LE = "linux/mips64le"
LINUX_PPC64LE = "linux/ppc64le"
LINUX_RISCV64 = "linux/riscv64"
LINUX_S390X = "linux/s390x"
NETBSD_386 = "netbsd/386"
NETBSD_AMD64 = "netbsd/amd64"
NETBSD_ARM = "netbsd/arm"
OPENBSD_386 = "openbsd/386"
OPENBSD_AMD64 = "openbsd/amd64"
OPENBSD_ARM = "openbsd/arm"
PLAN9_386 = "plan9/386"
PLAN9_AMD64 = "plan9/amd64"
SOLARIS_AMD64 = "solaris/amd64"
WINDOWS_386 = "windows/386"
WINDOWS_AMD64 = "windows/amd64"

2672
sdk/python/pulumi_dockerbuild/_inputs.py generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import sys
from .vars import _ExportableConfig
sys.modules[__name__].__class__ = _ExportableConfig

View File

@@ -0,0 +1,19 @@
# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from .. import outputs as _root_outputs
host: str
"""
The build daemon's address.
"""
registries: Optional[str]

View File

@@ -0,0 +1,29 @@
# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from .. import outputs as _root_outputs
import types
__config__ = pulumi.Config('dockerbuild')
class _ExportableConfig(types.ModuleType):
@property
def host(self) -> str:
"""
The build daemon's address.
"""
return __config__.get('host') or (_utilities.get_env('DOCKER_HOST') or '')
@property
def registries(self) -> Optional[str]:
return __config__.get('registries')

1798
sdk/python/pulumi_dockerbuild/image.py generated Normal file

File diff suppressed because it is too large Load Diff

352
sdk/python/pulumi_dockerbuild/index.py generated Normal file
View File

@@ -0,0 +1,352 @@
# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
from . import outputs
from ._inputs import *
__all__ = ['IndexArgs', 'Index']
@pulumi.input_type
class IndexArgs:
def __init__(__self__, *,
sources: pulumi.Input[Sequence[pulumi.Input[str]]],
tag: pulumi.Input[str],
push: Optional[pulumi.Input[bool]] = None,
registry: Optional[pulumi.Input['RegistryArgs']] = None):
"""
The set of arguments for constructing a Index resource.
:param pulumi.Input[Sequence[pulumi.Input[str]]] sources: Existing images to include in the index.
:param pulumi.Input[str] tag: The tag to apply to the index.
:param pulumi.Input[bool] push: If true, push the index to the target registry.
Defaults to `true`.
:param pulumi.Input['RegistryArgs'] registry: Authentication for the registry where the tagged index will be pushed.
Credentials can also be included with the provider's configuration.
"""
pulumi.set(__self__, "sources", sources)
pulumi.set(__self__, "tag", tag)
if push is None:
push = True
if push is not None:
pulumi.set(__self__, "push", push)
if registry is not None:
pulumi.set(__self__, "registry", registry)
@property
@pulumi.getter
def sources(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:
"""
Existing images to include in the index.
"""
return pulumi.get(self, "sources")
@sources.setter
def sources(self, value: pulumi.Input[Sequence[pulumi.Input[str]]]):
pulumi.set(self, "sources", value)
@property
@pulumi.getter
def tag(self) -> pulumi.Input[str]:
"""
The tag to apply to the index.
"""
return pulumi.get(self, "tag")
@tag.setter
def tag(self, value: pulumi.Input[str]):
pulumi.set(self, "tag", value)
@property
@pulumi.getter
def push(self) -> Optional[pulumi.Input[bool]]:
"""
If true, push the index to the target registry.
Defaults to `true`.
"""
return pulumi.get(self, "push")
@push.setter
def push(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "push", value)
@property
@pulumi.getter
def registry(self) -> Optional[pulumi.Input['RegistryArgs']]:
"""
Authentication for the registry where the tagged index will be pushed.
Credentials can also be included with the provider's configuration.
"""
return pulumi.get(self, "registry")
@registry.setter
def registry(self, value: Optional[pulumi.Input['RegistryArgs']]):
pulumi.set(self, "registry", value)
class Index(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
push: Optional[pulumi.Input[bool]] = None,
registry: Optional[pulumi.Input[pulumi.InputType['RegistryArgs']]] = None,
sources: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
tag: Optional[pulumi.Input[str]] = None,
__props__=None):
"""
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
```python
import pulumi
import pulumi_docker as docker
amd64 = docker.buildx.Image("amd64",
cache_from=[docker.buildx.CacheFromArgs(
registry=docker.buildx.CacheFromRegistryArgs(
ref="docker.io/pulumi/pulumi:cache-amd64",
),
)],
cache_to=[docker.buildx.CacheToArgs(
registry=docker.buildx.CacheToRegistryArgs(
mode=docker.buildx.image.CacheMode.MAX,
ref="docker.io/pulumi/pulumi:cache-amd64",
),
)],
context=docker.buildx.BuildContextArgs(
location="app",
),
platforms=[docker.buildx.image.Platform.LINUX_AMD64],
tags=["docker.io/pulumi/pulumi:3.107.0-amd64"])
arm64 = docker.buildx.Image("arm64",
cache_from=[docker.buildx.CacheFromArgs(
registry=docker.buildx.CacheFromRegistryArgs(
ref="docker.io/pulumi/pulumi:cache-arm64",
),
)],
cache_to=[docker.buildx.CacheToArgs(
registry=docker.buildx.CacheToRegistryArgs(
mode=docker.buildx.image.CacheMode.MAX,
ref="docker.io/pulumi/pulumi:cache-arm64",
),
)],
context=docker.buildx.BuildContextArgs(
location="app",
),
platforms=[docker.buildx.image.Platform.LINUX_ARM64],
tags=["docker.io/pulumi/pulumi:3.107.0-arm64"])
index = docker.buildx.Index("index",
sources=[
amd64.ref,
arm64.ref,
],
tag="docker.io/pulumi/pulumi:3.107.0")
pulumi.export("ref", index.ref)
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[bool] push: If true, push the index to the target registry.
Defaults to `true`.
:param pulumi.Input[pulumi.InputType['RegistryArgs']] registry: Authentication for the registry where the tagged index will be pushed.
Credentials can also be included with the provider's configuration.
:param pulumi.Input[Sequence[pulumi.Input[str]]] sources: Existing images to include in the index.
:param pulumi.Input[str] tag: The tag to apply to the index.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: IndexArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
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
```python
import pulumi
import pulumi_docker as docker
amd64 = docker.buildx.Image("amd64",
cache_from=[docker.buildx.CacheFromArgs(
registry=docker.buildx.CacheFromRegistryArgs(
ref="docker.io/pulumi/pulumi:cache-amd64",
),
)],
cache_to=[docker.buildx.CacheToArgs(
registry=docker.buildx.CacheToRegistryArgs(
mode=docker.buildx.image.CacheMode.MAX,
ref="docker.io/pulumi/pulumi:cache-amd64",
),
)],
context=docker.buildx.BuildContextArgs(
location="app",
),
platforms=[docker.buildx.image.Platform.LINUX_AMD64],
tags=["docker.io/pulumi/pulumi:3.107.0-amd64"])
arm64 = docker.buildx.Image("arm64",
cache_from=[docker.buildx.CacheFromArgs(
registry=docker.buildx.CacheFromRegistryArgs(
ref="docker.io/pulumi/pulumi:cache-arm64",
),
)],
cache_to=[docker.buildx.CacheToArgs(
registry=docker.buildx.CacheToRegistryArgs(
mode=docker.buildx.image.CacheMode.MAX,
ref="docker.io/pulumi/pulumi:cache-arm64",
),
)],
context=docker.buildx.BuildContextArgs(
location="app",
),
platforms=[docker.buildx.image.Platform.LINUX_ARM64],
tags=["docker.io/pulumi/pulumi:3.107.0-arm64"])
index = docker.buildx.Index("index",
sources=[
amd64.ref,
arm64.ref,
],
tag="docker.io/pulumi/pulumi:3.107.0")
pulumi.export("ref", index.ref)
```
:param str resource_name: The name of the resource.
:param IndexArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
def __init__(__self__, resource_name: str, *args, **kwargs):
resource_args, opts = _utilities.get_resource_args_opts(IndexArgs, pulumi.ResourceOptions, *args, **kwargs)
if resource_args is not None:
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
else:
__self__._internal_init(resource_name, *args, **kwargs)
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
push: Optional[pulumi.Input[bool]] = None,
registry: Optional[pulumi.Input[pulumi.InputType['RegistryArgs']]] = None,
sources: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
tag: Optional[pulumi.Input[str]] = None,
__props__=None):
opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = IndexArgs.__new__(IndexArgs)
if push is None:
push = True
__props__.__dict__["push"] = push
__props__.__dict__["registry"] = registry
if sources is None and not opts.urn:
raise TypeError("Missing required property 'sources'")
__props__.__dict__["sources"] = sources
if tag is None and not opts.urn:
raise TypeError("Missing required property 'tag'")
__props__.__dict__["tag"] = tag
__props__.__dict__["ref"] = None
super(Index, __self__).__init__(
'dockerbuild:index:Index',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None) -> 'Index':
"""
Get an existing Index resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = IndexArgs.__new__(IndexArgs)
__props__.__dict__["push"] = None
__props__.__dict__["ref"] = None
__props__.__dict__["registry"] = None
__props__.__dict__["sources"] = None
__props__.__dict__["tag"] = None
return Index(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter
def push(self) -> pulumi.Output[Optional[bool]]:
"""
If true, push the index to the target registry.
Defaults to `true`.
"""
return pulumi.get(self, "push")
@property
@pulumi.getter
def ref(self) -> pulumi.Output[str]:
"""
The pushed tag with digest.
Identical to the tag if the index was not pushed.
"""
return pulumi.get(self, "ref")
@property
@pulumi.getter
def registry(self) -> pulumi.Output[Optional['outputs.Registry']]:
"""
Authentication for the registry where the tagged index will be pushed.
Credentials can also be included with the provider's configuration.
"""
return pulumi.get(self, "registry")
@property
@pulumi.getter
def sources(self) -> pulumi.Output[Sequence[str]]:
"""
Existing images to include in the index.
"""
return pulumi.get(self, "sources")
@property
@pulumi.getter
def tag(self) -> pulumi.Output[str]:
"""
The tag to apply to the index.
"""
return pulumi.get(self, "tag")

2399
sdk/python/pulumi_dockerbuild/outputs.py generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -8,16 +8,46 @@ import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
from ._inputs import *
__all__ = ['ProviderArgs', 'Provider']
@pulumi.input_type
class ProviderArgs:
def __init__(__self__):
def __init__(__self__, *,
host: Optional[pulumi.Input[str]] = None,
registries: Optional[pulumi.Input[Sequence[pulumi.Input['RegistryArgs']]]] = None):
"""
The set of arguments for constructing a Provider resource.
:param pulumi.Input[str] host: The build daemon's address.
"""
pass
if host is None:
host = (_utilities.get_env('DOCKER_HOST') or '')
if host is not None:
pulumi.set(__self__, "host", host)
if registries is not None:
pulumi.set(__self__, "registries", registries)
@property
@pulumi.getter
def host(self) -> Optional[pulumi.Input[str]]:
"""
The build daemon's address.
"""
return pulumi.get(self, "host")
@host.setter
def host(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "host", value)
@property
@pulumi.getter
def registries(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['RegistryArgs']]]]:
return pulumi.get(self, "registries")
@registries.setter
def registries(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['RegistryArgs']]]]):
pulumi.set(self, "registries", value)
class Provider(pulumi.ProviderResource):
@@ -25,11 +55,14 @@ class Provider(pulumi.ProviderResource):
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
host: Optional[pulumi.Input[str]] = None,
registries: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['RegistryArgs']]]]] = None,
__props__=None):
"""
Create a Dockerbuild resource with the given unique name, props, and options.
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] host: The build daemon's address.
"""
...
@overload
@@ -54,6 +87,8 @@ class Provider(pulumi.ProviderResource):
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
host: Optional[pulumi.Input[str]] = None,
registries: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['RegistryArgs']]]]] = None,
__props__=None):
opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
if not isinstance(opts, pulumi.ResourceOptions):
@@ -63,9 +98,21 @@ class Provider(pulumi.ProviderResource):
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = ProviderArgs.__new__(ProviderArgs)
if host is None:
host = (_utilities.get_env('DOCKER_HOST') or '')
__props__.__dict__["host"] = host
__props__.__dict__["registries"] = pulumi.Output.from_input(registries).apply(pulumi.runtime.to_json) if registries is not None else None
super(Provider, __self__).__init__(
'dockerbuild',
resource_name,
__props__,
opts)
@property
@pulumi.getter
def host(self) -> pulumi.Output[Optional[str]]:
"""
The build daemon's address.
"""
return pulumi.get(self, "host")

View File

@@ -1,117 +0,0 @@
# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
__all__ = ['RandomArgs', 'Random']
@pulumi.input_type
class RandomArgs:
def __init__(__self__, *,
length: pulumi.Input[int]):
"""
The set of arguments for constructing a Random resource.
"""
pulumi.set(__self__, "length", length)
@property
@pulumi.getter
def length(self) -> pulumi.Input[int]:
return pulumi.get(self, "length")
@length.setter
def length(self, value: pulumi.Input[int]):
pulumi.set(self, "length", value)
class Random(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
length: Optional[pulumi.Input[int]] = None,
__props__=None):
"""
Create a Random resource with the given unique name, props, and options.
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: RandomArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
Create a Random resource with the given unique name, props, and options.
:param str resource_name: The name of the resource.
:param RandomArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
def __init__(__self__, resource_name: str, *args, **kwargs):
resource_args, opts = _utilities.get_resource_args_opts(RandomArgs, pulumi.ResourceOptions, *args, **kwargs)
if resource_args is not None:
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
else:
__self__._internal_init(resource_name, *args, **kwargs)
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
length: Optional[pulumi.Input[int]] = None,
__props__=None):
opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = RandomArgs.__new__(RandomArgs)
if length is None and not opts.urn:
raise TypeError("Missing required property 'length'")
__props__.__dict__["length"] = length
__props__.__dict__["result"] = None
super(Random, __self__).__init__(
'dockerbuild:index:Random',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None) -> 'Random':
"""
Get an existing Random resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = RandomArgs.__new__(RandomArgs)
__props__.__dict__["length"] = None
__props__.__dict__["result"] = None
return Random(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter
def length(self) -> pulumi.Output[int]:
return pulumi.get(self, "length")
@property
@pulumi.getter
def result(self) -> pulumi.Output[str]:
return pulumi.get(self, "result")

View File

@@ -1,8 +1,8 @@
[project]
name = "pulumi_dockerbuild"
description = "Description"
description = "A Pulumi provider for Docker buildx"
dependencies = ["parver>=0.2.1", "pulumi>=3.0.0,<4.0.0", "semver>=2.8.1"]
keywords = ["keywords"]
keywords = ["docker", "buildkit", "buildx"]
readme = "README.md"
requires-python = ">=3.8"
version = "0.0.0"