Skip to content

Commit

Permalink
image: fix outputs defined as optional (#552)
Browse files Browse the repository at this point in the history
Fixes #547

Co-authored-by: Guinevere Saenger <guinevere@pulumi.com>
  • Loading branch information
AaronFriel and guineveresaenger committed Mar 20, 2023
1 parent 993e8a3 commit 84618d7
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 52 deletions.
7 changes: 7 additions & 0 deletions provider/cmd/pulumi-resource-docker/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4438,6 +4438,13 @@
}
},
"type": "object",
"required": [
"dockerfile",
"context",
"baseImageName",
"registryServer",
"imageName"
],
"inputProperties": {
"build": {
"$ref": "#/types/docker:index/dockerBuild:DockerBuild",
Expand Down
14 changes: 8 additions & 6 deletions provider/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"io"
"net"
"os"
"path"
"path/filepath"
"strings"

buildCmd "github.com/docker/cli/cli/command/image/build"
clibuild "github.com/docker/cli/cli/command/image/build"
"github.com/docker/cli/cli/config"
Expand All @@ -25,12 +32,6 @@ import (
"github.com/moby/moby/registry"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin"
"io"
"net"
"os"
"path"
"path/filepath"
"strings"
)

const defaultDockerfile = "Dockerfile"
Expand Down Expand Up @@ -271,6 +272,7 @@ func (p *dockerNativeProvider) dockerBuild(ctx context.Context,
outputs := map[string]interface{}{
"dockerfile": relDockerfile,
"context": img.Build.Context,
"baseImageName": img.Name,
"registryServer": img.Registry.Server,
"imageName": img.Name,
}
Expand Down
3 changes: 3 additions & 0 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ func Provider() tfbridge.ProviderInfo {
Type: "object",
Description: "Builds a Docker Image and pushes to a Docker registry.\n\n" +
docImage,
Required: []string{
"dockerfile", "context", "baseImageName", "registryServer", "imageName",
},
Properties: map[string]schema.PropertySpec{
"imageName": {
Description: "The fully qualified image name",
Expand Down
10 changes: 5 additions & 5 deletions sdk/dotnet/Image.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,31 @@ public partial class Image : global::Pulumi.CustomResource
/// The fully qualified image name that was pushed to the registry.
/// </summary>
[Output("baseImageName")]
public Output<string?> BaseImageName { get; private set; } = null!;
public Output<string> BaseImageName { get; private set; } = null!;

/// <summary>
/// The path to the build context to use.
/// </summary>
[Output("context")]
public Output<string?> Context { get; private set; } = null!;
public Output<string> Context { get; private set; } = null!;

/// <summary>
/// The location of the Dockerfile relative to the docker build context.
/// </summary>
[Output("dockerfile")]
public Output<string?> Dockerfile { get; private set; } = null!;
public Output<string> Dockerfile { get; private set; } = null!;

/// <summary>
/// The fully qualified image name
/// </summary>
[Output("imageName")]
public Output<string?> ImageName { get; private set; } = null!;
public Output<string> ImageName { get; private set; } = null!;

/// <summary>
/// The name of the registry server hosting the image.
/// </summary>
[Output("registryServer")]
public Output<string?> RegistryServer { get; private set; } = null!;
public Output<string> RegistryServer { get; private set; } = null!;


/// <summary>
Expand Down
30 changes: 15 additions & 15 deletions sdk/go/docker/image.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 15 additions & 16 deletions sdk/java/src/main/java/com/pulumi/docker/Image.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.pulumi.docker.Utilities;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;

/**
Expand Down Expand Up @@ -64,70 +63,70 @@ public class Image extends com.pulumi.resources.CustomResource {
*
*/
@Export(name="baseImageName", type=String.class, parameters={})
private Output</* @Nullable */ String> baseImageName;
private Output<String> baseImageName;

/**
* @return The fully qualified image name that was pushed to the registry.
*
*/
public Output<Optional<String>> baseImageName() {
return Codegen.optional(this.baseImageName);
public Output<String> baseImageName() {
return this.baseImageName;
}
/**
* The path to the build context to use.
*
*/
@Export(name="context", type=String.class, parameters={})
private Output</* @Nullable */ String> context;
private Output<String> context;

/**
* @return The path to the build context to use.
*
*/
public Output<Optional<String>> context() {
return Codegen.optional(this.context);
public Output<String> context() {
return this.context;
}
/**
* The location of the Dockerfile relative to the docker build context.
*
*/
@Export(name="dockerfile", type=String.class, parameters={})
private Output</* @Nullable */ String> dockerfile;
private Output<String> dockerfile;

/**
* @return The location of the Dockerfile relative to the docker build context.
*
*/
public Output<Optional<String>> dockerfile() {
return Codegen.optional(this.dockerfile);
public Output<String> dockerfile() {
return this.dockerfile;
}
/**
* The fully qualified image name
*
*/
@Export(name="imageName", type=String.class, parameters={})
private Output</* @Nullable */ String> imageName;
private Output<String> imageName;

/**
* @return The fully qualified image name
*
*/
public Output<Optional<String>> imageName() {
return Codegen.optional(this.imageName);
public Output<String> imageName() {
return this.imageName;
}
/**
* The name of the registry server hosting the image.
*
*/
@Export(name="registryServer", type=String.class, parameters={})
private Output</* @Nullable */ String> registryServer;
private Output<String> registryServer;

/**
* @return The name of the registry server hosting the image.
*
*/
public Output<Optional<String>> registryServer() {
return Codegen.optional(this.registryServer);
public Output<String> registryServer() {
return this.registryServer;
}

/**
Expand Down
10 changes: 5 additions & 5 deletions sdk/nodejs/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ export class Image extends pulumi.CustomResource {
/**
* The fully qualified image name that was pushed to the registry.
*/
public /*out*/ readonly baseImageName!: pulumi.Output<string | undefined>;
public /*out*/ readonly baseImageName!: pulumi.Output<string>;
/**
* The path to the build context to use.
*/
public /*out*/ readonly context!: pulumi.Output<string | undefined>;
public /*out*/ readonly context!: pulumi.Output<string>;
/**
* The location of the Dockerfile relative to the docker build context.
*/
public /*out*/ readonly dockerfile!: pulumi.Output<string | undefined>;
public /*out*/ readonly dockerfile!: pulumi.Output<string>;
/**
* The fully qualified image name
*/
public readonly imageName!: pulumi.Output<string | undefined>;
public readonly imageName!: pulumi.Output<string>;
/**
* The name of the registry server hosting the image.
*/
public /*out*/ readonly registryServer!: pulumi.Output<string | undefined>;
public /*out*/ readonly registryServer!: pulumi.Output<string>;

/**
* Create a Image resource with the given unique name, arguments, and options.
Expand Down
10 changes: 5 additions & 5 deletions sdk/python/pulumi_docker/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,39 +220,39 @@ def get(resource_name: str,

@property
@pulumi.getter(name="baseImageName")
def base_image_name(self) -> pulumi.Output[Optional[str]]:
def base_image_name(self) -> pulumi.Output[str]:
"""
The fully qualified image name that was pushed to the registry.
"""
return pulumi.get(self, "base_image_name")

@property
@pulumi.getter
def context(self) -> pulumi.Output[Optional[str]]:
def context(self) -> pulumi.Output[str]:
"""
The path to the build context to use.
"""
return pulumi.get(self, "context")

@property
@pulumi.getter
def dockerfile(self) -> pulumi.Output[Optional[str]]:
def dockerfile(self) -> pulumi.Output[str]:
"""
The location of the Dockerfile relative to the docker build context.
"""
return pulumi.get(self, "dockerfile")

@property
@pulumi.getter(name="imageName")
def image_name(self) -> pulumi.Output[Optional[str]]:
def image_name(self) -> pulumi.Output[str]:
"""
The fully qualified image name
"""
return pulumi.get(self, "image_name")

@property
@pulumi.getter(name="registryServer")
def registry_server(self) -> pulumi.Output[Optional[str]]:
def registry_server(self) -> pulumi.Output[str]:
"""
The name of the registry server hosting the image.
"""
Expand Down

0 comments on commit 84618d7

Please sign in to comment.