Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that docker is available earlier in the Image creation #143

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## HEAD (Unreleased)
* Upgrade to v2.7.0 of the Docker Terraform Provider
* Ensure that we check that docker is available earlier in the build process

## 1.2.0 (2020-01-29)
* Upgrade to pulumi-terraform-bridge v1.6.4
Expand Down
4 changes: 2 additions & 2 deletions sdk/dotnet/Docker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ private static string GetFailureMessage(
/// when an error happens. In general reporting the full command line is fine. But it should be set
/// to false if it might contain sensitive information (like a username/password)
/// </summary>
private static async Task<string> RunCommandThatMustSucceed(
public static async Task<string> RunCommandThatMustSucceed(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public static async Task<string> RunCommandThatMustSucceed(
internal static async Task<string> RunCommandThatMustSucceed(

string cmd,
string[] args,
Resource logResource,
Expand Down Expand Up @@ -692,4 +692,4 @@ private static async Task WaitForExitAsync(Process process)
void ProcessExited(object? sender, EventArgs e) => tcs.TrySetResult(true);
}
}
}
}
4 changes: 3 additions & 1 deletion sdk/dotnet/Image.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ public Image(string name, ImageArgs args, ComponentResourceOptions? options = nu
{
var imageName = imageArgs.Item1;

Docker.RunCommandThatMustSucceed("docker", new[] { "ps"}, this).ConfigureAwait(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why will this run fundamentally earlier than BuildAndPushImage several lines down below?


// If there is no localImageName set it equal to imageName. Note: this means
// that if imageName contains a tag, localImageName will contain the same tag.
var localImageName = imageArgs.Item2 ?? imageName;
Expand Down Expand Up @@ -177,4 +179,4 @@ public Image(string name, ImageArgs args, ComponentResourceOptions? options = nu
});
}
}
}
}
2 changes: 1 addition & 1 deletion sdk/nodejs/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ function getFailureMessage(
// [reportFullCommandLine] is used to determine if the full command line should be reported
// when an error happens. In general reporting the full command line is fine. But it should be set
// to false if it might contain sensitive information (like a username/password)
async function runCommandThatMustSucceed(
export async function runCommandThatMustSucceed(
cmd: string,
args: string[],
logResource: pulumi.Resource,
Expand Down
2 changes: 2 additions & 0 deletions sdk/nodejs/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ export class Image extends pulumi.ComponentResource {
const imageData = pulumi.output(args).apply(async (imageArgs) => {
const imageName = imageArgs.imageName;

await docker.runCommandThatMustSucceed( "docker", ["ps"], this);

// If there is no localImageName set it equal to imageName. Note: this means
// that if imageName contains a tag, localImageName will contain the same tag.
const localImageName = imageArgs.localImageName || imageName;
Expand Down