Skip to content

Commit adb3dd6

Browse files
committed
(GH-2028) cleanup
1 parent f85a641 commit adb3dd6

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

build/utils/docker.cake

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,12 @@ string[] GetDockerTags(DockerImage dockerImage, BuildParameters parameters) {
176176

177177
static string GetDockerCliPlatform(this ICakeContext context)
178178
{
179-
var buildSystem = context.BuildSystem();
180-
var ciSupportsDockerBuild = buildSystem.IsRunningOnAzurePipelines || buildSystem.IsRunningOnAzurePipelinesHosted || buildSystem.IsRunningOnGitHubActions;
181-
182-
if (ciSupportsDockerBuild && context.Environment.Platform.Family != PlatformFamily.OSX || buildSystem.IsLocalBuild)
183-
{
184-
try {
185-
var toolPath = context.FindToolInPath(context.IsRunningOnUnix() ? "docker" : "docker.exe");
186-
return toolPath == null ? "" : context.DockerCustomCommand("info --format '{{.OSType}}'").First().Replace("'", "");
187-
}
188-
catch (Exception) {
189-
context.Warning("Docker is installed but the daemon not running");
190-
}
179+
try {
180+
var toolPath = context.FindToolInPath(context.IsRunningOnUnix() ? "docker" : "docker.exe");
181+
return toolPath == null ? "" : context.DockerCustomCommand("info --format '{{.OSType}}'").First().Replace("'", "");
182+
}
183+
catch (Exception) {
184+
context.Warning("Docker is installed but the daemon not running");
191185
}
192186
return "";
193187
}

build/utils/parameters.cake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ public class BuildParameters
7171
var target = context.Argument("target", "Default");
7272
var buildSystem = context.BuildSystem();
7373

74-
var dockerCliPlatform = context.GetDockerCliPlatform();
74+
var isReleasingCI = buildSystem.IsRunningOnAzurePipelines || buildSystem.IsRunningOnAzurePipelinesHosted || buildSystem.IsRunningOnGitHubActions;
75+
var dockerCliPlatform = isReleasingCI ? context.GetDockerCliPlatform() : "";
7576

7677
return new BuildParameters {
7778
Target = target,
@@ -97,7 +98,7 @@ public class BuildParameters
9798
IsRunningOnAzurePipeline = buildSystem.IsRunningOnAzurePipelines || buildSystem.IsRunningOnAzurePipelinesHosted,
9899
IsRunningOnGitHubActions = buildSystem.IsRunningOnGitHubActions,
99100

100-
IsReleasingCI = buildSystem.IsRunningOnAzurePipelines || buildSystem.IsRunningOnAzurePipelinesHosted || buildSystem.IsRunningOnGitHubActions,
101+
IsReleasingCI = isReleasingCI,
101102

102103
IsDockerForWindows = dockerCliPlatform == "windows",
103104
IsDockerForLinux = dockerCliPlatform == "linux",

0 commit comments

Comments
 (0)