Make push a required param

This commit is contained in:
Bryce Lampe
2024-04-25 09:25:50 -07:00
parent 5175dbeb3f
commit f8796f9095
10 changed files with 91 additions and 67 deletions

File diff suppressed because one or more lines are too long

View File

@@ -99,7 +99,7 @@ type ImageArgs struct {
NoCache bool `pulumi:"noCache,optional"`
Platforms []Platform `pulumi:"platforms,optional"`
Pull bool `pulumi:"pull,optional"`
Push bool `pulumi:"push,optional"`
Push bool `pulumi:"push"`
Registries []Registry `pulumi:"registries,optional"`
Secrets map[string]string `pulumi:"secrets,optional"`
SSH []SSH `pulumi:"ssh,optional"`
@@ -907,11 +907,9 @@ func (*Image) Diff(
if !reflect.DeepEqual(olds.Context.Named, news.Context.Named) {
diff["context.named"] = update
}
if olds.Dockerfile.Location != news.Dockerfile.Location {
diff["dockerfile.location"] = update
}
if olds.Dockerfile.Inline != news.Dockerfile.Inline {
diff["dockerfile.inline"] = update
dockerfile, _, _ := news.Context.validate(true, news.Dockerfile)
if !reflect.DeepEqual(olds.Dockerfile, dockerfile) {
diff["dockerfile"] = update
}
// Use string comparison to ignore any manifests attached to the export.
if fmt.Sprint(olds.Exports) != fmt.Sprint(news.Exports) {
@@ -932,10 +930,10 @@ func (*Image) Diff(
if !reflect.DeepEqual(olds.Platforms, news.Platforms) {
diff["platforms"] = update
}
if olds.Pull != news.Pull {
if !reflect.DeepEqual(olds.Pull, news.Pull) {
diff["pull"] = update
}
if olds.Push != news.Push {
if !reflect.DeepEqual(olds.Push, news.Push) {
diff["push"] = update
}
if !reflect.DeepEqual(olds.Secrets, news.Secrets) {
@@ -960,7 +958,7 @@ func (*Image) Diff(
// Check if anything has changed in our build context.
hash, err := hashBuildContext(
news.Context.Location,
news.Dockerfile.Location,
dockerfile.Location,
news.Context.Named.Map(),
)
if err != nil {

View File

@@ -82,6 +82,7 @@ func TestImageLifecycle(t *testing.T) {
op: func(t *testing.T) integration.Operation {
return integration.Operation{
Inputs: resource.PropertyMap{
"push": resource.NewBoolProperty(false),
"tags": resource.NewArrayProperty(
[]resource.PropertyValue{
resource.NewStringProperty("docker.io/pulumibot/buildkit-e2e"),
@@ -129,6 +130,7 @@ func TestImageLifecycle(t *testing.T) {
op: func(t *testing.T) integration.Operation {
return integration.Operation{
Inputs: resource.PropertyMap{
"push": resource.NewBoolProperty(false),
"tags": resource.NewArrayProperty([]resource.PropertyValue{}),
"context": resource.NewObjectProperty(resource.PropertyMap{
"location": resource.NewStringProperty("testdata/noop"),
@@ -157,6 +159,7 @@ func TestImageLifecycle(t *testing.T) {
op: func(t *testing.T) integration.Operation {
return integration.Operation{
Inputs: resource.PropertyMap{
"push": resource.NewBoolProperty(false),
"tags": resource.NewArrayProperty(
[]resource.PropertyValue{resource.NewStringProperty("invalid-exports")},
),
@@ -189,6 +192,7 @@ func TestImageLifecycle(t *testing.T) {
op: func(t *testing.T) integration.Operation {
return integration.Operation{
Inputs: resource.PropertyMap{
"push": resource.NewBoolProperty(false),
"tags": resource.NewArrayProperty(
[]resource.PropertyValue{resource.NewStringProperty("foo")},
),
@@ -215,6 +219,7 @@ func TestImageLifecycle(t *testing.T) {
op: func(t *testing.T) integration.Operation {
return integration.Operation{
Inputs: resource.PropertyMap{
"push": resource.NewBoolProperty(false),
"tags": resource.NewArrayProperty(
[]resource.PropertyValue{resource.NewStringProperty("foo")},
),
@@ -246,6 +251,7 @@ func TestImageLifecycle(t *testing.T) {
op: func(t *testing.T) integration.Operation {
return integration.Operation{
Inputs: resource.PropertyMap{
"push": resource.NewBoolProperty(false),
"tags": resource.NewArrayProperty(
[]resource.PropertyValue{
resource.NewStringProperty("default-dockerfile"),