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
88 changes: 43 additions & 45 deletions build/Build.Pack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ void CreateLinuxPackages(string runtimeId)
packagingScriptsDirectory /= "unsigned";

packagingScriptsDirectory.GlobFiles("*")
.ForEach(x => FileSystemTasks.CopyFileToDirectory(x, debBuildDir / "scripts"));
.ForEach(x => x.CopyToDirectory(debBuildDir / "scripts"));

DockerTasks.DockerPull(settings => settings
.When(RuntimeInformation.OSArchitecture == Architecture.Arm64, _ => _.SetPlatform("linux/amd64"))
.When(_ => RuntimeInformation.OSArchitecture == Architecture.Arm64, _ => _.SetPlatform("linux/amd64"))
.SetName(dockerToolsContainerImage));

DockerTasks.DockerRun(settings => settings
.When(RuntimeInformation.OSArchitecture == Architecture.Arm64, _ => _.SetPlatform("linux/amd64"))
.When(_ => RuntimeInformation.OSArchitecture == Architecture.Arm64, _ => _.SetPlatform("linux/amd64"))
.EnableRm()
.EnableTty()
.SetEnv(
Expand Down Expand Up @@ -132,13 +132,13 @@ void CreateLinuxPackages(string runtimeId)

(ArtifactsDirectory / "deb").CreateDirectory();
debOutputDirectory.GlobFiles("*.deb")
.ForEach(x => FileSystemTasks.CopyFileToDirectory(x, ArtifactsDirectory / "deb"));
.ForEach(x => x.CopyToDirectory(ArtifactsDirectory / "deb"));

CopyDebianPackageToDockerFolder(runtimeId);

(ArtifactsDirectory / "rpm").CreateDirectory();
debOutputDirectory.GlobFiles("*.rpm")
.ForEach(x => FileSystemTasks.CopyFileToDirectory(x, ArtifactsDirectory / "rpm"));
.ForEach(x => x.CopyToDirectory(ArtifactsDirectory / "rpm"));
}
});

Expand Down Expand Up @@ -245,7 +245,7 @@ void PackWindowsZip(string framework, string runtimeId)
workingTentacleDirectory.CreateOrCleanDirectory();

(BuildDirectory / "Tentacle" / framework / runtimeId).GlobFiles($"*")
.ForEach(x => FileSystemTasks.CopyFileToDirectory(x, workingTentacleDirectory));
.ForEach(x => x.CopyToDirectory(workingTentacleDirectory));

ZipFile.CreateFromDirectory(
workingDirectory,
Expand All @@ -267,23 +267,23 @@ void PackWindowsInstallers(MSBuildTargetPlatform platform, AbsolutePath wixNuget
if (framework == NetFramework)
{
(BuildDirectory / "Tentacle" / framework / "win").GlobFiles("*")
.ForEach(x => FileSystemTasks.CopyFileToDirectory(x, installerDirectory, FileExistsPolicy.Overwrite));
.ForEach(x => x.CopyToDirectory(installerDirectory, ExistsPolicy.FileOverwrite));

(BuildDirectory / "Octopus.Manager.Tentacle" / framework / "win").GlobFiles("*")
.ForEach(x => FileSystemTasks.CopyFileToDirectory(x, installerDirectory, FileExistsPolicy.Overwrite));
.ForEach(x => x.CopyToDirectory(installerDirectory, ExistsPolicy.FileOverwrite));
}
else if (framework is NetCoreWindows)
{
(BuildDirectory / "Tentacle" / framework / $"win-{platform}").GlobFiles("*")
.ForEach(x => FileSystemTasks.CopyFileToDirectory(x, installerDirectory, FileExistsPolicy.Overwrite));
.ForEach(x => x.CopyToDirectory(installerDirectory, ExistsPolicy.FileOverwrite));

(BuildDirectory / "Octopus.Manager.Tentacle" / framework / $"win-{platform}").GlobFiles("*")
.ForEach(x => FileSystemTasks.CopyFileToDirectory(x, installerDirectory, FileExistsPolicy.Overwrite));
.ForEach(x => x.CopyToDirectory(installerDirectory, ExistsPolicy.FileOverwrite));
}
else
{
(BuildDirectory / "Tentacle" / framework / $"win-{platform}").GlobFiles("*")
.ForEach(x => FileSystemTasks.CopyFileToDirectory(x, installerDirectory, FileExistsPolicy.Overwrite));
.ForEach(x => x.CopyToDirectory(installerDirectory, ExistsPolicy.FileOverwrite));
}

var harvestFilePath = RootDirectory / "installer" / "Octopus.Tentacle.Installer" / "Tentacle.Generated.wxs";
Expand Down Expand Up @@ -348,9 +348,7 @@ void BuildMsiInstallerForPlatform(MSBuildTargetPlatform platform, AbsolutePath w
_ => $"-{framework}-win" + (platform == MSBuildTargetPlatform.x64 ? "-x64" : "-x86")
};

FileSystemTasks.MoveFile(
builtMsi,
ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}{platformString}.msi");
builtMsi.Move(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}{platformString}.msi");
});
}

Expand Down Expand Up @@ -487,40 +485,40 @@ string ConstructRedHatPackageFilename(string packageName, string architecture)
workingDirectory.CreateDirectory();

// Get .NET Framework 4.8 installers for Tentacle
FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}.msi", workingDirectory / "Octopus.Tentacle.msi");
FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-x64.msi", workingDirectory / "Octopus.Tentacle-x64.msi");
(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}.msi").Copy(workingDirectory / "Octopus.Tentacle.msi");
(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-x64.msi").Copy(workingDirectory / "Octopus.Tentacle-x64.msi");

// Get .NET 8.0 installers for Tentacle (w/o Tentacle Manager)
FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-win-x86.msi", workingDirectory / "Octopus.Tentacle-net8.0-win-x86.msi");
FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-win-x64.msi", workingDirectory / "Octopus.Tentacle-net8.0-win-x64.msi");
(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-win-x86.msi").Copy(workingDirectory / "Octopus.Tentacle-net8.0-win-x86.msi");
(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-win-x64.msi").Copy(workingDirectory / "Octopus.Tentacle-net8.0-win-x64.msi");

// Get .NET 8.0 installers for Tentacle (w/ Tentacle Manager)
FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-windows-win-x86.msi", workingDirectory / "Octopus.Tentacle-net8.0-windows-win-x86.msi");
FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-windows-win-x64.msi", workingDirectory / "Octopus.Tentacle-net8.0-windows-win-x64.msi");
(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-windows-win-x86.msi").Copy(workingDirectory / "Octopus.Tentacle-net8.0-windows-win-x86.msi");
(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-windows-win-x64.msi").Copy(workingDirectory / "Octopus.Tentacle-net8.0-windows-win-x64.msi");

// Get .NET 8.0 installers for Tentacle Upgrader
FileSystemTasks.CopyFile(BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x86" / "Octopus.Tentacle.Upgrader.exe", workingDirectory / "Octopus.Tentacle.Upgrader-net8.0-win-x86.exe");
FileSystemTasks.CopyFile(BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x64" / "Octopus.Tentacle.Upgrader.exe", workingDirectory / "Octopus.Tentacle.Upgrader-net8.0-win-x64.exe");
(BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x86" / "Octopus.Tentacle.Upgrader.exe").Copy(workingDirectory / "Octopus.Tentacle.Upgrader-net8.0-win-x86.exe");
(BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x64" / "Octopus.Tentacle.Upgrader.exe").Copy(workingDirectory / "Octopus.Tentacle.Upgrader-net8.0-win-x64.exe");

// Get all .NET Framework 4.8 files (installers and archives) for Tentacle Upgrader
var octopusTentacleUpgraderDirectory = BuildDirectory / "Octopus.Tentacle.Upgrader" / NetFramework / "win";
octopusTentacleUpgraderDirectory.GlobFiles("*").ForEach(x => FileSystemTasks.CopyFileToDirectory(x, workingDirectory));
octopusTentacleUpgraderDirectory.GlobFiles("*").ForEach(x => x.CopyToDirectory(workingDirectory));

// Get all DEB packages for Linux
var debAmd64PackageFilename = ConstructDebianPackageFilename("tentacle", "amd64");
var debArm64PackageFilename = ConstructDebianPackageFilename("tentacle", "arm64");
var debArm32PackageFilename = ConstructDebianPackageFilename("tentacle", "armhf");
FileSystemTasks.CopyFile(ArtifactsDirectory / "deb" / debAmd64PackageFilename, workingDirectory / debAmd64PackageFilename);
FileSystemTasks.CopyFile(ArtifactsDirectory / "deb" / debArm64PackageFilename, workingDirectory / debArm64PackageFilename);
FileSystemTasks.CopyFile(ArtifactsDirectory / "deb" / debArm32PackageFilename, workingDirectory / debArm32PackageFilename);
(ArtifactsDirectory / "deb" / debAmd64PackageFilename).Copy(workingDirectory / debAmd64PackageFilename);
(ArtifactsDirectory / "deb" / debArm64PackageFilename).Copy(workingDirectory / debArm64PackageFilename);
(ArtifactsDirectory / "deb" / debArm32PackageFilename).Copy(workingDirectory / debArm32PackageFilename);

// Get all RPM packages for Linux
var rpmArm64PackageFilename = ConstructRedHatPackageFilename("tentacle", "aarch64");
var rpmArm32PackageFilename = ConstructRedHatPackageFilename("tentacle", "armv7hl");
var rpmx64PackageFilename = ConstructRedHatPackageFilename("tentacle", "x86_64");
FileSystemTasks.CopyFile(ArtifactsDirectory / "rpm" / rpmArm64PackageFilename, workingDirectory / rpmArm64PackageFilename);
FileSystemTasks.CopyFile(ArtifactsDirectory / "rpm" / rpmArm32PackageFilename, workingDirectory / rpmArm32PackageFilename);
FileSystemTasks.CopyFile(ArtifactsDirectory / "rpm" / rpmx64PackageFilename, workingDirectory / rpmx64PackageFilename);
(ArtifactsDirectory / "rpm" / rpmArm64PackageFilename).Copy(workingDirectory / rpmArm64PackageFilename);
(ArtifactsDirectory / "rpm" / rpmArm32PackageFilename).Copy(workingDirectory / rpmArm32PackageFilename);
(ArtifactsDirectory / "rpm" / rpmx64PackageFilename).Copy(workingDirectory / rpmx64PackageFilename);

// Get the archives for all runtimes
foreach (var framework in new[] { NetFramework, NetCore })
Expand All @@ -531,15 +529,15 @@ string ConstructRedHatPackageFilename(string packageName, string architecture)
|| runtimeId != "win" && framework == NetFramework) continue;

var fileExtension = runtimeId.StartsWith("win") ? "zip" : "tar.gz";
FileSystemTasks.CopyFile(ArtifactsDirectory / "zip" / $"tentacle-{FullSemVer}-{framework}-{runtimeId}.{fileExtension}",
workingDirectory / $"tentacle-{framework}-{runtimeId}.{fileExtension}");
var path = ArtifactsDirectory / "zip" / $"tentacle-{FullSemVer}-{framework}-{runtimeId}.{fileExtension}";
path.Copy(workingDirectory / $"tentacle-{framework}-{runtimeId}.{fileExtension}");
}
}

// Get the .NET 8.0 archives for Tentacle (w/ Tentacle Manager)
FileSystemTasks.CopyFile(ArtifactsDirectory / "zip" / $"tentacle-{FullSemVer}-{NetCoreWindows}-win-x86.zip",
(ArtifactsDirectory / "zip" / $"tentacle-{FullSemVer}-{NetCoreWindows}-win-x86.zip").Copy(
workingDirectory / $"tentacle-{NetCoreWindows}-win-x86.zip");
FileSystemTasks.CopyFile(ArtifactsDirectory / "zip" / $"tentacle-{FullSemVer}-{NetCoreWindows}-win-x64.zip",
(ArtifactsDirectory / "zip" / $"tentacle-{FullSemVer}-{NetCoreWindows}-win-x64.zip").Copy(
workingDirectory / $"tentacle-{NetCoreWindows}-win-x64.zip");

// Assert all the expected files have been successfully copied
Expand Down Expand Up @@ -579,20 +577,20 @@ string ConstructRedHatPackageFilename(string packageName, string architecture)
workingDirectory.CreateDirectory();

// Get the .NET Framework 4.8 installers for Tentacle
FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}.msi", workingDirectory / "Octopus.Tentacle.msi");
FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-x64.msi", workingDirectory / "Octopus.Tentacle-x64.msi");
(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}.msi").Copy(workingDirectory / "Octopus.Tentacle.msi");
(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-x64.msi").Copy(workingDirectory / "Octopus.Tentacle-x64.msi");

// Get the .NET 8.0 installers for Tentacle
FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-win-x86.msi", workingDirectory / "Octopus.Tentacle-net8.0-win-x86.msi");
FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-win-x64.msi", workingDirectory / "Octopus.Tentacle-net8.0-win-x64.msi");
(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-win-x86.msi").Copy(workingDirectory / "Octopus.Tentacle-net8.0-win-x86.msi");
(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-win-x64.msi").Copy(workingDirectory / "Octopus.Tentacle-net8.0-win-x64.msi");

// Get the .NET 8.0 installers for the Tentacle Upgrader
FileSystemTasks.CopyFile(BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x86" / "Octopus.Tentacle.Upgrader.exe", workingDirectory / "Octopus.Tentacle.Upgrader-net8.0-win-x86.exe");
FileSystemTasks.CopyFile(BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x64" / "Octopus.Tentacle.Upgrader.exe", workingDirectory / "Octopus.Tentacle.Upgrader-net8.0-win-x64.exe");
(BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x86" / "Octopus.Tentacle.Upgrader.exe").Copy(workingDirectory / "Octopus.Tentacle.Upgrader-net8.0-win-x86.exe");
(BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x64" / "Octopus.Tentacle.Upgrader.exe").Copy(workingDirectory / "Octopus.Tentacle.Upgrader-net8.0-win-x64.exe");

// Get the .NET Framework 4.8 installers for the Tentacle Upgrader
var octopusTentacleUpgraderDirectory = BuildDirectory / "Octopus.Tentacle.Upgrader" / NetFramework / "win";
octopusTentacleUpgraderDirectory.GlobFiles("*").ForEach(x => FileSystemTasks.CopyFileToDirectory(x, workingDirectory));
octopusTentacleUpgraderDirectory.GlobFiles("*").ForEach(x => x.CopyToDirectory(workingDirectory));

// Get the archives for all required runtimes
foreach (var runtimeId in CrossPlatformBundleForServerRequiredRuntimes)
Expand All @@ -601,8 +599,8 @@ string ConstructRedHatPackageFilename(string packageName, string architecture)
// as we've already manually grabbed the installers
if (runtimeId.StartsWith("win")) continue;

FileSystemTasks.CopyFile(ArtifactsDirectory / "zip" / $"tentacle-{FullSemVer}-{NetCore}-{runtimeId}.{"tar.gz"}",
workingDirectory / $"tentacle-{NetCore}-{runtimeId}.{"tar.gz"}");
var path = ArtifactsDirectory / "zip" / $"tentacle-{FullSemVer}-{NetCore}-{runtimeId}.{"tar.gz"}";
path.Copy(workingDirectory / $"tentacle-{NetCore}-{runtimeId}.{"tar.gz"}");
}

// Assert all the expected files have been successfully copied
Expand Down Expand Up @@ -660,9 +658,9 @@ void PackTarballs(string framework, string runtimeId)
var tentacleDirectory = BuildDirectory / "Tentacle" / framework / runtimeId;

linuxPackagesContent.GlobFiles("*")
.ForEach(x => FileSystemTasks.CopyFileToDirectory(x, workingDir / "tentacle"));
.ForEach(x => x.CopyToDirectory(workingDir / "tentacle"));
tentacleDirectory.GlobFiles("*")
.ForEach(x => FileSystemTasks.CopyFileToDirectory(x, workingDir / "tentacle"));
.ForEach(x => x.CopyToDirectory(workingDir / "tentacle"));

TarGZipCompress(
workingDir,
Expand Down Expand Up @@ -726,7 +724,7 @@ void CopyDebianPackageToDockerFolder(string runtimeId)
var dockerDir = ArtifactsDirectory / "docker";
dockerDir.CreateDirectory();

FileSystemTasks.CopyFile(packageFilePath, dockerDir / $"tentacle_{FullSemVer}_linux-{dockerArch}.deb");
packageFilePath.Copy(dockerDir / $"tentacle_{FullSemVer}_linux-{dockerArch}.deb");
}

string GetMicrok8sIpAddress()
Expand Down
16 changes: 8 additions & 8 deletions build/Build.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,31 +219,31 @@ void ThenBuiltInUserShouldNotHaveWritePermissions(string destination)

void InstallMsi(AbsolutePath installerPath, AbsolutePath destination)
{
var installLogName = Path.Combine(TestDirectory, $"{GetTestName(installerPath)}.install.log");
var installLogName = TestDirectory / $"{GetTestName(installerPath)}.install.log";

Log.Information($"Installing {installerPath} to {destination}");
Log.Information("Installing {InstallerPath} to {Destination}", installerPath, destination);

var arguments = $"/i {installerPath} /QN INSTALLLOCATION={destination} /L*V {installLogName}";
Log.Information($"Running msiexec {arguments}");
Log.Information("Running msiexec {Arguments}", arguments);
var installationProcess = ProcessTasks.StartProcess("msiexec", arguments);
installationProcess.WaitForExit();

FileSystemTasks.CopyFileToDirectory(installLogName, ArtifactsDirectory, FileExistsPolicy.Overwrite);
installLogName.CopyToDirectory(ArtifactsDirectory, ExistsPolicy.FileOverwrite);
if (installationProcess.ExitCode != 0) {
throw new Exception($"The installation process exited with a non-zero exit code ({installationProcess.ExitCode}). Check the log {installLogName} for details.");
}
}

void UninstallMsi(AbsolutePath installerPath)
{
Log.Information($"Uninstalling {installerPath}");
var uninstallLogName = Path.Combine(TestDirectory, $"{GetTestName(installerPath)}.uninstall.log");
Log.Information("Uninstalling {InstallerPath}", installerPath);
var uninstallLogName = TestDirectory / $"{GetTestName(installerPath)}.uninstall.log";

var arguments = $"/x {installerPath} /QN /L*V {uninstallLogName}";
Log.Information($"Running msiexec {arguments}");
Log.Information("Running msiexec {Arguments}", arguments);
var uninstallProcess = ProcessTasks.StartProcess("msiexec", arguments);
uninstallProcess.WaitForExit();
FileSystemTasks.CopyFileToDirectory(uninstallLogName, ArtifactsDirectory, FileExistsPolicy.Overwrite);
(uninstallLogName).CopyToDirectory(ArtifactsDirectory, ExistsPolicy.FileOverwrite);
}

[SupportedOSPlatform("windows")]
Expand Down
Loading