From 0690ba6a9dd4124fbc7e2888186dc891adbf0d7a Mon Sep 17 00:00:00 2001 From: Bryce Lampe Date: Tue, 5 Mar 2024 14:24:32 -0800 Subject: [PATCH] Regenerate SDK --- .../cmd/pulumi-resource-docker/schema.json | 165 +++++--- sdk/dotnet/Buildx/Enums.cs | 38 ++ sdk/dotnet/Buildx/Image.cs | 187 ++++++++- sdk/dotnet/Buildx/Inputs/ExportEntryArgs.cs | 13 - sdk/dotnet/Buildx/Inputs/ManifestArgs.cs | 44 -- .../Buildx/Inputs/ManifestPlatformArgs.cs | 32 -- sdk/dotnet/Buildx/Inputs/SSHArgs.cs | 48 +++ sdk/dotnet/Buildx/Outputs/ExportEntry.cs | 8 - sdk/dotnet/Buildx/Outputs/Manifest.cs | 49 --- sdk/dotnet/Buildx/Outputs/ManifestPlatform.cs | 35 -- sdk/dotnet/Buildx/Outputs/SSH.cs | 45 ++ sdk/go/docker/buildx/image.go | 257 +++++++++++- sdk/go/docker/buildx/pulumiEnums.go | 174 ++++++++ sdk/go/docker/buildx/pulumiTypes.go | 343 +++++++--------- .../java/com/pulumi/docker/buildx/Image.java | 213 +++++++++- .../com/pulumi/docker/buildx/ImageArgs.java | 386 +++++++++++++++++- .../docker/buildx/enums/NetworkMode.java | 46 +++ .../docker/buildx/inputs/ExportEntryArgs.java | 54 --- .../docker/buildx/inputs/ManifestArgs.java | 207 ---------- .../buildx/inputs/ManifestPlatformArgs.java | 125 ------ .../pulumi/docker/buildx/inputs/SSHArgs.java | 182 +++++++++ .../docker/buildx/outputs/ExportEntry.java | 28 -- .../docker/buildx/outputs/Manifest.java | 129 ------ .../buildx/outputs/ManifestPlatform.java | 81 ---- .../com/pulumi/docker/buildx/outputs/SSH.java | 104 +++++ sdk/nodejs/buildx/image.ts | 156 ++++++- sdk/nodejs/types/enums/buildx/index.ts | 17 + sdk/nodejs/types/input.ts | 56 +-- sdk/nodejs/types/output.ts | 56 +-- sdk/python/pulumi_docker/buildx/_enums.py | 16 + sdk/python/pulumi_docker/buildx/_inputs.py | 183 +++------ sdk/python/pulumi_docker/buildx/image.py | 346 +++++++++++++++- sdk/python/pulumi_docker/buildx/outputs.py | 147 +++---- 33 files changed, 2529 insertions(+), 1441 deletions(-) delete mode 100644 sdk/dotnet/Buildx/Inputs/ManifestArgs.cs delete mode 100644 sdk/dotnet/Buildx/Inputs/ManifestPlatformArgs.cs create mode 100644 sdk/dotnet/Buildx/Inputs/SSHArgs.cs delete mode 100644 sdk/dotnet/Buildx/Outputs/Manifest.cs delete mode 100644 sdk/dotnet/Buildx/Outputs/ManifestPlatform.cs create mode 100644 sdk/dotnet/Buildx/Outputs/SSH.cs create mode 100644 sdk/java/src/main/java/com/pulumi/docker/buildx/enums/NetworkMode.java delete mode 100644 sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/ManifestArgs.java delete mode 100644 sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/ManifestPlatformArgs.java create mode 100644 sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/SSHArgs.java delete mode 100644 sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/Manifest.java delete mode 100644 sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/ManifestPlatform.java create mode 100644 sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/SSH.java diff --git a/provider/cmd/pulumi-resource-docker/schema.json b/provider/cmd/pulumi-resource-docker/schema.json index c25cd489..0fdb8a63 100644 --- a/provider/cmd/pulumi-resource-docker/schema.json +++ b/provider/cmd/pulumi-resource-docker/schema.json @@ -726,13 +726,6 @@ "$ref": "#/types/docker:buildx/image:ExportLocal", "description": "Export to a local directory as files and directories." }, - "manifests": { - "type": "array", - "items": { - "$ref": "#/types/docker:buildx/image:Manifest" - }, - "description": "An output property populated for exporters that pushed image\nmanifest(s) to a registry." - }, "oci": { "$ref": "#/types/docker:buildx/image:ExportOCI", "description": "Identical to the Docker exporter but uses OCI media types by default." @@ -961,48 +954,21 @@ "dest" ] }, - "docker:buildx/image:Manifest": { - "properties": { - "digest": { - "type": "string", - "description": "The SHA256 digest of the manifest." - }, - "platform": { - "$ref": "#/types/docker:buildx/image:ManifestPlatform", - "description": "The manifest's platform." - }, - "ref": { - "type": "string", - "description": "The manifest's canonical ref." + "docker:buildx/image:NetworkMode": { + "type": "string", + "enum": [ + { + "description": "The default sandbox network mode.", + "value": "default" }, - "size": { - "type": "integer", - "description": "The size of the manifest in bytes." - } - }, - "type": "object", - "required": [ - "digest", - "platform", - "ref", - "size" - ] - }, - "docker:buildx/image:ManifestPlatform": { - "properties": { - "architecture": { - "type": "string", - "description": "The manifest's architecture." + { + "description": "Host network mode.", + "value": "host" }, - "os": { - "type": "string", - "description": "The manifest's operating systen." + { + "description": "Disable network access.", + "value": "none" } - }, - "type": "object", - "required": [ - "os", - "architecture" ] }, "docker:buildx/image:Platform": { @@ -1115,6 +1081,25 @@ "address" ] }, + "docker:buildx/image:SSH": { + "properties": { + "id": { + "type": "string", + "description": "Useful for distinguishing different servers that are part of the same\nbuild.\n\nA value of `default` is appropriate if only dealing with a single host." + }, + "paths": { + "type": "array", + "items": { + "type": "string" + }, + "description": "SSH agent socket or private keys to expose to the build under the given\nidentifier.\n\nDefaults to `[$SSH_AUTH_SOCK]`.\n\nNote that your keys are **not** automatically added when using an\nagent. Run `ssh-add -l` locally to confirm which public keys are\nvisible to the agent; these will be exposed to your build." + } + }, + "type": "object", + "required": [ + "id" + ] + }, "docker:config/registryAuth:registryAuth": { "properties": { "address": { @@ -3089,6 +3074,13 @@ "docker:buildx/image:Image": { "description": "A Docker image built using buildx -- Docker's interface to the improved\nBuildKit backend.\n\n## Stability\n\n**This resource is experimental and subject to change.**\n\nAPI types are unstable. Subsequent releases _may_ require manual edits\nto your state file(s) in order to adopt API changes.\n\n`retainOnDelete: true` is recommended with this resource until it is\nstable. This enables future API changes to be adopted more easily by renaming\nresources.\n\nOnly use this resource if you understand and accept the risks.\n\n## Migrating v3 and v4 Image resources\n\nThe `buildx.Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.\nExisting `Image` resources can be converted to `build.Image` resources with minor modifications.\n\n### Behavioral differences\n\nThere are several key behavioral differences to keep in mind when transitioning images to the new `buildx.Image` resource.\n\n#### Previews\n\nVersion `3.x` of the Pulumi Docker provider always builds images during preview operations.\nThis is helpful as a safeguard to prevent \"broken\" images from merging, but users found the behavior unnecessarily redundant when running previews and updates locally.\n\nVersion `4.x` changed build-on-preview behavior to be opt-in.\nBy default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.\nSome users felt this made previews in CI less helpful because they no longer detected bad images by default.\n\nThe default behavior of the `buildx.Image` resource has been changed to strike a better balance between CI use cases and manual updates.\nBy default, Pulumi will now only build `buildx.Image` resources during previews when it detects a CI environment like GitHub Actions.\nPreviews run in non-CI environments will not build images.\nThis behavior is still configurable with `buildOnPreview`.\n\n#### Push behavior\n\nVersions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.\nThey expose a `skipPush: true` option to disable pushing.\n\nThe `buildx.Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.\n\nTo push images to a registry you can include `push: true` (equivalent to Docker's `--push` flag) or configure an `export` of type `registry` (equivalent to Docker's `--output type=registry`).\nLike Docker, if an image is configured without exports you will see a warning with instructions for how to enable pushing, but the build will still proceed normally.\n\n#### Secrets\n\nVersion `3.x` of the Pulumi Docker provider supports secrets by way of the `extraOptions` field.\n\nVersion `4.x` of the Pulumi Docker provider does not support secrets.\n\nThe `buildx.Image` resource supports secrets but does not require those secrets to exist on-disk or in environment variables.\nInstead, they should be passed directly as values.\n(Please be sure to familiarize yourself with Pulumi's [native secret handling](https://www.pulumi.com/docs/concepts/secrets/).)\nPulumi also provides [ESC](https://www.pulumi.com/product/esc/) to make it easier to share secrets across stacks and environments.\n\n#### Caching\n\nVersion `3.x` of the Pulumi Docker provider exposes `cacheFrom: bool | { stages: [...] }`.\nIt builds targets individually and pushes them to separate images for caching.\n\nVersion `4.x` exposes a similar parameter `cacheFrom: { images: [...] }` which pushes and pulls inline caches.\n\nBoth versions 3 and 4 require specific environment variables to be set and deviate from Docker's native caching behavior.\nThis can result in inefficient builds due to unnecessary image pulls, repeated file transfers, etc.\n\nThe `buildx.Image` resource delegates all caching behavior to Docker.\n`cacheFrom` and `cacheTo` options (equivalent to Docker's `--cache-to` and `--cache-from`) are exposed and provide additional cache targets, such as local disk, S3 storage, etc.\n\n#### Outputs\n\nTODO:\n\n#### Tag deletion and refreshes\n\nVersions 3 and 4 of Pulumi Docker provider do not delete tags when the `Image` resource is deleted, nor do they confirm expected tags exist during `refresh` operations.\n\nThe `buidx.Image` will query your registries during `refresh` to ensure the expected tags exist.\nIf any are missing a subsequent `update` will push them.\n\nWhen a `buildx.Image` is deleted, it will _attempt_ to also delete any pushed tags.\nDeletion of remote tags is not guaranteed, because not all registries currently support this operation (`docker.io` in particular).\n\nUse the [`retainOnDelete: true`](https://www.pulumi.com/docs/concepts/options/retainondelete/) option if you do not want tags deleted.\n\n### Example migration\n\nExamples of \"fully-featured\" `v3` and `v4` `Image` resources are shown below, along with an example `buildx.Image` resource showing how they would look after migration.\n\nThe `v3` resource leverages `buildx` via a `DOCKER_BUILDKIT` environment variable and CLI flags passed in with `extraOption`.\nAfter migration, the environment variable is no longer needed and CLI flags are now properties on the `buildx.Image`.\nIn almost all cases, properties of `buildx.Image` are named after the Docker CLI flag they correspond to.\n\nThe `v4` resource is less functional than its `v3` counterpart because it lacks the flexibility of `extraOptions`.\nIt it is shown with parameters similar to the `v3` example for completeness.\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### v3/v4 migration\n\n```typescript\n\n// v3 Image\nconst v3 = new docker.Image(\"v3-image\", {\n imageName: \"myregistry.com/user/repo:latest\",\n localImageName: \"local-tag\",\n skipPush: false,\n build: {\n dockerfile: \"./Dockerfile\",\n context: \"../app\",\n target: \"mytarget\",\n args: {\n MY_BUILD_ARG: \"foo\",\n },\n env: {\n DOCKER_BUILDKIT: \"1\",\n },\n extraOptions: [\n \"--cache-from\",\n \"type=registry,myregistry.com/user/repo:cache\",\n \"--cache-to\",\n \"type=registry,myregistry.com/user/repo:cache\",\n \"--add-host\",\n \"metadata.google.internal:169.254.169.254\",\n \"--secret\",\n \"id=mysecret,src=/local/secret\",\n \"--ssh\",\n \"default=/home/runner/.ssh/id_ed25519\",\n \"--network\",\n \"host\",\n \"--platform\",\n \"linux/amd64\",\n ],\n },\n registry: {\n server: \"myregistry.com\",\n username: \"username\",\n password: pulumi.secret(\"password\"),\n },\n});\n\n// v3 Image after migrating to buildx.Image\nconst v3Migrated = new docker.buildx.Image(\"v3-to-buildx\", {\n tags: [\"myregistry.com/user/repo:latest\", \"local-tag\"],\n push: true,\n dockerfile: {\n location: \"./Dockerfile\",\n },\n context: {\n location: \"../app\",\n },\n targets: [\"mytarget\"],\n buildArgs: {\n MY_BUILD_ARG: \"foo\",\n },\n cacheFrom: [{ registry: { ref: \"myregistry.com/user/repo:cache\" } }],\n cacheTo: [{ registry: { ref: \"myregistry.com/user/repo:cache\" } }],\n secrets: {\n mysecret: \"value\",\n },\n addHosts: [\"metadata.google.internal:169.254.169.254\"],\n ssh: {\n default: [\"/home/runner/.ssh/id_ed25519\"],\n },\n network: \"host\",\n platforms: [\"linux/amd64\"],\n registries: [{\n address: \"myregistry.com\",\n username: \"username\",\n password: pulumi.secret(\"password\"),\n }],\n});\n\n\n// v4 Image\nconst v4 = new docker.Image(\"v4-image\", {\n imageName: \"myregistry.com/user/repo:latest\",\n skipPush: false,\n build: {\n dockerfile: \"./Dockerfile\",\n context: \"../app\",\n target: \"mytarget\",\n args: {\n MY_BUILD_ARG: \"foo\",\n },\n cacheFrom: {\n images: [\"myregistry.com/user/repo:cache\"],\n },\n addHosts: [\"metadata.google.internal:169.254.169.254\"],\n network: \"host\",\n platform: \"linux/amd64\",\n },\n buildOnPreview: true,\n registry: {\n server: \"myregistry.com\",\n username: \"username\",\n password: pulumi.secret(\"password\"),\n },\n});\n\n// v4 Image after migrating to buildx.Image\nconst v4Migrated = new docker.buildx.Image(\"v4-to-buildx\", {\n tags: [\"myregistry.com/user/repo:latest\"],\n push: true,\n dockerfile: {\n location: \"./Dockerfile\",\n },\n context: {\n location: \"../app\",\n },\n targets: [\"mytarget\"],\n buildArgs: {\n MY_BUILD_ARG: \"foo\",\n },\n cacheFrom: [{ registry: { ref: \"myregistry.com/user/repo:cache\" } }],\n cacheTo: [{ registry: { ref: \"myregistry.com/user/repo:cache\" } }],\n addHosts: [\"metadata.google.internal:169.254.169.254\"],\n network: \"host\",\n platforms: [\"linux/amd64\"],\n registries: [{\n address: \"myregistry.com\",\n username: \"username\",\n password: pulumi.secret(\"password\"),\n }],\n});\n\n```\n\n{{% /example %}}\n\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Push to AWS ECR with caching\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport * as docker from \"@pulumi/docker\";\n\nconst ecrRepository = new aws.ecr.Repository(\"ecr-repository\", {});\nconst authToken = aws.ecr.getAuthorizationTokenOutput({\n registryId: ecrRepository.registryId,\n});\nconst myImage = new docker.buildx.Image(\"my-image\", {\n cacheFrom: [{\n registry: {\n ref: pulumi.interpolate`${ecrRepository.repositoryUrl}:cache`,\n },\n }],\n cacheTo: [{\n registry: {\n imageManifest: true,\n ociMediaTypes: true,\n ref: pulumi.interpolate`${ecrRepository.repositoryUrl}:cache`,\n },\n }],\n context: {\n location: \"./app\",\n },\n dockerfile: {\n location: \"./Dockerfile\",\n },\n push: true,\n registries: [{\n address: ecrRepository.repositoryUrl,\n password: authToken.apply(authToken =\u003e authToken.password),\n username: authToken.apply(authToken =\u003e authToken.userName),\n }],\n tags: [pulumi.interpolate`${ecrRepository.repositoryUrl}:latest`],\n});\n```\n```python\nimport pulumi\nimport pulumi_aws as aws\nimport pulumi_docker as docker\n\necr_repository = aws.ecr.Repository(\"ecr-repository\")\nauth_token = aws.ecr.get_authorization_token_output(registry_id=ecr_repository.registry_id)\nmy_image = docker.buildx.Image(\"my-image\",\n cache_from=[docker.buildx.CacheFromEntryArgs(\n registry=docker.buildx.CacheFromRegistryArgs(\n ref=ecr_repository.repository_url.apply(lambda repository_url: f\"{repository_url}:cache\"),\n ),\n )],\n cache_to=[docker.buildx.CacheToEntryArgs(\n registry=docker.buildx.CacheToRegistryArgs(\n image_manifest=True,\n oci_media_types=True,\n ref=ecr_repository.repository_url.apply(lambda repository_url: f\"{repository_url}:cache\"),\n ),\n )],\n context=docker.buildx.BuildContextArgs(\n location=\"./app\",\n ),\n dockerfile=docker.buildx.DockerfileArgs(\n location=\"./Dockerfile\",\n ),\n push=True,\n registries=[docker.buildx.RegistryAuthArgs(\n address=ecr_repository.repository_url,\n password=auth_token.password,\n username=auth_token.user_name,\n )],\n tags=[ecr_repository.repository_url.apply(lambda repository_url: f\"{repository_url}:latest\")])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Aws = Pulumi.Aws;\nusing Docker = Pulumi.Docker;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var ecrRepository = new Aws.Ecr.Repository(\"ecr-repository\");\n\n var authToken = Aws.Ecr.GetAuthorizationToken.Invoke(new()\n {\n RegistryId = ecrRepository.RegistryId,\n });\n\n var myImage = new Docker.Buildx.Image(\"my-image\", new()\n {\n CacheFrom = new[]\n {\n new Docker.Buildx.Inputs.CacheFromEntryArgs\n {\n Registry = new Docker.Buildx.Inputs.CacheFromRegistryArgs\n {\n Ref = ecrRepository.RepositoryUrl.Apply(repositoryUrl =\u003e $\"{repositoryUrl}:cache\"),\n },\n },\n },\n CacheTo = new[]\n {\n new Docker.Buildx.Inputs.CacheToEntryArgs\n {\n Registry = new Docker.Buildx.Inputs.CacheToRegistryArgs\n {\n ImageManifest = true,\n OciMediaTypes = true,\n Ref = ecrRepository.RepositoryUrl.Apply(repositoryUrl =\u003e $\"{repositoryUrl}:cache\"),\n },\n },\n },\n Context = new Docker.Buildx.Inputs.BuildContextArgs\n {\n Location = \"./app\",\n },\n Dockerfile = new Docker.Buildx.Inputs.DockerfileArgs\n {\n Location = \"./Dockerfile\",\n },\n Push = true,\n Registries = new[]\n {\n new Docker.Buildx.Inputs.RegistryAuthArgs\n {\n Address = ecrRepository.RepositoryUrl,\n Password = authToken.Apply(getAuthorizationTokenResult =\u003e getAuthorizationTokenResult.Password),\n Username = authToken.Apply(getAuthorizationTokenResult =\u003e getAuthorizationTokenResult.UserName),\n },\n },\n Tags = new[]\n {\n ecrRepository.RepositoryUrl.Apply(repositoryUrl =\u003e $\"{repositoryUrl}:latest\"),\n },\n });\n\n});\n\n```\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecr\"\n\t\"github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\tecrRepository, err := ecr.NewRepository(ctx, \"ecr-repository\", nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tauthToken := ecr.GetAuthorizationTokenOutput(ctx, ecr.GetAuthorizationTokenOutputArgs{\n\t\t\tRegistryId: ecrRepository.RegistryId,\n\t\t}, nil)\n\t\t_, err = buildx.NewImage(ctx, \"my-image\", \u0026buildx.ImageArgs{\n\t\t\tCacheFrom: buildx.CacheFromEntryArray{\n\t\t\t\t\u0026buildx.CacheFromEntryArgs{\n\t\t\t\t\tRegistry: \u0026buildx.CacheFromRegistryArgs{\n\t\t\t\t\t\tRef: ecrRepository.RepositoryUrl.ApplyT(func(repositoryUrl string) (string, error) {\n\t\t\t\t\t\t\treturn fmt.Sprintf(\"%v:cache\", repositoryUrl), nil\n\t\t\t\t\t\t}).(pulumi.StringOutput),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tCacheTo: buildx.CacheToEntryArray{\n\t\t\t\t\u0026buildx.CacheToEntryArgs{\n\t\t\t\t\tRegistry: \u0026buildx.CacheToRegistryArgs{\n\t\t\t\t\t\tImageManifest: pulumi.Bool(true),\n\t\t\t\t\t\tOciMediaTypes: pulumi.Bool(true),\n\t\t\t\t\t\tRef: ecrRepository.RepositoryUrl.ApplyT(func(repositoryUrl string) (string, error) {\n\t\t\t\t\t\t\treturn fmt.Sprintf(\"%v:cache\", repositoryUrl), nil\n\t\t\t\t\t\t}).(pulumi.StringOutput),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tContext: \u0026buildx.BuildContextArgs{\n\t\t\t\tLocation: pulumi.String(\"./app\"),\n\t\t\t},\n\t\t\tDockerfile: \u0026buildx.DockerfileArgs{\n\t\t\t\tLocation: pulumi.String(\"./Dockerfile\"),\n\t\t\t},\n\t\t\tPush: pulumi.Bool(true),\n\t\t\tRegistries: buildx.RegistryAuthArray{\n\t\t\t\t\u0026buildx.RegistryAuthArgs{\n\t\t\t\t\tAddress: ecrRepository.RepositoryUrl,\n\t\t\t\t\tPassword: authToken.ApplyT(func(authToken ecr.GetAuthorizationTokenResult) (*string, error) {\n\t\t\t\t\t\treturn \u0026authToken.Password, nil\n\t\t\t\t\t}).(pulumi.StringPtrOutput),\n\t\t\t\t\tUsername: authToken.ApplyT(func(authToken ecr.GetAuthorizationTokenResult) (*string, error) {\n\t\t\t\t\t\treturn \u0026authToken.UserName, nil\n\t\t\t\t\t}).(pulumi.StringPtrOutput),\n\t\t\t\t},\n\t\t\t},\n\t\t\tTags: pulumi.StringArray{\n\t\t\t\tecrRepository.RepositoryUrl.ApplyT(func(repositoryUrl string) (string, error) {\n\t\t\t\t\treturn fmt.Sprintf(\"%v:latest\", repositoryUrl), nil\n\t\t\t\t}).(pulumi.StringOutput),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```yaml\ndescription: Push to AWS ECR with caching\nname: ecr\nresources:\n ecr-repository:\n type: aws:ecr:Repository\n my-image:\n properties:\n cacheFrom:\n - registry:\n ref: ${ecr-repository.repositoryUrl}:cache\n cacheTo:\n - registry:\n imageManifest: true\n ociMediaTypes: true\n ref: ${ecr-repository.repositoryUrl}:cache\n context:\n location: ./app\n dockerfile:\n location: ./Dockerfile\n push: true\n registries:\n - address: ${ecr-repository.repositoryUrl}\n password: ${auth-token.password}\n username: ${auth-token.userName}\n tags:\n - ${ecr-repository.repositoryUrl}:latest\n type: docker:buildx/image:Image\nruntime: yaml\nvariables:\n auth-token:\n fn::aws:ecr:getAuthorizationToken:\n registryId: ${ecr-repository.registryId}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.aws.ecr.Repository;\nimport com.pulumi.aws.ecr.EcrFunctions;\nimport com.pulumi.aws.ecr.inputs.GetAuthorizationTokenArgs;\nimport com.pulumi.docker.buildx.Image;\nimport com.pulumi.docker.buildx.ImageArgs;\nimport com.pulumi.docker.buildx.inputs.CacheFromEntryArgs;\nimport com.pulumi.docker.buildx.inputs.CacheFromRegistryArgs;\nimport com.pulumi.docker.buildx.inputs.CacheToEntryArgs;\nimport com.pulumi.docker.buildx.inputs.CacheToRegistryArgs;\nimport com.pulumi.docker.buildx.inputs.BuildContextArgs;\nimport com.pulumi.docker.buildx.inputs.DockerfileArgs;\nimport com.pulumi.docker.buildx.inputs.RegistryAuthArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var ecrRepository = new Repository(\"ecrRepository\");\n\n final var authToken = EcrFunctions.getAuthorizationToken(GetAuthorizationTokenArgs.builder()\n .registryId(ecrRepository.registryId())\n .build());\n\n var myImage = new Image(\"myImage\", ImageArgs.builder() \n .cacheFrom(CacheFromEntryArgs.builder()\n .registry(CacheFromRegistryArgs.builder()\n .ref(ecrRepository.repositoryUrl().applyValue(repositoryUrl -\u003e String.format(\"%s:cache\", repositoryUrl)))\n .build())\n .build())\n .cacheTo(CacheToEntryArgs.builder()\n .registry(CacheToRegistryArgs.builder()\n .imageManifest(true)\n .ociMediaTypes(true)\n .ref(ecrRepository.repositoryUrl().applyValue(repositoryUrl -\u003e String.format(\"%s:cache\", repositoryUrl)))\n .build())\n .build())\n .context(BuildContextArgs.builder()\n .location(\"./app\")\n .build())\n .dockerfile(DockerfileArgs.builder()\n .location(\"./Dockerfile\")\n .build())\n .push(true)\n .registries(RegistryAuthArgs.builder()\n .address(ecrRepository.repositoryUrl())\n .password(authToken.applyValue(getAuthorizationTokenResult -\u003e getAuthorizationTokenResult).applyValue(authToken -\u003e authToken.applyValue(getAuthorizationTokenResult -\u003e getAuthorizationTokenResult.password())))\n .username(authToken.applyValue(getAuthorizationTokenResult -\u003e getAuthorizationTokenResult).applyValue(authToken -\u003e authToken.applyValue(getAuthorizationTokenResult -\u003e getAuthorizationTokenResult.userName())))\n .build())\n .tags(ecrRepository.repositoryUrl().applyValue(repositoryUrl -\u003e String.format(\"%s:latest\", repositoryUrl)))\n .build());\n\n }\n}\n```\n{{% /example %}}\n{{% example %}}\n### Multi-platform image\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as docker from \"@pulumi/docker\";\n\nconst image = new docker.buildx.Image(\"image\", {\n context: {\n location: \"app\",\n },\n platforms: [\n docker.buildx.image.Platform.Plan9_amd64,\n docker.buildx.image.Platform.Plan9_386,\n ],\n});\n```\n```python\nimport pulumi\nimport pulumi_docker as docker\n\nimage = docker.buildx.Image(\"image\",\n context=docker.buildx.BuildContextArgs(\n location=\"app\",\n ),\n platforms=[\n docker.buildx/image.Platform.PLAN9_AMD64,\n docker.buildx/image.Platform.PLAN9_386,\n ])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Docker = Pulumi.Docker;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var image = new Docker.Buildx.Image(\"image\", new()\n {\n Context = new Docker.Buildx.Inputs.BuildContextArgs\n {\n Location = \"app\",\n },\n Platforms = new[]\n {\n Docker.Buildx.Image.Platform.Plan9_amd64,\n Docker.Buildx.Image.Platform.Plan9_386,\n },\n });\n\n});\n\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := buildx.NewImage(ctx, \"image\", \u0026buildx.ImageArgs{\n\t\t\tContext: \u0026buildx.BuildContextArgs{\n\t\t\t\tLocation: pulumi.String(\"app\"),\n\t\t\t},\n\t\t\tPlatforms: buildx.PlatformArray{\n\t\t\t\tbuildx.Platform_Plan9_amd64,\n\t\t\t\tbuildx.Platform_Plan9_386,\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```yaml\ndescription: Multi-platform image\nname: multi-platform\nresources:\n image:\n properties:\n context:\n location: app\n platforms:\n - plan9/amd64\n - plan9/386\n type: docker:buildx/image:Image\nruntime: yaml\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.docker.buildx.Image;\nimport com.pulumi.docker.buildx.ImageArgs;\nimport com.pulumi.docker.buildx.inputs.BuildContextArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var image = new Image(\"image\", ImageArgs.builder() \n .context(BuildContextArgs.builder()\n .location(\"app\")\n .build())\n .platforms( \n \"plan9/amd64\",\n \"plan9/386\")\n .build());\n\n }\n}\n```\n{{% /example %}}\n{{% example %}}\n### Registry export\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as docker from \"@pulumi/docker\";\n\nconst image = new docker.buildx.Image(\"image\", {\n context: {\n location: \"app\",\n },\n push: true,\n registries: [{\n address: \"docker.io\",\n password: dockerHubPassword,\n username: \"pulumibot\",\n }],\n tags: [\"docker.io/pulumi/pulumi:3.107.0\"],\n});\n```\n```python\nimport pulumi\nimport pulumi_docker as docker\n\nimage = docker.buildx.Image(\"image\",\n context=docker.buildx.BuildContextArgs(\n location=\"app\",\n ),\n push=True,\n registries=[docker.buildx.RegistryAuthArgs(\n address=\"docker.io\",\n password=docker_hub_password,\n username=\"pulumibot\",\n )],\n tags=[\"docker.io/pulumi/pulumi:3.107.0\"])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Docker = Pulumi.Docker;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var image = new Docker.Buildx.Image(\"image\", new()\n {\n Context = new Docker.Buildx.Inputs.BuildContextArgs\n {\n Location = \"app\",\n },\n Push = true,\n Registries = new[]\n {\n new Docker.Buildx.Inputs.RegistryAuthArgs\n {\n Address = \"docker.io\",\n Password = dockerHubPassword,\n Username = \"pulumibot\",\n },\n },\n Tags = new[]\n {\n \"docker.io/pulumi/pulumi:3.107.0\",\n },\n });\n\n});\n\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := buildx.NewImage(ctx, \"image\", \u0026buildx.ImageArgs{\n\t\t\tContext: \u0026buildx.BuildContextArgs{\n\t\t\t\tLocation: pulumi.String(\"app\"),\n\t\t\t},\n\t\t\tPush: pulumi.Bool(true),\n\t\t\tRegistries: buildx.RegistryAuthArray{\n\t\t\t\t\u0026buildx.RegistryAuthArgs{\n\t\t\t\t\tAddress: pulumi.String(\"docker.io\"),\n\t\t\t\t\tPassword: pulumi.Any(dockerHubPassword),\n\t\t\t\t\tUsername: pulumi.String(\"pulumibot\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\tTags: pulumi.StringArray{\n\t\t\t\tpulumi.String(\"docker.io/pulumi/pulumi:3.107.0\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```yaml\ndescription: Registry export\nname: registry\nresources:\n image:\n properties:\n context:\n location: app\n push: true\n registries:\n - address: docker.io\n password: ${dockerHubPassword}\n username: pulumibot\n tags:\n - docker.io/pulumi/pulumi:3.107.0\n type: docker:buildx/image:Image\nruntime: yaml\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.docker.buildx.Image;\nimport com.pulumi.docker.buildx.ImageArgs;\nimport com.pulumi.docker.buildx.inputs.BuildContextArgs;\nimport com.pulumi.docker.buildx.inputs.RegistryAuthArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var image = new Image(\"image\", ImageArgs.builder() \n .context(BuildContextArgs.builder()\n .location(\"app\")\n .build())\n .push(true)\n .registries(RegistryAuthArgs.builder()\n .address(\"docker.io\")\n .password(dockerHubPassword)\n .username(\"pulumibot\")\n .build())\n .tags(\"docker.io/pulumi/pulumi:3.107.0\")\n .build());\n\n }\n}\n```\n{{% /example %}}\n{{% example %}}\n### Caching\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as docker from \"@pulumi/docker\";\n\nconst image = new docker.buildx.Image(\"image\", {\n cacheFrom: [{\n local: {\n src: \"tmp/cache\",\n },\n }],\n cacheTo: [{\n local: {\n dest: \"tmp/cache\",\n mode: docker.buildx.image.CacheMode.Max,\n },\n }],\n context: {\n location: \"app\",\n },\n});\n```\n```python\nimport pulumi\nimport pulumi_docker as docker\n\nimage = docker.buildx.Image(\"image\",\n cache_from=[docker.buildx.CacheFromEntryArgs(\n local=docker.buildx.CacheFromLocalArgs(\n src=\"tmp/cache\",\n ),\n )],\n cache_to=[docker.buildx.CacheToEntryArgs(\n local=docker.buildx.CacheToLocalArgs(\n dest=\"tmp/cache\",\n mode=docker.buildx/image.CacheMode.MAX,\n ),\n )],\n context=docker.buildx.BuildContextArgs(\n location=\"app\",\n ))\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Docker = Pulumi.Docker;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var image = new Docker.Buildx.Image(\"image\", new()\n {\n CacheFrom = new[]\n {\n new Docker.Buildx.Inputs.CacheFromEntryArgs\n {\n Local = new Docker.Buildx.Inputs.CacheFromLocalArgs\n {\n Src = \"tmp/cache\",\n },\n },\n },\n CacheTo = new[]\n {\n new Docker.Buildx.Inputs.CacheToEntryArgs\n {\n Local = new Docker.Buildx.Inputs.CacheToLocalArgs\n {\n Dest = \"tmp/cache\",\n Mode = Docker.Buildx.Image.CacheMode.Max,\n },\n },\n },\n Context = new Docker.Buildx.Inputs.BuildContextArgs\n {\n Location = \"app\",\n },\n });\n\n});\n\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := buildx.NewImage(ctx, \"image\", \u0026buildx.ImageArgs{\n\t\t\tCacheFrom: buildx.CacheFromEntryArray{\n\t\t\t\t\u0026buildx.CacheFromEntryArgs{\n\t\t\t\t\tLocal: \u0026buildx.CacheFromLocalArgs{\n\t\t\t\t\t\tSrc: pulumi.String(\"tmp/cache\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tCacheTo: buildx.CacheToEntryArray{\n\t\t\t\t\u0026buildx.CacheToEntryArgs{\n\t\t\t\t\tLocal: \u0026buildx.CacheToLocalArgs{\n\t\t\t\t\t\tDest: pulumi.String(\"tmp/cache\"),\n\t\t\t\t\t\tMode: buildx.CacheModeMax,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tContext: \u0026buildx.BuildContextArgs{\n\t\t\t\tLocation: pulumi.String(\"app\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```yaml\ndescription: Caching\nname: caching\nresources:\n image:\n properties:\n cacheFrom:\n - local:\n src: tmp/cache\n cacheTo:\n - local:\n dest: tmp/cache\n mode: max\n context:\n location: app\n type: docker:buildx/image:Image\nruntime: yaml\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.docker.buildx.Image;\nimport com.pulumi.docker.buildx.ImageArgs;\nimport com.pulumi.docker.buildx.inputs.CacheFromEntryArgs;\nimport com.pulumi.docker.buildx.inputs.CacheFromLocalArgs;\nimport com.pulumi.docker.buildx.inputs.CacheToEntryArgs;\nimport com.pulumi.docker.buildx.inputs.CacheToLocalArgs;\nimport com.pulumi.docker.buildx.inputs.BuildContextArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var image = new Image(\"image\", ImageArgs.builder() \n .cacheFrom(CacheFromEntryArgs.builder()\n .local(CacheFromLocalArgs.builder()\n .src(\"tmp/cache\")\n .build())\n .build())\n .cacheTo(CacheToEntryArgs.builder()\n .local(CacheToLocalArgs.builder()\n .dest(\"tmp/cache\")\n .mode(\"max\")\n .build())\n .build())\n .context(BuildContextArgs.builder()\n .location(\"app\")\n .build())\n .build());\n\n }\n}\n```\n{{% /example %}}\n{{% example %}}\n### Build arguments\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as docker from \"@pulumi/docker\";\n\nconst image = new docker.buildx.Image(\"image\", {\n buildArgs: {\n SET_ME_TO_TRUE: \"true\",\n },\n context: {\n location: \"app\",\n },\n});\n```\n```python\nimport pulumi\nimport pulumi_docker as docker\n\nimage = docker.buildx.Image(\"image\",\n build_args={\n \"SET_ME_TO_TRUE\": \"true\",\n },\n context=docker.buildx.BuildContextArgs(\n location=\"app\",\n ))\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Docker = Pulumi.Docker;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var image = new Docker.Buildx.Image(\"image\", new()\n {\n BuildArgs = \n {\n { \"SET_ME_TO_TRUE\", \"true\" },\n },\n Context = new Docker.Buildx.Inputs.BuildContextArgs\n {\n Location = \"app\",\n },\n });\n\n});\n\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := buildx.NewImage(ctx, \"image\", \u0026buildx.ImageArgs{\n\t\t\tBuildArgs: pulumi.StringMap{\n\t\t\t\t\"SET_ME_TO_TRUE\": pulumi.String(\"true\"),\n\t\t\t},\n\t\t\tContext: \u0026buildx.BuildContextArgs{\n\t\t\t\tLocation: pulumi.String(\"app\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```yaml\ndescription: Build arguments\nname: build-args\nresources:\n image:\n properties:\n buildArgs:\n SET_ME_TO_TRUE: \"true\"\n context:\n location: app\n type: docker:buildx/image:Image\nruntime: yaml\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.docker.buildx.Image;\nimport com.pulumi.docker.buildx.ImageArgs;\nimport com.pulumi.docker.buildx.inputs.BuildContextArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var image = new Image(\"image\", ImageArgs.builder() \n .buildArgs(Map.of(\"SET_ME_TO_TRUE\", \"true\"))\n .context(BuildContextArgs.builder()\n .location(\"app\")\n .build())\n .build());\n\n }\n}\n```\n{{% /example %}}\n{{% example %}}\n### Build targets\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as docker from \"@pulumi/docker\";\n\nconst image = new docker.buildx.Image(\"image\", {\n context: {\n location: \"app\",\n },\n targets: [\n \"build-me\",\n \"also-build-me\",\n ],\n});\n```\n```python\nimport pulumi\nimport pulumi_docker as docker\n\nimage = docker.buildx.Image(\"image\",\n context=docker.buildx.BuildContextArgs(\n location=\"app\",\n ),\n targets=[\n \"build-me\",\n \"also-build-me\",\n ])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Docker = Pulumi.Docker;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var image = new Docker.Buildx.Image(\"image\", new()\n {\n Context = new Docker.Buildx.Inputs.BuildContextArgs\n {\n Location = \"app\",\n },\n Targets = new[]\n {\n \"build-me\",\n \"also-build-me\",\n },\n });\n\n});\n\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := buildx.NewImage(ctx, \"image\", \u0026buildx.ImageArgs{\n\t\t\tContext: \u0026buildx.BuildContextArgs{\n\t\t\t\tLocation: pulumi.String(\"app\"),\n\t\t\t},\n\t\t\tTargets: pulumi.StringArray{\n\t\t\t\tpulumi.String(\"build-me\"),\n\t\t\t\tpulumi.String(\"also-build-me\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```yaml\ndescription: Build targets\nname: build-targets\nresources:\n image:\n properties:\n context:\n location: app\n targets:\n - build-me\n - also-build-me\n type: docker:buildx/image:Image\nruntime: yaml\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.docker.buildx.Image;\nimport com.pulumi.docker.buildx.ImageArgs;\nimport com.pulumi.docker.buildx.inputs.BuildContextArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var image = new Image(\"image\", ImageArgs.builder() \n .context(BuildContextArgs.builder()\n .location(\"app\")\n .build())\n .targets( \n \"build-me\",\n \"also-build-me\")\n .build());\n\n }\n}\n```\n{{% /example %}}\n{{% example %}}\n### Named contexts\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as docker from \"@pulumi/docker\";\n\nconst image = new docker.buildx.Image(\"image\", {context: {\n location: \"app\",\n named: {\n \"golang:latest\": {\n location: \"docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984\",\n },\n },\n}});\n```\n```python\nimport pulumi\nimport pulumi_docker as docker\n\nimage = docker.buildx.Image(\"image\", context=docker.buildx.BuildContextArgs(\n location=\"app\",\n named={\n \"golang:latest\": docker.buildx.ContextArgs(\n location=\"docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984\",\n ),\n },\n))\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Docker = Pulumi.Docker;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var image = new Docker.Buildx.Image(\"image\", new()\n {\n Context = new Docker.Buildx.Inputs.BuildContextArgs\n {\n Location = \"app\",\n Named = \n {\n { \"golang:latest\", new Docker.Buildx.Inputs.ContextArgs\n {\n Location = \"docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984\",\n } },\n },\n },\n });\n\n});\n\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := buildx.NewImage(ctx, \"image\", \u0026buildx.ImageArgs{\n\t\t\tContext: \u0026buildx.BuildContextArgs{\n\t\t\t\tLocation: pulumi.String(\"app\"),\n\t\t\t\tNamed: buildx.ContextMap{\n\t\t\t\t\t\"golang:latest\": \u0026buildx.ContextArgs{\n\t\t\t\t\t\tLocation: pulumi.String(\"docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```yaml\ndescription: Named contexts\nname: named-contexts\nresources:\n image:\n properties:\n context:\n location: app\n named:\n golang:latest:\n location: docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984\n type: docker:buildx/image:Image\nruntime: yaml\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.docker.buildx.Image;\nimport com.pulumi.docker.buildx.ImageArgs;\nimport com.pulumi.docker.buildx.inputs.BuildContextArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var image = new Image(\"image\", ImageArgs.builder() \n .context(BuildContextArgs.builder()\n .location(\"app\")\n .named(Map.of(\"golang:latest\", Map.of(\"location\", \"docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984\")))\n .build())\n .build());\n\n }\n}\n```\n{{% /example %}}\n{{% example %}}\n### Remote context\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as docker from \"@pulumi/docker\";\n\nconst image = new docker.buildx.Image(\"image\", {context: {\n location: \"https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile\",\n}});\n```\n```python\nimport pulumi\nimport pulumi_docker as docker\n\nimage = docker.buildx.Image(\"image\", context=docker.buildx.BuildContextArgs(\n location=\"https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile\",\n))\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Docker = Pulumi.Docker;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var image = new Docker.Buildx.Image(\"image\", new()\n {\n Context = new Docker.Buildx.Inputs.BuildContextArgs\n {\n Location = \"https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile\",\n },\n });\n\n});\n\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := buildx.NewImage(ctx, \"image\", \u0026buildx.ImageArgs{\n\t\t\tContext: \u0026buildx.BuildContextArgs{\n\t\t\t\tLocation: pulumi.String(\"https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```yaml\ndescription: Remote context\nname: remote-context\nresources:\n image:\n properties:\n context:\n location: https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile\n type: docker:buildx/image:Image\nruntime: yaml\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.docker.buildx.Image;\nimport com.pulumi.docker.buildx.ImageArgs;\nimport com.pulumi.docker.buildx.inputs.BuildContextArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var image = new Image(\"image\", ImageArgs.builder() \n .context(BuildContextArgs.builder()\n .location(\"https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile\")\n .build())\n .build());\n\n }\n}\n```\n{{% /example %}}\n{{% example %}}\n### Inline Dockerfile\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as docker from \"@pulumi/docker\";\n\nconst image = new docker.buildx.Image(\"image\", {\n context: {\n location: \"app\",\n },\n dockerfile: {\n inline: `FROM busybox\nCOPY hello.c ./\n`,\n },\n});\n```\n```python\nimport pulumi\nimport pulumi_docker as docker\n\nimage = docker.buildx.Image(\"image\",\n context=docker.buildx.BuildContextArgs(\n location=\"app\",\n ),\n dockerfile=docker.buildx.DockerfileArgs(\n inline=\"\"\"FROM busybox\nCOPY hello.c ./\n\"\"\",\n ))\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Docker = Pulumi.Docker;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var image = new Docker.Buildx.Image(\"image\", new()\n {\n Context = new Docker.Buildx.Inputs.BuildContextArgs\n {\n Location = \"app\",\n },\n Dockerfile = new Docker.Buildx.Inputs.DockerfileArgs\n {\n Inline = @\"FROM busybox\nCOPY hello.c ./\n\",\n },\n });\n\n});\n\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := buildx.NewImage(ctx, \"image\", \u0026buildx.ImageArgs{\n\t\t\tContext: \u0026buildx.BuildContextArgs{\n\t\t\t\tLocation: pulumi.String(\"app\"),\n\t\t\t},\n\t\t\tDockerfile: \u0026buildx.DockerfileArgs{\n\t\t\t\tInline: pulumi.String(\"FROM busybox\\nCOPY hello.c ./\\n\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```yaml\ndescription: Inline Dockerfile\nname: inline\nresources:\n image:\n properties:\n context:\n location: app\n dockerfile:\n inline: |\n FROM busybox\n COPY hello.c ./\n type: docker:buildx/image:Image\nruntime: yaml\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.docker.buildx.Image;\nimport com.pulumi.docker.buildx.ImageArgs;\nimport com.pulumi.docker.buildx.inputs.BuildContextArgs;\nimport com.pulumi.docker.buildx.inputs.DockerfileArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var image = new Image(\"image\", ImageArgs.builder() \n .context(BuildContextArgs.builder()\n .location(\"app\")\n .build())\n .dockerfile(DockerfileArgs.builder()\n .inline(\"\"\"\nFROM busybox\nCOPY hello.c ./\n \"\"\")\n .build())\n .build());\n\n }\n}\n```\n{{% /example %}}\n{{% example %}}\n### Remote context\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as docker from \"@pulumi/docker\";\n\nconst image = new docker.buildx.Image(\"image\", {\n context: {\n location: \"https://github.com/docker-library/hello-world.git\",\n },\n dockerfile: {\n location: \"app/Dockerfile\",\n },\n});\n```\n```python\nimport pulumi\nimport pulumi_docker as docker\n\nimage = docker.buildx.Image(\"image\",\n context=docker.buildx.BuildContextArgs(\n location=\"https://github.com/docker-library/hello-world.git\",\n ),\n dockerfile=docker.buildx.DockerfileArgs(\n location=\"app/Dockerfile\",\n ))\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Docker = Pulumi.Docker;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var image = new Docker.Buildx.Image(\"image\", new()\n {\n Context = new Docker.Buildx.Inputs.BuildContextArgs\n {\n Location = \"https://github.com/docker-library/hello-world.git\",\n },\n Dockerfile = new Docker.Buildx.Inputs.DockerfileArgs\n {\n Location = \"app/Dockerfile\",\n },\n });\n\n});\n\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := buildx.NewImage(ctx, \"image\", \u0026buildx.ImageArgs{\n\t\t\tContext: \u0026buildx.BuildContextArgs{\n\t\t\t\tLocation: pulumi.String(\"https://github.com/docker-library/hello-world.git\"),\n\t\t\t},\n\t\t\tDockerfile: \u0026buildx.DockerfileArgs{\n\t\t\t\tLocation: pulumi.String(\"app/Dockerfile\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```yaml\ndescription: Remote context\nname: remote-context\nresources:\n image:\n properties:\n context:\n location: https://github.com/docker-library/hello-world.git\n dockerfile:\n location: app/Dockerfile\n type: docker:buildx/image:Image\nruntime: yaml\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.docker.buildx.Image;\nimport com.pulumi.docker.buildx.ImageArgs;\nimport com.pulumi.docker.buildx.inputs.BuildContextArgs;\nimport com.pulumi.docker.buildx.inputs.DockerfileArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var image = new Image(\"image\", ImageArgs.builder() \n .context(BuildContextArgs.builder()\n .location(\"https://github.com/docker-library/hello-world.git\")\n .build())\n .dockerfile(DockerfileArgs.builder()\n .location(\"app/Dockerfile\")\n .build())\n .build());\n\n }\n}\n```\n{{% /example %}}\n{{% example %}}\n### Local export\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as docker from \"@pulumi/docker\";\n\nconst image = new docker.buildx.Image(\"image\", {\n context: {\n location: \"app\",\n },\n exports: [{\n docker: {\n tar: true,\n },\n }],\n});\n```\n```python\nimport pulumi\nimport pulumi_docker as docker\n\nimage = docker.buildx.Image(\"image\",\n context=docker.buildx.BuildContextArgs(\n location=\"app\",\n ),\n exports=[docker.buildx.ExportEntryArgs(\n docker=docker.buildx.ExportDockerArgs(\n tar=True,\n ),\n )])\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Docker = Pulumi.Docker;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var image = new Docker.Buildx.Image(\"image\", new()\n {\n Context = new Docker.Buildx.Inputs.BuildContextArgs\n {\n Location = \"app\",\n },\n Exports = new[]\n {\n new Docker.Buildx.Inputs.ExportEntryArgs\n {\n Docker = new Docker.Buildx.Inputs.ExportDockerArgs\n {\n Tar = true,\n },\n },\n },\n });\n\n});\n\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\t_, err := buildx.NewImage(ctx, \"image\", \u0026buildx.ImageArgs{\n\t\t\tContext: \u0026buildx.BuildContextArgs{\n\t\t\t\tLocation: pulumi.String(\"app\"),\n\t\t\t},\n\t\t\tExports: buildx.ExportEntryArray{\n\t\t\t\t\u0026buildx.ExportEntryArgs{\n\t\t\t\t\tDocker: \u0026buildx.ExportDockerArgs{\n\t\t\t\t\t\tTar: pulumi.Bool(true),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```yaml\ndescription: Local export\nname: docker-load\nresources:\n image:\n properties:\n context:\n location: app\n exports:\n - docker:\n tar: true\n type: docker:buildx/image:Image\nruntime: yaml\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.docker.buildx.Image;\nimport com.pulumi.docker.buildx.ImageArgs;\nimport com.pulumi.docker.buildx.inputs.BuildContextArgs;\nimport com.pulumi.docker.buildx.inputs.ExportEntryArgs;\nimport com.pulumi.docker.buildx.inputs.ExportDockerArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var image = new Image(\"image\", ImageArgs.builder() \n .context(BuildContextArgs.builder()\n .location(\"app\")\n .build())\n .exports(ExportEntryArgs.builder()\n .docker(ExportDockerArgs.builder()\n .tar(true)\n .build())\n .build())\n .build());\n\n }\n}\n```\n{{% /example %}}\n{{% /examples %}}", "properties": { + "addHosts": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Custom `host:ip` mappings to use during the build.\n\nEquivalent to Docker's `--add-host` flag." + }, "buildArgs": { "type": "object", "additionalProperties": { @@ -3098,7 +3090,7 @@ }, "buildOnPreview": { "type": "boolean", - "description": "When `true`, attempt to build the image during previews. The image will\nnot be pushed to registries, however caches will still be populated." + "description": "By default, preview behavior depends on the execution environment. If\nPulumi detects the operation is running on a CI system (GitHub Actions,\nTravis CI, Azure Pipelines, etc.) then it will build images during\npreviews as a safeguard. Otherwise, if not running on CI, previews will\nnot build images.\n\nSetting this to `false` forces previews to never perform builds, and\nsetting it to `true` will always build the image during previews.\n\nImages built during previews are never exported to registries, however\ncache manifests are still exported.\n\nOn-disk Dockerfiles are always validated for syntactic correctness\nregardless of this setting." }, "builder": { "$ref": "#/types/docker:buildx/image:BuilderConfig", @@ -3129,12 +3121,9 @@ "digests": { "type": "object", "additionalProperties": { - "type": "array", - "items": { - "type": "string" - } + "type": "string" }, - "description": "A mapping of platform type to refs which were pushed to registries." + "description": "A mapping of target names to the SHA256 digest of their pushed manifest.\n\nIf no target was specified 'default' is used as the target name.\n\nPushed manifests can be referenced as `\u003ctag\u003e@\u003cdigest\u003e`." }, "dockerfile": { "$ref": "#/types/docker:buildx/image:Dockerfile", @@ -3154,6 +3143,19 @@ }, "description": "Attach arbitrary key/value metadata to the image.\n\nEquivalent to Docker's `--label` flag." }, + "load": { + "type": "boolean", + "description": "When `true` the build will automatically include a `docker` export.\n\nDefaults to `false`.\n\nEquivalent to Docker's `--load` flag." + }, + "network": { + "$ref": "#/types/docker:buildx/image:NetworkMode", + "description": "Set the network mode for `RUN` instructions. Defaults to `default`.\n\nFor custom networks, configure your builder with `--driver-opt network=...`.\n\nEquivalent to Docker's `--network` flag.", + "default": "default" + }, + "noCache": { + "type": "boolean", + "description": "Do not import cache manifests when building the image.\n\nEquivalent to Docker's `--no-cache` flag." + }, "platforms": { "type": "array", "items": { @@ -3165,6 +3167,14 @@ "type": "boolean", "description": "Always pull referenced images.\n\nEquivalent to Docker's `--pull` flag." }, + "push": { + "type": "boolean", + "description": "When `true` the build will automatically include a `registry` export.\n\nDefaults to `false`.\n\nEquivalent to Docker's `--push` flag." + }, + "ref": { + "type": "string", + "description": "If the image was pushed to any registries then this will contain a\nsingle fully-qualified tag including the build's digest.\n\nThis is only for convenience and may not be appropriate for situations\nwhere multiple tags or registries are involved. In those cases this\noutput is not guaranteed to be stable.\n\nFor more control over tags consumed by downstream resources you should\nuse the `Digests` output." + }, "registries": { "type": "array", "items": { @@ -3177,8 +3187,14 @@ "additionalProperties": { "type": "string" }, - "description": "A mapping of secret names to their corresponding values.\n\nUnlike the Docker CLI, these can be passed by value and do not need to\nexist on-disk or in environment variables.\n\nBuild arguments and environment variables are persistent in the final\nimage, so you should use this for sensitive values.\n\nSimilar to Docker's `--secret` flag.", - "secret": true + "description": "A mapping of secret names to their corresponding values.\n\nUnlike the Docker CLI, these can be passed by value and do not need to\nexist on-disk or in environment variables.\n\nBuild arguments and environment variables are persistent in the final\nimage, so you should use this for sensitive values.\n\nSimilar to Docker's `--secret` flag." + }, + "ssh": { + "type": "array", + "items": { + "$ref": "#/types/docker:buildx/image:SSH" + }, + "description": "SSH agent socket or keys to expose to the build.\n\nEquivalent to Docker's `--ssh` flag." }, "tags": { "type": "array", @@ -3195,7 +3211,19 @@ "description": "Set the target build stage(s) to build.\n\nIf not specified all targets will be built by default.\n\nEquivalent to Docker's `--target` flag." } }, + "required": [ + "digests", + "contextHash", + "ref" + ], "inputProperties": { + "addHosts": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Custom `host:ip` mappings to use during the build.\n\nEquivalent to Docker's `--add-host` flag." + }, "buildArgs": { "type": "object", "additionalProperties": { @@ -3205,7 +3233,7 @@ }, "buildOnPreview": { "type": "boolean", - "description": "When `true`, attempt to build the image during previews. The image will\nnot be pushed to registries, however caches will still be populated." + "description": "By default, preview behavior depends on the execution environment. If\nPulumi detects the operation is running on a CI system (GitHub Actions,\nTravis CI, Azure Pipelines, etc.) then it will build images during\npreviews as a safeguard. Otherwise, if not running on CI, previews will\nnot build images.\n\nSetting this to `false` forces previews to never perform builds, and\nsetting it to `true` will always build the image during previews.\n\nImages built during previews are never exported to registries, however\ncache manifests are still exported.\n\nOn-disk Dockerfiles are always validated for syntactic correctness\nregardless of this setting." }, "builder": { "$ref": "#/types/docker:buildx/image:BuilderConfig", @@ -3247,6 +3275,19 @@ }, "description": "Attach arbitrary key/value metadata to the image.\n\nEquivalent to Docker's `--label` flag." }, + "load": { + "type": "boolean", + "description": "When `true` the build will automatically include a `docker` export.\n\nDefaults to `false`.\n\nEquivalent to Docker's `--load` flag." + }, + "network": { + "$ref": "#/types/docker:buildx/image:NetworkMode", + "description": "Set the network mode for `RUN` instructions. Defaults to `default`.\n\nFor custom networks, configure your builder with `--driver-opt network=...`.\n\nEquivalent to Docker's `--network` flag.", + "default": "default" + }, + "noCache": { + "type": "boolean", + "description": "Do not import cache manifests when building the image.\n\nEquivalent to Docker's `--no-cache` flag." + }, "platforms": { "type": "array", "items": { @@ -3258,6 +3299,10 @@ "type": "boolean", "description": "Always pull referenced images.\n\nEquivalent to Docker's `--pull` flag." }, + "push": { + "type": "boolean", + "description": "When `true` the build will automatically include a `registry` export.\n\nDefaults to `false`.\n\nEquivalent to Docker's `--push` flag." + }, "registries": { "type": "array", "items": { @@ -3270,8 +3315,14 @@ "additionalProperties": { "type": "string" }, - "description": "A mapping of secret names to their corresponding values.\n\nUnlike the Docker CLI, these can be passed by value and do not need to\nexist on-disk or in environment variables.\n\nBuild arguments and environment variables are persistent in the final\nimage, so you should use this for sensitive values.\n\nSimilar to Docker's `--secret` flag.", - "secret": true + "description": "A mapping of secret names to their corresponding values.\n\nUnlike the Docker CLI, these can be passed by value and do not need to\nexist on-disk or in environment variables.\n\nBuild arguments and environment variables are persistent in the final\nimage, so you should use this for sensitive values.\n\nSimilar to Docker's `--secret` flag." + }, + "ssh": { + "type": "array", + "items": { + "$ref": "#/types/docker:buildx/image:SSH" + }, + "description": "SSH agent socket or keys to expose to the build.\n\nEquivalent to Docker's `--ssh` flag." }, "tags": { "type": "array", diff --git a/sdk/dotnet/Buildx/Enums.cs b/sdk/dotnet/Buildx/Enums.cs index de7584c1..39bfcadd 100644 --- a/sdk/dotnet/Buildx/Enums.cs +++ b/sdk/dotnet/Buildx/Enums.cs @@ -79,6 +79,44 @@ private CompressionType(string value) public override string ToString() => _value; } + [EnumType] + public readonly struct NetworkMode : IEquatable + { + private readonly string _value; + + private NetworkMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + /// + /// The default sandbox network mode. + /// + public static NetworkMode @Default { get; } = new NetworkMode("default"); + /// + /// Host network mode. + /// + public static NetworkMode Host { get; } = new NetworkMode("host"); + /// + /// Disable network access. + /// + public static NetworkMode None { get; } = new NetworkMode("none"); + + public static bool operator ==(NetworkMode left, NetworkMode right) => left.Equals(right); + public static bool operator !=(NetworkMode left, NetworkMode right) => !left.Equals(right); + + public static explicit operator string(NetworkMode value) => value._value; + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object? obj) => obj is NetworkMode other && Equals(other); + public bool Equals(NetworkMode other) => string.Equals(_value, other._value, StringComparison.Ordinal); + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + + public override string ToString() => _value; + } + [EnumType] public readonly struct Platform : IEquatable { diff --git a/sdk/dotnet/Buildx/Image.cs b/sdk/dotnet/Buildx/Image.cs index 68629861..d031d3b4 100644 --- a/sdk/dotnet/Buildx/Image.cs +++ b/sdk/dotnet/Buildx/Image.cs @@ -461,6 +461,14 @@ namespace Pulumi.Docker.Buildx [DockerResourceType("docker:buildx/image:Image")] public partial class Image : global::Pulumi.CustomResource { + /// + /// Custom `host:ip` mappings to use during the build. + /// + /// Equivalent to Docker's `--add-host` flag. + /// + [Output("addHosts")] + public Output> AddHosts { get; private set; } = null!; + /// /// `ARG` names and values to set during the build. /// @@ -476,8 +484,20 @@ public partial class Image : global::Pulumi.CustomResource public Output?> BuildArgs { get; private set; } = null!; /// - /// When `true`, attempt to build the image during previews. The image will - /// not be pushed to registries, however caches will still be populated. + /// By default, preview behavior depends on the execution environment. If + /// Pulumi detects the operation is running on a CI system (GitHub Actions, + /// Travis CI, Azure Pipelines, etc.) then it will build images during + /// previews as a safeguard. Otherwise, if not running on CI, previews will + /// not build images. + /// + /// Setting this to `false` forces previews to never perform builds, and + /// setting it to `true` will always build the image during previews. + /// + /// Images built during previews are never exported to registries, however + /// cache manifests are still exported. + /// + /// On-disk Dockerfiles are always validated for syntactic correctness + /// regardless of this setting. /// [Output("buildOnPreview")] public Output BuildOnPreview { get; private set; } = null!; @@ -518,13 +538,17 @@ public partial class Image : global::Pulumi.CustomResource /// Pulumi uses this to determine if an image _may_ need to be re-built. /// [Output("contextHash")] - public Output ContextHash { get; private set; } = null!; + public Output ContextHash { get; private set; } = null!; /// - /// A mapping of platform type to refs which were pushed to registries. + /// A mapping of target names to the SHA256 digest of their pushed manifest. + /// + /// If no target was specified 'default' is used as the target name. + /// + /// Pushed manifests can be referenced as `<tag>@<digest>`. /// [Output("digests")] - public Output>?> Digests { get; private set; } = null!; + public Output> Digests { get; private set; } = null!; /// /// Dockerfile settings. @@ -553,6 +577,34 @@ public partial class Image : global::Pulumi.CustomResource [Output("labels")] public Output?> Labels { get; private set; } = null!; + /// + /// When `true` the build will automatically include a `docker` export. + /// + /// Defaults to `false`. + /// + /// Equivalent to Docker's `--load` flag. + /// + [Output("load")] + public Output Load { get; private set; } = null!; + + /// + /// Set the network mode for `RUN` instructions. Defaults to `default`. + /// + /// For custom networks, configure your builder with `--driver-opt network=...`. + /// + /// Equivalent to Docker's `--network` flag. + /// + [Output("network")] + public Output Network { get; private set; } = null!; + + /// + /// Do not import cache manifests when building the image. + /// + /// Equivalent to Docker's `--no-cache` flag. + /// + [Output("noCache")] + public Output NoCache { get; private set; } = null!; + /// /// Set target platform(s) for the build. Defaults to the host's platform. /// @@ -569,6 +621,30 @@ public partial class Image : global::Pulumi.CustomResource [Output("pull")] public Output Pull { get; private set; } = null!; + /// + /// When `true` the build will automatically include a `registry` export. + /// + /// Defaults to `false`. + /// + /// Equivalent to Docker's `--push` flag. + /// + [Output("push")] + public Output Push { get; private set; } = null!; + + /// + /// If the image was pushed to any registries then this will contain a + /// single fully-qualified tag including the build's digest. + /// + /// This is only for convenience and may not be appropriate for situations + /// where multiple tags or registries are involved. In those cases this + /// output is not guaranteed to be stable. + /// + /// For more control over tags consumed by downstream resources you should + /// use the `Digests` output. + /// + [Output("ref")] + public Output Ref { get; private set; } = null!; + /// /// Registry credentials. Required if reading or exporting to private /// repositories. @@ -595,6 +671,14 @@ public partial class Image : global::Pulumi.CustomResource [Output("secrets")] public Output?> Secrets { get; private set; } = null!; + /// + /// SSH agent socket or keys to expose to the build. + /// + /// Equivalent to Docker's `--ssh` flag. + /// + [Output("ssh")] + public Output> Ssh { get; private set; } = null!; + /// /// Name and optionally a tag (format: `name:tag`). /// @@ -639,10 +723,6 @@ private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? var defaultOptions = new CustomResourceOptions { Version = Utilities.Version, - AdditionalSecretOutputs = - { - "secrets", - }, }; var merged = CustomResourceOptions.Merge(defaultOptions, options); // Override the ID if one was specified for consistency with other language SDKs. @@ -665,6 +745,20 @@ public static Image Get(string name, Input id, CustomResourceOptions? op public sealed class ImageArgs : global::Pulumi.ResourceArgs { + [Input("addHosts")] + private InputList? _addHosts; + + /// + /// Custom `host:ip` mappings to use during the build. + /// + /// Equivalent to Docker's `--add-host` flag. + /// + public InputList AddHosts + { + get => _addHosts ?? (_addHosts = new InputList()); + set => _addHosts = value; + } + [Input("buildArgs")] private InputMap? _buildArgs; @@ -686,8 +780,20 @@ public InputMap BuildArgs } /// - /// When `true`, attempt to build the image during previews. The image will - /// not be pushed to registries, however caches will still be populated. + /// By default, preview behavior depends on the execution environment. If + /// Pulumi detects the operation is running on a CI system (GitHub Actions, + /// Travis CI, Azure Pipelines, etc.) then it will build images during + /// previews as a safeguard. Otherwise, if not running on CI, previews will + /// not build images. + /// + /// Setting this to `false` forces previews to never perform builds, and + /// setting it to `true` will always build the image during previews. + /// + /// Images built during previews are never exported to registries, however + /// cache manifests are still exported. + /// + /// On-disk Dockerfiles are always validated for syntactic correctness + /// regardless of this setting. /// [Input("buildOnPreview")] public Input? BuildOnPreview { get; set; } @@ -773,6 +879,34 @@ public InputMap Labels set => _labels = value; } + /// + /// When `true` the build will automatically include a `docker` export. + /// + /// Defaults to `false`. + /// + /// Equivalent to Docker's `--load` flag. + /// + [Input("load")] + public Input? Load { get; set; } + + /// + /// Set the network mode for `RUN` instructions. Defaults to `default`. + /// + /// For custom networks, configure your builder with `--driver-opt network=...`. + /// + /// Equivalent to Docker's `--network` flag. + /// + [Input("network")] + public Input? Network { get; set; } + + /// + /// Do not import cache manifests when building the image. + /// + /// Equivalent to Docker's `--no-cache` flag. + /// + [Input("noCache")] + public Input? NoCache { get; set; } + [Input("platforms")] private InputList? _platforms; @@ -795,6 +929,16 @@ public InputList Platforms [Input("pull")] public Input? Pull { get; set; } + /// + /// When `true` the build will automatically include a `registry` export. + /// + /// Defaults to `false`. + /// + /// Equivalent to Docker's `--push` flag. + /// + [Input("push")] + public Input? Push { get; set; } + [Input("registries")] private InputList? _registries; @@ -830,11 +974,21 @@ public InputList Registries public InputMap Secrets { get => _secrets ?? (_secrets = new InputMap()); - set - { - var emptySecret = Output.CreateSecret(ImmutableDictionary.Create()); - _secrets = Output.All(value, emptySecret).Apply(v => v[0]); - } + set => _secrets = value; + } + + [Input("ssh")] + private InputList? _ssh; + + /// + /// SSH agent socket or keys to expose to the build. + /// + /// Equivalent to Docker's `--ssh` flag. + /// + public InputList Ssh + { + get => _ssh ?? (_ssh = new InputList()); + set => _ssh = value; } [Input("tags")] @@ -872,6 +1026,7 @@ public InputList Targets public ImageArgs() { + Network = Pulumi.Docker.Buildx.NetworkMode.@Default; } public static new ImageArgs Empty => new ImageArgs(); } diff --git a/sdk/dotnet/Buildx/Inputs/ExportEntryArgs.cs b/sdk/dotnet/Buildx/Inputs/ExportEntryArgs.cs index 6e5583c9..e7b816c4 100644 --- a/sdk/dotnet/Buildx/Inputs/ExportEntryArgs.cs +++ b/sdk/dotnet/Buildx/Inputs/ExportEntryArgs.cs @@ -36,19 +36,6 @@ public sealed class ExportEntryArgs : global::Pulumi.ResourceArgs [Input("local")] public Input? Local { get; set; } - [Input("manifests")] - private InputList? _manifests; - - /// - /// An output property populated for exporters that pushed image - /// manifest(s) to a registry. - /// - public InputList Manifests - { - get => _manifests ?? (_manifests = new InputList()); - set => _manifests = value; - } - /// /// Identical to the Docker exporter but uses OCI media types by default. /// diff --git a/sdk/dotnet/Buildx/Inputs/ManifestArgs.cs b/sdk/dotnet/Buildx/Inputs/ManifestArgs.cs deleted file mode 100644 index b371ec8d..00000000 --- a/sdk/dotnet/Buildx/Inputs/ManifestArgs.cs +++ /dev/null @@ -1,44 +0,0 @@ -// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Threading.Tasks; -using Pulumi.Serialization; - -namespace Pulumi.Docker.Buildx.Inputs -{ - - public sealed class ManifestArgs : global::Pulumi.ResourceArgs - { - /// - /// The SHA256 digest of the manifest. - /// - [Input("digest", required: true)] - public Input Digest { get; set; } = null!; - - /// - /// The manifest's platform. - /// - [Input("platform", required: true)] - public Input Platform { get; set; } = null!; - - /// - /// The manifest's canonical ref. - /// - [Input("ref", required: true)] - public Input Ref { get; set; } = null!; - - /// - /// The size of the manifest in bytes. - /// - [Input("size", required: true)] - public Input Size { get; set; } = null!; - - public ManifestArgs() - { - } - public static new ManifestArgs Empty => new ManifestArgs(); - } -} diff --git a/sdk/dotnet/Buildx/Inputs/ManifestPlatformArgs.cs b/sdk/dotnet/Buildx/Inputs/ManifestPlatformArgs.cs deleted file mode 100644 index 9b95fb8a..00000000 --- a/sdk/dotnet/Buildx/Inputs/ManifestPlatformArgs.cs +++ /dev/null @@ -1,32 +0,0 @@ -// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Threading.Tasks; -using Pulumi.Serialization; - -namespace Pulumi.Docker.Buildx.Inputs -{ - - public sealed class ManifestPlatformArgs : global::Pulumi.ResourceArgs - { - /// - /// The manifest's architecture. - /// - [Input("architecture", required: true)] - public Input Architecture { get; set; } = null!; - - /// - /// The manifest's operating systen. - /// - [Input("os", required: true)] - public Input Os { get; set; } = null!; - - public ManifestPlatformArgs() - { - } - public static new ManifestPlatformArgs Empty => new ManifestPlatformArgs(); - } -} diff --git a/sdk/dotnet/Buildx/Inputs/SSHArgs.cs b/sdk/dotnet/Buildx/Inputs/SSHArgs.cs new file mode 100644 index 00000000..2f07c7ac --- /dev/null +++ b/sdk/dotnet/Buildx/Inputs/SSHArgs.cs @@ -0,0 +1,48 @@ +// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading.Tasks; +using Pulumi.Serialization; + +namespace Pulumi.Docker.Buildx.Inputs +{ + + public sealed class SSHArgs : global::Pulumi.ResourceArgs + { + /// + /// Useful for distinguishing different servers that are part of the same + /// build. + /// + /// A value of `default` is appropriate if only dealing with a single host. + /// + [Input("id", required: true)] + public Input Id { get; set; } = null!; + + [Input("paths")] + private InputList? _paths; + + /// + /// SSH agent socket or private keys to expose to the build under the given + /// identifier. + /// + /// Defaults to `[$SSH_AUTH_SOCK]`. + /// + /// Note that your keys are **not** automatically added when using an + /// agent. Run `ssh-add -l` locally to confirm which public keys are + /// visible to the agent; these will be exposed to your build. + /// + public InputList Paths + { + get => _paths ?? (_paths = new InputList()); + set => _paths = value; + } + + public SSHArgs() + { + } + public static new SSHArgs Empty => new SSHArgs(); + } +} diff --git a/sdk/dotnet/Buildx/Outputs/ExportEntry.cs b/sdk/dotnet/Buildx/Outputs/ExportEntry.cs index 727ede06..e294ffc4 100644 --- a/sdk/dotnet/Buildx/Outputs/ExportEntry.cs +++ b/sdk/dotnet/Buildx/Outputs/ExportEntry.cs @@ -30,11 +30,6 @@ public sealed class ExportEntry /// public readonly Outputs.ExportLocal? Local; /// - /// An output property populated for exporters that pushed image - /// manifest(s) to a registry. - /// - public readonly ImmutableArray Manifests; - /// /// Identical to the Docker exporter but uses OCI media types by default. /// public readonly Outputs.ExportOCI? Oci; @@ -62,8 +57,6 @@ private ExportEntry( Outputs.ExportLocal? local, - ImmutableArray manifests, - Outputs.ExportOCI? oci, string? raw, @@ -76,7 +69,6 @@ private ExportEntry( Docker = docker; Image = image; Local = local; - Manifests = manifests; Oci = oci; Raw = raw; Registry = registry; diff --git a/sdk/dotnet/Buildx/Outputs/Manifest.cs b/sdk/dotnet/Buildx/Outputs/Manifest.cs deleted file mode 100644 index 1badef99..00000000 --- a/sdk/dotnet/Buildx/Outputs/Manifest.cs +++ /dev/null @@ -1,49 +0,0 @@ -// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Threading.Tasks; -using Pulumi.Serialization; - -namespace Pulumi.Docker.Buildx.Outputs -{ - - [OutputType] - public sealed class Manifest - { - /// - /// The SHA256 digest of the manifest. - /// - public readonly string Digest; - /// - /// The manifest's platform. - /// - public readonly Outputs.ManifestPlatform Platform; - /// - /// The manifest's canonical ref. - /// - public readonly string Ref; - /// - /// The size of the manifest in bytes. - /// - public readonly int Size; - - [OutputConstructor] - private Manifest( - string digest, - - Outputs.ManifestPlatform platform, - - string @ref, - - int size) - { - Digest = digest; - Platform = platform; - Ref = @ref; - Size = size; - } - } -} diff --git a/sdk/dotnet/Buildx/Outputs/ManifestPlatform.cs b/sdk/dotnet/Buildx/Outputs/ManifestPlatform.cs deleted file mode 100644 index 7c8aec5c..00000000 --- a/sdk/dotnet/Buildx/Outputs/ManifestPlatform.cs +++ /dev/null @@ -1,35 +0,0 @@ -// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Threading.Tasks; -using Pulumi.Serialization; - -namespace Pulumi.Docker.Buildx.Outputs -{ - - [OutputType] - public sealed class ManifestPlatform - { - /// - /// The manifest's architecture. - /// - public readonly string Architecture; - /// - /// The manifest's operating systen. - /// - public readonly string Os; - - [OutputConstructor] - private ManifestPlatform( - string architecture, - - string os) - { - Architecture = architecture; - Os = os; - } - } -} diff --git a/sdk/dotnet/Buildx/Outputs/SSH.cs b/sdk/dotnet/Buildx/Outputs/SSH.cs new file mode 100644 index 00000000..296684d6 --- /dev/null +++ b/sdk/dotnet/Buildx/Outputs/SSH.cs @@ -0,0 +1,45 @@ +// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading.Tasks; +using Pulumi.Serialization; + +namespace Pulumi.Docker.Buildx.Outputs +{ + + [OutputType] + public sealed class SSH + { + /// + /// Useful for distinguishing different servers that are part of the same + /// build. + /// + /// A value of `default` is appropriate if only dealing with a single host. + /// + public readonly string Id; + /// + /// SSH agent socket or private keys to expose to the build under the given + /// identifier. + /// + /// Defaults to `[$SSH_AUTH_SOCK]`. + /// + /// Note that your keys are **not** automatically added when using an + /// agent. Run `ssh-add -l` locally to confirm which public keys are + /// visible to the agent; these will be exposed to your build. + /// + public readonly ImmutableArray Paths; + + [OutputConstructor] + private SSH( + string id, + + ImmutableArray paths) + { + Id = id; + Paths = paths; + } + } +} diff --git a/sdk/go/docker/buildx/image.go b/sdk/go/docker/buildx/image.go index 782929d0..6de584bb 100644 --- a/sdk/go/docker/buildx/image.go +++ b/sdk/go/docker/buildx/image.go @@ -508,6 +508,10 @@ import ( type Image struct { pulumi.CustomResourceState + // Custom `host:ip` mappings to use during the build. + // + // Equivalent to Docker's `--add-host` flag. + AddHosts pulumi.StringArrayOutput `pulumi:"addHosts"` // `ARG` names and values to set during the build. // // These variables are accessed like environment variables inside `RUN` @@ -518,8 +522,20 @@ type Image struct { // // Equivalent to Docker's `--build-arg` flag. BuildArgs pulumi.StringMapOutput `pulumi:"buildArgs"` - // When `true`, attempt to build the image during previews. The image will - // not be pushed to registries, however caches will still be populated. + // By default, preview behavior depends on the execution environment. If + // Pulumi detects the operation is running on a CI system (GitHub Actions, + // Travis CI, Azure Pipelines, etc.) then it will build images during + // previews as a safeguard. Otherwise, if not running on CI, previews will + // not build images. + // + // Setting this to `false` forces previews to never perform builds, and + // setting it to `true` will always build the image during previews. + // + // Images built during previews are never exported to registries, however + // cache manifests are still exported. + // + // On-disk Dockerfiles are always validated for syntactic correctness + // regardless of this setting. BuildOnPreview pulumi.BoolPtrOutput `pulumi:"buildOnPreview"` // Builder configuration. Builder BuilderConfigPtrOutput `pulumi:"builder"` @@ -538,9 +554,13 @@ type Image struct { // A preliminary hash of the image's build context. // // Pulumi uses this to determine if an image _may_ need to be re-built. - ContextHash pulumi.StringPtrOutput `pulumi:"contextHash"` - // A mapping of platform type to refs which were pushed to registries. - Digests pulumi.StringArrayMapOutput `pulumi:"digests"` + ContextHash pulumi.StringOutput `pulumi:"contextHash"` + // A mapping of target names to the SHA256 digest of their pushed manifest. + // + // If no target was specified 'default' is used as the target name. + // + // Pushed manifests can be referenced as `@`. + Digests pulumi.StringMapOutput `pulumi:"digests"` // Dockerfile settings. // // Equivalent to Docker's `--file` flag. @@ -556,6 +576,22 @@ type Image struct { // // Equivalent to Docker's `--label` flag. Labels pulumi.StringMapOutput `pulumi:"labels"` + // When `true` the build will automatically include a `docker` export. + // + // Defaults to `false`. + // + // Equivalent to Docker's `--load` flag. + Load pulumi.BoolPtrOutput `pulumi:"load"` + // Set the network mode for `RUN` instructions. Defaults to `default`. + // + // For custom networks, configure your builder with `--driver-opt network=...`. + // + // Equivalent to Docker's `--network` flag. + Network NetworkModePtrOutput `pulumi:"network"` + // Do not import cache manifests when building the image. + // + // Equivalent to Docker's `--no-cache` flag. + NoCache pulumi.BoolPtrOutput `pulumi:"noCache"` // Set target platform(s) for the build. Defaults to the host's platform. // // Equivalent to Docker's `--platform` flag. @@ -564,6 +600,22 @@ type Image struct { // // Equivalent to Docker's `--pull` flag. Pull pulumi.BoolPtrOutput `pulumi:"pull"` + // When `true` the build will automatically include a `registry` export. + // + // Defaults to `false`. + // + // Equivalent to Docker's `--push` flag. + Push pulumi.BoolPtrOutput `pulumi:"push"` + // If the image was pushed to any registries then this will contain a + // single fully-qualified tag including the build's digest. + // + // This is only for convenience and may not be appropriate for situations + // where multiple tags or registries are involved. In those cases this + // output is not guaranteed to be stable. + // + // For more control over tags consumed by downstream resources you should + // use the `Digests` output. + Ref pulumi.StringOutput `pulumi:"ref"` // Registry credentials. Required if reading or exporting to private // repositories. // @@ -582,6 +634,10 @@ type Image struct { // // Similar to Docker's `--secret` flag. Secrets pulumi.StringMapOutput `pulumi:"secrets"` + // SSH agent socket or keys to expose to the build. + // + // Equivalent to Docker's `--ssh` flag. + Ssh SSHArrayOutput `pulumi:"ssh"` // Name and optionally a tag (format: `name:tag`). // // If exporting to a registry, the name should include the fully qualified @@ -604,13 +660,9 @@ func NewImage(ctx *pulumi.Context, args = &ImageArgs{} } - if args.Secrets != nil { - args.Secrets = pulumi.ToSecret(args.Secrets).(pulumi.StringMapInput) + if args.Network == nil { + args.Network = NetworkMode("default") } - secrets := pulumi.AdditionalSecretOutputs([]string{ - "secrets", - }) - opts = append(opts, secrets) opts = internal.PkgResourceDefaultOpts(opts) var resource Image err := ctx.RegisterResource("docker:buildx/image:Image", name, args, &resource, opts...) @@ -644,6 +696,10 @@ func (ImageState) ElementType() reflect.Type { } type imageArgs struct { + // Custom `host:ip` mappings to use during the build. + // + // Equivalent to Docker's `--add-host` flag. + AddHosts []string `pulumi:"addHosts"` // `ARG` names and values to set during the build. // // These variables are accessed like environment variables inside `RUN` @@ -654,8 +710,20 @@ type imageArgs struct { // // Equivalent to Docker's `--build-arg` flag. BuildArgs map[string]string `pulumi:"buildArgs"` - // When `true`, attempt to build the image during previews. The image will - // not be pushed to registries, however caches will still be populated. + // By default, preview behavior depends on the execution environment. If + // Pulumi detects the operation is running on a CI system (GitHub Actions, + // Travis CI, Azure Pipelines, etc.) then it will build images during + // previews as a safeguard. Otherwise, if not running on CI, previews will + // not build images. + // + // Setting this to `false` forces previews to never perform builds, and + // setting it to `true` will always build the image during previews. + // + // Images built during previews are never exported to registries, however + // cache manifests are still exported. + // + // On-disk Dockerfiles are always validated for syntactic correctness + // regardless of this setting. BuildOnPreview *bool `pulumi:"buildOnPreview"` // Builder configuration. Builder *BuilderConfig `pulumi:"builder"` @@ -686,6 +754,22 @@ type imageArgs struct { // // Equivalent to Docker's `--label` flag. Labels map[string]string `pulumi:"labels"` + // When `true` the build will automatically include a `docker` export. + // + // Defaults to `false`. + // + // Equivalent to Docker's `--load` flag. + Load *bool `pulumi:"load"` + // Set the network mode for `RUN` instructions. Defaults to `default`. + // + // For custom networks, configure your builder with `--driver-opt network=...`. + // + // Equivalent to Docker's `--network` flag. + Network *NetworkMode `pulumi:"network"` + // Do not import cache manifests when building the image. + // + // Equivalent to Docker's `--no-cache` flag. + NoCache *bool `pulumi:"noCache"` // Set target platform(s) for the build. Defaults to the host's platform. // // Equivalent to Docker's `--platform` flag. @@ -694,6 +778,12 @@ type imageArgs struct { // // Equivalent to Docker's `--pull` flag. Pull *bool `pulumi:"pull"` + // When `true` the build will automatically include a `registry` export. + // + // Defaults to `false`. + // + // Equivalent to Docker's `--push` flag. + Push *bool `pulumi:"push"` // Registry credentials. Required if reading or exporting to private // repositories. // @@ -712,6 +802,10 @@ type imageArgs struct { // // Similar to Docker's `--secret` flag. Secrets map[string]string `pulumi:"secrets"` + // SSH agent socket or keys to expose to the build. + // + // Equivalent to Docker's `--ssh` flag. + Ssh []SSH `pulumi:"ssh"` // Name and optionally a tag (format: `name:tag`). // // If exporting to a registry, the name should include the fully qualified @@ -729,6 +823,10 @@ type imageArgs struct { // The set of arguments for constructing a Image resource. type ImageArgs struct { + // Custom `host:ip` mappings to use during the build. + // + // Equivalent to Docker's `--add-host` flag. + AddHosts pulumi.StringArrayInput // `ARG` names and values to set during the build. // // These variables are accessed like environment variables inside `RUN` @@ -739,8 +837,20 @@ type ImageArgs struct { // // Equivalent to Docker's `--build-arg` flag. BuildArgs pulumi.StringMapInput - // When `true`, attempt to build the image during previews. The image will - // not be pushed to registries, however caches will still be populated. + // By default, preview behavior depends on the execution environment. If + // Pulumi detects the operation is running on a CI system (GitHub Actions, + // Travis CI, Azure Pipelines, etc.) then it will build images during + // previews as a safeguard. Otherwise, if not running on CI, previews will + // not build images. + // + // Setting this to `false` forces previews to never perform builds, and + // setting it to `true` will always build the image during previews. + // + // Images built during previews are never exported to registries, however + // cache manifests are still exported. + // + // On-disk Dockerfiles are always validated for syntactic correctness + // regardless of this setting. BuildOnPreview pulumi.BoolPtrInput // Builder configuration. Builder BuilderConfigPtrInput @@ -771,6 +881,22 @@ type ImageArgs struct { // // Equivalent to Docker's `--label` flag. Labels pulumi.StringMapInput + // When `true` the build will automatically include a `docker` export. + // + // Defaults to `false`. + // + // Equivalent to Docker's `--load` flag. + Load pulumi.BoolPtrInput + // Set the network mode for `RUN` instructions. Defaults to `default`. + // + // For custom networks, configure your builder with `--driver-opt network=...`. + // + // Equivalent to Docker's `--network` flag. + Network NetworkModePtrInput + // Do not import cache manifests when building the image. + // + // Equivalent to Docker's `--no-cache` flag. + NoCache pulumi.BoolPtrInput // Set target platform(s) for the build. Defaults to the host's platform. // // Equivalent to Docker's `--platform` flag. @@ -779,6 +905,12 @@ type ImageArgs struct { // // Equivalent to Docker's `--pull` flag. Pull pulumi.BoolPtrInput + // When `true` the build will automatically include a `registry` export. + // + // Defaults to `false`. + // + // Equivalent to Docker's `--push` flag. + Push pulumi.BoolPtrInput // Registry credentials. Required if reading or exporting to private // repositories. // @@ -797,6 +929,10 @@ type ImageArgs struct { // // Similar to Docker's `--secret` flag. Secrets pulumi.StringMapInput + // SSH agent socket or keys to expose to the build. + // + // Equivalent to Docker's `--ssh` flag. + Ssh SSHArrayInput // Name and optionally a tag (format: `name:tag`). // // If exporting to a registry, the name should include the fully qualified @@ -899,6 +1035,13 @@ func (o ImageOutput) ToImageOutputWithContext(ctx context.Context) ImageOutput { return o } +// Custom `host:ip` mappings to use during the build. +// +// Equivalent to Docker's `--add-host` flag. +func (o ImageOutput) AddHosts() pulumi.StringArrayOutput { + return o.ApplyT(func(v *Image) pulumi.StringArrayOutput { return v.AddHosts }).(pulumi.StringArrayOutput) +} + // `ARG` names and values to set during the build. // // These variables are accessed like environment variables inside `RUN` @@ -912,8 +1055,20 @@ func (o ImageOutput) BuildArgs() pulumi.StringMapOutput { return o.ApplyT(func(v *Image) pulumi.StringMapOutput { return v.BuildArgs }).(pulumi.StringMapOutput) } -// When `true`, attempt to build the image during previews. The image will -// not be pushed to registries, however caches will still be populated. +// By default, preview behavior depends on the execution environment. If +// Pulumi detects the operation is running on a CI system (GitHub Actions, +// Travis CI, Azure Pipelines, etc.) then it will build images during +// previews as a safeguard. Otherwise, if not running on CI, previews will +// not build images. +// +// Setting this to `false` forces previews to never perform builds, and +// setting it to `true` will always build the image during previews. +// +// Images built during previews are never exported to registries, however +// cache manifests are still exported. +// +// On-disk Dockerfiles are always validated for syntactic correctness +// regardless of this setting. func (o ImageOutput) BuildOnPreview() pulumi.BoolPtrOutput { return o.ApplyT(func(v *Image) pulumi.BoolPtrOutput { return v.BuildOnPreview }).(pulumi.BoolPtrOutput) } @@ -947,13 +1102,17 @@ func (o ImageOutput) Context() BuildContextPtrOutput { // A preliminary hash of the image's build context. // // Pulumi uses this to determine if an image _may_ need to be re-built. -func (o ImageOutput) ContextHash() pulumi.StringPtrOutput { - return o.ApplyT(func(v *Image) pulumi.StringPtrOutput { return v.ContextHash }).(pulumi.StringPtrOutput) +func (o ImageOutput) ContextHash() pulumi.StringOutput { + return o.ApplyT(func(v *Image) pulumi.StringOutput { return v.ContextHash }).(pulumi.StringOutput) } -// A mapping of platform type to refs which were pushed to registries. -func (o ImageOutput) Digests() pulumi.StringArrayMapOutput { - return o.ApplyT(func(v *Image) pulumi.StringArrayMapOutput { return v.Digests }).(pulumi.StringArrayMapOutput) +// A mapping of target names to the SHA256 digest of their pushed manifest. +// +// If no target was specified 'default' is used as the target name. +// +// Pushed manifests can be referenced as `@`. +func (o ImageOutput) Digests() pulumi.StringMapOutput { + return o.ApplyT(func(v *Image) pulumi.StringMapOutput { return v.Digests }).(pulumi.StringMapOutput) } // Dockerfile settings. @@ -980,6 +1139,31 @@ func (o ImageOutput) Labels() pulumi.StringMapOutput { return o.ApplyT(func(v *Image) pulumi.StringMapOutput { return v.Labels }).(pulumi.StringMapOutput) } +// When `true` the build will automatically include a `docker` export. +// +// Defaults to `false`. +// +// Equivalent to Docker's `--load` flag. +func (o ImageOutput) Load() pulumi.BoolPtrOutput { + return o.ApplyT(func(v *Image) pulumi.BoolPtrOutput { return v.Load }).(pulumi.BoolPtrOutput) +} + +// Set the network mode for `RUN` instructions. Defaults to `default`. +// +// For custom networks, configure your builder with `--driver-opt network=...`. +// +// Equivalent to Docker's `--network` flag. +func (o ImageOutput) Network() NetworkModePtrOutput { + return o.ApplyT(func(v *Image) NetworkModePtrOutput { return v.Network }).(NetworkModePtrOutput) +} + +// Do not import cache manifests when building the image. +// +// Equivalent to Docker's `--no-cache` flag. +func (o ImageOutput) NoCache() pulumi.BoolPtrOutput { + return o.ApplyT(func(v *Image) pulumi.BoolPtrOutput { return v.NoCache }).(pulumi.BoolPtrOutput) +} + // Set target platform(s) for the build. Defaults to the host's platform. // // Equivalent to Docker's `--platform` flag. @@ -994,6 +1178,28 @@ func (o ImageOutput) Pull() pulumi.BoolPtrOutput { return o.ApplyT(func(v *Image) pulumi.BoolPtrOutput { return v.Pull }).(pulumi.BoolPtrOutput) } +// When `true` the build will automatically include a `registry` export. +// +// Defaults to `false`. +// +// Equivalent to Docker's `--push` flag. +func (o ImageOutput) Push() pulumi.BoolPtrOutput { + return o.ApplyT(func(v *Image) pulumi.BoolPtrOutput { return v.Push }).(pulumi.BoolPtrOutput) +} + +// If the image was pushed to any registries then this will contain a +// single fully-qualified tag including the build's digest. +// +// This is only for convenience and may not be appropriate for situations +// where multiple tags or registries are involved. In those cases this +// output is not guaranteed to be stable. +// +// For more control over tags consumed by downstream resources you should +// use the `Digests` output. +func (o ImageOutput) Ref() pulumi.StringOutput { + return o.ApplyT(func(v *Image) pulumi.StringOutput { return v.Ref }).(pulumi.StringOutput) +} + // Registry credentials. Required if reading or exporting to private // repositories. // @@ -1018,6 +1224,13 @@ func (o ImageOutput) Secrets() pulumi.StringMapOutput { return o.ApplyT(func(v *Image) pulumi.StringMapOutput { return v.Secrets }).(pulumi.StringMapOutput) } +// SSH agent socket or keys to expose to the build. +// +// Equivalent to Docker's `--ssh` flag. +func (o ImageOutput) Ssh() SSHArrayOutput { + return o.ApplyT(func(v *Image) SSHArrayOutput { return v.Ssh }).(SSHArrayOutput) +} + // Name and optionally a tag (format: `name:tag`). // // If exporting to a registry, the name should include the fully qualified diff --git a/sdk/go/docker/buildx/pulumiEnums.go b/sdk/go/docker/buildx/pulumiEnums.go index 5a230a8c..098931dc 100644 --- a/sdk/go/docker/buildx/pulumiEnums.go +++ b/sdk/go/docker/buildx/pulumiEnums.go @@ -347,6 +347,176 @@ func (in *compressionTypePtr) ToCompressionTypePtrOutputWithContext(ctx context. return pulumi.ToOutputWithContext(ctx, in).(CompressionTypePtrOutput) } +type NetworkMode string + +const ( + // The default sandbox network mode. + NetworkModeDefault = NetworkMode("default") + // Host network mode. + NetworkModeHost = NetworkMode("host") + // Disable network access. + NetworkModeNone = NetworkMode("none") +) + +func (NetworkMode) ElementType() reflect.Type { + return reflect.TypeOf((*NetworkMode)(nil)).Elem() +} + +func (e NetworkMode) ToNetworkModeOutput() NetworkModeOutput { + return pulumi.ToOutput(e).(NetworkModeOutput) +} + +func (e NetworkMode) ToNetworkModeOutputWithContext(ctx context.Context) NetworkModeOutput { + return pulumi.ToOutputWithContext(ctx, e).(NetworkModeOutput) +} + +func (e NetworkMode) ToNetworkModePtrOutput() NetworkModePtrOutput { + return e.ToNetworkModePtrOutputWithContext(context.Background()) +} + +func (e NetworkMode) ToNetworkModePtrOutputWithContext(ctx context.Context) NetworkModePtrOutput { + return NetworkMode(e).ToNetworkModeOutputWithContext(ctx).ToNetworkModePtrOutputWithContext(ctx) +} + +func (e NetworkMode) ToStringOutput() pulumi.StringOutput { + return pulumi.ToOutput(pulumi.String(e)).(pulumi.StringOutput) +} + +func (e NetworkMode) ToStringOutputWithContext(ctx context.Context) pulumi.StringOutput { + return pulumi.ToOutputWithContext(ctx, pulumi.String(e)).(pulumi.StringOutput) +} + +func (e NetworkMode) ToStringPtrOutput() pulumi.StringPtrOutput { + return pulumi.String(e).ToStringPtrOutputWithContext(context.Background()) +} + +func (e NetworkMode) ToStringPtrOutputWithContext(ctx context.Context) pulumi.StringPtrOutput { + return pulumi.String(e).ToStringOutputWithContext(ctx).ToStringPtrOutputWithContext(ctx) +} + +type NetworkModeOutput struct{ *pulumi.OutputState } + +func (NetworkModeOutput) ElementType() reflect.Type { + return reflect.TypeOf((*NetworkMode)(nil)).Elem() +} + +func (o NetworkModeOutput) ToNetworkModeOutput() NetworkModeOutput { + return o +} + +func (o NetworkModeOutput) ToNetworkModeOutputWithContext(ctx context.Context) NetworkModeOutput { + return o +} + +func (o NetworkModeOutput) ToNetworkModePtrOutput() NetworkModePtrOutput { + return o.ToNetworkModePtrOutputWithContext(context.Background()) +} + +func (o NetworkModeOutput) ToNetworkModePtrOutputWithContext(ctx context.Context) NetworkModePtrOutput { + return o.ApplyTWithContext(ctx, func(_ context.Context, v NetworkMode) *NetworkMode { + return &v + }).(NetworkModePtrOutput) +} + +func (o NetworkModeOutput) ToStringOutput() pulumi.StringOutput { + return o.ToStringOutputWithContext(context.Background()) +} + +func (o NetworkModeOutput) ToStringOutputWithContext(ctx context.Context) pulumi.StringOutput { + return o.ApplyTWithContext(ctx, func(_ context.Context, e NetworkMode) string { + return string(e) + }).(pulumi.StringOutput) +} + +func (o NetworkModeOutput) ToStringPtrOutput() pulumi.StringPtrOutput { + return o.ToStringPtrOutputWithContext(context.Background()) +} + +func (o NetworkModeOutput) ToStringPtrOutputWithContext(ctx context.Context) pulumi.StringPtrOutput { + return o.ApplyTWithContext(ctx, func(_ context.Context, e NetworkMode) *string { + v := string(e) + return &v + }).(pulumi.StringPtrOutput) +} + +type NetworkModePtrOutput struct{ *pulumi.OutputState } + +func (NetworkModePtrOutput) ElementType() reflect.Type { + return reflect.TypeOf((**NetworkMode)(nil)).Elem() +} + +func (o NetworkModePtrOutput) ToNetworkModePtrOutput() NetworkModePtrOutput { + return o +} + +func (o NetworkModePtrOutput) ToNetworkModePtrOutputWithContext(ctx context.Context) NetworkModePtrOutput { + return o +} + +func (o NetworkModePtrOutput) Elem() NetworkModeOutput { + return o.ApplyT(func(v *NetworkMode) NetworkMode { + if v != nil { + return *v + } + var ret NetworkMode + return ret + }).(NetworkModeOutput) +} + +func (o NetworkModePtrOutput) ToStringPtrOutput() pulumi.StringPtrOutput { + return o.ToStringPtrOutputWithContext(context.Background()) +} + +func (o NetworkModePtrOutput) ToStringPtrOutputWithContext(ctx context.Context) pulumi.StringPtrOutput { + return o.ApplyTWithContext(ctx, func(_ context.Context, e *NetworkMode) *string { + if e == nil { + return nil + } + v := string(*e) + return &v + }).(pulumi.StringPtrOutput) +} + +// NetworkModeInput is an input type that accepts values of the NetworkMode enum +// A concrete instance of `NetworkModeInput` can be one of the following: +// +// NetworkModeDefault +// NetworkModeHost +// NetworkModeNone +type NetworkModeInput interface { + pulumi.Input + + ToNetworkModeOutput() NetworkModeOutput + ToNetworkModeOutputWithContext(context.Context) NetworkModeOutput +} + +var networkModePtrType = reflect.TypeOf((**NetworkMode)(nil)).Elem() + +type NetworkModePtrInput interface { + pulumi.Input + + ToNetworkModePtrOutput() NetworkModePtrOutput + ToNetworkModePtrOutputWithContext(context.Context) NetworkModePtrOutput +} + +type networkModePtr string + +func NetworkModePtr(v string) NetworkModePtrInput { + return (*networkModePtr)(&v) +} + +func (*networkModePtr) ElementType() reflect.Type { + return networkModePtrType +} + +func (in *networkModePtr) ToNetworkModePtrOutput() NetworkModePtrOutput { + return pulumi.ToOutput(in).(NetworkModePtrOutput) +} + +func (in *networkModePtr) ToNetworkModePtrOutputWithContext(ctx context.Context) NetworkModePtrOutput { + return pulumi.ToOutputWithContext(ctx, in).(NetworkModePtrOutput) +} + type Platform string const ( @@ -614,6 +784,8 @@ func init() { pulumi.RegisterInputType(reflect.TypeOf((*CacheModePtrInput)(nil)).Elem(), CacheMode("min")) pulumi.RegisterInputType(reflect.TypeOf((*CompressionTypeInput)(nil)).Elem(), CompressionType("gzip")) pulumi.RegisterInputType(reflect.TypeOf((*CompressionTypePtrInput)(nil)).Elem(), CompressionType("gzip")) + pulumi.RegisterInputType(reflect.TypeOf((*NetworkModeInput)(nil)).Elem(), NetworkMode("default")) + pulumi.RegisterInputType(reflect.TypeOf((*NetworkModePtrInput)(nil)).Elem(), NetworkMode("default")) pulumi.RegisterInputType(reflect.TypeOf((*PlatformInput)(nil)).Elem(), Platform("darwin/386")) pulumi.RegisterInputType(reflect.TypeOf((*PlatformPtrInput)(nil)).Elem(), Platform("darwin/386")) pulumi.RegisterInputType(reflect.TypeOf((*PlatformArrayInput)(nil)).Elem(), PlatformArray{}) @@ -621,6 +793,8 @@ func init() { pulumi.RegisterOutputType(CacheModePtrOutput{}) pulumi.RegisterOutputType(CompressionTypeOutput{}) pulumi.RegisterOutputType(CompressionTypePtrOutput{}) + pulumi.RegisterOutputType(NetworkModeOutput{}) + pulumi.RegisterOutputType(NetworkModePtrOutput{}) pulumi.RegisterOutputType(PlatformOutput{}) pulumi.RegisterOutputType(PlatformPtrOutput{}) pulumi.RegisterOutputType(PlatformArrayOutput{}) diff --git a/sdk/go/docker/buildx/pulumiTypes.go b/sdk/go/docker/buildx/pulumiTypes.go index 2026da88..0b396711 100644 --- a/sdk/go/docker/buildx/pulumiTypes.go +++ b/sdk/go/docker/buildx/pulumiTypes.go @@ -4268,9 +4268,6 @@ type ExportEntry struct { Image *ExportImage `pulumi:"image"` // Export to a local directory as files and directories. Local *ExportLocal `pulumi:"local"` - // An output property populated for exporters that pushed image - // manifest(s) to a registry. - Manifests []Manifest `pulumi:"manifests"` // Identical to the Docker exporter but uses OCI media types by default. Oci *ExportOCI `pulumi:"oci"` // A raw string as you would provide it to the Docker CLI (e.g., @@ -4319,9 +4316,6 @@ type ExportEntryArgs struct { Image ExportImagePtrInput `pulumi:"image"` // Export to a local directory as files and directories. Local ExportLocalPtrInput `pulumi:"local"` - // An output property populated for exporters that pushed image - // manifest(s) to a registry. - Manifests ManifestArrayInput `pulumi:"manifests"` // Identical to the Docker exporter but uses OCI media types by default. Oci ExportOCIPtrInput `pulumi:"oci"` // A raw string as you would provide it to the Docker CLI (e.g., @@ -4413,12 +4407,6 @@ func (o ExportEntryOutput) Local() ExportLocalPtrOutput { return o.ApplyT(func(v ExportEntry) *ExportLocal { return v.Local }).(ExportLocalPtrOutput) } -// An output property populated for exporters that pushed image -// manifest(s) to a registry. -func (o ExportEntryOutput) Manifests() ManifestArrayOutput { - return o.ApplyT(func(v ExportEntry) []Manifest { return v.Manifests }).(ManifestArrayOutput) -} - // Identical to the Docker exporter but uses OCI media types by default. func (o ExportEntryOutput) Oci() ExportOCIPtrOutput { return o.ApplyT(func(v ExportEntry) *ExportOCI { return v.Oci }).(ExportOCIPtrOutput) @@ -5953,191 +5941,6 @@ func (o ExportTarPtrOutput) Dest() pulumi.StringPtrOutput { }).(pulumi.StringPtrOutput) } -type Manifest struct { - // The SHA256 digest of the manifest. - Digest string `pulumi:"digest"` - // The manifest's platform. - Platform ManifestPlatform `pulumi:"platform"` - // The manifest's canonical ref. - Ref string `pulumi:"ref"` - // The size of the manifest in bytes. - Size int `pulumi:"size"` -} - -// ManifestInput is an input type that accepts ManifestArgs and ManifestOutput values. -// You can construct a concrete instance of `ManifestInput` via: -// -// ManifestArgs{...} -type ManifestInput interface { - pulumi.Input - - ToManifestOutput() ManifestOutput - ToManifestOutputWithContext(context.Context) ManifestOutput -} - -type ManifestArgs struct { - // The SHA256 digest of the manifest. - Digest pulumi.StringInput `pulumi:"digest"` - // The manifest's platform. - Platform ManifestPlatformInput `pulumi:"platform"` - // The manifest's canonical ref. - Ref pulumi.StringInput `pulumi:"ref"` - // The size of the manifest in bytes. - Size pulumi.IntInput `pulumi:"size"` -} - -func (ManifestArgs) ElementType() reflect.Type { - return reflect.TypeOf((*Manifest)(nil)).Elem() -} - -func (i ManifestArgs) ToManifestOutput() ManifestOutput { - return i.ToManifestOutputWithContext(context.Background()) -} - -func (i ManifestArgs) ToManifestOutputWithContext(ctx context.Context) ManifestOutput { - return pulumi.ToOutputWithContext(ctx, i).(ManifestOutput) -} - -// ManifestArrayInput is an input type that accepts ManifestArray and ManifestArrayOutput values. -// You can construct a concrete instance of `ManifestArrayInput` via: -// -// ManifestArray{ ManifestArgs{...} } -type ManifestArrayInput interface { - pulumi.Input - - ToManifestArrayOutput() ManifestArrayOutput - ToManifestArrayOutputWithContext(context.Context) ManifestArrayOutput -} - -type ManifestArray []ManifestInput - -func (ManifestArray) ElementType() reflect.Type { - return reflect.TypeOf((*[]Manifest)(nil)).Elem() -} - -func (i ManifestArray) ToManifestArrayOutput() ManifestArrayOutput { - return i.ToManifestArrayOutputWithContext(context.Background()) -} - -func (i ManifestArray) ToManifestArrayOutputWithContext(ctx context.Context) ManifestArrayOutput { - return pulumi.ToOutputWithContext(ctx, i).(ManifestArrayOutput) -} - -type ManifestOutput struct{ *pulumi.OutputState } - -func (ManifestOutput) ElementType() reflect.Type { - return reflect.TypeOf((*Manifest)(nil)).Elem() -} - -func (o ManifestOutput) ToManifestOutput() ManifestOutput { - return o -} - -func (o ManifestOutput) ToManifestOutputWithContext(ctx context.Context) ManifestOutput { - return o -} - -// The SHA256 digest of the manifest. -func (o ManifestOutput) Digest() pulumi.StringOutput { - return o.ApplyT(func(v Manifest) string { return v.Digest }).(pulumi.StringOutput) -} - -// The manifest's platform. -func (o ManifestOutput) Platform() ManifestPlatformOutput { - return o.ApplyT(func(v Manifest) ManifestPlatform { return v.Platform }).(ManifestPlatformOutput) -} - -// The manifest's canonical ref. -func (o ManifestOutput) Ref() pulumi.StringOutput { - return o.ApplyT(func(v Manifest) string { return v.Ref }).(pulumi.StringOutput) -} - -// The size of the manifest in bytes. -func (o ManifestOutput) Size() pulumi.IntOutput { - return o.ApplyT(func(v Manifest) int { return v.Size }).(pulumi.IntOutput) -} - -type ManifestArrayOutput struct{ *pulumi.OutputState } - -func (ManifestArrayOutput) ElementType() reflect.Type { - return reflect.TypeOf((*[]Manifest)(nil)).Elem() -} - -func (o ManifestArrayOutput) ToManifestArrayOutput() ManifestArrayOutput { - return o -} - -func (o ManifestArrayOutput) ToManifestArrayOutputWithContext(ctx context.Context) ManifestArrayOutput { - return o -} - -func (o ManifestArrayOutput) Index(i pulumi.IntInput) ManifestOutput { - return pulumi.All(o, i).ApplyT(func(vs []interface{}) Manifest { - return vs[0].([]Manifest)[vs[1].(int)] - }).(ManifestOutput) -} - -type ManifestPlatform struct { - // The manifest's architecture. - Architecture string `pulumi:"architecture"` - // The manifest's operating systen. - Os string `pulumi:"os"` -} - -// ManifestPlatformInput is an input type that accepts ManifestPlatformArgs and ManifestPlatformOutput values. -// You can construct a concrete instance of `ManifestPlatformInput` via: -// -// ManifestPlatformArgs{...} -type ManifestPlatformInput interface { - pulumi.Input - - ToManifestPlatformOutput() ManifestPlatformOutput - ToManifestPlatformOutputWithContext(context.Context) ManifestPlatformOutput -} - -type ManifestPlatformArgs struct { - // The manifest's architecture. - Architecture pulumi.StringInput `pulumi:"architecture"` - // The manifest's operating systen. - Os pulumi.StringInput `pulumi:"os"` -} - -func (ManifestPlatformArgs) ElementType() reflect.Type { - return reflect.TypeOf((*ManifestPlatform)(nil)).Elem() -} - -func (i ManifestPlatformArgs) ToManifestPlatformOutput() ManifestPlatformOutput { - return i.ToManifestPlatformOutputWithContext(context.Background()) -} - -func (i ManifestPlatformArgs) ToManifestPlatformOutputWithContext(ctx context.Context) ManifestPlatformOutput { - return pulumi.ToOutputWithContext(ctx, i).(ManifestPlatformOutput) -} - -type ManifestPlatformOutput struct{ *pulumi.OutputState } - -func (ManifestPlatformOutput) ElementType() reflect.Type { - return reflect.TypeOf((*ManifestPlatform)(nil)).Elem() -} - -func (o ManifestPlatformOutput) ToManifestPlatformOutput() ManifestPlatformOutput { - return o -} - -func (o ManifestPlatformOutput) ToManifestPlatformOutputWithContext(ctx context.Context) ManifestPlatformOutput { - return o -} - -// The manifest's architecture. -func (o ManifestPlatformOutput) Architecture() pulumi.StringOutput { - return o.ApplyT(func(v ManifestPlatform) string { return v.Architecture }).(pulumi.StringOutput) -} - -// The manifest's operating systen. -func (o ManifestPlatformOutput) Os() pulumi.StringOutput { - return o.ApplyT(func(v ManifestPlatform) string { return v.Os }).(pulumi.StringOutput) -} - type RegistryAuth struct { // The registry's address (e.g. "docker.io"). Address string `pulumi:"address"` @@ -6253,6 +6056,142 @@ func (o RegistryAuthArrayOutput) Index(i pulumi.IntInput) RegistryAuthOutput { }).(RegistryAuthOutput) } +type SSH struct { + // Useful for distinguishing different servers that are part of the same + // build. + // + // A value of `default` is appropriate if only dealing with a single host. + Id string `pulumi:"id"` + // SSH agent socket or private keys to expose to the build under the given + // identifier. + // + // Defaults to `[$SSH_AUTH_SOCK]`. + // + // Note that your keys are **not** automatically added when using an + // agent. Run `ssh-add -l` locally to confirm which public keys are + // visible to the agent; these will be exposed to your build. + Paths []string `pulumi:"paths"` +} + +// SSHInput is an input type that accepts SSHArgs and SSHOutput values. +// You can construct a concrete instance of `SSHInput` via: +// +// SSHArgs{...} +type SSHInput interface { + pulumi.Input + + ToSSHOutput() SSHOutput + ToSSHOutputWithContext(context.Context) SSHOutput +} + +type SSHArgs struct { + // Useful for distinguishing different servers that are part of the same + // build. + // + // A value of `default` is appropriate if only dealing with a single host. + Id pulumi.StringInput `pulumi:"id"` + // SSH agent socket or private keys to expose to the build under the given + // identifier. + // + // Defaults to `[$SSH_AUTH_SOCK]`. + // + // Note that your keys are **not** automatically added when using an + // agent. Run `ssh-add -l` locally to confirm which public keys are + // visible to the agent; these will be exposed to your build. + Paths pulumi.StringArrayInput `pulumi:"paths"` +} + +func (SSHArgs) ElementType() reflect.Type { + return reflect.TypeOf((*SSH)(nil)).Elem() +} + +func (i SSHArgs) ToSSHOutput() SSHOutput { + return i.ToSSHOutputWithContext(context.Background()) +} + +func (i SSHArgs) ToSSHOutputWithContext(ctx context.Context) SSHOutput { + return pulumi.ToOutputWithContext(ctx, i).(SSHOutput) +} + +// SSHArrayInput is an input type that accepts SSHArray and SSHArrayOutput values. +// You can construct a concrete instance of `SSHArrayInput` via: +// +// SSHArray{ SSHArgs{...} } +type SSHArrayInput interface { + pulumi.Input + + ToSSHArrayOutput() SSHArrayOutput + ToSSHArrayOutputWithContext(context.Context) SSHArrayOutput +} + +type SSHArray []SSHInput + +func (SSHArray) ElementType() reflect.Type { + return reflect.TypeOf((*[]SSH)(nil)).Elem() +} + +func (i SSHArray) ToSSHArrayOutput() SSHArrayOutput { + return i.ToSSHArrayOutputWithContext(context.Background()) +} + +func (i SSHArray) ToSSHArrayOutputWithContext(ctx context.Context) SSHArrayOutput { + return pulumi.ToOutputWithContext(ctx, i).(SSHArrayOutput) +} + +type SSHOutput struct{ *pulumi.OutputState } + +func (SSHOutput) ElementType() reflect.Type { + return reflect.TypeOf((*SSH)(nil)).Elem() +} + +func (o SSHOutput) ToSSHOutput() SSHOutput { + return o +} + +func (o SSHOutput) ToSSHOutputWithContext(ctx context.Context) SSHOutput { + return o +} + +// Useful for distinguishing different servers that are part of the same +// build. +// +// A value of `default` is appropriate if only dealing with a single host. +func (o SSHOutput) Id() pulumi.StringOutput { + return o.ApplyT(func(v SSH) string { return v.Id }).(pulumi.StringOutput) +} + +// SSH agent socket or private keys to expose to the build under the given +// identifier. +// +// Defaults to `[$SSH_AUTH_SOCK]`. +// +// Note that your keys are **not** automatically added when using an +// agent. Run `ssh-add -l` locally to confirm which public keys are +// visible to the agent; these will be exposed to your build. +func (o SSHOutput) Paths() pulumi.StringArrayOutput { + return o.ApplyT(func(v SSH) []string { return v.Paths }).(pulumi.StringArrayOutput) +} + +type SSHArrayOutput struct{ *pulumi.OutputState } + +func (SSHArrayOutput) ElementType() reflect.Type { + return reflect.TypeOf((*[]SSH)(nil)).Elem() +} + +func (o SSHArrayOutput) ToSSHArrayOutput() SSHArrayOutput { + return o +} + +func (o SSHArrayOutput) ToSSHArrayOutputWithContext(ctx context.Context) SSHArrayOutput { + return o +} + +func (o SSHArrayOutput) Index(i pulumi.IntInput) SSHOutput { + return pulumi.All(o, i).ApplyT(func(vs []interface{}) SSH { + return vs[0].([]SSH)[vs[1].(int)] + }).(SSHOutput) +} + func init() { pulumi.RegisterInputType(reflect.TypeOf((*BuildContextInput)(nil)).Elem(), BuildContextArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*BuildContextPtrInput)(nil)).Elem(), BuildContextArgs{}) @@ -6302,11 +6241,10 @@ func init() { pulumi.RegisterInputType(reflect.TypeOf((*ExportRegistryPtrInput)(nil)).Elem(), ExportRegistryArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*ExportTarInput)(nil)).Elem(), ExportTarArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*ExportTarPtrInput)(nil)).Elem(), ExportTarArgs{}) - pulumi.RegisterInputType(reflect.TypeOf((*ManifestInput)(nil)).Elem(), ManifestArgs{}) - pulumi.RegisterInputType(reflect.TypeOf((*ManifestArrayInput)(nil)).Elem(), ManifestArray{}) - pulumi.RegisterInputType(reflect.TypeOf((*ManifestPlatformInput)(nil)).Elem(), ManifestPlatformArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*RegistryAuthInput)(nil)).Elem(), RegistryAuthArgs{}) pulumi.RegisterInputType(reflect.TypeOf((*RegistryAuthArrayInput)(nil)).Elem(), RegistryAuthArray{}) + pulumi.RegisterInputType(reflect.TypeOf((*SSHInput)(nil)).Elem(), SSHArgs{}) + pulumi.RegisterInputType(reflect.TypeOf((*SSHArrayInput)(nil)).Elem(), SSHArray{}) pulumi.RegisterOutputType(BuildContextOutput{}) pulumi.RegisterOutputType(BuildContextPtrOutput{}) pulumi.RegisterOutputType(BuilderConfigOutput{}) @@ -6355,9 +6293,8 @@ func init() { pulumi.RegisterOutputType(ExportRegistryPtrOutput{}) pulumi.RegisterOutputType(ExportTarOutput{}) pulumi.RegisterOutputType(ExportTarPtrOutput{}) - pulumi.RegisterOutputType(ManifestOutput{}) - pulumi.RegisterOutputType(ManifestArrayOutput{}) - pulumi.RegisterOutputType(ManifestPlatformOutput{}) pulumi.RegisterOutputType(RegistryAuthOutput{}) pulumi.RegisterOutputType(RegistryAuthArrayOutput{}) + pulumi.RegisterOutputType(SSHOutput{}) + pulumi.RegisterOutputType(SSHArrayOutput{}) } diff --git a/sdk/java/src/main/java/com/pulumi/docker/buildx/Image.java b/sdk/java/src/main/java/com/pulumi/docker/buildx/Image.java index 1bff2d86..38198db8 100644 --- a/sdk/java/src/main/java/com/pulumi/docker/buildx/Image.java +++ b/sdk/java/src/main/java/com/pulumi/docker/buildx/Image.java @@ -9,6 +9,7 @@ import com.pulumi.core.internal.Codegen; import com.pulumi.docker.Utilities; import com.pulumi.docker.buildx.ImageArgs; +import com.pulumi.docker.buildx.enums.NetworkMode; import com.pulumi.docker.buildx.enums.Platform; import com.pulumi.docker.buildx.outputs.BuildContext; import com.pulumi.docker.buildx.outputs.BuilderConfig; @@ -17,6 +18,7 @@ import com.pulumi.docker.buildx.outputs.Dockerfile; import com.pulumi.docker.buildx.outputs.ExportEntry; import com.pulumi.docker.buildx.outputs.RegistryAuth; +import com.pulumi.docker.buildx.outputs.SSH; import java.lang.Boolean; import java.lang.String; import java.util.List; @@ -570,6 +572,24 @@ */ @ResourceType(type="docker:buildx/image:Image") public class Image extends com.pulumi.resources.CustomResource { + /** + * Custom `host:ip` mappings to use during the build. + * + * Equivalent to Docker's `--add-host` flag. + * + */ + @Export(name="addHosts", refs={List.class,String.class}, tree="[0,1]") + private Output> addHosts; + + /** + * @return Custom `host:ip` mappings to use during the build. + * + * Equivalent to Docker's `--add-host` flag. + * + */ + public Output>> addHosts() { + return Codegen.optional(this.addHosts); + } /** * `ARG` names and values to set during the build. * @@ -601,16 +621,40 @@ public Output>> buildArgs() { return Codegen.optional(this.buildArgs); } /** - * When `true`, attempt to build the image during previews. The image will - * not be pushed to registries, however caches will still be populated. + * By default, preview behavior depends on the execution environment. If + * Pulumi detects the operation is running on a CI system (GitHub Actions, + * Travis CI, Azure Pipelines, etc.) then it will build images during + * previews as a safeguard. Otherwise, if not running on CI, previews will + * not build images. + * + * Setting this to `false` forces previews to never perform builds, and + * setting it to `true` will always build the image during previews. + * + * Images built during previews are never exported to registries, however + * cache manifests are still exported. + * + * On-disk Dockerfiles are always validated for syntactic correctness + * regardless of this setting. * */ @Export(name="buildOnPreview", refs={Boolean.class}, tree="[0]") private Output buildOnPreview; /** - * @return When `true`, attempt to build the image during previews. The image will - * not be pushed to registries, however caches will still be populated. + * @return By default, preview behavior depends on the execution environment. If + * Pulumi detects the operation is running on a CI system (GitHub Actions, + * Travis CI, Azure Pipelines, etc.) then it will build images during + * previews as a safeguard. Otherwise, if not running on CI, previews will + * not build images. + * + * Setting this to `false` forces previews to never perform builds, and + * setting it to `true` will always build the image during previews. + * + * Images built during previews are never exported to registries, however + * cache manifests are still exported. + * + * On-disk Dockerfiles are always validated for syntactic correctness + * regardless of this setting. * */ public Output> buildOnPreview() { @@ -691,7 +735,7 @@ public Output> context() { * */ @Export(name="contextHash", refs={String.class}, tree="[0]") - private Output contextHash; + private Output contextHash; /** * @return A preliminary hash of the image's build context. @@ -699,22 +743,30 @@ public Output> context() { * Pulumi uses this to determine if an image _may_ need to be re-built. * */ - public Output> contextHash() { - return Codegen.optional(this.contextHash); + public Output contextHash() { + return this.contextHash; } /** - * A mapping of platform type to refs which were pushed to registries. + * A mapping of target names to the SHA256 digest of their pushed manifest. + * + * If no target was specified 'default' is used as the target name. + * + * Pushed manifests can be referenced as `<tag>@<digest>`. * */ - @Export(name="digests", refs={Map.class,String.class,List.class}, tree="[0,1,[2,1]]") - private Output>> digests; + @Export(name="digests", refs={Map.class,String.class}, tree="[0,1,1]") + private Output> digests; /** - * @return A mapping of platform type to refs which were pushed to registries. + * @return A mapping of target names to the SHA256 digest of their pushed manifest. + * + * If no target was specified 'default' is used as the target name. + * + * Pushed manifests can be referenced as `<tag>@<digest>`. * */ - public Output>>> digests() { - return Codegen.optional(this.digests); + public Output> digests() { + return this.digests; } /** * Dockerfile settings. @@ -776,6 +828,68 @@ public Output>> exports() { public Output>> labels() { return Codegen.optional(this.labels); } + /** + * When `true` the build will automatically include a `docker` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--load` flag. + * + */ + @Export(name="load", refs={Boolean.class}, tree="[0]") + private Output load; + + /** + * @return When `true` the build will automatically include a `docker` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--load` flag. + * + */ + public Output> load() { + return Codegen.optional(this.load); + } + /** + * Set the network mode for `RUN` instructions. Defaults to `default`. + * + * For custom networks, configure your builder with `--driver-opt network=...`. + * + * Equivalent to Docker's `--network` flag. + * + */ + @Export(name="network", refs={NetworkMode.class}, tree="[0]") + private Output network; + + /** + * @return Set the network mode for `RUN` instructions. Defaults to `default`. + * + * For custom networks, configure your builder with `--driver-opt network=...`. + * + * Equivalent to Docker's `--network` flag. + * + */ + public Output> network() { + return Codegen.optional(this.network); + } + /** + * Do not import cache manifests when building the image. + * + * Equivalent to Docker's `--no-cache` flag. + * + */ + @Export(name="noCache", refs={Boolean.class}, tree="[0]") + private Output noCache; + + /** + * @return Do not import cache manifests when building the image. + * + * Equivalent to Docker's `--no-cache` flag. + * + */ + public Output> noCache() { + return Codegen.optional(this.noCache); + } /** * Set target platform(s) for the build. Defaults to the host's platform. * @@ -812,6 +926,58 @@ public Output>> platforms() { public Output> pull() { return Codegen.optional(this.pull); } + /** + * When `true` the build will automatically include a `registry` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--push` flag. + * + */ + @Export(name="push", refs={Boolean.class}, tree="[0]") + private Output push; + + /** + * @return When `true` the build will automatically include a `registry` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--push` flag. + * + */ + public Output> push() { + return Codegen.optional(this.push); + } + /** + * If the image was pushed to any registries then this will contain a + * single fully-qualified tag including the build's digest. + * + * This is only for convenience and may not be appropriate for situations + * where multiple tags or registries are involved. In those cases this + * output is not guaranteed to be stable. + * + * For more control over tags consumed by downstream resources you should + * use the `Digests` output. + * + */ + @Export(name="ref", refs={String.class}, tree="[0]") + private Output ref; + + /** + * @return If the image was pushed to any registries then this will contain a + * single fully-qualified tag including the build's digest. + * + * This is only for convenience and may not be appropriate for situations + * where multiple tags or registries are involved. In those cases this + * output is not guaranteed to be stable. + * + * For more control over tags consumed by downstream resources you should + * use the `Digests` output. + * + */ + public Output ref() { + return this.ref; + } /** * Registry credentials. Required if reading or exporting to private * repositories. @@ -868,6 +1034,24 @@ public Output>> registries() { public Output>> secrets() { return Codegen.optional(this.secrets); } + /** + * SSH agent socket or keys to expose to the build. + * + * Equivalent to Docker's `--ssh` flag. + * + */ + @Export(name="ssh", refs={List.class,SSH.class}, tree="[0,1]") + private Output> ssh; + + /** + * @return SSH agent socket or keys to expose to the build. + * + * Equivalent to Docker's `--ssh` flag. + * + */ + public Output>> ssh() { + return Codegen.optional(this.ssh); + } /** * Name and optionally a tag (format: `name:tag`). * @@ -947,9 +1131,6 @@ private Image(String name, Output id, @Nullable com.pulumi.resources.Cus private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() .version(Utilities.getVersion()) - .additionalSecretOutputs(List.of( - "secrets" - )) .build(); return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); } diff --git a/sdk/java/src/main/java/com/pulumi/docker/buildx/ImageArgs.java b/sdk/java/src/main/java/com/pulumi/docker/buildx/ImageArgs.java index b53352b4..2406a894 100644 --- a/sdk/java/src/main/java/com/pulumi/docker/buildx/ImageArgs.java +++ b/sdk/java/src/main/java/com/pulumi/docker/buildx/ImageArgs.java @@ -5,6 +5,8 @@ import com.pulumi.core.Output; import com.pulumi.core.annotations.Import; +import com.pulumi.core.internal.Codegen; +import com.pulumi.docker.buildx.enums.NetworkMode; import com.pulumi.docker.buildx.enums.Platform; import com.pulumi.docker.buildx.inputs.BuildContextArgs; import com.pulumi.docker.buildx.inputs.BuilderConfigArgs; @@ -13,6 +15,7 @@ import com.pulumi.docker.buildx.inputs.DockerfileArgs; import com.pulumi.docker.buildx.inputs.ExportEntryArgs; import com.pulumi.docker.buildx.inputs.RegistryAuthArgs; +import com.pulumi.docker.buildx.inputs.SSHArgs; import java.lang.Boolean; import java.lang.String; import java.util.List; @@ -26,6 +29,25 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs { public static final ImageArgs Empty = new ImageArgs(); + /** + * Custom `host:ip` mappings to use during the build. + * + * Equivalent to Docker's `--add-host` flag. + * + */ + @Import(name="addHosts") + private @Nullable Output> addHosts; + + /** + * @return Custom `host:ip` mappings to use during the build. + * + * Equivalent to Docker's `--add-host` flag. + * + */ + public Optional>> addHosts() { + return Optional.ofNullable(this.addHosts); + } + /** * `ARG` names and values to set during the build. * @@ -58,16 +80,40 @@ public Optional>> buildArgs() { } /** - * When `true`, attempt to build the image during previews. The image will - * not be pushed to registries, however caches will still be populated. + * By default, preview behavior depends on the execution environment. If + * Pulumi detects the operation is running on a CI system (GitHub Actions, + * Travis CI, Azure Pipelines, etc.) then it will build images during + * previews as a safeguard. Otherwise, if not running on CI, previews will + * not build images. + * + * Setting this to `false` forces previews to never perform builds, and + * setting it to `true` will always build the image during previews. + * + * Images built during previews are never exported to registries, however + * cache manifests are still exported. + * + * On-disk Dockerfiles are always validated for syntactic correctness + * regardless of this setting. * */ @Import(name="buildOnPreview") private @Nullable Output buildOnPreview; /** - * @return When `true`, attempt to build the image during previews. The image will - * not be pushed to registries, however caches will still be populated. + * @return By default, preview behavior depends on the execution environment. If + * Pulumi detects the operation is running on a CI system (GitHub Actions, + * Travis CI, Azure Pipelines, etc.) then it will build images during + * previews as a safeguard. Otherwise, if not running on CI, previews will + * not build images. + * + * Setting this to `false` forces previews to never perform builds, and + * setting it to `true` will always build the image during previews. + * + * Images built during previews are never exported to registries, however + * cache manifests are still exported. + * + * On-disk Dockerfiles are always validated for syntactic correctness + * regardless of this setting. * */ public Optional> buildOnPreview() { @@ -209,6 +255,71 @@ public Optional>> labels() { return Optional.ofNullable(this.labels); } + /** + * When `true` the build will automatically include a `docker` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--load` flag. + * + */ + @Import(name="load") + private @Nullable Output load; + + /** + * @return When `true` the build will automatically include a `docker` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--load` flag. + * + */ + public Optional> load() { + return Optional.ofNullable(this.load); + } + + /** + * Set the network mode for `RUN` instructions. Defaults to `default`. + * + * For custom networks, configure your builder with `--driver-opt network=...`. + * + * Equivalent to Docker's `--network` flag. + * + */ + @Import(name="network") + private @Nullable Output network; + + /** + * @return Set the network mode for `RUN` instructions. Defaults to `default`. + * + * For custom networks, configure your builder with `--driver-opt network=...`. + * + * Equivalent to Docker's `--network` flag. + * + */ + public Optional> network() { + return Optional.ofNullable(this.network); + } + + /** + * Do not import cache manifests when building the image. + * + * Equivalent to Docker's `--no-cache` flag. + * + */ + @Import(name="noCache") + private @Nullable Output noCache; + + /** + * @return Do not import cache manifests when building the image. + * + * Equivalent to Docker's `--no-cache` flag. + * + */ + public Optional> noCache() { + return Optional.ofNullable(this.noCache); + } + /** * Set target platform(s) for the build. Defaults to the host's platform. * @@ -247,6 +358,29 @@ public Optional> pull() { return Optional.ofNullable(this.pull); } + /** + * When `true` the build will automatically include a `registry` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--push` flag. + * + */ + @Import(name="push") + private @Nullable Output push; + + /** + * @return When `true` the build will automatically include a `registry` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--push` flag. + * + */ + public Optional> push() { + return Optional.ofNullable(this.push); + } + /** * Registry credentials. Required if reading or exporting to private * repositories. @@ -305,6 +439,25 @@ public Optional>> secrets() { return Optional.ofNullable(this.secrets); } + /** + * SSH agent socket or keys to expose to the build. + * + * Equivalent to Docker's `--ssh` flag. + * + */ + @Import(name="ssh") + private @Nullable Output> ssh; + + /** + * @return SSH agent socket or keys to expose to the build. + * + * Equivalent to Docker's `--ssh` flag. + * + */ + public Optional>> ssh() { + return Optional.ofNullable(this.ssh); + } + /** * Name and optionally a tag (format: `name:tag`). * @@ -356,6 +509,7 @@ public Optional>> targets() { private ImageArgs() {} private ImageArgs(ImageArgs $) { + this.addHosts = $.addHosts; this.buildArgs = $.buildArgs; this.buildOnPreview = $.buildOnPreview; this.builder = $.builder; @@ -365,10 +519,15 @@ private ImageArgs(ImageArgs $) { this.dockerfile = $.dockerfile; this.exports = $.exports; this.labels = $.labels; + this.load = $.load; + this.network = $.network; + this.noCache = $.noCache; this.platforms = $.platforms; this.pull = $.pull; + this.push = $.push; this.registries = $.registries; this.secrets = $.secrets; + this.ssh = $.ssh; this.tags = $.tags; this.targets = $.targets; } @@ -391,6 +550,43 @@ public Builder(ImageArgs defaults) { $ = new ImageArgs(Objects.requireNonNull(defaults)); } + /** + * @param addHosts Custom `host:ip` mappings to use during the build. + * + * Equivalent to Docker's `--add-host` flag. + * + * @return builder + * + */ + public Builder addHosts(@Nullable Output> addHosts) { + $.addHosts = addHosts; + return this; + } + + /** + * @param addHosts Custom `host:ip` mappings to use during the build. + * + * Equivalent to Docker's `--add-host` flag. + * + * @return builder + * + */ + public Builder addHosts(List addHosts) { + return addHosts(Output.of(addHosts)); + } + + /** + * @param addHosts Custom `host:ip` mappings to use during the build. + * + * Equivalent to Docker's `--add-host` flag. + * + * @return builder + * + */ + public Builder addHosts(String... addHosts) { + return addHosts(List.of(addHosts)); + } + /** * @param buildArgs `ARG` names and values to set during the build. * @@ -429,8 +625,20 @@ public Builder buildArgs(Map buildArgs) { } /** - * @param buildOnPreview When `true`, attempt to build the image during previews. The image will - * not be pushed to registries, however caches will still be populated. + * @param buildOnPreview By default, preview behavior depends on the execution environment. If + * Pulumi detects the operation is running on a CI system (GitHub Actions, + * Travis CI, Azure Pipelines, etc.) then it will build images during + * previews as a safeguard. Otherwise, if not running on CI, previews will + * not build images. + * + * Setting this to `false` forces previews to never perform builds, and + * setting it to `true` will always build the image during previews. + * + * Images built during previews are never exported to registries, however + * cache manifests are still exported. + * + * On-disk Dockerfiles are always validated for syntactic correctness + * regardless of this setting. * * @return builder * @@ -441,8 +649,20 @@ public Builder buildOnPreview(@Nullable Output buildOnPreview) { } /** - * @param buildOnPreview When `true`, attempt to build the image during previews. The image will - * not be pushed to registries, however caches will still be populated. + * @param buildOnPreview By default, preview behavior depends on the execution environment. If + * Pulumi detects the operation is running on a CI system (GitHub Actions, + * Travis CI, Azure Pipelines, etc.) then it will build images during + * previews as a safeguard. Otherwise, if not running on CI, previews will + * not build images. + * + * Setting this to `false` forces previews to never perform builds, and + * setting it to `true` will always build the image during previews. + * + * Images built during previews are never exported to registries, however + * cache manifests are still exported. + * + * On-disk Dockerfiles are always validated for syntactic correctness + * regardless of this setting. * * @return builder * @@ -667,6 +887,89 @@ public Builder labels(Map labels) { return labels(Output.of(labels)); } + /** + * @param load When `true` the build will automatically include a `docker` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--load` flag. + * + * @return builder + * + */ + public Builder load(@Nullable Output load) { + $.load = load; + return this; + } + + /** + * @param load When `true` the build will automatically include a `docker` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--load` flag. + * + * @return builder + * + */ + public Builder load(Boolean load) { + return load(Output.of(load)); + } + + /** + * @param network Set the network mode for `RUN` instructions. Defaults to `default`. + * + * For custom networks, configure your builder with `--driver-opt network=...`. + * + * Equivalent to Docker's `--network` flag. + * + * @return builder + * + */ + public Builder network(@Nullable Output network) { + $.network = network; + return this; + } + + /** + * @param network Set the network mode for `RUN` instructions. Defaults to `default`. + * + * For custom networks, configure your builder with `--driver-opt network=...`. + * + * Equivalent to Docker's `--network` flag. + * + * @return builder + * + */ + public Builder network(NetworkMode network) { + return network(Output.of(network)); + } + + /** + * @param noCache Do not import cache manifests when building the image. + * + * Equivalent to Docker's `--no-cache` flag. + * + * @return builder + * + */ + public Builder noCache(@Nullable Output noCache) { + $.noCache = noCache; + return this; + } + + /** + * @param noCache Do not import cache manifests when building the image. + * + * Equivalent to Docker's `--no-cache` flag. + * + * @return builder + * + */ + public Builder noCache(Boolean noCache) { + return noCache(Output.of(noCache)); + } + /** * @param platforms Set target platform(s) for the build. Defaults to the host's platform. * @@ -729,6 +1032,35 @@ public Builder pull(Boolean pull) { return pull(Output.of(pull)); } + /** + * @param push When `true` the build will automatically include a `registry` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--push` flag. + * + * @return builder + * + */ + public Builder push(@Nullable Output push) { + $.push = push; + return this; + } + + /** + * @param push When `true` the build will automatically include a `registry` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--push` flag. + * + * @return builder + * + */ + public Builder push(Boolean push) { + return push(Output.of(push)); + } + /** * @param registries Registry credentials. Required if reading or exporting to private * repositories. @@ -815,6 +1147,43 @@ public Builder secrets(Map secrets) { return secrets(Output.of(secrets)); } + /** + * @param ssh SSH agent socket or keys to expose to the build. + * + * Equivalent to Docker's `--ssh` flag. + * + * @return builder + * + */ + public Builder ssh(@Nullable Output> ssh) { + $.ssh = ssh; + return this; + } + + /** + * @param ssh SSH agent socket or keys to expose to the build. + * + * Equivalent to Docker's `--ssh` flag. + * + * @return builder + * + */ + public Builder ssh(List ssh) { + return ssh(Output.of(ssh)); + } + + /** + * @param ssh SSH agent socket or keys to expose to the build. + * + * Equivalent to Docker's `--ssh` flag. + * + * @return builder + * + */ + public Builder ssh(SSHArgs... ssh) { + return ssh(List.of(ssh)); + } + /** * @param tags Name and optionally a tag (format: `name:tag`). * @@ -905,6 +1274,7 @@ public Builder targets(String... targets) { } public ImageArgs build() { + $.network = Codegen.objectProp("network", NetworkMode.class).output().arg($.network).def(NetworkMode.Default_).getNullable(); return $; } } diff --git a/sdk/java/src/main/java/com/pulumi/docker/buildx/enums/NetworkMode.java b/sdk/java/src/main/java/com/pulumi/docker/buildx/enums/NetworkMode.java new file mode 100644 index 00000000..707c9e36 --- /dev/null +++ b/sdk/java/src/main/java/com/pulumi/docker/buildx/enums/NetworkMode.java @@ -0,0 +1,46 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.docker.buildx.enums; + +import com.pulumi.core.annotations.EnumType; +import java.lang.String; +import java.util.Objects; +import java.util.StringJoiner; + + @EnumType + public enum NetworkMode { + /** + * The default sandbox network mode. + * + */ + Default_("default"), + /** + * Host network mode. + * + */ + Host("host"), + /** + * Disable network access. + * + */ + None("none"); + + private final String value; + + NetworkMode(String value) { + this.value = Objects.requireNonNull(value); + } + + @EnumType.Converter + public String getValue() { + return this.value; + } + + @Override + public String toString() { + return new StringJoiner(", ", "NetworkMode[", "]") + .add("value='" + this.value + "'") + .toString(); + } + } diff --git a/sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/ExportEntryArgs.java b/sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/ExportEntryArgs.java index adb18808..7501c12b 100644 --- a/sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/ExportEntryArgs.java +++ b/sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/ExportEntryArgs.java @@ -11,10 +11,8 @@ import com.pulumi.docker.buildx.inputs.ExportOCIArgs; import com.pulumi.docker.buildx.inputs.ExportRegistryArgs; import com.pulumi.docker.buildx.inputs.ExportTarArgs; -import com.pulumi.docker.buildx.inputs.ManifestArgs; import java.lang.Boolean; import java.lang.String; -import java.util.List; import java.util.Objects; import java.util.Optional; import javax.annotation.Nullable; @@ -84,23 +82,6 @@ public Optional> local() { return Optional.ofNullable(this.local); } - /** - * An output property populated for exporters that pushed image - * manifest(s) to a registry. - * - */ - @Import(name="manifests") - private @Nullable Output> manifests; - - /** - * @return An output property populated for exporters that pushed image - * manifest(s) to a registry. - * - */ - public Optional>> manifests() { - return Optional.ofNullable(this.manifests); - } - /** * Identical to the Docker exporter but uses OCI media types by default. * @@ -170,7 +151,6 @@ private ExportEntryArgs(ExportEntryArgs $) { this.docker = $.docker; this.image = $.image; this.local = $.local; - this.manifests = $.manifests; this.oci = $.oci; this.raw = $.raw; this.registry = $.registry; @@ -279,40 +259,6 @@ public Builder local(ExportLocalArgs local) { return local(Output.of(local)); } - /** - * @param manifests An output property populated for exporters that pushed image - * manifest(s) to a registry. - * - * @return builder - * - */ - public Builder manifests(@Nullable Output> manifests) { - $.manifests = manifests; - return this; - } - - /** - * @param manifests An output property populated for exporters that pushed image - * manifest(s) to a registry. - * - * @return builder - * - */ - public Builder manifests(List manifests) { - return manifests(Output.of(manifests)); - } - - /** - * @param manifests An output property populated for exporters that pushed image - * manifest(s) to a registry. - * - * @return builder - * - */ - public Builder manifests(ManifestArgs... manifests) { - return manifests(List.of(manifests)); - } - /** * @param oci Identical to the Docker exporter but uses OCI media types by default. * diff --git a/sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/ManifestArgs.java b/sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/ManifestArgs.java deleted file mode 100644 index 374c19c7..00000000 --- a/sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/ManifestArgs.java +++ /dev/null @@ -1,207 +0,0 @@ -// *** WARNING: this file was generated by pulumi-java-gen. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package com.pulumi.docker.buildx.inputs; - -import com.pulumi.core.Output; -import com.pulumi.core.annotations.Import; -import com.pulumi.docker.buildx.inputs.ManifestPlatformArgs; -import com.pulumi.exceptions.MissingRequiredPropertyException; -import java.lang.Integer; -import java.lang.String; -import java.util.Objects; - - -public final class ManifestArgs extends com.pulumi.resources.ResourceArgs { - - public static final ManifestArgs Empty = new ManifestArgs(); - - /** - * The SHA256 digest of the manifest. - * - */ - @Import(name="digest", required=true) - private Output digest; - - /** - * @return The SHA256 digest of the manifest. - * - */ - public Output digest() { - return this.digest; - } - - /** - * The manifest's platform. - * - */ - @Import(name="platform", required=true) - private Output platform; - - /** - * @return The manifest's platform. - * - */ - public Output platform() { - return this.platform; - } - - /** - * The manifest's canonical ref. - * - */ - @Import(name="ref", required=true) - private Output ref; - - /** - * @return The manifest's canonical ref. - * - */ - public Output ref() { - return this.ref; - } - - /** - * The size of the manifest in bytes. - * - */ - @Import(name="size", required=true) - private Output size; - - /** - * @return The size of the manifest in bytes. - * - */ - public Output size() { - return this.size; - } - - private ManifestArgs() {} - - private ManifestArgs(ManifestArgs $) { - this.digest = $.digest; - this.platform = $.platform; - this.ref = $.ref; - this.size = $.size; - } - - public static Builder builder() { - return new Builder(); - } - public static Builder builder(ManifestArgs defaults) { - return new Builder(defaults); - } - - public static final class Builder { - private ManifestArgs $; - - public Builder() { - $ = new ManifestArgs(); - } - - public Builder(ManifestArgs defaults) { - $ = new ManifestArgs(Objects.requireNonNull(defaults)); - } - - /** - * @param digest The SHA256 digest of the manifest. - * - * @return builder - * - */ - public Builder digest(Output digest) { - $.digest = digest; - return this; - } - - /** - * @param digest The SHA256 digest of the manifest. - * - * @return builder - * - */ - public Builder digest(String digest) { - return digest(Output.of(digest)); - } - - /** - * @param platform The manifest's platform. - * - * @return builder - * - */ - public Builder platform(Output platform) { - $.platform = platform; - return this; - } - - /** - * @param platform The manifest's platform. - * - * @return builder - * - */ - public Builder platform(ManifestPlatformArgs platform) { - return platform(Output.of(platform)); - } - - /** - * @param ref The manifest's canonical ref. - * - * @return builder - * - */ - public Builder ref(Output ref) { - $.ref = ref; - return this; - } - - /** - * @param ref The manifest's canonical ref. - * - * @return builder - * - */ - public Builder ref(String ref) { - return ref(Output.of(ref)); - } - - /** - * @param size The size of the manifest in bytes. - * - * @return builder - * - */ - public Builder size(Output size) { - $.size = size; - return this; - } - - /** - * @param size The size of the manifest in bytes. - * - * @return builder - * - */ - public Builder size(Integer size) { - return size(Output.of(size)); - } - - public ManifestArgs build() { - if ($.digest == null) { - throw new MissingRequiredPropertyException("ManifestArgs", "digest"); - } - if ($.platform == null) { - throw new MissingRequiredPropertyException("ManifestArgs", "platform"); - } - if ($.ref == null) { - throw new MissingRequiredPropertyException("ManifestArgs", "ref"); - } - if ($.size == null) { - throw new MissingRequiredPropertyException("ManifestArgs", "size"); - } - return $; - } - } - -} diff --git a/sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/ManifestPlatformArgs.java b/sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/ManifestPlatformArgs.java deleted file mode 100644 index 6b8deb81..00000000 --- a/sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/ManifestPlatformArgs.java +++ /dev/null @@ -1,125 +0,0 @@ -// *** WARNING: this file was generated by pulumi-java-gen. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package com.pulumi.docker.buildx.inputs; - -import com.pulumi.core.Output; -import com.pulumi.core.annotations.Import; -import com.pulumi.exceptions.MissingRequiredPropertyException; -import java.lang.String; -import java.util.Objects; - - -public final class ManifestPlatformArgs extends com.pulumi.resources.ResourceArgs { - - public static final ManifestPlatformArgs Empty = new ManifestPlatformArgs(); - - /** - * The manifest's architecture. - * - */ - @Import(name="architecture", required=true) - private Output architecture; - - /** - * @return The manifest's architecture. - * - */ - public Output architecture() { - return this.architecture; - } - - /** - * The manifest's operating systen. - * - */ - @Import(name="os", required=true) - private Output os; - - /** - * @return The manifest's operating systen. - * - */ - public Output os() { - return this.os; - } - - private ManifestPlatformArgs() {} - - private ManifestPlatformArgs(ManifestPlatformArgs $) { - this.architecture = $.architecture; - this.os = $.os; - } - - public static Builder builder() { - return new Builder(); - } - public static Builder builder(ManifestPlatformArgs defaults) { - return new Builder(defaults); - } - - public static final class Builder { - private ManifestPlatformArgs $; - - public Builder() { - $ = new ManifestPlatformArgs(); - } - - public Builder(ManifestPlatformArgs defaults) { - $ = new ManifestPlatformArgs(Objects.requireNonNull(defaults)); - } - - /** - * @param architecture The manifest's architecture. - * - * @return builder - * - */ - public Builder architecture(Output architecture) { - $.architecture = architecture; - return this; - } - - /** - * @param architecture The manifest's architecture. - * - * @return builder - * - */ - public Builder architecture(String architecture) { - return architecture(Output.of(architecture)); - } - - /** - * @param os The manifest's operating systen. - * - * @return builder - * - */ - public Builder os(Output os) { - $.os = os; - return this; - } - - /** - * @param os The manifest's operating systen. - * - * @return builder - * - */ - public Builder os(String os) { - return os(Output.of(os)); - } - - public ManifestPlatformArgs build() { - if ($.architecture == null) { - throw new MissingRequiredPropertyException("ManifestPlatformArgs", "architecture"); - } - if ($.os == null) { - throw new MissingRequiredPropertyException("ManifestPlatformArgs", "os"); - } - return $; - } - } - -} diff --git a/sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/SSHArgs.java b/sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/SSHArgs.java new file mode 100644 index 00000000..33e78b8a --- /dev/null +++ b/sdk/java/src/main/java/com/pulumi/docker/buildx/inputs/SSHArgs.java @@ -0,0 +1,182 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.docker.buildx.inputs; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import com.pulumi.exceptions.MissingRequiredPropertyException; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +public final class SSHArgs extends com.pulumi.resources.ResourceArgs { + + public static final SSHArgs Empty = new SSHArgs(); + + /** + * Useful for distinguishing different servers that are part of the same + * build. + * + * A value of `default` is appropriate if only dealing with a single host. + * + */ + @Import(name="id", required=true) + private Output id; + + /** + * @return Useful for distinguishing different servers that are part of the same + * build. + * + * A value of `default` is appropriate if only dealing with a single host. + * + */ + public Output id() { + return this.id; + } + + /** + * SSH agent socket or private keys to expose to the build under the given + * identifier. + * + * Defaults to `[$SSH_AUTH_SOCK]`. + * + * Note that your keys are **not** automatically added when using an + * agent. Run `ssh-add -l` locally to confirm which public keys are + * visible to the agent; these will be exposed to your build. + * + */ + @Import(name="paths") + private @Nullable Output> paths; + + /** + * @return SSH agent socket or private keys to expose to the build under the given + * identifier. + * + * Defaults to `[$SSH_AUTH_SOCK]`. + * + * Note that your keys are **not** automatically added when using an + * agent. Run `ssh-add -l` locally to confirm which public keys are + * visible to the agent; these will be exposed to your build. + * + */ + public Optional>> paths() { + return Optional.ofNullable(this.paths); + } + + private SSHArgs() {} + + private SSHArgs(SSHArgs $) { + this.id = $.id; + this.paths = $.paths; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(SSHArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private SSHArgs $; + + public Builder() { + $ = new SSHArgs(); + } + + public Builder(SSHArgs defaults) { + $ = new SSHArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param id Useful for distinguishing different servers that are part of the same + * build. + * + * A value of `default` is appropriate if only dealing with a single host. + * + * @return builder + * + */ + public Builder id(Output id) { + $.id = id; + return this; + } + + /** + * @param id Useful for distinguishing different servers that are part of the same + * build. + * + * A value of `default` is appropriate if only dealing with a single host. + * + * @return builder + * + */ + public Builder id(String id) { + return id(Output.of(id)); + } + + /** + * @param paths SSH agent socket or private keys to expose to the build under the given + * identifier. + * + * Defaults to `[$SSH_AUTH_SOCK]`. + * + * Note that your keys are **not** automatically added when using an + * agent. Run `ssh-add -l` locally to confirm which public keys are + * visible to the agent; these will be exposed to your build. + * + * @return builder + * + */ + public Builder paths(@Nullable Output> paths) { + $.paths = paths; + return this; + } + + /** + * @param paths SSH agent socket or private keys to expose to the build under the given + * identifier. + * + * Defaults to `[$SSH_AUTH_SOCK]`. + * + * Note that your keys are **not** automatically added when using an + * agent. Run `ssh-add -l` locally to confirm which public keys are + * visible to the agent; these will be exposed to your build. + * + * @return builder + * + */ + public Builder paths(List paths) { + return paths(Output.of(paths)); + } + + /** + * @param paths SSH agent socket or private keys to expose to the build under the given + * identifier. + * + * Defaults to `[$SSH_AUTH_SOCK]`. + * + * Note that your keys are **not** automatically added when using an + * agent. Run `ssh-add -l` locally to confirm which public keys are + * visible to the agent; these will be exposed to your build. + * + * @return builder + * + */ + public Builder paths(String... paths) { + return paths(List.of(paths)); + } + + public SSHArgs build() { + if ($.id == null) { + throw new MissingRequiredPropertyException("SSHArgs", "id"); + } + return $; + } + } + +} diff --git a/sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/ExportEntry.java b/sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/ExportEntry.java index a7fbdf62..a17f1481 100644 --- a/sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/ExportEntry.java +++ b/sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/ExportEntry.java @@ -10,10 +10,8 @@ import com.pulumi.docker.buildx.outputs.ExportOCI; import com.pulumi.docker.buildx.outputs.ExportRegistry; import com.pulumi.docker.buildx.outputs.ExportTar; -import com.pulumi.docker.buildx.outputs.Manifest; import java.lang.Boolean; import java.lang.String; -import java.util.List; import java.util.Objects; import java.util.Optional; import javax.annotation.Nullable; @@ -40,12 +38,6 @@ public final class ExportEntry { * */ private @Nullable ExportLocal local; - /** - * @return An output property populated for exporters that pushed image - * manifest(s) to a registry. - * - */ - private @Nullable List manifests; /** * @return Identical to the Docker exporter but uses OCI media types by default. * @@ -97,14 +89,6 @@ public Optional image() { public Optional local() { return Optional.ofNullable(this.local); } - /** - * @return An output property populated for exporters that pushed image - * manifest(s) to a registry. - * - */ - public List manifests() { - return this.manifests == null ? List.of() : this.manifests; - } /** * @return Identical to the Docker exporter but uses OCI media types by default. * @@ -148,7 +132,6 @@ public static final class Builder { private @Nullable ExportDocker docker; private @Nullable ExportImage image; private @Nullable ExportLocal local; - private @Nullable List manifests; private @Nullable ExportOCI oci; private @Nullable String raw; private @Nullable ExportRegistry registry; @@ -160,7 +143,6 @@ public Builder(ExportEntry defaults) { this.docker = defaults.docker; this.image = defaults.image; this.local = defaults.local; - this.manifests = defaults.manifests; this.oci = defaults.oci; this.raw = defaults.raw; this.registry = defaults.registry; @@ -192,15 +174,6 @@ public Builder local(@Nullable ExportLocal local) { return this; } @CustomType.Setter - public Builder manifests(@Nullable List manifests) { - - this.manifests = manifests; - return this; - } - public Builder manifests(Manifest... manifests) { - return manifests(List.of(manifests)); - } - @CustomType.Setter public Builder oci(@Nullable ExportOCI oci) { this.oci = oci; @@ -230,7 +203,6 @@ public ExportEntry build() { _resultValue.docker = docker; _resultValue.image = image; _resultValue.local = local; - _resultValue.manifests = manifests; _resultValue.oci = oci; _resultValue.raw = raw; _resultValue.registry = registry; diff --git a/sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/Manifest.java b/sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/Manifest.java deleted file mode 100644 index 7635db5b..00000000 --- a/sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/Manifest.java +++ /dev/null @@ -1,129 +0,0 @@ -// *** WARNING: this file was generated by pulumi-java-gen. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package com.pulumi.docker.buildx.outputs; - -import com.pulumi.core.annotations.CustomType; -import com.pulumi.docker.buildx.outputs.ManifestPlatform; -import com.pulumi.exceptions.MissingRequiredPropertyException; -import java.lang.Integer; -import java.lang.String; -import java.util.Objects; - -@CustomType -public final class Manifest { - /** - * @return The SHA256 digest of the manifest. - * - */ - private String digest; - /** - * @return The manifest's platform. - * - */ - private ManifestPlatform platform; - /** - * @return The manifest's canonical ref. - * - */ - private String ref; - /** - * @return The size of the manifest in bytes. - * - */ - private Integer size; - - private Manifest() {} - /** - * @return The SHA256 digest of the manifest. - * - */ - public String digest() { - return this.digest; - } - /** - * @return The manifest's platform. - * - */ - public ManifestPlatform platform() { - return this.platform; - } - /** - * @return The manifest's canonical ref. - * - */ - public String ref() { - return this.ref; - } - /** - * @return The size of the manifest in bytes. - * - */ - public Integer size() { - return this.size; - } - - public static Builder builder() { - return new Builder(); - } - - public static Builder builder(Manifest defaults) { - return new Builder(defaults); - } - @CustomType.Builder - public static final class Builder { - private String digest; - private ManifestPlatform platform; - private String ref; - private Integer size; - public Builder() {} - public Builder(Manifest defaults) { - Objects.requireNonNull(defaults); - this.digest = defaults.digest; - this.platform = defaults.platform; - this.ref = defaults.ref; - this.size = defaults.size; - } - - @CustomType.Setter - public Builder digest(String digest) { - if (digest == null) { - throw new MissingRequiredPropertyException("Manifest", "digest"); - } - this.digest = digest; - return this; - } - @CustomType.Setter - public Builder platform(ManifestPlatform platform) { - if (platform == null) { - throw new MissingRequiredPropertyException("Manifest", "platform"); - } - this.platform = platform; - return this; - } - @CustomType.Setter - public Builder ref(String ref) { - if (ref == null) { - throw new MissingRequiredPropertyException("Manifest", "ref"); - } - this.ref = ref; - return this; - } - @CustomType.Setter - public Builder size(Integer size) { - if (size == null) { - throw new MissingRequiredPropertyException("Manifest", "size"); - } - this.size = size; - return this; - } - public Manifest build() { - final var _resultValue = new Manifest(); - _resultValue.digest = digest; - _resultValue.platform = platform; - _resultValue.ref = ref; - _resultValue.size = size; - return _resultValue; - } - } -} diff --git a/sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/ManifestPlatform.java b/sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/ManifestPlatform.java deleted file mode 100644 index f96447e3..00000000 --- a/sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/ManifestPlatform.java +++ /dev/null @@ -1,81 +0,0 @@ -// *** WARNING: this file was generated by pulumi-java-gen. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package com.pulumi.docker.buildx.outputs; - -import com.pulumi.core.annotations.CustomType; -import com.pulumi.exceptions.MissingRequiredPropertyException; -import java.lang.String; -import java.util.Objects; - -@CustomType -public final class ManifestPlatform { - /** - * @return The manifest's architecture. - * - */ - private String architecture; - /** - * @return The manifest's operating systen. - * - */ - private String os; - - private ManifestPlatform() {} - /** - * @return The manifest's architecture. - * - */ - public String architecture() { - return this.architecture; - } - /** - * @return The manifest's operating systen. - * - */ - public String os() { - return this.os; - } - - public static Builder builder() { - return new Builder(); - } - - public static Builder builder(ManifestPlatform defaults) { - return new Builder(defaults); - } - @CustomType.Builder - public static final class Builder { - private String architecture; - private String os; - public Builder() {} - public Builder(ManifestPlatform defaults) { - Objects.requireNonNull(defaults); - this.architecture = defaults.architecture; - this.os = defaults.os; - } - - @CustomType.Setter - public Builder architecture(String architecture) { - if (architecture == null) { - throw new MissingRequiredPropertyException("ManifestPlatform", "architecture"); - } - this.architecture = architecture; - return this; - } - @CustomType.Setter - public Builder os(String os) { - if (os == null) { - throw new MissingRequiredPropertyException("ManifestPlatform", "os"); - } - this.os = os; - return this; - } - public ManifestPlatform build() { - final var _resultValue = new ManifestPlatform(); - _resultValue.architecture = architecture; - _resultValue.os = os; - return _resultValue; - } - } -} diff --git a/sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/SSH.java b/sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/SSH.java new file mode 100644 index 00000000..50289939 --- /dev/null +++ b/sdk/java/src/main/java/com/pulumi/docker/buildx/outputs/SSH.java @@ -0,0 +1,104 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.docker.buildx.outputs; + +import com.pulumi.core.annotations.CustomType; +import com.pulumi.exceptions.MissingRequiredPropertyException; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import javax.annotation.Nullable; + +@CustomType +public final class SSH { + /** + * @return Useful for distinguishing different servers that are part of the same + * build. + * + * A value of `default` is appropriate if only dealing with a single host. + * + */ + private String id; + /** + * @return SSH agent socket or private keys to expose to the build under the given + * identifier. + * + * Defaults to `[$SSH_AUTH_SOCK]`. + * + * Note that your keys are **not** automatically added when using an + * agent. Run `ssh-add -l` locally to confirm which public keys are + * visible to the agent; these will be exposed to your build. + * + */ + private @Nullable List paths; + + private SSH() {} + /** + * @return Useful for distinguishing different servers that are part of the same + * build. + * + * A value of `default` is appropriate if only dealing with a single host. + * + */ + public String id() { + return this.id; + } + /** + * @return SSH agent socket or private keys to expose to the build under the given + * identifier. + * + * Defaults to `[$SSH_AUTH_SOCK]`. + * + * Note that your keys are **not** automatically added when using an + * agent. Run `ssh-add -l` locally to confirm which public keys are + * visible to the agent; these will be exposed to your build. + * + */ + public List paths() { + return this.paths == null ? List.of() : this.paths; + } + + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(SSH defaults) { + return new Builder(defaults); + } + @CustomType.Builder + public static final class Builder { + private String id; + private @Nullable List paths; + public Builder() {} + public Builder(SSH defaults) { + Objects.requireNonNull(defaults); + this.id = defaults.id; + this.paths = defaults.paths; + } + + @CustomType.Setter + public Builder id(String id) { + if (id == null) { + throw new MissingRequiredPropertyException("SSH", "id"); + } + this.id = id; + return this; + } + @CustomType.Setter + public Builder paths(@Nullable List paths) { + + this.paths = paths; + return this; + } + public Builder paths(String... paths) { + return paths(List.of(paths)); + } + public SSH build() { + final var _resultValue = new SSH(); + _resultValue.id = id; + _resultValue.paths = paths; + return _resultValue; + } + } +} diff --git a/sdk/nodejs/buildx/image.ts b/sdk/nodejs/buildx/image.ts index c3a92a55..62ac37c6 100644 --- a/sdk/nodejs/buildx/image.ts +++ b/sdk/nodejs/buildx/image.ts @@ -470,6 +470,12 @@ export class Image extends pulumi.CustomResource { return obj['__pulumiType'] === Image.__pulumiType; } + /** + * Custom `host:ip` mappings to use during the build. + * + * Equivalent to Docker's `--add-host` flag. + */ + public readonly addHosts!: pulumi.Output; /** * `ARG` names and values to set during the build. * @@ -483,8 +489,20 @@ export class Image extends pulumi.CustomResource { */ public readonly buildArgs!: pulumi.Output<{[key: string]: string} | undefined>; /** - * When `true`, attempt to build the image during previews. The image will - * not be pushed to registries, however caches will still be populated. + * By default, preview behavior depends on the execution environment. If + * Pulumi detects the operation is running on a CI system (GitHub Actions, + * Travis CI, Azure Pipelines, etc.) then it will build images during + * previews as a safeguard. Otherwise, if not running on CI, previews will + * not build images. + * + * Setting this to `false` forces previews to never perform builds, and + * setting it to `true` will always build the image during previews. + * + * Images built during previews are never exported to registries, however + * cache manifests are still exported. + * + * On-disk Dockerfiles are always validated for syntactic correctness + * regardless of this setting. */ public readonly buildOnPreview!: pulumi.Output; /** @@ -514,11 +532,15 @@ export class Image extends pulumi.CustomResource { * * Pulumi uses this to determine if an image _may_ need to be re-built. */ - public /*out*/ readonly contextHash!: pulumi.Output; + public /*out*/ readonly contextHash!: pulumi.Output; /** - * A mapping of platform type to refs which were pushed to registries. + * A mapping of target names to the SHA256 digest of their pushed manifest. + * + * If no target was specified 'default' is used as the target name. + * + * Pushed manifests can be referenced as `@`. */ - public /*out*/ readonly digests!: pulumi.Output<{[key: string]: string[]} | undefined>; + public /*out*/ readonly digests!: pulumi.Output<{[key: string]: string}>; /** * Dockerfile settings. * @@ -540,6 +562,28 @@ export class Image extends pulumi.CustomResource { * Equivalent to Docker's `--label` flag. */ public readonly labels!: pulumi.Output<{[key: string]: string} | undefined>; + /** + * When `true` the build will automatically include a `docker` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--load` flag. + */ + public readonly load!: pulumi.Output; + /** + * Set the network mode for `RUN` instructions. Defaults to `default`. + * + * For custom networks, configure your builder with `--driver-opt network=...`. + * + * Equivalent to Docker's `--network` flag. + */ + public readonly network!: pulumi.Output; + /** + * Do not import cache manifests when building the image. + * + * Equivalent to Docker's `--no-cache` flag. + */ + public readonly noCache!: pulumi.Output; /** * Set target platform(s) for the build. Defaults to the host's platform. * @@ -552,6 +596,26 @@ export class Image extends pulumi.CustomResource { * Equivalent to Docker's `--pull` flag. */ public readonly pull!: pulumi.Output; + /** + * When `true` the build will automatically include a `registry` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--push` flag. + */ + public readonly push!: pulumi.Output; + /** + * If the image was pushed to any registries then this will contain a + * single fully-qualified tag including the build's digest. + * + * This is only for convenience and may not be appropriate for situations + * where multiple tags or registries are involved. In those cases this + * output is not guaranteed to be stable. + * + * For more control over tags consumed by downstream resources you should + * use the `Digests` output. + */ + public /*out*/ readonly ref!: pulumi.Output; /** * Registry credentials. Required if reading or exporting to private * repositories. @@ -574,6 +638,12 @@ export class Image extends pulumi.CustomResource { * Similar to Docker's `--secret` flag. */ public readonly secrets!: pulumi.Output<{[key: string]: string} | undefined>; + /** + * SSH agent socket or keys to expose to the build. + * + * Equivalent to Docker's `--ssh` flag. + */ + public readonly ssh!: pulumi.Output; /** * Name and optionally a tag (format: `name:tag`). * @@ -603,6 +673,7 @@ export class Image extends pulumi.CustomResource { let resourceInputs: pulumi.Inputs = {}; opts = opts || {}; if (!opts.id) { + resourceInputs["addHosts"] = args ? args.addHosts : undefined; resourceInputs["buildArgs"] = args ? args.buildArgs : undefined; resourceInputs["buildOnPreview"] = args ? args.buildOnPreview : undefined; resourceInputs["builder"] = args ? args.builder : undefined; @@ -612,15 +683,22 @@ export class Image extends pulumi.CustomResource { resourceInputs["dockerfile"] = args ? args.dockerfile : undefined; resourceInputs["exports"] = args ? args.exports : undefined; resourceInputs["labels"] = args ? args.labels : undefined; + resourceInputs["load"] = args ? args.load : undefined; + resourceInputs["network"] = (args ? args.network : undefined) ?? "default"; + resourceInputs["noCache"] = args ? args.noCache : undefined; resourceInputs["platforms"] = args ? args.platforms : undefined; resourceInputs["pull"] = args ? args.pull : undefined; + resourceInputs["push"] = args ? args.push : undefined; resourceInputs["registries"] = args ? args.registries : undefined; - resourceInputs["secrets"] = args?.secrets ? pulumi.secret(args.secrets) : undefined; + resourceInputs["secrets"] = args ? args.secrets : undefined; + resourceInputs["ssh"] = args ? args.ssh : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["targets"] = args ? args.targets : undefined; resourceInputs["contextHash"] = undefined /*out*/; resourceInputs["digests"] = undefined /*out*/; + resourceInputs["ref"] = undefined /*out*/; } else { + resourceInputs["addHosts"] = undefined /*out*/; resourceInputs["buildArgs"] = undefined /*out*/; resourceInputs["buildOnPreview"] = undefined /*out*/; resourceInputs["builder"] = undefined /*out*/; @@ -632,16 +710,20 @@ export class Image extends pulumi.CustomResource { resourceInputs["dockerfile"] = undefined /*out*/; resourceInputs["exports"] = undefined /*out*/; resourceInputs["labels"] = undefined /*out*/; + resourceInputs["load"] = undefined /*out*/; + resourceInputs["network"] = undefined /*out*/; + resourceInputs["noCache"] = undefined /*out*/; resourceInputs["platforms"] = undefined /*out*/; resourceInputs["pull"] = undefined /*out*/; + resourceInputs["push"] = undefined /*out*/; + resourceInputs["ref"] = undefined /*out*/; resourceInputs["registries"] = undefined /*out*/; resourceInputs["secrets"] = undefined /*out*/; + resourceInputs["ssh"] = undefined /*out*/; resourceInputs["tags"] = undefined /*out*/; resourceInputs["targets"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); - const secretOpts = { additionalSecretOutputs: ["secrets"] }; - opts = pulumi.mergeOptions(opts, secretOpts); super(Image.__pulumiType, name, resourceInputs, opts); } } @@ -650,6 +732,12 @@ export class Image extends pulumi.CustomResource { * The set of arguments for constructing a Image resource. */ export interface ImageArgs { + /** + * Custom `host:ip` mappings to use during the build. + * + * Equivalent to Docker's `--add-host` flag. + */ + addHosts?: pulumi.Input[]>; /** * `ARG` names and values to set during the build. * @@ -663,8 +751,20 @@ export interface ImageArgs { */ buildArgs?: pulumi.Input<{[key: string]: pulumi.Input}>; /** - * When `true`, attempt to build the image during previews. The image will - * not be pushed to registries, however caches will still be populated. + * By default, preview behavior depends on the execution environment. If + * Pulumi detects the operation is running on a CI system (GitHub Actions, + * Travis CI, Azure Pipelines, etc.) then it will build images during + * previews as a safeguard. Otherwise, if not running on CI, previews will + * not build images. + * + * Setting this to `false` forces previews to never perform builds, and + * setting it to `true` will always build the image during previews. + * + * Images built during previews are never exported to registries, however + * cache manifests are still exported. + * + * On-disk Dockerfiles are always validated for syntactic correctness + * regardless of this setting. */ buildOnPreview?: pulumi.Input; /** @@ -710,6 +810,28 @@ export interface ImageArgs { * Equivalent to Docker's `--label` flag. */ labels?: pulumi.Input<{[key: string]: pulumi.Input}>; + /** + * When `true` the build will automatically include a `docker` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--load` flag. + */ + load?: pulumi.Input; + /** + * Set the network mode for `RUN` instructions. Defaults to `default`. + * + * For custom networks, configure your builder with `--driver-opt network=...`. + * + * Equivalent to Docker's `--network` flag. + */ + network?: pulumi.Input; + /** + * Do not import cache manifests when building the image. + * + * Equivalent to Docker's `--no-cache` flag. + */ + noCache?: pulumi.Input; /** * Set target platform(s) for the build. Defaults to the host's platform. * @@ -722,6 +844,14 @@ export interface ImageArgs { * Equivalent to Docker's `--pull` flag. */ pull?: pulumi.Input; + /** + * When `true` the build will automatically include a `registry` export. + * + * Defaults to `false`. + * + * Equivalent to Docker's `--push` flag. + */ + push?: pulumi.Input; /** * Registry credentials. Required if reading or exporting to private * repositories. @@ -744,6 +874,12 @@ export interface ImageArgs { * Similar to Docker's `--secret` flag. */ secrets?: pulumi.Input<{[key: string]: pulumi.Input}>; + /** + * SSH agent socket or keys to expose to the build. + * + * Equivalent to Docker's `--ssh` flag. + */ + ssh?: pulumi.Input[]>; /** * Name and optionally a tag (format: `name:tag`). * diff --git a/sdk/nodejs/types/enums/buildx/index.ts b/sdk/nodejs/types/enums/buildx/index.ts index c5215764..00c5847d 100644 --- a/sdk/nodejs/types/enums/buildx/index.ts +++ b/sdk/nodejs/types/enums/buildx/index.ts @@ -32,6 +32,23 @@ export const CompressionType = { export type CompressionType = (typeof CompressionType)[keyof typeof CompressionType]; +export const NetworkMode = { + /** + * The default sandbox network mode. + */ + Default: "default", + /** + * Host network mode. + */ + Host: "host", + /** + * Disable network access. + */ + None: "none", +} as const; + +export type NetworkMode = (typeof NetworkMode)[keyof typeof NetworkMode]; + export const Platform = { Darwin_386: "darwin/386", Darwin_amd64: "darwin/amd64", diff --git a/sdk/nodejs/types/input.ts b/sdk/nodejs/types/input.ts index 2ffc68af..58ba745b 100644 --- a/sdk/nodejs/types/input.ts +++ b/sdk/nodejs/types/input.ts @@ -1877,11 +1877,6 @@ export namespace buildx { * Export to a local directory as files and directories. */ local?: pulumi.Input; - /** - * An output property populated for exporters that pushed image - * manifest(s) to a registry. - */ - manifests?: pulumi.Input[]>; /** * Identical to the Docker exporter but uses OCI media types by default. */ @@ -2126,36 +2121,6 @@ export namespace buildx { dest: pulumi.Input; } - export interface Manifest { - /** - * The SHA256 digest of the manifest. - */ - digest: pulumi.Input; - /** - * The manifest's platform. - */ - platform: pulumi.Input; - /** - * The manifest's canonical ref. - */ - ref: pulumi.Input; - /** - * The size of the manifest in bytes. - */ - size: pulumi.Input; - } - - export interface ManifestPlatform { - /** - * The manifest's architecture. - */ - architecture: pulumi.Input; - /** - * The manifest's operating systen. - */ - os: pulumi.Input; - } - export interface RegistryAuth { /** * The registry's address (e.g. "docker.io"). @@ -2170,6 +2135,27 @@ export namespace buildx { */ username?: pulumi.Input; } + + export interface SSH { + /** + * Useful for distinguishing different servers that are part of the same + * build. + * + * A value of `default` is appropriate if only dealing with a single host. + */ + id: pulumi.Input; + /** + * SSH agent socket or private keys to expose to the build under the given + * identifier. + * + * Defaults to `[$SSH_AUTH_SOCK]`. + * + * Note that your keys are **not** automatically added when using an + * agent. Run `ssh-add -l` locally to confirm which public keys are + * visible to the agent; these will be exposed to your build. + */ + paths?: pulumi.Input[]>; + } } export namespace config { diff --git a/sdk/nodejs/types/output.ts b/sdk/nodejs/types/output.ts index 3d322d6d..d3f8f652 100644 --- a/sdk/nodejs/types/output.ts +++ b/sdk/nodejs/types/output.ts @@ -1803,11 +1803,6 @@ export namespace buildx { * Export to a local directory as files and directories. */ local?: outputs.buildx.ExportLocal; - /** - * An output property populated for exporters that pushed image - * manifest(s) to a registry. - */ - manifests?: outputs.buildx.Manifest[]; /** * Identical to the Docker exporter but uses OCI media types by default. */ @@ -2052,36 +2047,6 @@ export namespace buildx { dest: string; } - export interface Manifest { - /** - * The SHA256 digest of the manifest. - */ - digest: string; - /** - * The manifest's platform. - */ - platform: outputs.buildx.ManifestPlatform; - /** - * The manifest's canonical ref. - */ - ref: string; - /** - * The size of the manifest in bytes. - */ - size: number; - } - - export interface ManifestPlatform { - /** - * The manifest's architecture. - */ - architecture: string; - /** - * The manifest's operating systen. - */ - os: string; - } - export interface RegistryAuth { /** * The registry's address (e.g. "docker.io"). @@ -2097,6 +2062,27 @@ export namespace buildx { username?: string; } + export interface SSH { + /** + * Useful for distinguishing different servers that are part of the same + * build. + * + * A value of `default` is appropriate if only dealing with a single host. + */ + id: string; + /** + * SSH agent socket or private keys to expose to the build under the given + * identifier. + * + * Defaults to `[$SSH_AUTH_SOCK]`. + * + * Note that your keys are **not** automatically added when using an + * agent. Run `ssh-add -l` locally to confirm which public keys are + * visible to the agent; these will be exposed to your build. + */ + paths?: string[]; + } + } export namespace config { diff --git a/sdk/python/pulumi_docker/buildx/_enums.py b/sdk/python/pulumi_docker/buildx/_enums.py index 8bfd91af..e3281503 100644 --- a/sdk/python/pulumi_docker/buildx/_enums.py +++ b/sdk/python/pulumi_docker/buildx/_enums.py @@ -7,6 +7,7 @@ __all__ = [ 'CacheMode', 'CompressionType', + 'NetworkMode', 'Platform', ] @@ -37,6 +38,21 @@ class CompressionType(str, Enum): """ +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" diff --git a/sdk/python/pulumi_docker/buildx/_inputs.py b/sdk/python/pulumi_docker/buildx/_inputs.py index 41e983dd..5f3e07ff 100644 --- a/sdk/python/pulumi_docker/buildx/_inputs.py +++ b/sdk/python/pulumi_docker/buildx/_inputs.py @@ -35,9 +35,8 @@ 'ExportOCIArgs', 'ExportRegistryArgs', 'ExportTarArgs', - 'ManifestPlatformArgs', - 'ManifestArgs', 'RegistryAuthArgs', + 'SSHArgs', ] @pulumi.input_type @@ -1726,7 +1725,6 @@ def __init__(__self__, *, docker: Optional[pulumi.Input['ExportDockerArgs']] = None, image: Optional[pulumi.Input['ExportImageArgs']] = None, local: Optional[pulumi.Input['ExportLocalArgs']] = None, - manifests: Optional[pulumi.Input[Sequence[pulumi.Input['ManifestArgs']]]] = None, oci: Optional[pulumi.Input['ExportOCIArgs']] = None, raw: Optional[pulumi.Input[str]] = None, registry: Optional[pulumi.Input['ExportRegistryArgs']] = None, @@ -1736,8 +1734,6 @@ def __init__(__self__, *, :param pulumi.Input['ExportDockerArgs'] docker: Export as a Docker image layout. :param pulumi.Input['ExportImageArgs'] image: Outputs the build result into a container image format. :param pulumi.Input['ExportLocalArgs'] local: Export to a local directory as files and directories. - :param pulumi.Input[Sequence[pulumi.Input['ManifestArgs']]] manifests: An output property populated for exporters that pushed image - manifest(s) to a registry. :param pulumi.Input['ExportOCIArgs'] oci: Identical to the Docker exporter but uses OCI media types by default. :param pulumi.Input[str] raw: A raw string as you would provide it to the Docker CLI (e.g., `type=docker`) @@ -1752,8 +1748,6 @@ def __init__(__self__, *, pulumi.set(__self__, "image", image) if local is not None: pulumi.set(__self__, "local", local) - if manifests is not None: - pulumi.set(__self__, "manifests", manifests) if oci is not None: pulumi.set(__self__, "oci", oci) if raw is not None: @@ -1811,19 +1805,6 @@ def local(self) -> Optional[pulumi.Input['ExportLocalArgs']]: def local(self, value: Optional[pulumi.Input['ExportLocalArgs']]): pulumi.set(self, "local", value) - @property - @pulumi.getter - def manifests(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ManifestArgs']]]]: - """ - An output property populated for exporters that pushed image - manifest(s) to a registry. - """ - return pulumi.get(self, "manifests") - - @manifests.setter - def manifests(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ManifestArgs']]]]): - pulumi.set(self, "manifests", value) - @property @pulumi.getter def oci(self) -> Optional[pulumi.Input['ExportOCIArgs']]: @@ -2543,110 +2524,6 @@ def dest(self, value: pulumi.Input[str]): pulumi.set(self, "dest", value) -@pulumi.input_type -class ManifestPlatformArgs: - def __init__(__self__, *, - architecture: pulumi.Input[str], - os: pulumi.Input[str]): - """ - :param pulumi.Input[str] architecture: The manifest's architecture. - :param pulumi.Input[str] os: The manifest's operating systen. - """ - pulumi.set(__self__, "architecture", architecture) - pulumi.set(__self__, "os", os) - - @property - @pulumi.getter - def architecture(self) -> pulumi.Input[str]: - """ - The manifest's architecture. - """ - return pulumi.get(self, "architecture") - - @architecture.setter - def architecture(self, value: pulumi.Input[str]): - pulumi.set(self, "architecture", value) - - @property - @pulumi.getter - def os(self) -> pulumi.Input[str]: - """ - The manifest's operating systen. - """ - return pulumi.get(self, "os") - - @os.setter - def os(self, value: pulumi.Input[str]): - pulumi.set(self, "os", value) - - -@pulumi.input_type -class ManifestArgs: - def __init__(__self__, *, - digest: pulumi.Input[str], - platform: pulumi.Input['ManifestPlatformArgs'], - ref: pulumi.Input[str], - size: pulumi.Input[int]): - """ - :param pulumi.Input[str] digest: The SHA256 digest of the manifest. - :param pulumi.Input['ManifestPlatformArgs'] platform: The manifest's platform. - :param pulumi.Input[str] ref: The manifest's canonical ref. - :param pulumi.Input[int] size: The size of the manifest in bytes. - """ - pulumi.set(__self__, "digest", digest) - pulumi.set(__self__, "platform", platform) - pulumi.set(__self__, "ref", ref) - pulumi.set(__self__, "size", size) - - @property - @pulumi.getter - def digest(self) -> pulumi.Input[str]: - """ - The SHA256 digest of the manifest. - """ - return pulumi.get(self, "digest") - - @digest.setter - def digest(self, value: pulumi.Input[str]): - pulumi.set(self, "digest", value) - - @property - @pulumi.getter - def platform(self) -> pulumi.Input['ManifestPlatformArgs']: - """ - The manifest's platform. - """ - return pulumi.get(self, "platform") - - @platform.setter - def platform(self, value: pulumi.Input['ManifestPlatformArgs']): - pulumi.set(self, "platform", value) - - @property - @pulumi.getter - def ref(self) -> pulumi.Input[str]: - """ - The manifest's canonical ref. - """ - return pulumi.get(self, "ref") - - @ref.setter - def ref(self, value: pulumi.Input[str]): - pulumi.set(self, "ref", value) - - @property - @pulumi.getter - def size(self) -> pulumi.Input[int]: - """ - The size of the manifest in bytes. - """ - return pulumi.get(self, "size") - - @size.setter - def size(self, value: pulumi.Input[int]): - pulumi.set(self, "size", value) - - @pulumi.input_type class RegistryAuthArgs: def __init__(__self__, *, @@ -2701,3 +2578,61 @@ def username(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "username", value) +@pulumi.input_type +class SSHArgs: + def __init__(__self__, *, + id: pulumi.Input[str], + paths: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None): + """ + :param pulumi.Input[str] id: Useful for distinguishing different servers that are part of the same + build. + + A value of `default` is appropriate if only dealing with a single host. + :param pulumi.Input[Sequence[pulumi.Input[str]]] paths: SSH agent socket or private keys to expose to the build under the given + identifier. + + Defaults to `[$SSH_AUTH_SOCK]`. + + Note that your keys are **not** automatically added when using an + agent. Run `ssh-add -l` locally to confirm which public keys are + visible to the agent; these will be exposed to your build. + """ + pulumi.set(__self__, "id", id) + if paths is not None: + pulumi.set(__self__, "paths", paths) + + @property + @pulumi.getter + def id(self) -> pulumi.Input[str]: + """ + Useful for distinguishing different servers that are part of the same + build. + + A value of `default` is appropriate if only dealing with a single host. + """ + return pulumi.get(self, "id") + + @id.setter + def id(self, value: pulumi.Input[str]): + pulumi.set(self, "id", value) + + @property + @pulumi.getter + def paths(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]: + """ + SSH agent socket or private keys to expose to the build under the given + identifier. + + Defaults to `[$SSH_AUTH_SOCK]`. + + Note that your keys are **not** automatically added when using an + agent. Run `ssh-add -l` locally to confirm which public keys are + visible to the agent; these will be exposed to your build. + """ + return pulumi.get(self, "paths") + + @paths.setter + def paths(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]): + pulumi.set(self, "paths", value) + + diff --git a/sdk/python/pulumi_docker/buildx/image.py b/sdk/python/pulumi_docker/buildx/image.py index f5e7bd5e..cfcf7a29 100644 --- a/sdk/python/pulumi_docker/buildx/image.py +++ b/sdk/python/pulumi_docker/buildx/image.py @@ -17,6 +17,7 @@ @pulumi.input_type class ImageArgs: def __init__(__self__, *, + add_hosts: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, build_args: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, build_on_preview: Optional[pulumi.Input[bool]] = None, builder: Optional[pulumi.Input['BuilderConfigArgs']] = None, @@ -26,14 +27,22 @@ def __init__(__self__, *, dockerfile: Optional[pulumi.Input['DockerfileArgs']] = None, exports: Optional[pulumi.Input[Sequence[pulumi.Input['ExportEntryArgs']]]] = None, labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, + load: Optional[pulumi.Input[bool]] = None, + network: Optional[pulumi.Input['NetworkMode']] = None, + no_cache: Optional[pulumi.Input[bool]] = None, platforms: Optional[pulumi.Input[Sequence[pulumi.Input['Platform']]]] = None, pull: Optional[pulumi.Input[bool]] = None, + push: Optional[pulumi.Input[bool]] = None, registries: Optional[pulumi.Input[Sequence[pulumi.Input['RegistryAuthArgs']]]] = None, secrets: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, + ssh: Optional[pulumi.Input[Sequence[pulumi.Input['SSHArgs']]]] = None, tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, targets: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None): """ The set of arguments for constructing a Image resource. + :param pulumi.Input[Sequence[pulumi.Input[str]]] add_hosts: Custom `host:ip` mappings to use during the build. + + Equivalent to Docker's `--add-host` flag. :param pulumi.Input[Mapping[str, pulumi.Input[str]]] build_args: `ARG` names and values to set during the build. These variables are accessed like environment variables inside `RUN` @@ -43,8 +52,20 @@ def __init__(__self__, *, if these arguments are sensitive. Equivalent to Docker's `--build-arg` flag. - :param pulumi.Input[bool] build_on_preview: When `true`, attempt to build the image during previews. The image will - not be pushed to registries, however caches will still be populated. + :param pulumi.Input[bool] build_on_preview: By default, preview behavior depends on the execution environment. If + Pulumi detects the operation is running on a CI system (GitHub Actions, + Travis CI, Azure Pipelines, etc.) then it will build images during + previews as a safeguard. Otherwise, if not running on CI, previews will + not build images. + + Setting this to `false` forces previews to never perform builds, and + setting it to `true` will always build the image during previews. + + Images built during previews are never exported to registries, however + cache manifests are still exported. + + On-disk Dockerfiles are always validated for syntactic correctness + regardless of this setting. :param pulumi.Input['BuilderConfigArgs'] builder: Builder configuration. :param pulumi.Input[Sequence[pulumi.Input['CacheFromEntryArgs']]] cache_from: Cache export configuration. @@ -67,12 +88,30 @@ def __init__(__self__, *, :param pulumi.Input[Mapping[str, pulumi.Input[str]]] labels: Attach arbitrary key/value metadata to the image. Equivalent to Docker's `--label` flag. + :param pulumi.Input[bool] load: When `true` the build will automatically include a `docker` export. + + Defaults to `false`. + + Equivalent to Docker's `--load` flag. + :param pulumi.Input['NetworkMode'] network: Set the network mode for `RUN` instructions. Defaults to `default`. + + For custom networks, configure your builder with `--driver-opt network=...`. + + Equivalent to Docker's `--network` flag. + :param pulumi.Input[bool] no_cache: Do not import cache manifests when building the image. + + Equivalent to Docker's `--no-cache` flag. :param pulumi.Input[Sequence[pulumi.Input['Platform']]] platforms: Set target platform(s) for the build. Defaults to the host's platform. Equivalent to Docker's `--platform` flag. :param pulumi.Input[bool] pull: Always pull referenced images. Equivalent to Docker's `--pull` flag. + :param pulumi.Input[bool] push: When `true` the build will automatically include a `registry` export. + + Defaults to `false`. + + Equivalent to Docker's `--push` flag. :param pulumi.Input[Sequence[pulumi.Input['RegistryAuthArgs']]] registries: Registry credentials. Required if reading or exporting to private repositories. @@ -89,6 +128,9 @@ def __init__(__self__, *, image, so you should use this for sensitive values. Similar to Docker's `--secret` flag. + :param pulumi.Input[Sequence[pulumi.Input['SSHArgs']]] ssh: SSH agent socket or keys to expose to the build. + + Equivalent to Docker's `--ssh` flag. :param pulumi.Input[Sequence[pulumi.Input[str]]] tags: Name and optionally a tag (format: `name:tag`). If exporting to a registry, the name should include the fully qualified @@ -101,6 +143,8 @@ def __init__(__self__, *, Equivalent to Docker's `--target` flag. """ + if add_hosts is not None: + pulumi.set(__self__, "add_hosts", add_hosts) if build_args is not None: pulumi.set(__self__, "build_args", build_args) if build_on_preview is not None: @@ -119,19 +163,45 @@ def __init__(__self__, *, pulumi.set(__self__, "exports", exports) if labels is not None: pulumi.set(__self__, "labels", labels) + if load is not None: + pulumi.set(__self__, "load", load) + if network is None: + network = 'default' + if network is not None: + pulumi.set(__self__, "network", network) + if no_cache is not None: + pulumi.set(__self__, "no_cache", no_cache) if platforms is not None: pulumi.set(__self__, "platforms", platforms) if pull is not None: pulumi.set(__self__, "pull", pull) + if push is not None: + pulumi.set(__self__, "push", push) if registries is not None: pulumi.set(__self__, "registries", registries) if secrets is not None: pulumi.set(__self__, "secrets", secrets) + if ssh is not None: + pulumi.set(__self__, "ssh", ssh) if tags is not None: pulumi.set(__self__, "tags", tags) if targets is not None: pulumi.set(__self__, "targets", targets) + @property + @pulumi.getter(name="addHosts") + def add_hosts(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]: + """ + Custom `host:ip` mappings to use during the build. + + Equivalent to Docker's `--add-host` flag. + """ + return pulumi.get(self, "add_hosts") + + @add_hosts.setter + def add_hosts(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]): + pulumi.set(self, "add_hosts", value) + @property @pulumi.getter(name="buildArgs") def build_args(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]: @@ -156,8 +226,20 @@ def build_args(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str] @pulumi.getter(name="buildOnPreview") def build_on_preview(self) -> Optional[pulumi.Input[bool]]: """ - When `true`, attempt to build the image during previews. The image will - not be pushed to registries, however caches will still be populated. + By default, preview behavior depends on the execution environment. If + Pulumi detects the operation is running on a CI system (GitHub Actions, + Travis CI, Azure Pipelines, etc.) then it will build images during + previews as a safeguard. Otherwise, if not running on CI, previews will + not build images. + + Setting this to `false` forces previews to never perform builds, and + setting it to `true` will always build the image during previews. + + Images built during previews are never exported to registries, however + cache manifests are still exported. + + On-disk Dockerfiles are always validated for syntactic correctness + regardless of this setting. """ return pulumi.get(self, "build_on_preview") @@ -264,6 +346,52 @@ def labels(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]: def labels(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]): pulumi.set(self, "labels", value) + @property + @pulumi.getter + def load(self) -> Optional[pulumi.Input[bool]]: + """ + When `true` the build will automatically include a `docker` export. + + Defaults to `false`. + + Equivalent to Docker's `--load` flag. + """ + return pulumi.get(self, "load") + + @load.setter + def load(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "load", value) + + @property + @pulumi.getter + def network(self) -> Optional[pulumi.Input['NetworkMode']]: + """ + Set the network mode for `RUN` instructions. Defaults to `default`. + + For custom networks, configure your builder with `--driver-opt network=...`. + + Equivalent to Docker's `--network` flag. + """ + return pulumi.get(self, "network") + + @network.setter + def network(self, value: Optional[pulumi.Input['NetworkMode']]): + pulumi.set(self, "network", value) + + @property + @pulumi.getter(name="noCache") + def no_cache(self) -> Optional[pulumi.Input[bool]]: + """ + Do not import cache manifests when building the image. + + Equivalent to Docker's `--no-cache` flag. + """ + return pulumi.get(self, "no_cache") + + @no_cache.setter + def no_cache(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "no_cache", value) + @property @pulumi.getter def platforms(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['Platform']]]]: @@ -292,6 +420,22 @@ def pull(self) -> Optional[pulumi.Input[bool]]: def pull(self, value: Optional[pulumi.Input[bool]]): pulumi.set(self, "pull", value) + @property + @pulumi.getter + def push(self) -> Optional[pulumi.Input[bool]]: + """ + When `true` the build will automatically include a `registry` export. + + Defaults to `false`. + + Equivalent to Docker's `--push` flag. + """ + return pulumi.get(self, "push") + + @push.setter + def push(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "push", value) + @property @pulumi.getter def registries(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['RegistryAuthArgs']]]]: @@ -330,6 +474,20 @@ def secrets(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]: def secrets(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]): pulumi.set(self, "secrets", value) + @property + @pulumi.getter + def ssh(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SSHArgs']]]]: + """ + SSH agent socket or keys to expose to the build. + + Equivalent to Docker's `--ssh` flag. + """ + return pulumi.get(self, "ssh") + + @ssh.setter + def ssh(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SSHArgs']]]]): + pulumi.set(self, "ssh", value) + @property @pulumi.getter def tags(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]: @@ -369,6 +527,7 @@ class Image(pulumi.CustomResource): def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, + add_hosts: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, build_args: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, build_on_preview: Optional[pulumi.Input[bool]] = None, builder: Optional[pulumi.Input[pulumi.InputType['BuilderConfigArgs']]] = None, @@ -378,10 +537,15 @@ def __init__(__self__, dockerfile: Optional[pulumi.Input[pulumi.InputType['DockerfileArgs']]] = None, exports: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportEntryArgs']]]]] = None, labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, + load: Optional[pulumi.Input[bool]] = None, + network: Optional[pulumi.Input['NetworkMode']] = None, + no_cache: Optional[pulumi.Input[bool]] = None, platforms: Optional[pulumi.Input[Sequence[pulumi.Input['Platform']]]] = None, pull: Optional[pulumi.Input[bool]] = None, + push: Optional[pulumi.Input[bool]] = None, registries: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['RegistryAuthArgs']]]]] = None, secrets: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, + ssh: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['SSHArgs']]]]] = None, tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, targets: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, __props__=None): @@ -672,6 +836,9 @@ def __init__(__self__, :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. + :param pulumi.Input[Sequence[pulumi.Input[str]]] add_hosts: Custom `host:ip` mappings to use during the build. + + Equivalent to Docker's `--add-host` flag. :param pulumi.Input[Mapping[str, pulumi.Input[str]]] build_args: `ARG` names and values to set during the build. These variables are accessed like environment variables inside `RUN` @@ -681,8 +848,20 @@ def __init__(__self__, if these arguments are sensitive. Equivalent to Docker's `--build-arg` flag. - :param pulumi.Input[bool] build_on_preview: When `true`, attempt to build the image during previews. The image will - not be pushed to registries, however caches will still be populated. + :param pulumi.Input[bool] build_on_preview: By default, preview behavior depends on the execution environment. If + Pulumi detects the operation is running on a CI system (GitHub Actions, + Travis CI, Azure Pipelines, etc.) then it will build images during + previews as a safeguard. Otherwise, if not running on CI, previews will + not build images. + + Setting this to `false` forces previews to never perform builds, and + setting it to `true` will always build the image during previews. + + Images built during previews are never exported to registries, however + cache manifests are still exported. + + On-disk Dockerfiles are always validated for syntactic correctness + regardless of this setting. :param pulumi.Input[pulumi.InputType['BuilderConfigArgs']] builder: Builder configuration. :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromEntryArgs']]]] cache_from: Cache export configuration. @@ -705,12 +884,30 @@ def __init__(__self__, :param pulumi.Input[Mapping[str, pulumi.Input[str]]] labels: Attach arbitrary key/value metadata to the image. Equivalent to Docker's `--label` flag. + :param pulumi.Input[bool] load: When `true` the build will automatically include a `docker` export. + + Defaults to `false`. + + Equivalent to Docker's `--load` flag. + :param pulumi.Input['NetworkMode'] network: Set the network mode for `RUN` instructions. Defaults to `default`. + + For custom networks, configure your builder with `--driver-opt network=...`. + + Equivalent to Docker's `--network` flag. + :param pulumi.Input[bool] no_cache: Do not import cache manifests when building the image. + + Equivalent to Docker's `--no-cache` flag. :param pulumi.Input[Sequence[pulumi.Input['Platform']]] platforms: Set target platform(s) for the build. Defaults to the host's platform. Equivalent to Docker's `--platform` flag. :param pulumi.Input[bool] pull: Always pull referenced images. Equivalent to Docker's `--pull` flag. + :param pulumi.Input[bool] push: When `true` the build will automatically include a `registry` export. + + Defaults to `false`. + + Equivalent to Docker's `--push` flag. :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['RegistryAuthArgs']]]] registries: Registry credentials. Required if reading or exporting to private repositories. @@ -727,6 +924,9 @@ def __init__(__self__, image, so you should use this for sensitive values. Similar to Docker's `--secret` flag. + :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['SSHArgs']]]] ssh: SSH agent socket or keys to expose to the build. + + Equivalent to Docker's `--ssh` flag. :param pulumi.Input[Sequence[pulumi.Input[str]]] tags: Name and optionally a tag (format: `name:tag`). If exporting to a registry, the name should include the fully qualified @@ -1045,6 +1245,7 @@ def __init__(__self__, resource_name: str, *args, **kwargs): def _internal_init(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, + add_hosts: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, build_args: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, build_on_preview: Optional[pulumi.Input[bool]] = None, builder: Optional[pulumi.Input[pulumi.InputType['BuilderConfigArgs']]] = None, @@ -1054,10 +1255,15 @@ def _internal_init(__self__, dockerfile: Optional[pulumi.Input[pulumi.InputType['DockerfileArgs']]] = None, exports: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ExportEntryArgs']]]]] = None, labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, + load: Optional[pulumi.Input[bool]] = None, + network: Optional[pulumi.Input['NetworkMode']] = None, + no_cache: Optional[pulumi.Input[bool]] = None, platforms: Optional[pulumi.Input[Sequence[pulumi.Input['Platform']]]] = None, pull: Optional[pulumi.Input[bool]] = None, + push: Optional[pulumi.Input[bool]] = None, registries: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['RegistryAuthArgs']]]]] = None, secrets: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, + ssh: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['SSHArgs']]]]] = None, tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, targets: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, __props__=None): @@ -1069,6 +1275,7 @@ def _internal_init(__self__, raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource') __props__ = ImageArgs.__new__(ImageArgs) + __props__.__dict__["add_hosts"] = add_hosts __props__.__dict__["build_args"] = build_args __props__.__dict__["build_on_preview"] = build_on_preview __props__.__dict__["builder"] = builder @@ -1078,16 +1285,22 @@ def _internal_init(__self__, __props__.__dict__["dockerfile"] = dockerfile __props__.__dict__["exports"] = exports __props__.__dict__["labels"] = labels + __props__.__dict__["load"] = load + if network is None: + network = 'default' + __props__.__dict__["network"] = network + __props__.__dict__["no_cache"] = no_cache __props__.__dict__["platforms"] = platforms __props__.__dict__["pull"] = pull + __props__.__dict__["push"] = push __props__.__dict__["registries"] = registries - __props__.__dict__["secrets"] = None if secrets is None else pulumi.Output.secret(secrets) + __props__.__dict__["secrets"] = secrets + __props__.__dict__["ssh"] = ssh __props__.__dict__["tags"] = tags __props__.__dict__["targets"] = targets __props__.__dict__["context_hash"] = None __props__.__dict__["digests"] = None - secret_opts = pulumi.ResourceOptions(additional_secret_outputs=["secrets"]) - opts = pulumi.ResourceOptions.merge(opts, secret_opts) + __props__.__dict__["ref"] = None super(Image, __self__).__init__( 'docker:buildx/image:Image', resource_name, @@ -1110,6 +1323,7 @@ def get(resource_name: str, __props__ = ImageArgs.__new__(ImageArgs) + __props__.__dict__["add_hosts"] = None __props__.__dict__["build_args"] = None __props__.__dict__["build_on_preview"] = None __props__.__dict__["builder"] = None @@ -1121,14 +1335,30 @@ def get(resource_name: str, __props__.__dict__["dockerfile"] = None __props__.__dict__["exports"] = None __props__.__dict__["labels"] = None + __props__.__dict__["load"] = None + __props__.__dict__["network"] = None + __props__.__dict__["no_cache"] = None __props__.__dict__["platforms"] = None __props__.__dict__["pull"] = None + __props__.__dict__["push"] = None + __props__.__dict__["ref"] = None __props__.__dict__["registries"] = None __props__.__dict__["secrets"] = None + __props__.__dict__["ssh"] = None __props__.__dict__["tags"] = None __props__.__dict__["targets"] = None return Image(resource_name, opts=opts, __props__=__props__) + @property + @pulumi.getter(name="addHosts") + def add_hosts(self) -> pulumi.Output[Optional[Sequence[str]]]: + """ + Custom `host:ip` mappings to use during the build. + + Equivalent to Docker's `--add-host` flag. + """ + return pulumi.get(self, "add_hosts") + @property @pulumi.getter(name="buildArgs") def build_args(self) -> pulumi.Output[Optional[Mapping[str, str]]]: @@ -1149,8 +1379,20 @@ def build_args(self) -> pulumi.Output[Optional[Mapping[str, str]]]: @pulumi.getter(name="buildOnPreview") def build_on_preview(self) -> pulumi.Output[Optional[bool]]: """ - When `true`, attempt to build the image during previews. The image will - not be pushed to registries, however caches will still be populated. + By default, preview behavior depends on the execution environment. If + Pulumi detects the operation is running on a CI system (GitHub Actions, + Travis CI, Azure Pipelines, etc.) then it will build images during + previews as a safeguard. Otherwise, if not running on CI, previews will + not build images. + + Setting this to `false` forces previews to never perform builds, and + setting it to `true` will always build the image during previews. + + Images built during previews are never exported to registries, however + cache manifests are still exported. + + On-disk Dockerfiles are always validated for syntactic correctness + regardless of this setting. """ return pulumi.get(self, "build_on_preview") @@ -1194,7 +1436,7 @@ def context(self) -> pulumi.Output[Optional['outputs.BuildContext']]: @property @pulumi.getter(name="contextHash") - def context_hash(self) -> pulumi.Output[Optional[str]]: + def context_hash(self) -> pulumi.Output[str]: """ A preliminary hash of the image's build context. @@ -1204,9 +1446,13 @@ def context_hash(self) -> pulumi.Output[Optional[str]]: @property @pulumi.getter - def digests(self) -> pulumi.Output[Optional[Mapping[str, Sequence[str]]]]: + def digests(self) -> pulumi.Output[Mapping[str, str]]: """ - A mapping of platform type to refs which were pushed to registries. + A mapping of target names to the SHA256 digest of their pushed manifest. + + If no target was specified 'default' is used as the target name. + + Pushed manifests can be referenced as `@`. """ return pulumi.get(self, "digests") @@ -1243,6 +1489,40 @@ def labels(self) -> pulumi.Output[Optional[Mapping[str, str]]]: """ return pulumi.get(self, "labels") + @property + @pulumi.getter + def load(self) -> pulumi.Output[Optional[bool]]: + """ + When `true` the build will automatically include a `docker` export. + + Defaults to `false`. + + Equivalent to Docker's `--load` flag. + """ + return pulumi.get(self, "load") + + @property + @pulumi.getter + def network(self) -> pulumi.Output[Optional['NetworkMode']]: + """ + Set the network mode for `RUN` instructions. Defaults to `default`. + + For custom networks, configure your builder with `--driver-opt network=...`. + + Equivalent to Docker's `--network` flag. + """ + return pulumi.get(self, "network") + + @property + @pulumi.getter(name="noCache") + def no_cache(self) -> pulumi.Output[Optional[bool]]: + """ + Do not import cache manifests when building the image. + + Equivalent to Docker's `--no-cache` flag. + """ + return pulumi.get(self, "no_cache") + @property @pulumi.getter def platforms(self) -> pulumi.Output[Optional[Sequence['Platform']]]: @@ -1263,6 +1543,34 @@ def pull(self) -> pulumi.Output[Optional[bool]]: """ return pulumi.get(self, "pull") + @property + @pulumi.getter + def push(self) -> pulumi.Output[Optional[bool]]: + """ + When `true` the build will automatically include a `registry` export. + + Defaults to `false`. + + Equivalent to Docker's `--push` flag. + """ + return pulumi.get(self, "push") + + @property + @pulumi.getter + def ref(self) -> pulumi.Output[str]: + """ + If the image was pushed to any registries then this will contain a + single fully-qualified tag including the build's digest. + + This is only for convenience and may not be appropriate for situations + where multiple tags or registries are involved. In those cases this + output is not guaranteed to be stable. + + For more control over tags consumed by downstream resources you should + use the `Digests` output. + """ + return pulumi.get(self, "ref") + @property @pulumi.getter def registries(self) -> pulumi.Output[Optional[Sequence['outputs.RegistryAuth']]]: @@ -1293,6 +1601,16 @@ def secrets(self) -> pulumi.Output[Optional[Mapping[str, str]]]: """ return pulumi.get(self, "secrets") + @property + @pulumi.getter + def ssh(self) -> pulumi.Output[Optional[Sequence['outputs.SSH']]]: + """ + SSH agent socket or keys to expose to the build. + + Equivalent to Docker's `--ssh` flag. + """ + return pulumi.get(self, "ssh") + @property @pulumi.getter def tags(self) -> pulumi.Output[Optional[Sequence[str]]]: diff --git a/sdk/python/pulumi_docker/buildx/outputs.py b/sdk/python/pulumi_docker/buildx/outputs.py index d695c496..4fdd5105 100644 --- a/sdk/python/pulumi_docker/buildx/outputs.py +++ b/sdk/python/pulumi_docker/buildx/outputs.py @@ -36,9 +36,8 @@ 'ExportOCI', 'ExportRegistry', 'ExportTar', - 'Manifest', - 'ManifestPlatform', 'RegistryAuth', + 'SSH', ] @pulumi.output_type @@ -1575,7 +1574,6 @@ def __init__(__self__, *, docker: Optional['outputs.ExportDocker'] = None, image: Optional['outputs.ExportImage'] = None, local: Optional['outputs.ExportLocal'] = None, - manifests: Optional[Sequence['outputs.Manifest']] = None, oci: Optional['outputs.ExportOCI'] = None, raw: Optional[str] = None, registry: Optional['outputs.ExportRegistry'] = None, @@ -1585,8 +1583,6 @@ def __init__(__self__, *, :param 'ExportDockerArgs' docker: Export as a Docker image layout. :param 'ExportImageArgs' image: Outputs the build result into a container image format. :param 'ExportLocalArgs' local: Export to a local directory as files and directories. - :param Sequence['ManifestArgs'] manifests: An output property populated for exporters that pushed image - manifest(s) to a registry. :param 'ExportOCIArgs' oci: Identical to the Docker exporter but uses OCI media types by default. :param str raw: A raw string as you would provide it to the Docker CLI (e.g., `type=docker`) @@ -1601,8 +1597,6 @@ def __init__(__self__, *, pulumi.set(__self__, "image", image) if local is not None: pulumi.set(__self__, "local", local) - if manifests is not None: - pulumi.set(__self__, "manifests", manifests) if oci is not None: pulumi.set(__self__, "oci", oci) if raw is not None: @@ -1644,15 +1638,6 @@ def local(self) -> Optional['outputs.ExportLocal']: """ return pulumi.get(self, "local") - @property - @pulumi.getter - def manifests(self) -> Optional[Sequence['outputs.Manifest']]: - """ - An output property populated for exporters that pushed image - manifest(s) to a registry. - """ - return pulumi.get(self, "manifests") - @property @pulumi.getter def oci(self) -> Optional['outputs.ExportOCI']: @@ -2287,86 +2272,6 @@ def dest(self) -> str: return pulumi.get(self, "dest") -@pulumi.output_type -class Manifest(dict): - def __init__(__self__, *, - digest: str, - platform: 'outputs.ManifestPlatform', - ref: str, - size: int): - """ - :param str digest: The SHA256 digest of the manifest. - :param 'ManifestPlatformArgs' platform: The manifest's platform. - :param str ref: The manifest's canonical ref. - :param int size: The size of the manifest in bytes. - """ - pulumi.set(__self__, "digest", digest) - pulumi.set(__self__, "platform", platform) - pulumi.set(__self__, "ref", ref) - pulumi.set(__self__, "size", size) - - @property - @pulumi.getter - def digest(self) -> str: - """ - The SHA256 digest of the manifest. - """ - return pulumi.get(self, "digest") - - @property - @pulumi.getter - def platform(self) -> 'outputs.ManifestPlatform': - """ - The manifest's platform. - """ - return pulumi.get(self, "platform") - - @property - @pulumi.getter - def ref(self) -> str: - """ - The manifest's canonical ref. - """ - return pulumi.get(self, "ref") - - @property - @pulumi.getter - def size(self) -> int: - """ - The size of the manifest in bytes. - """ - return pulumi.get(self, "size") - - -@pulumi.output_type -class ManifestPlatform(dict): - def __init__(__self__, *, - architecture: str, - os: str): - """ - :param str architecture: The manifest's architecture. - :param str os: The manifest's operating systen. - """ - pulumi.set(__self__, "architecture", architecture) - pulumi.set(__self__, "os", os) - - @property - @pulumi.getter - def architecture(self) -> str: - """ - The manifest's architecture. - """ - return pulumi.get(self, "architecture") - - @property - @pulumi.getter - def os(self) -> str: - """ - The manifest's operating systen. - """ - return pulumi.get(self, "os") - - @pulumi.output_type class RegistryAuth(dict): def __init__(__self__, *, @@ -2409,3 +2314,53 @@ def username(self) -> Optional[str]: return pulumi.get(self, "username") +@pulumi.output_type +class SSH(dict): + def __init__(__self__, *, + id: str, + paths: Optional[Sequence[str]] = None): + """ + :param str id: Useful for distinguishing different servers that are part of the same + build. + + A value of `default` is appropriate if only dealing with a single host. + :param Sequence[str] paths: SSH agent socket or private keys to expose to the build under the given + identifier. + + Defaults to `[$SSH_AUTH_SOCK]`. + + Note that your keys are **not** automatically added when using an + agent. Run `ssh-add -l` locally to confirm which public keys are + visible to the agent; these will be exposed to your build. + """ + pulumi.set(__self__, "id", id) + if paths is not None: + pulumi.set(__self__, "paths", paths) + + @property + @pulumi.getter + def id(self) -> str: + """ + Useful for distinguishing different servers that are part of the same + build. + + A value of `default` is appropriate if only dealing with a single host. + """ + return pulumi.get(self, "id") + + @property + @pulumi.getter + def paths(self) -> Optional[Sequence[str]]: + """ + SSH agent socket or private keys to expose to the build under the given + identifier. + + Defaults to `[$SSH_AUTH_SOCK]`. + + Note that your keys are **not** automatically added when using an + agent. Run `ssh-add -l` locally to confirm which public keys are + visible to the agent; these will be exposed to your build. + """ + return pulumi.get(self, "paths") + +