Skip to content

Commit

Permalink
make all
Browse files Browse the repository at this point in the history
  • Loading branch information
t0yv0 committed Apr 12, 2024
1 parent cd97001 commit 0244c35
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 2 deletions.
7 changes: 5 additions & 2 deletions awsx/ecr/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ export function computeImageFromAsset(

pulumi.log.debug(`Building container image at '${JSON.stringify(dockerInputs)}'`, parent);

const imageName = args.imageName ? args.imageName :
(imageTag ? imageTag : createUniqueImageName(dockerInputs));
const imageName = args.imageName
? args.imageName
: imageTag
? imageTag
: createUniqueImageName(dockerInputs);

// Note: the tag, if provided, is included in the image name.
const canonicalImageName = `${repositoryUrl}:${imageName}`;
Expand Down
2 changes: 2 additions & 0 deletions awsx/schema-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@ export interface DockerBuildInputs {
readonly cacheFrom?: pulumi.Input<pulumi.Input<string>[]>;
readonly context?: pulumi.Input<string>;
readonly dockerfile?: pulumi.Input<string>;
readonly imageName?: pulumi.Input<string>;
readonly imageTag?: pulumi.Input<string>;
readonly platform?: pulumi.Input<string>;
readonly target?: pulumi.Input<string>;
Expand All @@ -651,6 +652,7 @@ export interface DockerBuildOutputs {
readonly cacheFrom?: pulumi.Output<string[]>;
readonly context?: pulumi.Output<string>;
readonly dockerfile?: pulumi.Output<string>;
readonly imageName?: pulumi.Output<string>;
readonly imageTag?: pulumi.Output<string>;
readonly platform?: pulumi.Output<string>;
readonly target?: pulumi.Output<string>;
Expand Down
4 changes: 4 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,10 @@
"type": "string",
"description": "dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context."
},
"imageName": {
"type": "string",
"description": "Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used"
},
"imageTag": {
"type": "string",
"description": "Custom image tag for the resulting docker image. If omitted a random string will be used"
Expand Down
6 changes: 6 additions & 0 deletions sdk/dotnet/Ecr/Image.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ public InputList<string> CacheFrom
[Input("dockerfile")]
public Input<string>? Dockerfile { get; set; }

/// <summary>
/// Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used
/// </summary>
[Input("imageName")]
public Input<string>? ImageName { get; set; }

/// <summary>
/// Custom image tag for the resulting docker image. If omitted a random string will be used
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions sdk/go/awsx/ecr/image.go

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

2 changes: 2 additions & 0 deletions sdk/go/awsx/ecr/pulumiTypes.go

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

37 changes: 37 additions & 0 deletions sdk/java/src/main/java/com/pulumi/awsx/ecr/ImageArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@ public Optional<Output<String>> dockerfile() {
return Optional.ofNullable(this.dockerfile);
}

/**
* Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used
*
*/
@Import(name="imageName")
private @Nullable Output<String> imageName;

/**
* @return Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used
*
*/
public Optional<Output<String>> imageName() {
return Optional.ofNullable(this.imageName);
}

/**
* Custom image tag for the resulting docker image. If omitted a random string will be used
*
Expand Down Expand Up @@ -176,6 +191,7 @@ private ImageArgs(ImageArgs $) {
this.cacheFrom = $.cacheFrom;
this.context = $.context;
this.dockerfile = $.dockerfile;
this.imageName = $.imageName;
this.imageTag = $.imageTag;
this.platform = $.platform;
this.registryId = $.registryId;
Expand Down Expand Up @@ -306,6 +322,27 @@ public Builder dockerfile(String dockerfile) {
return dockerfile(Output.of(dockerfile));
}

/**
* @param imageName Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used
*
* @return builder
*
*/
public Builder imageName(@Nullable Output<String> imageName) {
$.imageName = imageName;
return this;
}

/**
* @param imageName Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used
*
* @return builder
*
*/
public Builder imageName(String imageName) {
return imageName(Output.of(imageName));
}

/**
* @param imageTag Custom image tag for the resulting docker image. If omitted a random string will be used
*
Expand Down
20 changes: 20 additions & 0 deletions sdk/python/pulumi_awsx/ecr/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def __init__(__self__, *,
cache_from: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
context: Optional[pulumi.Input[str]] = None,
dockerfile: Optional[pulumi.Input[str]] = None,
image_name: Optional[pulumi.Input[str]] = None,
image_tag: Optional[pulumi.Input[str]] = None,
platform: Optional[pulumi.Input[str]] = None,
registry_id: Optional[pulumi.Input[str]] = None,
Expand All @@ -33,6 +34,7 @@ def __init__(__self__, *,
:param pulumi.Input[Sequence[pulumi.Input[str]]] cache_from: Images to consider as cache sources
:param pulumi.Input[str] context: Path to a directory to use for the Docker build context, usually the directory in which the Dockerfile resides (although dockerfile may be used to choose a custom location independent of this choice). If not specified, the context defaults to the current working directory; if a relative path is used, it is relative to the current working directory that Pulumi is evaluating.
:param pulumi.Input[str] dockerfile: dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context.
:param pulumi.Input[str] image_name: Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used
:param pulumi.Input[str] image_tag: Custom image tag for the resulting docker image. If omitted a random string will be used
:param pulumi.Input[str] platform: The architecture of the platform you want to build this image for, e.g. `linux/arm64`.
:param pulumi.Input[str] registry_id: ID of the ECR registry in which to store the image. If not provided, this will be inferred from the repository URL)
Expand All @@ -49,6 +51,8 @@ def __init__(__self__, *,
pulumi.set(__self__, "context", context)
if dockerfile is not None:
pulumi.set(__self__, "dockerfile", dockerfile)
if image_name is not None:
pulumi.set(__self__, "image_name", image_name)
if image_tag is not None:
pulumi.set(__self__, "image_tag", image_tag)
if platform is not None:
Expand Down Expand Up @@ -130,6 +134,18 @@ def dockerfile(self) -> Optional[pulumi.Input[str]]:
def dockerfile(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "dockerfile", value)

@property
@pulumi.getter(name="imageName")
def image_name(self) -> Optional[pulumi.Input[str]]:
"""
Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used
"""
return pulumi.get(self, "image_name")

@image_name.setter
def image_name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "image_name", value)

@property
@pulumi.getter(name="imageTag")
def image_tag(self) -> Optional[pulumi.Input[str]]:
Expand Down Expand Up @@ -189,6 +205,7 @@ def __init__(__self__,
cache_from: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
context: Optional[pulumi.Input[str]] = None,
dockerfile: Optional[pulumi.Input[str]] = None,
image_name: Optional[pulumi.Input[str]] = None,
image_tag: Optional[pulumi.Input[str]] = None,
platform: Optional[pulumi.Input[str]] = None,
registry_id: Optional[pulumi.Input[str]] = None,
Expand All @@ -205,6 +222,7 @@ def __init__(__self__,
:param pulumi.Input[Sequence[pulumi.Input[str]]] cache_from: Images to consider as cache sources
:param pulumi.Input[str] context: Path to a directory to use for the Docker build context, usually the directory in which the Dockerfile resides (although dockerfile may be used to choose a custom location independent of this choice). If not specified, the context defaults to the current working directory; if a relative path is used, it is relative to the current working directory that Pulumi is evaluating.
:param pulumi.Input[str] dockerfile: dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context.
:param pulumi.Input[str] image_name: Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used
:param pulumi.Input[str] image_tag: Custom image tag for the resulting docker image. If omitted a random string will be used
:param pulumi.Input[str] platform: The architecture of the platform you want to build this image for, e.g. `linux/arm64`.
:param pulumi.Input[str] registry_id: ID of the ECR registry in which to store the image. If not provided, this will be inferred from the repository URL)
Expand Down Expand Up @@ -240,6 +258,7 @@ def _internal_init(__self__,
cache_from: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
context: Optional[pulumi.Input[str]] = None,
dockerfile: Optional[pulumi.Input[str]] = None,
image_name: Optional[pulumi.Input[str]] = None,
image_tag: Optional[pulumi.Input[str]] = None,
platform: Optional[pulumi.Input[str]] = None,
registry_id: Optional[pulumi.Input[str]] = None,
Expand All @@ -261,6 +280,7 @@ def _internal_init(__self__,
__props__.__dict__["cache_from"] = cache_from
__props__.__dict__["context"] = context
__props__.__dict__["dockerfile"] = dockerfile
__props__.__dict__["image_name"] = image_name
__props__.__dict__["image_tag"] = image_tag
__props__.__dict__["platform"] = platform
__props__.__dict__["registry_id"] = registry_id
Expand Down

0 comments on commit 0244c35

Please sign in to comment.