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

@@ -551,20 +551,17 @@ type Image struct {
//
// Equivalent to Docker's `--build-arg` flag.
BuildArgs pulumix.MapOutput[string] `pulumi:"buildArgs"`
// 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.
// Setting this to `false` will always skip image builds during previews,
// and setting it to `true` will always build images 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.
//
// Defaults to `true` as a safeguard against broken images merging as part
// of CI pipelines.
BuildOnPreview pulumix.Output[*bool] `pulumi:"buildOnPreview"`
// Builder configuration.
Builder pulumix.GPtrOutput[BuilderConfig, BuilderConfigOutput] `pulumi:"builder"`
@@ -720,6 +717,9 @@ func NewImage(ctx *pulumi.Context,
args = &ImageArgs{}
}
if args.BuildOnPreview == nil {
args.BuildOnPreview = pulumix.Ptr(true)
}
if args.Network == nil {
args.Network = pulumix.Ptr(NetworkMode("default"))
}
@@ -770,20 +770,17 @@ type imageArgs struct {
//
// Equivalent to Docker's `--build-arg` flag.
BuildArgs map[string]string `pulumi:"buildArgs"`
// 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.
// Setting this to `false` will always skip image builds during previews,
// and setting it to `true` will always build images 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.
//
// Defaults to `true` as a safeguard against broken images merging as part
// of CI pipelines.
BuildOnPreview *bool `pulumi:"buildOnPreview"`
// Builder configuration.
Builder *BuilderConfig `pulumi:"builder"`
@@ -921,20 +918,17 @@ type ImageArgs struct {
//
// Equivalent to Docker's `--build-arg` flag.
BuildArgs pulumix.Input[map[string]string]
// 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.
// Setting this to `false` will always skip image builds during previews,
// and setting it to `true` will always build images 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.
//
// Defaults to `true` as a safeguard against broken images merging as part
// of CI pipelines.
BuildOnPreview pulumix.Input[*bool]
// Builder configuration.
Builder pulumix.Input[*BuilderConfigArgs]
@@ -1104,20 +1098,17 @@ func (o ImageOutput) BuildArgs() pulumix.MapOutput[string] {
return pulumix.MapOutput[string]{OutputState: unwrapped.OutputState}
}
// 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.
// Setting this to `false` will always skip image builds during previews,
// and setting it to `true` will always build images 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.
//
// Defaults to `true` as a safeguard against broken images merging as part
// of CI pipelines.
func (o ImageOutput) BuildOnPreview() pulumix.Output[*bool] {
value := pulumix.Apply[Image](o, func(v Image) pulumix.Output[*bool] { return v.BuildOnPreview })
return pulumix.Flatten[*bool, pulumix.Output[*bool]](value)