Skip to content

Commit 8345f8e

Browse files
committed
(build) small improvements
1 parent d1a940e commit 8345f8e

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

.azurepipelines/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
parameters:
1818
includeArtifacts: true
1919
- pwsh: ./build.ps1 -target Publish-DockerHub -DockerDistro $(DISTRO) -DockerDotnetVersion $(DOTNET_VERSION)
20-
displayName: '[Docker build]'
20+
displayName: '[Docker build & Test]'
2121
env:
2222
DOCKER_USERNAME: $(DOCKER_USERNAME)
2323
DOCKER_PASSWORD: $(DOCKER_PASSWORD)

build.cake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#load "./build/test.cake"
3737
#load "./build/pack.cake"
3838
#load "./build/artifacts-test.cake"
39-
#load "./build/docker.cake"
39+
#load "./build/docker-build.cake"
4040
#load "./build/publish.cake"
4141
#load "./build/wyam.cake"
4242

build/artifacts-test.cake

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
singleStageRun = !IsEnabled(Context, "ENABLED_MULTI_STAGE_BUILD", false);
22

33
Task("Artifacts-Prepare")
4-
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsRunningOnMacOS, "Artifacts-Prepare can be tested only on Windows or Linux agents.")
5-
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsCiSupportingDocker, "Artifacts-Prepare works only on AzurePipeline or GitHub Actions.")
4+
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsRunningOnMacOS, "Artifacts-Prepare can be tested only on Windows or Linux agents.")
5+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsCiSupportingDocker, "Artifacts-Prepare works only on AzurePipeline.")
66
.IsDependentOnWhen("Pack-Nuget", singleStageRun)
77
.Does<BuildParameters>((parameters) =>
88
{
99
});
1010

1111
Task("Artifacts-DotnetTool-Test")
12-
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsRunningOnMacOS, "Artifacts-DotnetTool-Test can be tested only on Windows or Linux agents.")
13-
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsCiSupportingDocker, "Artifacts-DotnetTool-Test works only on AzurePipeline or GitHub Actions.")
12+
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsRunningOnMacOS, "Artifacts-DotnetTool-Test can be tested only on Windows or Linux agents.")
13+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsCiSupportingDocker, "Artifacts-DotnetTool-Test works only on AzurePipeline.")
1414
.IsDependentOn("Artifacts-Prepare")
1515
.Does<BuildParameters>((parameters) =>
1616
{
@@ -29,8 +29,8 @@ Task("Artifacts-DotnetTool-Test")
2929
});
3030

3131
Task("Artifacts-MsBuild-Test")
32-
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsRunningOnMacOS, "Artifacts-MsBuild-Test can be tested only on Windows or Linux agents.")
33-
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsCiSupportingDocker, "Artifacts-MsBuild-Test works only on AzurePipeline or GitHub Actions.")
32+
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsRunningOnMacOS, "Artifacts-MsBuild-Test can be tested only on Windows or Linux agents.")
33+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsCiSupportingDocker, "Artifacts-MsBuild-Test works only on AzurePipeline.")
3434
.IsDependentOn("Artifacts-Prepare")
3535
.Does<BuildParameters>((parameters) =>
3636
{
@@ -50,7 +50,7 @@ Task("Artifacts-MsBuild-Test")
5050
});
5151

5252
Task("Artifacts-Test")
53-
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsRunningOnMacOS, "Artifacts-Test can be tested only on Windows or Linux agents.")
54-
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsCiSupportingDocker, "Artifacts-Test works only on AzurePipeline or GitHub Actions.")
53+
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsRunningOnMacOS, "Artifacts-Test can be tested only on Windows or Linux agents.")
54+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsCiSupportingDocker, "Artifacts-Test works only on AzurePipeline.")
5555
.IsDependentOn("Artifacts-DotnetTool-Test")
5656
.IsDependentOn("Artifacts-MsBuild-Test");

build/docker.cake renamed to build/docker-build.cake

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
singleStageRun = !IsEnabled(Context, "ENABLED_MULTI_STAGE_BUILD", false);
22

33
Task("Docker-Build")
4-
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsRunningOnMacOS, "Docker can be built only on Windows or Linux agents.")
5-
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnAzurePipeline, "Docker-Build works only on AzurePipeline.")
4+
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsRunningOnMacOS, "Docker can be built only on Windows or Linux agents.")
5+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsCiSupportingDocker, "Docker-Build works only on AzurePipeline.")
66
.IsDependentOnWhen("Pack-Prepare", singleStageRun)
77
.Does<BuildParameters>((parameters) =>
88
{
@@ -13,8 +13,8 @@ Task("Docker-Build")
1313
});
1414

1515
Task("Docker-Test")
16-
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsRunningOnMacOS, "Docker can be tested only on Windows or Linux agents.")
17-
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnAzurePipeline, "Docker-Test works only on AzurePipeline.")
16+
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsRunningOnMacOS, "Docker can be tested only on Windows or Linux agents.")
17+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsCiSupportingDocker, "Docker-Test works only on AzurePipeline.")
1818
.IsDependentOn("Docker-Build")
1919
.Does<BuildParameters>((parameters) =>
2020
{
@@ -31,9 +31,9 @@ Task("Docker-Test")
3131
});
3232

3333
Task("Docker-Publish")
34-
.WithCriteria<BuildParameters>((context, parameters) => parameters.EnabledPublishDocker, "Docker-Publish was disabled.")
35-
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsRunningOnMacOS, "Docker-Publish works only on Windows and Linux agents.")
36-
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnAzurePipeline, "Docker-Publish works only on AzurePipeline.")
34+
.WithCriteria<BuildParameters>((context, parameters) => parameters.EnabledPublishDocker, "Docker-Publish was disabled.")
35+
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsRunningOnMacOS, "Docker-Publish works only on Windows and Linux agents.")
36+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsCiSupportingDocker, "Docker-Publish works only on AzurePipeline.")
3737
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsStableRelease() || parameters.IsPreRelease(), "Docker-Publish works only for releases.")
3838
.IsDependentOn("Docker-Test")
3939
.Does<BuildParameters>((parameters) =>

build/utils/docker.cake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,14 @@ string DockerRunImage(DockerContainerRunSettings settings, string image, string
8181
}
8282

8383
var result = runner.RunWithResult("run", settings ?? new DockerContainerRunSettings(), r => r.ToArray(), arguments.ToArray());
84-
var output = string.Join("\n", result);
85-
Information("Output : " + output);
86-
return output;
84+
return string.Join("\n", result);
8785
}
8886

8987
void DockerTestRun(DockerContainerRunSettings settings, BuildParameters parameters, string image, string command, params string[] args)
9088
{
9189
Information($"Testing image: {image}");
9290
var output = DockerRunImage(settings, image, command, args);
91+
Information("Output : " + output);
9392

9493
Assert.Equal(parameters.Version.GitVersion.FullSemVer, output);
9594
}
@@ -99,11 +98,12 @@ void DockerTestArtifact(DockerImage dockerImage, BuildParameters parameters, str
9998
var settings = GetDockerRunSettings(parameters);
10099
var (os, distro, targetframework) = dockerImage;
101100
var tag = $"gittools/build-images:{distro}-sdk-{targetframework.Replace("netcoreapp", "")}";
102-
Information("Docker tag: {0}", tag);
103-
Information("Docker cmd: {0}", cmd);
104101

105102
cmd = "-Command " + cmd; // powershell 7 needs a -Command parameter
106103

104+
Information("Docker tag: {0}", tag);
105+
Information("Docker cmd: {0}", cmd);
106+
107107
DockerTestRun(settings, parameters, tag, "pwsh", cmd);
108108
}
109109

0 commit comments

Comments
 (0)