Fix references to buildx.Image

This commit is contained in:
Bryce Lampe
2024-03-29 11:22:08 -07:00
parent 6efd4b045b
commit da2fecf013
20 changed files with 979 additions and 981 deletions

View File

@@ -30,12 +30,12 @@ import (
//
// ## Migrating v3 and v4 Image resources
//
// The `buildx.Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
// Existing `Image` resources can be converted to `build.Image` resources with minor modifications.
// The `dockerbuild.Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
// Existing `Image` resources can be converted to `dockerbuild.Image` resources with minor modifications.
//
// ### Behavioral differences
//
// There are several key behavioral differences to keep in mind when transitioning images to the new `buildx.Image` resource.
// There are several key behavioral differences to keep in mind when transitioning images to the new `dockerbuild.Image` resource.
//
// #### Previews
//
@@ -46,8 +46,8 @@ import (
// By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.
// Some users felt this made previews in CI less helpful because they no longer detected bad images by default.
//
// The default behavior of the `buildx.Image` resource has been changed to strike a better balance between CI use cases and manual updates.
// By default, Pulumi will now only build `buildx.Image` resources during previews when it detects a CI environment like GitHub Actions.
// The default behavior of the `dockerbuild.Image` resource has been changed to strike a better balance between CI use cases and manual updates.
// By default, Pulumi will now only build `dockerbuild.Image` resources during previews when it detects a CI environment like GitHub Actions.
// Previews run in non-CI environments will not build images.
// This behavior is still configurable with `buildOnPreview`.
//
@@ -56,7 +56,7 @@ import (
// Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.
// They expose a `skipPush: true` option to disable pushing.
//
// The `buildx.Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
// The `dockerbuild.Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
//
// To 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`).
// Like 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.
@@ -67,7 +67,7 @@ import (
//
// Version `4.x` of the Pulumi Docker provider does not support secrets.
//
// The `buildx.Image` resource supports secrets but does not require those secrets to exist on-disk or in environment variables.
// The `dockerbuild.Image` resource supports secrets but does not require those secrets to exist on-disk or in environment variables.
// Instead, they should be passed directly as values.
// (Please be sure to familiarize yourself with Pulumi's [native secret handling](https://www.pulumi.com/docs/concepts/secrets/).)
// Pulumi also provides [ESC](https://www.pulumi.com/product/esc/) to make it easier to share secrets across stacks and environments.
@@ -82,7 +82,7 @@ import (
// Both versions 3 and 4 require specific environment variables to be set and deviate from Docker's native caching behavior.
// This can result in inefficient builds due to unnecessary image pulls, repeated file transfers, etc.
//
// The `buildx.Image` resource delegates all caching behavior to Docker.
// The `dockerbuild.Image` resource delegates all caching behavior to Docker.
// `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.
//
// #### Outputs
@@ -90,7 +90,7 @@ import (
// Versions `3.x` and `4.x` of the provider exposed a `repoDigest` output which was a fully qualified tag with digest.
// In `4.x` this could also be a single sha256 hash if the image wasn't pushed.
//
// Unlike earlier providers the `buildx.Image` resource can push multiple tags.
// Unlike earlier providers the `dockerbuild.Image` resource can push multiple tags.
// As a convenience, it exposes a `ref` output consisting of a tag with digest as long as the image was pushed.
// If multiple tags were pushed this uses one at random.
//
@@ -103,7 +103,7 @@ import (
// The `buidx.Image` will query your registries during `refresh` to ensure the expected tags exist.
// If any are missing a subsequent `update` will push them.
//
// When a `buildx.Image` is deleted, it will _attempt_ to also delete any pushed tags.
// When a `dockerbuild.Image` is deleted, it will _attempt_ to also delete any pushed tags.
// Deletion of remote tags is not guaranteed because not all registries support the manifest `DELETE` API (`docker.io` in particular).
// Manifests are _not_ deleted in the same way during updates -- to do so safely would require a full build to determine whether a Pulumi operation should be an update or update-replace.
//
@@ -111,11 +111,11 @@ import (
//
// ### Example migration
//
// Examples 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.
// Examples of "fully-featured" `v3` and `v4` `Image` resources are shown below, along with an example `dockerbuild.Image` resource showing how they would look after migration.
//
// The `v3` resource leverages `buildx` via a `DOCKER_BUILDKIT` environment variable and CLI flags passed in with `extraOption`.
// After migration, the environment variable is no longer needed and CLI flags are now properties on the `buildx.Image`.
// In almost all cases, properties of `buildx.Image` are named after the Docker CLI flag they correspond to.
// After migration, the environment variable is no longer needed and CLI flags are now properties on the `dockerbuild.Image`.
// In almost all cases, properties of `dockerbuild.Image` are named after the Docker CLI flag they correspond to.
//
// The `v4` resource is less functional than its `v3` counterpart because it lacks the flexibility of `extraOptions`.
// It it is shown with parameters similar to the `v3` example for completeness.
@@ -132,7 +132,7 @@ import (
// "fmt"
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecr"
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
@@ -146,19 +146,19 @@ import (
// authToken := ecr.GetAuthorizationTokenOutput(ctx, ecr.GetAuthorizationTokenOutputArgs{
// RegistryId: ecrRepository.RegistryId,
// }, nil)
// myImage, err := buildx.NewImage(ctx, "my-image", &buildx.ImageArgs{
// CacheFrom: buildx.CacheFromArray{
// &buildx.CacheFromArgs{
// Registry: &buildx.CacheFromRegistryArgs{
// myImage, err := dockerbuild.NewImage(ctx, "my-image", &dockerbuild.ImageArgs{
// CacheFrom: dockerbuild.CacheFromArray{
// &dockerbuild.CacheFromArgs{
// Registry: &dockerbuild.CacheFromRegistryArgs{
// Ref: ecrRepository.RepositoryUrl.ApplyT(func(repositoryUrl string) (string, error) {
// return fmt.Sprintf("%v:cache", repositoryUrl), nil
// }).(pulumi.StringOutput),
// },
// },
// },
// CacheTo: buildx.CacheToArray{
// &buildx.CacheToArgs{
// Registry: &buildx.CacheToRegistryArgs{
// CacheTo: dockerbuild.CacheToArray{
// &dockerbuild.CacheToArgs{
// Registry: &dockerbuild.CacheToRegistryArgs{
// ImageManifest: pulumi.Bool(true),
// OciMediaTypes: pulumi.Bool(true),
// Ref: ecrRepository.RepositoryUrl.ApplyT(func(repositoryUrl string) (string, error) {
@@ -167,12 +167,12 @@ import (
// },
// },
// },
// Context: &buildx.BuildContextArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("./app"),
// },
// Push: pulumi.Bool(true),
// Registries: buildx.RegistryAuthArray{
// &buildx.RegistryAuthArgs{
// Registries: dockerbuild.RegistryArray{
// &dockerbuild.RegistryArgs{
// Address: ecrRepository.RepositoryUrl,
// Password: authToken.ApplyT(func(authToken ecr.GetAuthorizationTokenResult) (*string, error) {
// return &authToken.Password, nil
@@ -203,20 +203,20 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Platforms: buildx.PlatformArray{
// buildx.Platform_Plan9_amd64,
// buildx.Platform_Plan9_386,
// Platforms: dockerbuild.PlatformArray{
// dockerbuild.Platform_Plan9_amd64,
// dockerbuild.Platform_Plan9_386,
// },
// })
// if err != nil {
@@ -233,20 +233,20 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Push: pulumi.Bool(true),
// Registries: buildx.RegistryAuthArray{
// &buildx.RegistryAuthArgs{
// Registries: dockerbuild.RegistryArray{
// &dockerbuild.RegistryArgs{
// Address: pulumi.String("docker.io"),
// Password: pulumi.Any(dockerHubPassword),
// Username: pulumi.String("pulumibot"),
@@ -271,30 +271,30 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// CacheFrom: buildx.CacheFromArray{
// &buildx.CacheFromArgs{
// Local: &buildx.CacheFromLocalArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// CacheFrom: dockerbuild.CacheFromArray{
// &dockerbuild.CacheFromArgs{
// Local: &dockerbuild.CacheFromLocalArgs{
// Src: pulumi.String("tmp/cache"),
// },
// },
// },
// CacheTo: buildx.CacheToArray{
// &buildx.CacheToArgs{
// Local: &buildx.CacheToLocalArgs{
// CacheTo: dockerbuild.CacheToArray{
// &dockerbuild.CacheToArgs{
// Local: &dockerbuild.CacheToLocalArgs{
// Dest: pulumi.String("tmp/cache"),
// Mode: buildx.CacheModeMax,
// Mode: dockerbuild.CacheModeMax,
// },
// },
// },
// Context: &buildx.BuildContextArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// })
@@ -312,18 +312,18 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Builder: &buildx.BuilderConfigArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Builder: &dockerbuild.BuilderConfigArgs{
// Name: pulumi.String("cloud-builder-name"),
// },
// Context: &buildx.BuildContextArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Exec: pulumi.Bool(true),
@@ -342,18 +342,18 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// BuildArgs: pulumi.StringMap{
// "SET_ME_TO_TRUE": pulumi.String("true"),
// },
// Context: &buildx.BuildContextArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// })
@@ -371,15 +371,15 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Target: pulumi.String("build-me"),
@@ -398,18 +398,18 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// Named: buildx.ContextMap{
// "golang:latest": &buildx.ContextArgs{
// Named: dockerbuild.ContextMap{
// "golang:latest": &dockerbuild.ContextArgs{
// Location: pulumi.String("docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984"),
// },
// },
@@ -429,15 +429,15 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile"),
// },
// })
@@ -455,18 +455,18 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Dockerfile: &buildx.DockerfileArgs{
// Dockerfile: &dockerbuild.DockerfileArgs{
// Inline: pulumi.String("FROM busybox\nCOPY hello.c ./\n"),
// },
// })
@@ -484,18 +484,18 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("https://github.com/docker-library/hello-world.git"),
// },
// Dockerfile: &buildx.DockerfileArgs{
// Dockerfile: &dockerbuild.DockerfileArgs{
// Location: pulumi.String("app/Dockerfile"),
// },
// })
@@ -513,20 +513,20 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Exports: buildx.ExportArray{
// &buildx.ExportArgs{
// Docker: &buildx.ExportDockerArgs{
// Exports: dockerbuild.ExportArray{
// &dockerbuild.ExportArgs{
// Docker: &dockerbuild.ExportDockerArgs{
// Tar: pulumi.Bool(true),
// },
// },

View File

@@ -28,34 +28,34 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// amd64, err := buildx.NewImage(ctx, "amd64", &buildx.ImageArgs{
// CacheFrom: buildx.CacheFromArray{
// &buildx.CacheFromArgs{
// Registry: &buildx.CacheFromRegistryArgs{
// amd64, err := dockerbuild.NewImage(ctx, "amd64", &dockerbuild.ImageArgs{
// CacheFrom: dockerbuild.CacheFromArray{
// &dockerbuild.CacheFromArgs{
// Registry: &dockerbuild.CacheFromRegistryArgs{
// Ref: pulumi.String("docker.io/pulumi/pulumi:cache-amd64"),
// },
// },
// },
// CacheTo: buildx.CacheToArray{
// &buildx.CacheToArgs{
// Registry: &buildx.CacheToRegistryArgs{
// Mode: buildx.CacheModeMax,
// CacheTo: dockerbuild.CacheToArray{
// &dockerbuild.CacheToArgs{
// Registry: &dockerbuild.CacheToRegistryArgs{
// Mode: dockerbuild.CacheModeMax,
// Ref: pulumi.String("docker.io/pulumi/pulumi:cache-amd64"),
// },
// },
// },
// Context: &buildx.BuildContextArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Platforms: buildx.PlatformArray{
// buildx.Platform_Linux_amd64,
// Platforms: dockerbuild.PlatformArray{
// dockerbuild.Platform_Linux_amd64,
// },
// Tags: pulumi.StringArray{
// pulumi.String("docker.io/pulumi/pulumi:3.107.0-amd64"),
@@ -64,27 +64,27 @@ import (
// if err != nil {
// return err
// }
// arm64, err := buildx.NewImage(ctx, "arm64", &buildx.ImageArgs{
// CacheFrom: buildx.CacheFromArray{
// &buildx.CacheFromArgs{
// Registry: &buildx.CacheFromRegistryArgs{
// arm64, err := dockerbuild.NewImage(ctx, "arm64", &dockerbuild.ImageArgs{
// CacheFrom: dockerbuild.CacheFromArray{
// &dockerbuild.CacheFromArgs{
// Registry: &dockerbuild.CacheFromRegistryArgs{
// Ref: pulumi.String("docker.io/pulumi/pulumi:cache-arm64"),
// },
// },
// },
// CacheTo: buildx.CacheToArray{
// &buildx.CacheToArgs{
// Registry: &buildx.CacheToRegistryArgs{
// Mode: buildx.CacheModeMax,
// CacheTo: dockerbuild.CacheToArray{
// &dockerbuild.CacheToArgs{
// Registry: &dockerbuild.CacheToRegistryArgs{
// Mode: dockerbuild.CacheModeMax,
// Ref: pulumi.String("docker.io/pulumi/pulumi:cache-arm64"),
// },
// },
// },
// Context: &buildx.BuildContextArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Platforms: buildx.PlatformArray{
// buildx.Platform_Linux_arm64,
// Platforms: dockerbuild.PlatformArray{
// dockerbuild.Platform_Linux_arm64,
// },
// Tags: pulumi.StringArray{
// pulumi.String("docker.io/pulumi/pulumi:3.107.0-arm64"),
@@ -93,7 +93,7 @@ import (
// if err != nil {
// return err
// }
// index, err := buildx.NewIndex(ctx, "index", &buildx.IndexArgs{
// index, err := dockerbuild.NewIndex(ctx, "index", &dockerbuild.IndexArgs{
// Sources: pulumi.StringArray{
// amd64.Ref,
// arm64.Ref,

View File

@@ -30,12 +30,12 @@ import (
//
// ## Migrating v3 and v4 Image resources
//
// The `buildx.Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
// Existing `Image` resources can be converted to `build.Image` resources with minor modifications.
// The `dockerbuild.Image` resource provides a superset of functionality over the `Image` resources available in versions 3 and 4 of the Pulumi Docker provider.
// Existing `Image` resources can be converted to `dockerbuild.Image` resources with minor modifications.
//
// ### Behavioral differences
//
// There are several key behavioral differences to keep in mind when transitioning images to the new `buildx.Image` resource.
// There are several key behavioral differences to keep in mind when transitioning images to the new `dockerbuild.Image` resource.
//
// #### Previews
//
@@ -46,8 +46,8 @@ import (
// By default, `v4.x` `Image` resources do _not_ build during previews, but this behavior can be toggled with the `buildOnPreview` option.
// Some users felt this made previews in CI less helpful because they no longer detected bad images by default.
//
// The default behavior of the `buildx.Image` resource has been changed to strike a better balance between CI use cases and manual updates.
// By default, Pulumi will now only build `buildx.Image` resources during previews when it detects a CI environment like GitHub Actions.
// The default behavior of the `dockerbuild.Image` resource has been changed to strike a better balance between CI use cases and manual updates.
// By default, Pulumi will now only build `dockerbuild.Image` resources during previews when it detects a CI environment like GitHub Actions.
// Previews run in non-CI environments will not build images.
// This behavior is still configurable with `buildOnPreview`.
//
@@ -56,7 +56,7 @@ import (
// Versions `3.x` and `4.x` of the Pulumi Docker provider attempt to push images to remote registries by default.
// They expose a `skipPush: true` option to disable pushing.
//
// The `buildx.Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
// The `dockerbuild.Image` resource matches the Docker CLI's behavior and does not push images anywhere by default.
//
// To 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`).
// Like 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.
@@ -67,7 +67,7 @@ import (
//
// Version `4.x` of the Pulumi Docker provider does not support secrets.
//
// The `buildx.Image` resource supports secrets but does not require those secrets to exist on-disk or in environment variables.
// The `dockerbuild.Image` resource supports secrets but does not require those secrets to exist on-disk or in environment variables.
// Instead, they should be passed directly as values.
// (Please be sure to familiarize yourself with Pulumi's [native secret handling](https://www.pulumi.com/docs/concepts/secrets/).)
// Pulumi also provides [ESC](https://www.pulumi.com/product/esc/) to make it easier to share secrets across stacks and environments.
@@ -82,7 +82,7 @@ import (
// Both versions 3 and 4 require specific environment variables to be set and deviate from Docker's native caching behavior.
// This can result in inefficient builds due to unnecessary image pulls, repeated file transfers, etc.
//
// The `buildx.Image` resource delegates all caching behavior to Docker.
// The `dockerbuild.Image` resource delegates all caching behavior to Docker.
// `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.
//
// #### Outputs
@@ -90,7 +90,7 @@ import (
// Versions `3.x` and `4.x` of the provider exposed a `repoDigest` output which was a fully qualified tag with digest.
// In `4.x` this could also be a single sha256 hash if the image wasn't pushed.
//
// Unlike earlier providers the `buildx.Image` resource can push multiple tags.
// Unlike earlier providers the `dockerbuild.Image` resource can push multiple tags.
// As a convenience, it exposes a `ref` output consisting of a tag with digest as long as the image was pushed.
// If multiple tags were pushed this uses one at random.
//
@@ -103,7 +103,7 @@ import (
// The `buidx.Image` will query your registries during `refresh` to ensure the expected tags exist.
// If any are missing a subsequent `update` will push them.
//
// When a `buildx.Image` is deleted, it will _attempt_ to also delete any pushed tags.
// When a `dockerbuild.Image` is deleted, it will _attempt_ to also delete any pushed tags.
// Deletion of remote tags is not guaranteed because not all registries support the manifest `DELETE` API (`docker.io` in particular).
// Manifests are _not_ deleted in the same way during updates -- to do so safely would require a full build to determine whether a Pulumi operation should be an update or update-replace.
//
@@ -111,11 +111,11 @@ import (
//
// ### Example migration
//
// Examples 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.
// Examples of "fully-featured" `v3` and `v4` `Image` resources are shown below, along with an example `dockerbuild.Image` resource showing how they would look after migration.
//
// The `v3` resource leverages `buildx` via a `DOCKER_BUILDKIT` environment variable and CLI flags passed in with `extraOption`.
// After migration, the environment variable is no longer needed and CLI flags are now properties on the `buildx.Image`.
// In almost all cases, properties of `buildx.Image` are named after the Docker CLI flag they correspond to.
// After migration, the environment variable is no longer needed and CLI flags are now properties on the `dockerbuild.Image`.
// In almost all cases, properties of `dockerbuild.Image` are named after the Docker CLI flag they correspond to.
//
// The `v4` resource is less functional than its `v3` counterpart because it lacks the flexibility of `extraOptions`.
// It it is shown with parameters similar to the `v3` example for completeness.
@@ -132,7 +132,7 @@ import (
// "fmt"
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecr"
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
@@ -146,19 +146,19 @@ import (
// authToken := ecr.GetAuthorizationTokenOutput(ctx, ecr.GetAuthorizationTokenOutputArgs{
// RegistryId: ecrRepository.RegistryId,
// }, nil)
// myImage, err := buildx.NewImage(ctx, "my-image", &buildx.ImageArgs{
// CacheFrom: buildx.CacheFromArray{
// &buildx.CacheFromArgs{
// Registry: &buildx.CacheFromRegistryArgs{
// myImage, err := dockerbuild.NewImage(ctx, "my-image", &dockerbuild.ImageArgs{
// CacheFrom: dockerbuild.CacheFromArray{
// &dockerbuild.CacheFromArgs{
// Registry: &dockerbuild.CacheFromRegistryArgs{
// Ref: ecrRepository.RepositoryUrl.ApplyT(func(repositoryUrl string) (string, error) {
// return fmt.Sprintf("%v:cache", repositoryUrl), nil
// }).(pulumi.StringOutput),
// },
// },
// },
// CacheTo: buildx.CacheToArray{
// &buildx.CacheToArgs{
// Registry: &buildx.CacheToRegistryArgs{
// CacheTo: dockerbuild.CacheToArray{
// &dockerbuild.CacheToArgs{
// Registry: &dockerbuild.CacheToRegistryArgs{
// ImageManifest: pulumi.Bool(true),
// OciMediaTypes: pulumi.Bool(true),
// Ref: ecrRepository.RepositoryUrl.ApplyT(func(repositoryUrl string) (string, error) {
@@ -167,12 +167,12 @@ import (
// },
// },
// },
// Context: &buildx.BuildContextArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("./app"),
// },
// Push: pulumi.Bool(true),
// Registries: buildx.RegistryAuthArray{
// &buildx.RegistryAuthArgs{
// Registries: dockerbuild.RegistryArray{
// &dockerbuild.RegistryArgs{
// Address: ecrRepository.RepositoryUrl,
// Password: authToken.ApplyT(func(authToken ecr.GetAuthorizationTokenResult) (*string, error) {
// return &authToken.Password, nil
@@ -203,20 +203,20 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Platforms: buildx.PlatformArray{
// buildx.Platform_Plan9_amd64,
// buildx.Platform_Plan9_386,
// Platforms: dockerbuild.PlatformArray{
// dockerbuild.Platform_Plan9_amd64,
// dockerbuild.Platform_Plan9_386,
// },
// })
// if err != nil {
@@ -233,20 +233,20 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Push: pulumi.Bool(true),
// Registries: buildx.RegistryAuthArray{
// &buildx.RegistryAuthArgs{
// Registries: dockerbuild.RegistryArray{
// &dockerbuild.RegistryArgs{
// Address: pulumi.String("docker.io"),
// Password: pulumi.Any(dockerHubPassword),
// Username: pulumi.String("pulumibot"),
@@ -271,30 +271,30 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// CacheFrom: buildx.CacheFromArray{
// &buildx.CacheFromArgs{
// Local: &buildx.CacheFromLocalArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// CacheFrom: dockerbuild.CacheFromArray{
// &dockerbuild.CacheFromArgs{
// Local: &dockerbuild.CacheFromLocalArgs{
// Src: pulumi.String("tmp/cache"),
// },
// },
// },
// CacheTo: buildx.CacheToArray{
// &buildx.CacheToArgs{
// Local: &buildx.CacheToLocalArgs{
// CacheTo: dockerbuild.CacheToArray{
// &dockerbuild.CacheToArgs{
// Local: &dockerbuild.CacheToLocalArgs{
// Dest: pulumi.String("tmp/cache"),
// Mode: buildx.CacheModeMax,
// Mode: dockerbuild.CacheModeMax,
// },
// },
// },
// Context: &buildx.BuildContextArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// })
@@ -312,18 +312,18 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Builder: &buildx.BuilderConfigArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Builder: &dockerbuild.BuilderConfigArgs{
// Name: pulumi.String("cloud-builder-name"),
// },
// Context: &buildx.BuildContextArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Exec: pulumi.Bool(true),
@@ -342,18 +342,18 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// BuildArgs: pulumi.StringMap{
// "SET_ME_TO_TRUE": pulumi.String("true"),
// },
// Context: &buildx.BuildContextArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// })
@@ -371,15 +371,15 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Target: pulumi.String("build-me"),
@@ -398,18 +398,18 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// Named: buildx.ContextMap{
// "golang:latest": &buildx.ContextArgs{
// Named: dockerbuild.ContextMap{
// "golang:latest": &dockerbuild.ContextArgs{
// Location: pulumi.String("docker-image://golang@sha256:b8e62cf593cdaff36efd90aa3a37de268e6781a2e68c6610940c48f7cdf36984"),
// },
// },
@@ -429,15 +429,15 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("https://raw.githubusercontent.com/pulumi/pulumi-docker/api-types/provider/testdata/Dockerfile"),
// },
// })
@@ -455,18 +455,18 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Dockerfile: &buildx.DockerfileArgs{
// Dockerfile: &dockerbuild.DockerfileArgs{
// Inline: pulumi.String("FROM busybox\nCOPY hello.c ./\n"),
// },
// })
@@ -484,18 +484,18 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("https://github.com/docker-library/hello-world.git"),
// },
// Dockerfile: &buildx.DockerfileArgs{
// Dockerfile: &dockerbuild.DockerfileArgs{
// Location: pulumi.String("app/Dockerfile"),
// },
// })
@@ -513,20 +513,20 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := buildx.NewImage(ctx, "image", &buildx.ImageArgs{
// Context: &buildx.BuildContextArgs{
// _, err := dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Exports: buildx.ExportArray{
// &buildx.ExportArgs{
// Docker: &buildx.ExportDockerArgs{
// Exports: dockerbuild.ExportArray{
// &dockerbuild.ExportArgs{
// Docker: &dockerbuild.ExportDockerArgs{
// Tar: pulumi.Bool(true),
// },
// },

View File

@@ -28,34 +28,34 @@ import (
//
// import (
//
// "github.com/pulumi/pulumi-docker/sdk/v4/go/docker/buildx"
// "github.com/pulumi/pulumi-dockerbuild/sdk/go/dockerbuild"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// amd64, err := buildx.NewImage(ctx, "amd64", &buildx.ImageArgs{
// CacheFrom: buildx.CacheFromArray{
// &buildx.CacheFromArgs{
// Registry: &buildx.CacheFromRegistryArgs{
// amd64, err := dockerbuild.NewImage(ctx, "amd64", &dockerbuild.ImageArgs{
// CacheFrom: dockerbuild.CacheFromArray{
// &dockerbuild.CacheFromArgs{
// Registry: &dockerbuild.CacheFromRegistryArgs{
// Ref: pulumi.String("docker.io/pulumi/pulumi:cache-amd64"),
// },
// },
// },
// CacheTo: buildx.CacheToArray{
// &buildx.CacheToArgs{
// Registry: &buildx.CacheToRegistryArgs{
// Mode: buildx.CacheModeMax,
// CacheTo: dockerbuild.CacheToArray{
// &dockerbuild.CacheToArgs{
// Registry: &dockerbuild.CacheToRegistryArgs{
// Mode: dockerbuild.CacheModeMax,
// Ref: pulumi.String("docker.io/pulumi/pulumi:cache-amd64"),
// },
// },
// },
// Context: &buildx.BuildContextArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Platforms: buildx.PlatformArray{
// buildx.Platform_Linux_amd64,
// Platforms: dockerbuild.PlatformArray{
// dockerbuild.Platform_Linux_amd64,
// },
// Tags: pulumi.StringArray{
// pulumi.String("docker.io/pulumi/pulumi:3.107.0-amd64"),
@@ -64,27 +64,27 @@ import (
// if err != nil {
// return err
// }
// arm64, err := buildx.NewImage(ctx, "arm64", &buildx.ImageArgs{
// CacheFrom: buildx.CacheFromArray{
// &buildx.CacheFromArgs{
// Registry: &buildx.CacheFromRegistryArgs{
// arm64, err := dockerbuild.NewImage(ctx, "arm64", &dockerbuild.ImageArgs{
// CacheFrom: dockerbuild.CacheFromArray{
// &dockerbuild.CacheFromArgs{
// Registry: &dockerbuild.CacheFromRegistryArgs{
// Ref: pulumi.String("docker.io/pulumi/pulumi:cache-arm64"),
// },
// },
// },
// CacheTo: buildx.CacheToArray{
// &buildx.CacheToArgs{
// Registry: &buildx.CacheToRegistryArgs{
// Mode: buildx.CacheModeMax,
// CacheTo: dockerbuild.CacheToArray{
// &dockerbuild.CacheToArgs{
// Registry: &dockerbuild.CacheToRegistryArgs{
// Mode: dockerbuild.CacheModeMax,
// Ref: pulumi.String("docker.io/pulumi/pulumi:cache-arm64"),
// },
// },
// },
// Context: &buildx.BuildContextArgs{
// Context: &dockerbuild.BuildContextArgs{
// Location: pulumi.String("app"),
// },
// Platforms: buildx.PlatformArray{
// buildx.Platform_Linux_arm64,
// Platforms: dockerbuild.PlatformArray{
// dockerbuild.Platform_Linux_arm64,
// },
// Tags: pulumi.StringArray{
// pulumi.String("docker.io/pulumi/pulumi:3.107.0-arm64"),
@@ -93,7 +93,7 @@ import (
// if err != nil {
// return err
// }
// index, err := buildx.NewIndex(ctx, "index", &buildx.IndexArgs{
// index, err := dockerbuild.NewIndex(ctx, "index", &dockerbuild.IndexArgs{
// Sources: pulumi.StringArray{
// amd64.Ref,
// arm64.Ref,