diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b1be945..3e8d8650 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/sdk/dotnet/Docker.cs b/sdk/dotnet/Docker.cs index c0a2e6c7..b954856d 100644 --- a/sdk/dotnet/Docker.cs +++ b/sdk/dotnet/Docker.cs @@ -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) /// - private static async Task RunCommandThatMustSucceed( + public static async Task RunCommandThatMustSucceed( string cmd, string[] args, Resource logResource, @@ -692,4 +692,4 @@ private static async Task WaitForExitAsync(Process process) void ProcessExited(object? sender, EventArgs e) => tcs.TrySetResult(true); } } -} \ No newline at end of file +} diff --git a/sdk/dotnet/Image.cs b/sdk/dotnet/Image.cs index c8a41b45..657578c1 100644 --- a/sdk/dotnet/Image.cs +++ b/sdk/dotnet/Image.cs @@ -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); + // 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; @@ -177,4 +179,4 @@ public Image(string name, ImageArgs args, ComponentResourceOptions? options = nu }); } } -} \ No newline at end of file +} diff --git a/sdk/nodejs/docker.ts b/sdk/nodejs/docker.ts index a055a895..f7d76805 100644 --- a/sdk/nodejs/docker.ts +++ b/sdk/nodejs/docker.ts @@ -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, diff --git a/sdk/nodejs/image.ts b/sdk/nodejs/image.ts index eeaa1c2e..b8cc2ad3 100644 --- a/sdk/nodejs/image.ts +++ b/sdk/nodejs/image.ts @@ -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;