Build images during preview by default

This commit is contained in:
Bryce Lampe
2024-04-22 16:04:01 -07:00
parent 72bd40b97c
commit 40a3223b23
8 changed files with 132 additions and 189 deletions

View File

@@ -40,7 +40,7 @@ import (
"github.com/pulumi/pulumi-go-provider/infer" "github.com/pulumi/pulumi-go-provider/infer"
"github.com/pulumi/pulumi/sdk/v3/go/common/diag" "github.com/pulumi/pulumi/sdk/v3/go/common/diag"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/resource"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/ciutil" "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
) )
var ( var (
@@ -127,21 +127,19 @@ func (ia *ImageArgs) Annotate(a infer.Annotator) {
Equivalent to Docker's "--build-arg" flag. Equivalent to Docker's "--build-arg" flag.
`)) `))
a.Describe(&ia.BuildOnPreview, dedent(` a.Describe(&ia.BuildOnPreview, dedent(`
By default, preview behavior depends on the execution environment. If Setting this to "false" will always skip image builds during previews,
Pulumi detects the operation is running on a CI system (GitHub Actions, and setting it to "true" will always build images during previews.
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 Images built during previews are never exported to registries, however
cache manifests are still exported. cache manifests are still exported.
On-disk Dockerfiles are always validated for syntactic correctness On-disk Dockerfiles are always validated for syntactic correctness
regardless of this setting. regardless of this setting.
Defaults to "true" as a safeguard against broken images merging as part
of CI pipelines.
`)) `))
a.SetDefault(&ia.BuildOnPreview, pulumi.Bool(true))
a.Describe(&ia.Builder, dedent(` a.Describe(&ia.Builder, dedent(`
Builder configuration. Builder configuration.
`)) `))
@@ -457,13 +455,12 @@ func (ia *ImageArgs) isExported() bool {
} }
// shouldBuildOnPreview returns true if we should build this image during // shouldBuildOnPreview returns true if we should build this image during
// previews. In CI environments we default to building during previews, but we // previews.
// always respect buildOnPreview if it was specified.
func (ia *ImageArgs) shouldBuildOnPreview() bool { func (ia *ImageArgs) shouldBuildOnPreview() bool {
if ia.BuildOnPreview != nil { if ia.BuildOnPreview != nil {
return *ia.BuildOnPreview return *ia.BuildOnPreview
} }
return ciutil.IsCI() return true
} }
type build struct { type build struct {

27
sdk/dotnet/Image.cs generated
View File

@@ -511,20 +511,17 @@ namespace Pulumi.DockerBuild
public Output<ImmutableDictionary<string, string>?> BuildArgs { get; private set; } = null!; public Output<ImmutableDictionary<string, string>?> BuildArgs { get; private set; } = null!;
/// <summary> /// <summary>
/// By default, preview behavior depends on the execution environment. If /// Setting this to `false` will always skip image builds during previews,
/// Pulumi detects the operation is running on a CI system (GitHub Actions, /// and setting it to `true` will always build images during previews.
/// 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 /// Images built during previews are never exported to registries, however
/// cache manifests are still exported. /// cache manifests are still exported.
/// ///
/// On-disk Dockerfiles are always validated for syntactic correctness /// On-disk Dockerfiles are always validated for syntactic correctness
/// regardless of this setting. /// regardless of this setting.
///
/// Defaults to `true` as a safeguard against broken images merging as part
/// of CI pipelines.
/// </summary> /// </summary>
[Output("buildOnPreview")] [Output("buildOnPreview")]
public Output<bool?> BuildOnPreview { get; private set; } = null!; public Output<bool?> BuildOnPreview { get; private set; } = null!;
@@ -842,20 +839,17 @@ namespace Pulumi.DockerBuild
} }
/// <summary> /// <summary>
/// By default, preview behavior depends on the execution environment. If /// Setting this to `false` will always skip image builds during previews,
/// Pulumi detects the operation is running on a CI system (GitHub Actions, /// and setting it to `true` will always build images during previews.
/// 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 /// Images built during previews are never exported to registries, however
/// cache manifests are still exported. /// cache manifests are still exported.
/// ///
/// On-disk Dockerfiles are always validated for syntactic correctness /// On-disk Dockerfiles are always validated for syntactic correctness
/// regardless of this setting. /// regardless of this setting.
///
/// Defaults to `true` as a safeguard against broken images merging as part
/// of CI pipelines.
/// </summary> /// </summary>
[Input("buildOnPreview")] [Input("buildOnPreview")]
public Input<bool>? BuildOnPreview { get; set; } public Input<bool>? BuildOnPreview { get; set; }
@@ -1110,6 +1104,7 @@ namespace Pulumi.DockerBuild
public ImageArgs() public ImageArgs()
{ {
BuildOnPreview = true;
Network = Pulumi.DockerBuild.NetworkMode.@Default; Network = Pulumi.DockerBuild.NetworkMode.@Default;
} }
public static new ImageArgs Empty => new ImageArgs(); public static new ImageArgs Empty => new ImageArgs();

View File

@@ -551,20 +551,17 @@ type Image struct {
// //
// Equivalent to Docker's `--build-arg` flag. // Equivalent to Docker's `--build-arg` flag.
BuildArgs pulumi.StringMapOutput `pulumi:"buildArgs"` BuildArgs pulumi.StringMapOutput `pulumi:"buildArgs"`
// By default, preview behavior depends on the execution environment. If // Setting this to `false` will always skip image builds during previews,
// Pulumi detects the operation is running on a CI system (GitHub Actions, // and setting it to `true` will always build images during previews.
// 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 // Images built during previews are never exported to registries, however
// cache manifests are still exported. // cache manifests are still exported.
// //
// On-disk Dockerfiles are always validated for syntactic correctness // On-disk Dockerfiles are always validated for syntactic correctness
// regardless of this setting. // regardless of this setting.
//
// Defaults to `true` as a safeguard against broken images merging as part
// of CI pipelines.
BuildOnPreview pulumi.BoolPtrOutput `pulumi:"buildOnPreview"` BuildOnPreview pulumi.BoolPtrOutput `pulumi:"buildOnPreview"`
// Builder configuration. // Builder configuration.
Builder BuilderConfigPtrOutput `pulumi:"builder"` Builder BuilderConfigPtrOutput `pulumi:"builder"`
@@ -720,6 +717,9 @@ func NewImage(ctx *pulumi.Context,
args = &ImageArgs{} args = &ImageArgs{}
} }
if args.BuildOnPreview == nil {
args.BuildOnPreview = pulumi.BoolPtr(true)
}
if args.Network == nil { if args.Network == nil {
args.Network = NetworkMode("default") args.Network = NetworkMode("default")
} }
@@ -770,20 +770,17 @@ type imageArgs struct {
// //
// Equivalent to Docker's `--build-arg` flag. // Equivalent to Docker's `--build-arg` flag.
BuildArgs map[string]string `pulumi:"buildArgs"` BuildArgs map[string]string `pulumi:"buildArgs"`
// By default, preview behavior depends on the execution environment. If // Setting this to `false` will always skip image builds during previews,
// Pulumi detects the operation is running on a CI system (GitHub Actions, // and setting it to `true` will always build images during previews.
// 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 // Images built during previews are never exported to registries, however
// cache manifests are still exported. // cache manifests are still exported.
// //
// On-disk Dockerfiles are always validated for syntactic correctness // On-disk Dockerfiles are always validated for syntactic correctness
// regardless of this setting. // regardless of this setting.
//
// Defaults to `true` as a safeguard against broken images merging as part
// of CI pipelines.
BuildOnPreview *bool `pulumi:"buildOnPreview"` BuildOnPreview *bool `pulumi:"buildOnPreview"`
// Builder configuration. // Builder configuration.
Builder *BuilderConfig `pulumi:"builder"` Builder *BuilderConfig `pulumi:"builder"`
@@ -921,20 +918,17 @@ type ImageArgs struct {
// //
// Equivalent to Docker's `--build-arg` flag. // Equivalent to Docker's `--build-arg` flag.
BuildArgs pulumi.StringMapInput BuildArgs pulumi.StringMapInput
// By default, preview behavior depends on the execution environment. If // Setting this to `false` will always skip image builds during previews,
// Pulumi detects the operation is running on a CI system (GitHub Actions, // and setting it to `true` will always build images during previews.
// 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 // Images built during previews are never exported to registries, however
// cache manifests are still exported. // cache manifests are still exported.
// //
// On-disk Dockerfiles are always validated for syntactic correctness // On-disk Dockerfiles are always validated for syntactic correctness
// regardless of this setting. // regardless of this setting.
//
// Defaults to `true` as a safeguard against broken images merging as part
// of CI pipelines.
BuildOnPreview pulumi.BoolPtrInput BuildOnPreview pulumi.BoolPtrInput
// Builder configuration. // Builder configuration.
Builder BuilderConfigPtrInput Builder BuilderConfigPtrInput
@@ -1125,20 +1119,17 @@ func (o ImageOutput) BuildArgs() pulumi.StringMapOutput {
return o.ApplyT(func(v *Image) pulumi.StringMapOutput { return v.BuildArgs }).(pulumi.StringMapOutput) return o.ApplyT(func(v *Image) pulumi.StringMapOutput { return v.BuildArgs }).(pulumi.StringMapOutput)
} }
// By default, preview behavior depends on the execution environment. If // Setting this to `false` will always skip image builds during previews,
// Pulumi detects the operation is running on a CI system (GitHub Actions, // and setting it to `true` will always build images during previews.
// 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 // Images built during previews are never exported to registries, however
// cache manifests are still exported. // cache manifests are still exported.
// //
// On-disk Dockerfiles are always validated for syntactic correctness // On-disk Dockerfiles are always validated for syntactic correctness
// regardless of this setting. // regardless of this setting.
//
// Defaults to `true` as a safeguard against broken images merging as part
// of CI pipelines.
func (o ImageOutput) BuildOnPreview() pulumi.BoolPtrOutput { func (o ImageOutput) BuildOnPreview() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *Image) pulumi.BoolPtrOutput { return v.BuildOnPreview }).(pulumi.BoolPtrOutput) return o.ApplyT(func(v *Image) pulumi.BoolPtrOutput { return v.BuildOnPreview }).(pulumi.BoolPtrOutput)
} }

View File

@@ -551,20 +551,17 @@ type Image struct {
// //
// Equivalent to Docker's `--build-arg` flag. // Equivalent to Docker's `--build-arg` flag.
BuildArgs pulumix.MapOutput[string] `pulumi:"buildArgs"` BuildArgs pulumix.MapOutput[string] `pulumi:"buildArgs"`
// By default, preview behavior depends on the execution environment. If // Setting this to `false` will always skip image builds during previews,
// Pulumi detects the operation is running on a CI system (GitHub Actions, // and setting it to `true` will always build images during previews.
// 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 // Images built during previews are never exported to registries, however
// cache manifests are still exported. // cache manifests are still exported.
// //
// On-disk Dockerfiles are always validated for syntactic correctness // On-disk Dockerfiles are always validated for syntactic correctness
// regardless of this setting. // regardless of this setting.
//
// Defaults to `true` as a safeguard against broken images merging as part
// of CI pipelines.
BuildOnPreview pulumix.Output[*bool] `pulumi:"buildOnPreview"` BuildOnPreview pulumix.Output[*bool] `pulumi:"buildOnPreview"`
// Builder configuration. // Builder configuration.
Builder pulumix.GPtrOutput[BuilderConfig, BuilderConfigOutput] `pulumi:"builder"` Builder pulumix.GPtrOutput[BuilderConfig, BuilderConfigOutput] `pulumi:"builder"`
@@ -720,6 +717,9 @@ func NewImage(ctx *pulumi.Context,
args = &ImageArgs{} args = &ImageArgs{}
} }
if args.BuildOnPreview == nil {
args.BuildOnPreview = pulumix.Ptr(true)
}
if args.Network == nil { if args.Network == nil {
args.Network = pulumix.Ptr(NetworkMode("default")) args.Network = pulumix.Ptr(NetworkMode("default"))
} }
@@ -770,20 +770,17 @@ type imageArgs struct {
// //
// Equivalent to Docker's `--build-arg` flag. // Equivalent to Docker's `--build-arg` flag.
BuildArgs map[string]string `pulumi:"buildArgs"` BuildArgs map[string]string `pulumi:"buildArgs"`
// By default, preview behavior depends on the execution environment. If // Setting this to `false` will always skip image builds during previews,
// Pulumi detects the operation is running on a CI system (GitHub Actions, // and setting it to `true` will always build images during previews.
// 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 // Images built during previews are never exported to registries, however
// cache manifests are still exported. // cache manifests are still exported.
// //
// On-disk Dockerfiles are always validated for syntactic correctness // On-disk Dockerfiles are always validated for syntactic correctness
// regardless of this setting. // regardless of this setting.
//
// Defaults to `true` as a safeguard against broken images merging as part
// of CI pipelines.
BuildOnPreview *bool `pulumi:"buildOnPreview"` BuildOnPreview *bool `pulumi:"buildOnPreview"`
// Builder configuration. // Builder configuration.
Builder *BuilderConfig `pulumi:"builder"` Builder *BuilderConfig `pulumi:"builder"`
@@ -921,20 +918,17 @@ type ImageArgs struct {
// //
// Equivalent to Docker's `--build-arg` flag. // Equivalent to Docker's `--build-arg` flag.
BuildArgs pulumix.Input[map[string]string] BuildArgs pulumix.Input[map[string]string]
// By default, preview behavior depends on the execution environment. If // Setting this to `false` will always skip image builds during previews,
// Pulumi detects the operation is running on a CI system (GitHub Actions, // and setting it to `true` will always build images during previews.
// 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 // Images built during previews are never exported to registries, however
// cache manifests are still exported. // cache manifests are still exported.
// //
// On-disk Dockerfiles are always validated for syntactic correctness // On-disk Dockerfiles are always validated for syntactic correctness
// regardless of this setting. // regardless of this setting.
//
// Defaults to `true` as a safeguard against broken images merging as part
// of CI pipelines.
BuildOnPreview pulumix.Input[*bool] BuildOnPreview pulumix.Input[*bool]
// Builder configuration. // Builder configuration.
Builder pulumix.Input[*BuilderConfigArgs] Builder pulumix.Input[*BuilderConfigArgs]
@@ -1104,20 +1098,17 @@ func (o ImageOutput) BuildArgs() pulumix.MapOutput[string] {
return pulumix.MapOutput[string]{OutputState: unwrapped.OutputState} return pulumix.MapOutput[string]{OutputState: unwrapped.OutputState}
} }
// By default, preview behavior depends on the execution environment. If // Setting this to `false` will always skip image builds during previews,
// Pulumi detects the operation is running on a CI system (GitHub Actions, // and setting it to `true` will always build images during previews.
// 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 // Images built during previews are never exported to registries, however
// cache manifests are still exported. // cache manifests are still exported.
// //
// On-disk Dockerfiles are always validated for syntactic correctness // On-disk Dockerfiles are always validated for syntactic correctness
// regardless of this setting. // regardless of this setting.
//
// Defaults to `true` as a safeguard against broken images merging as part
// of CI pipelines.
func (o ImageOutput) BuildOnPreview() pulumix.Output[*bool] { func (o ImageOutput) BuildOnPreview() pulumix.Output[*bool] {
value := pulumix.Apply[Image](o, func(v Image) pulumix.Output[*bool] { return v.BuildOnPreview }) value := pulumix.Apply[Image](o, func(v Image) pulumix.Output[*bool] { return v.BuildOnPreview })
return pulumix.Flatten[*bool, pulumix.Output[*bool]](value) return pulumix.Flatten[*bool, pulumix.Output[*bool]](value)

View File

@@ -655,14 +655,8 @@ public class Image extends com.pulumi.resources.CustomResource {
return Codegen.optional(this.buildArgs); return Codegen.optional(this.buildArgs);
} }
/** /**
* By default, preview behavior depends on the execution environment. If * Setting this to `false` will always skip image builds during previews,
* Pulumi detects the operation is running on a CI system (GitHub Actions, * and setting it to `true` will always build images during previews.
* 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 * Images built during previews are never exported to registries, however
* cache manifests are still exported. * cache manifests are still exported.
@@ -670,19 +664,16 @@ public class Image extends com.pulumi.resources.CustomResource {
* On-disk Dockerfiles are always validated for syntactic correctness * On-disk Dockerfiles are always validated for syntactic correctness
* regardless of this setting. * regardless of this setting.
* *
* Defaults to `true` as a safeguard against broken images merging as part
* of CI pipelines.
*
*/ */
@Export(name="buildOnPreview", refs={Boolean.class}, tree="[0]") @Export(name="buildOnPreview", refs={Boolean.class}, tree="[0]")
private Output</* @Nullable */ Boolean> buildOnPreview; private Output</* @Nullable */ Boolean> buildOnPreview;
/** /**
* @return By default, preview behavior depends on the execution environment. If * @return Setting this to `false` will always skip image builds during previews,
* Pulumi detects the operation is running on a CI system (GitHub Actions, * and setting it to `true` will always build images during previews.
* 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 * Images built during previews are never exported to registries, however
* cache manifests are still exported. * cache manifests are still exported.
@@ -690,6 +681,9 @@ public class Image extends com.pulumi.resources.CustomResource {
* On-disk Dockerfiles are always validated for syntactic correctness * On-disk Dockerfiles are always validated for syntactic correctness
* regardless of this setting. * regardless of this setting.
* *
* Defaults to `true` as a safeguard against broken images merging as part
* of CI pipelines.
*
*/ */
public Output<Optional<Boolean>> buildOnPreview() { public Output<Optional<Boolean>> buildOnPreview() {
return Codegen.optional(this.buildOnPreview); return Codegen.optional(this.buildOnPreview);

View File

@@ -80,14 +80,8 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
} }
/** /**
* By default, preview behavior depends on the execution environment. If * Setting this to `false` will always skip image builds during previews,
* Pulumi detects the operation is running on a CI system (GitHub Actions, * and setting it to `true` will always build images during previews.
* 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 * Images built during previews are never exported to registries, however
* cache manifests are still exported. * cache manifests are still exported.
@@ -95,19 +89,16 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
* On-disk Dockerfiles are always validated for syntactic correctness * On-disk Dockerfiles are always validated for syntactic correctness
* regardless of this setting. * regardless of this setting.
* *
* Defaults to `true` as a safeguard against broken images merging as part
* of CI pipelines.
*
*/ */
@Import(name="buildOnPreview") @Import(name="buildOnPreview")
private @Nullable Output<Boolean> buildOnPreview; private @Nullable Output<Boolean> buildOnPreview;
/** /**
* @return By default, preview behavior depends on the execution environment. If * @return Setting this to `false` will always skip image builds during previews,
* Pulumi detects the operation is running on a CI system (GitHub Actions, * and setting it to `true` will always build images during previews.
* 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 * Images built during previews are never exported to registries, however
* cache manifests are still exported. * cache manifests are still exported.
@@ -115,6 +106,9 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
* On-disk Dockerfiles are always validated for syntactic correctness * On-disk Dockerfiles are always validated for syntactic correctness
* regardless of this setting. * regardless of this setting.
* *
* Defaults to `true` as a safeguard against broken images merging as part
* of CI pipelines.
*
*/ */
public Optional<Output<Boolean>> buildOnPreview() { public Optional<Output<Boolean>> buildOnPreview() {
return Optional.ofNullable(this.buildOnPreview); return Optional.ofNullable(this.buildOnPreview);
@@ -685,14 +679,8 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
} }
/** /**
* @param buildOnPreview By default, preview behavior depends on the execution environment. If * @param buildOnPreview Setting this to `false` will always skip image builds during previews,
* Pulumi detects the operation is running on a CI system (GitHub Actions, * and setting it to `true` will always build images during previews.
* 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 * Images built during previews are never exported to registries, however
* cache manifests are still exported. * cache manifests are still exported.
@@ -700,6 +688,9 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
* On-disk Dockerfiles are always validated for syntactic correctness * On-disk Dockerfiles are always validated for syntactic correctness
* regardless of this setting. * regardless of this setting.
* *
* Defaults to `true` as a safeguard against broken images merging as part
* of CI pipelines.
*
* @return builder * @return builder
* *
*/ */
@@ -709,14 +700,8 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
} }
/** /**
* @param buildOnPreview By default, preview behavior depends on the execution environment. If * @param buildOnPreview Setting this to `false` will always skip image builds during previews,
* Pulumi detects the operation is running on a CI system (GitHub Actions, * and setting it to `true` will always build images during previews.
* 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 * Images built during previews are never exported to registries, however
* cache manifests are still exported. * cache manifests are still exported.
@@ -724,6 +709,9 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
* On-disk Dockerfiles are always validated for syntactic correctness * On-disk Dockerfiles are always validated for syntactic correctness
* regardless of this setting. * regardless of this setting.
* *
* Defaults to `true` as a safeguard against broken images merging as part
* of CI pipelines.
*
* @return builder * @return builder
* *
*/ */
@@ -1388,6 +1376,7 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
} }
public ImageArgs build() { public ImageArgs build() {
$.buildOnPreview = Codegen.booleanProp("buildOnPreview").output().arg($.buildOnPreview).def(true).getNullable();
$.network = Codegen.objectProp("network", NetworkMode.class).output().arg($.network).def(NetworkMode.Default_).getNullable(); $.network = Codegen.objectProp("network", NetworkMode.class).output().arg($.network).def(NetworkMode.Default_).getNullable();
return $; return $;
} }

28
sdk/nodejs/image.ts generated
View File

@@ -503,20 +503,17 @@ export class Image extends pulumi.CustomResource {
*/ */
public readonly buildArgs!: pulumi.Output<{[key: string]: string} | undefined>; public readonly buildArgs!: pulumi.Output<{[key: string]: string} | undefined>;
/** /**
* By default, preview behavior depends on the execution environment. If * Setting this to `false` will always skip image builds during previews,
* Pulumi detects the operation is running on a CI system (GitHub Actions, * and setting it to `true` will always build images during previews.
* 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 * Images built during previews are never exported to registries, however
* cache manifests are still exported. * cache manifests are still exported.
* *
* On-disk Dockerfiles are always validated for syntactic correctness * On-disk Dockerfiles are always validated for syntactic correctness
* regardless of this setting. * regardless of this setting.
*
* Defaults to `true` as a safeguard against broken images merging as part
* of CI pipelines.
*/ */
public readonly buildOnPreview!: pulumi.Output<boolean | undefined>; public readonly buildOnPreview!: pulumi.Output<boolean | undefined>;
/** /**
@@ -722,7 +719,7 @@ export class Image extends pulumi.CustomResource {
if (!opts.id) { if (!opts.id) {
resourceInputs["addHosts"] = args ? args.addHosts : undefined; resourceInputs["addHosts"] = args ? args.addHosts : undefined;
resourceInputs["buildArgs"] = args ? args.buildArgs : undefined; resourceInputs["buildArgs"] = args ? args.buildArgs : undefined;
resourceInputs["buildOnPreview"] = args ? args.buildOnPreview : undefined; resourceInputs["buildOnPreview"] = (args ? args.buildOnPreview : undefined) ?? true;
resourceInputs["builder"] = args ? args.builder : undefined; resourceInputs["builder"] = args ? args.builder : undefined;
resourceInputs["cacheFrom"] = args ? args.cacheFrom : undefined; resourceInputs["cacheFrom"] = args ? args.cacheFrom : undefined;
resourceInputs["cacheTo"] = args ? args.cacheTo : undefined; resourceInputs["cacheTo"] = args ? args.cacheTo : undefined;
@@ -800,20 +797,17 @@ export interface ImageArgs {
*/ */
buildArgs?: pulumi.Input<{[key: string]: pulumi.Input<string>}>; buildArgs?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/** /**
* By default, preview behavior depends on the execution environment. If * Setting this to `false` will always skip image builds during previews,
* Pulumi detects the operation is running on a CI system (GitHub Actions, * and setting it to `true` will always build images during previews.
* 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 * Images built during previews are never exported to registries, however
* cache manifests are still exported. * cache manifests are still exported.
* *
* On-disk Dockerfiles are always validated for syntactic correctness * On-disk Dockerfiles are always validated for syntactic correctness
* regardless of this setting. * regardless of this setting.
*
* Defaults to `true` as a safeguard against broken images merging as part
* of CI pipelines.
*/ */
buildOnPreview?: pulumi.Input<boolean>; buildOnPreview?: pulumi.Input<boolean>;
/** /**

View File

@@ -53,20 +53,17 @@ class ImageArgs:
if these arguments are sensitive. if these arguments are sensitive.
Equivalent to Docker's `--build-arg` flag. Equivalent to Docker's `--build-arg` flag.
:param pulumi.Input[bool] build_on_preview: By default, preview behavior depends on the execution environment. If :param pulumi.Input[bool] build_on_preview: Setting this to `false` will always skip image builds during previews,
Pulumi detects the operation is running on a CI system (GitHub Actions, and setting it to `true` will always build images during previews.
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 Images built during previews are never exported to registries, however
cache manifests are still exported. cache manifests are still exported.
On-disk Dockerfiles are always validated for syntactic correctness On-disk Dockerfiles are always validated for syntactic correctness
regardless of this setting. regardless of this setting.
Defaults to `true` as a safeguard against broken images merging as part
of CI pipelines.
:param pulumi.Input['BuilderConfigArgs'] builder: Builder configuration. :param pulumi.Input['BuilderConfigArgs'] builder: Builder configuration.
:param pulumi.Input[Sequence[pulumi.Input['CacheFromArgs']]] cache_from: Cache export configuration. :param pulumi.Input[Sequence[pulumi.Input['CacheFromArgs']]] cache_from: Cache export configuration.
@@ -171,6 +168,8 @@ class ImageArgs:
pulumi.set(__self__, "add_hosts", add_hosts) pulumi.set(__self__, "add_hosts", add_hosts)
if build_args is not None: if build_args is not None:
pulumi.set(__self__, "build_args", build_args) pulumi.set(__self__, "build_args", build_args)
if build_on_preview is None:
build_on_preview = True
if build_on_preview is not None: if build_on_preview is not None:
pulumi.set(__self__, "build_on_preview", build_on_preview) pulumi.set(__self__, "build_on_preview", build_on_preview)
if builder is not None: if builder is not None:
@@ -252,20 +251,17 @@ class ImageArgs:
@pulumi.getter(name="buildOnPreview") @pulumi.getter(name="buildOnPreview")
def build_on_preview(self) -> Optional[pulumi.Input[bool]]: def build_on_preview(self) -> Optional[pulumi.Input[bool]]:
""" """
By default, preview behavior depends on the execution environment. If Setting this to `false` will always skip image builds during previews,
Pulumi detects the operation is running on a CI system (GitHub Actions, and setting it to `true` will always build images during previews.
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 Images built during previews are never exported to registries, however
cache manifests are still exported. cache manifests are still exported.
On-disk Dockerfiles are always validated for syntactic correctness On-disk Dockerfiles are always validated for syntactic correctness
regardless of this setting. regardless of this setting.
Defaults to `true` as a safeguard against broken images merging as part
of CI pipelines.
""" """
return pulumi.get(self, "build_on_preview") return pulumi.get(self, "build_on_preview")
@@ -921,20 +917,17 @@ class Image(pulumi.CustomResource):
if these arguments are sensitive. if these arguments are sensitive.
Equivalent to Docker's `--build-arg` flag. Equivalent to Docker's `--build-arg` flag.
:param pulumi.Input[bool] build_on_preview: By default, preview behavior depends on the execution environment. If :param pulumi.Input[bool] build_on_preview: Setting this to `false` will always skip image builds during previews,
Pulumi detects the operation is running on a CI system (GitHub Actions, and setting it to `true` will always build images during previews.
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 Images built during previews are never exported to registries, however
cache manifests are still exported. cache manifests are still exported.
On-disk Dockerfiles are always validated for syntactic correctness On-disk Dockerfiles are always validated for syntactic correctness
regardless of this setting. regardless of this setting.
Defaults to `true` as a safeguard against broken images merging as part
of CI pipelines.
:param pulumi.Input[pulumi.InputType['BuilderConfigArgs']] builder: Builder configuration. :param pulumi.Input[pulumi.InputType['BuilderConfigArgs']] builder: Builder configuration.
:param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromArgs']]]] cache_from: Cache export configuration. :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheFromArgs']]]] cache_from: Cache export configuration.
@@ -1386,6 +1379,8 @@ class Image(pulumi.CustomResource):
__props__.__dict__["add_hosts"] = add_hosts __props__.__dict__["add_hosts"] = add_hosts
__props__.__dict__["build_args"] = build_args __props__.__dict__["build_args"] = build_args
if build_on_preview is None:
build_on_preview = True
__props__.__dict__["build_on_preview"] = build_on_preview __props__.__dict__["build_on_preview"] = build_on_preview
__props__.__dict__["builder"] = builder __props__.__dict__["builder"] = builder
__props__.__dict__["cache_from"] = cache_from __props__.__dict__["cache_from"] = cache_from
@@ -1490,20 +1485,17 @@ class Image(pulumi.CustomResource):
@pulumi.getter(name="buildOnPreview") @pulumi.getter(name="buildOnPreview")
def build_on_preview(self) -> pulumi.Output[Optional[bool]]: def build_on_preview(self) -> pulumi.Output[Optional[bool]]:
""" """
By default, preview behavior depends on the execution environment. If Setting this to `false` will always skip image builds during previews,
Pulumi detects the operation is running on a CI system (GitHub Actions, and setting it to `true` will always build images during previews.
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 Images built during previews are never exported to registries, however
cache manifests are still exported. cache manifests are still exported.
On-disk Dockerfiles are always validated for syntactic correctness On-disk Dockerfiles are always validated for syntactic correctness
regardless of this setting. regardless of this setting.
Defaults to `true` as a safeguard against broken images merging as part
of CI pipelines.
""" """
return pulumi.get(self, "build_on_preview") return pulumi.get(self, "build_on_preview")