Skip to content
Merged
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
20 changes: 13 additions & 7 deletions Optimum.Bootstrap.Core.Tests/BuildLayerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,12 @@ public void BootstrapCommandUsesAnAbsoluteScriptPathFromTheSourceRoot()

var command = new ScriptBuildDriver(probe).BootstrapCommand(request);

Assert.Equal("-File", command.Args[0]);
Assert.Equal(Path.GetFullPath(Path.Combine(repo, "scripts", "bootstrap.ps1")), command.Args[1]);
Assert.True(Path.IsPathFullyQualified(command.Args[1]));
Assert.Equal("-NoProfile", command.Args[0]);
Assert.Equal("-ExecutionPolicy", command.Args[1]);
Assert.Equal("Bypass", command.Args[2]);
Assert.Equal("-File", command.Args[3]);
Assert.Equal(Path.GetFullPath(Path.Combine(repo, "scripts", "bootstrap.ps1")), command.Args[4]);
Assert.True(Path.IsPathFullyQualified(command.Args[4]));
}

[Fact]
Expand All @@ -228,9 +231,12 @@ public void PackageCommandUsesAnAbsoluteScriptPathFromTheSourceRoot()

var command = new ScriptBuildDriver(probe).PackageCommand(request);

Assert.Equal("-File", command.Args[0]);
Assert.Equal(Path.GetFullPath(Path.Combine(repo, "scripts", "package.ps1")), command.Args[1]);
Assert.True(Path.IsPathFullyQualified(command.Args[1]));
Assert.Equal(output, command.Args[3]);
Assert.Equal("-NoProfile", command.Args[0]);
Assert.Equal("-ExecutionPolicy", command.Args[1]);
Assert.Equal("Bypass", command.Args[2]);
Assert.Equal("-File", command.Args[3]);
Assert.Equal(Path.GetFullPath(Path.Combine(repo, "scripts", "package.ps1")), command.Args[4]);
Assert.True(Path.IsPathFullyQualified(command.Args[4]));
Assert.Equal(output, command.Args[6]);
}
}
4 changes: 2 additions & 2 deletions Optimum.Bootstrap.Core/Build/ScriptBuildDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public async Task<BuildResult> RunAsync(
{
if (probe.Os == OsKind.Windows)
{
List<string> win = ["-File", ScriptPath(request.RepoRoot, "bootstrap.ps1")];
List<string> win = ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", ScriptPath(request.RepoRoot, "bootstrap.ps1")];
if (request.ClientArchive is not null)
win.AddRange(["-ClientArchive", request.ClientArchive]);
if (request.Version is not null)
Expand All @@ -137,7 +137,7 @@ public async Task<BuildResult> RunAsync(
switch (probe.Os)
{
case OsKind.Windows:
List<string> win = ["-File", ScriptPath(request.RepoRoot, "package.ps1"), "-OutputDir", output];
List<string> win = ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", ScriptPath(request.RepoRoot, "package.ps1"), "-OutputDir", output];
if (request.ClientArchive is not null) win.AddRange(["-ClientArchive", request.ClientArchive]);
return (PwshExecutable(), win);
case OsKind.MacOs:
Expand Down