2222partial class Build
2323{
2424 const string KubernetesTentacleContainerRuntimeDepsTag = "8.0-bookworm-slim" ;
25-
25+
2626 //We don't sign linux packages when building locally
2727 readonly bool SignLinuxPackages = ! IsLocalBuild ;
2828
@@ -34,8 +34,7 @@ partial class Build
3434 Name = "DockerPlatform" ) ]
3535 string DockerPlatform = "linux/arm64,linux/amd64" ;
3636
37- [ PathVariable ]
38- readonly Tool Multipass = null ! ;
37+ [ PathVariable ] readonly Tool Multipass = null ! ;
3938
4039 [ PublicAPI ]
4140 Target PackOsxTarballs => _ => _
@@ -177,7 +176,7 @@ void CreateLinuxPackages(string runtimeId)
177176 var host = GetMicrok8sIpAddress ( ) ;
178177 const int port = 32000 ;
179178 var hostPort = $ "{ host } :{ port } ";
180-
179+
181180 BuildAndPushOrLoadKubernetesTentacleContainerImage ( push : true , load : false , KubernetesTentacleContainerRuntimeDepsTag , host : hostPort ) ;
182181 } ) ;
183182
@@ -277,7 +276,7 @@ void PackWindowsInstallers(MSBuildTargetPlatform platform, AbsolutePath wixNuget
277276 {
278277 ( BuildDirectory / "Tentacle" / framework / $ "win-{ platform } ") . GlobFiles ( "*" )
279278 . ForEach ( x => FileSystemTasks . CopyFileToDirectory ( x , installerDirectory , FileExistsPolicy . Overwrite ) ) ;
280-
279+
281280 ( BuildDirectory / "Octopus.Manager.Tentacle" / framework / $ "win-{ platform } ") . GlobFiles ( "*" )
282281 . ForEach ( x => FileSystemTasks . CopyFileToDirectory ( x , installerDirectory , FileExistsPolicy . Overwrite ) ) ;
283282 }
@@ -366,7 +365,7 @@ void BuildMsiInstallerForPlatform(MSBuildTargetPlatform platform, AbsolutePath w
366365
367366 PackWindowsInstallers ( MSBuildTargetPlatform . x64 , wixNugetInstalledPackage . Directory , NetCore , "NetCore" ) ;
368367 PackWindowsInstallers ( MSBuildTargetPlatform . x86 , wixNugetInstalledPackage . Directory , NetCore , "NetCore" ) ;
369-
368+
370369 PackWindowsInstallers ( MSBuildTargetPlatform . x64 , wixNugetInstalledPackage . Directory , NetCoreWindows , "NetCoreWindows" ) ;
371370 PackWindowsInstallers ( MSBuildTargetPlatform . x86 , wixNugetInstalledPackage . Directory , NetCoreWindows , "NetCoreWindows" ) ;
372371 } ) ;
@@ -378,11 +377,11 @@ void BuildMsiInstallerForPlatform(MSBuildTargetPlatform platform, AbsolutePath w
378377 . Executes ( ( ) =>
379378 {
380379 ( ArtifactsDirectory / "chocolatey" ) . CreateDirectory ( ) ;
381-
380+
382381 var chocolateyNetFrameworkSourceDirectory = SourceDirectory / "Chocolatey-Net-Framework" ;
383382 const string chocolateyNetFrameworkNuspecFileName = "OctopusDeploy.Tentacle.nuspec" ;
384383 PackChocolateyPackageToArtifactsDirectory ( "" , "-x64" , chocolateyNetFrameworkSourceDirectory , chocolateyNetFrameworkNuspecFileName ) ;
385-
384+
386385 var chocolateySelfContainedSourceDirectory = SourceDirectory / "Chocolatey-Self-Contained" ;
387386 const string chocolateySelfContainedNuspecFileName = "OctopusDeploy.Tentacle.SelfContained.nuspec" ;
388387 PackChocolateyPackageToArtifactsDirectory ( "-net8.0-windows-win-x86" , "-net8.0-windows-win-x64" , chocolateySelfContainedSourceDirectory , chocolateySelfContainedNuspecFileName ) ;
@@ -426,7 +425,7 @@ void PackChocolateyPackageToArtifactsDirectory(string x86FileSuffix, string x64F
426425 . SetVerbosity ( DotNetVerbosity . normal )
427426 . SetProperty ( "NuspecProperties" , $ "Version={ FullSemVer } ") ) ;
428427 } ) ;
429-
428+
430429 [ PublicAPI ]
431430 Target PackCore => _ => _
432431 . Description ( "Packs the NuGet package for Tentacle core." )
@@ -487,34 +486,43 @@ string ConstructRedHatPackageFilename(string packageName, string architecture)
487486 var workingDirectory = BuildDirectory / "Octopus.Tentacle.CrossPlatformBundle" ;
488487 workingDirectory . CreateDirectory ( ) ;
489488
490- var debAmd64PackageFilename = ConstructDebianPackageFilename ( "tentacle" , "amd64" ) ;
491- var debArm64PackageFilename = ConstructDebianPackageFilename ( "tentacle" , "arm64" ) ;
492- var debArm32PackageFilename = ConstructDebianPackageFilename ( "tentacle" , "armhf" ) ;
493-
494- var rpmArm64PackageFilename = ConstructRedHatPackageFilename ( "tentacle" , "aarch64" ) ;
495- var rpmArm32PackageFilename = ConstructRedHatPackageFilename ( "tentacle" , "armv7hl" ) ;
496- var rpmx64PackageFilename = ConstructRedHatPackageFilename ( "tentacle" , "x86_64" ) ;
497-
489+ // Get .NET Framework 4.8 installers for Tentacle
498490 FileSystemTasks . CopyFile ( ArtifactsDirectory / "msi" / $ "Octopus.Tentacle.{ FullSemVer } .msi", workingDirectory / "Octopus.Tentacle.msi" ) ;
499491 FileSystemTasks . CopyFile ( ArtifactsDirectory / "msi" / $ "Octopus.Tentacle.{ FullSemVer } -x64.msi", workingDirectory / "Octopus.Tentacle-x64.msi" ) ;
500492
493+ // Get .NET 8.0 installers for Tentacle (w/o Tentacle Manager)
501494 FileSystemTasks . CopyFile ( ArtifactsDirectory / "msi" / $ "Octopus.Tentacle.{ FullSemVer } -net8.0-win-x86.msi", workingDirectory / "Octopus.Tentacle-net8.0-win-x86.msi" ) ;
502495 FileSystemTasks . CopyFile ( ArtifactsDirectory / "msi" / $ "Octopus.Tentacle.{ FullSemVer } -net8.0-win-x64.msi", workingDirectory / "Octopus.Tentacle-net8.0-win-x64.msi" ) ;
496+
497+ // Get .NET 8.0 installers for Tentacle (w/ Tentacle Manager)
503498 FileSystemTasks . CopyFile ( ArtifactsDirectory / "msi" / $ "Octopus.Tentacle.{ FullSemVer } -net8.0-windows-win-x86.msi", workingDirectory / "Octopus.Tentacle-net8.0-windows-win-x86.msi" ) ;
504499 FileSystemTasks . CopyFile ( ArtifactsDirectory / "msi" / $ "Octopus.Tentacle.{ FullSemVer } -net8.0-windows-win-x64.msi", workingDirectory / "Octopus.Tentacle-net8.0-windows-win-x64.msi" ) ;
505500
501+ // Get .NET 8.0 installers for Tentacle Upgrader
506502 FileSystemTasks . CopyFile ( BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x86" / "Octopus.Tentacle.Upgrader.exe" , workingDirectory / "Octopus.Tentacle.Upgrader-net8.0-win-x86.exe" ) ;
507503 FileSystemTasks . CopyFile ( BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x64" / "Octopus.Tentacle.Upgrader.exe" , workingDirectory / "Octopus.Tentacle.Upgrader-net8.0-win-x64.exe" ) ;
508504
505+ // Get all .NET Framework 4.8 files (installers and archives) for Tentacle Upgrader
509506 var octopusTentacleUpgraderDirectory = BuildDirectory / "Octopus.Tentacle.Upgrader" / NetFramework / "win" ;
510507 octopusTentacleUpgraderDirectory . GlobFiles ( "*" ) . ForEach ( x => FileSystemTasks . CopyFileToDirectory ( x , workingDirectory ) ) ;
508+
509+ // Get all DEB packages for Linux
510+ var debAmd64PackageFilename = ConstructDebianPackageFilename ( "tentacle" , "amd64" ) ;
511+ var debArm64PackageFilename = ConstructDebianPackageFilename ( "tentacle" , "arm64" ) ;
512+ var debArm32PackageFilename = ConstructDebianPackageFilename ( "tentacle" , "armhf" ) ;
511513 FileSystemTasks . CopyFile ( ArtifactsDirectory / "deb" / debAmd64PackageFilename , workingDirectory / debAmd64PackageFilename ) ;
512514 FileSystemTasks . CopyFile ( ArtifactsDirectory / "deb" / debArm64PackageFilename , workingDirectory / debArm64PackageFilename ) ;
513515 FileSystemTasks . CopyFile ( ArtifactsDirectory / "deb" / debArm32PackageFilename , workingDirectory / debArm32PackageFilename ) ;
516+
517+ // Get all RPM packages for Linux
518+ var rpmArm64PackageFilename = ConstructRedHatPackageFilename ( "tentacle" , "aarch64" ) ;
519+ var rpmArm32PackageFilename = ConstructRedHatPackageFilename ( "tentacle" , "armv7hl" ) ;
520+ var rpmx64PackageFilename = ConstructRedHatPackageFilename ( "tentacle" , "x86_64" ) ;
514521 FileSystemTasks . CopyFile ( ArtifactsDirectory / "rpm" / rpmArm64PackageFilename , workingDirectory / rpmArm64PackageFilename ) ;
515522 FileSystemTasks . CopyFile ( ArtifactsDirectory / "rpm" / rpmArm32PackageFilename , workingDirectory / rpmArm32PackageFilename ) ;
516523 FileSystemTasks . CopyFile ( ArtifactsDirectory / "rpm" / rpmx64PackageFilename , workingDirectory / rpmx64PackageFilename ) ;
517524
525+ // Get the archives for all runtimes
518526 foreach ( var framework in new [ ] { NetFramework , NetCore } )
519527 {
520528 foreach ( var runtimeId in RuntimeIds )
@@ -527,50 +535,116 @@ string ConstructRedHatPackageFilename(string packageName, string architecture)
527535 workingDirectory / $ "tentacle-{ framework } -{ runtimeId } .{ fileExtension } ") ;
528536 }
529537 }
530-
538+
539+ // Get the .NET 8.0 archives for Tentacle (w/ Tentacle Manager)
531540 FileSystemTasks . CopyFile ( ArtifactsDirectory / "zip" / $ "tentacle-{ FullSemVer } -{ NetCoreWindows } -win-x86.zip",
532541 workingDirectory / $ "tentacle-{ NetCoreWindows } -win-x86.zip") ;
533542 FileSystemTasks . CopyFile ( ArtifactsDirectory / "zip" / $ "tentacle-{ FullSemVer } -{ NetCoreWindows } -win-x64.zip",
534543 workingDirectory / $ "tentacle-{ NetCoreWindows } -win-x64.zip") ;
535544
545+ // Assert all the expected files have been successfully copied
536546 Assert . True ( ( workingDirectory / "Octopus.Tentacle.msi" ) . FileExists ( ) , "Missing Octopus.Tentacle.msi" ) ;
537547 Assert . True ( ( workingDirectory / "Octopus.Tentacle-x64.msi" ) . FileExists ( ) , "Missing Octopus.Tentacle-x64.msi" ) ;
538548 Assert . True ( ( workingDirectory / "Octopus.Tentacle.Upgrader.exe" ) . FileExists ( ) , "Missing Octopus.Tentacle.Upgrader.exe" ) ;
539- foreach ( var framework in new [ ] { NetCore } )
540- {
541- Assert . True ( ( workingDirectory / $ "Octopus.Tentacle-{ framework } -win-x86.msi") . FileExists ( ) , $ "Missing Octopus.Tentacle-{ framework } -win-x86.msi") ;
542- Assert . True ( ( workingDirectory / $ "Octopus.Tentacle-{ framework } -win-x64.msi") . FileExists ( ) , $ "Missing Octopus.Tentacle-{ framework } -win-x64.msi") ;
543- Assert . True ( ( workingDirectory / $ "Octopus.Tentacle-{ framework } -windows-win-x86.msi") . FileExists ( ) , $ "Missing Octopus.Tentacle-{ framework } -windows-win-x86.msi") ;
544- Assert . True ( ( workingDirectory / $ "Octopus.Tentacle-{ framework } -windows-win-x64.msi") . FileExists ( ) , $ "Missing Octopus.Tentacle-{ framework } -windows-win-x64.msi") ;
545- Assert . True ( ( workingDirectory / $ "Octopus.Tentacle.Upgrader-{ framework } -win-x86.exe") . FileExists ( ) , $ "Missing Octopus.Tentacle.Upgrader-{ framework } -win-x86.exe") ;
546- Assert . True ( ( workingDirectory / $ "Octopus.Tentacle.Upgrader-{ framework } -win-x64.exe") . FileExists ( ) , $ "Missing Octopus.Tentacle.Upgrader-{ framework } -win-x64.exe") ;
547- }
549+ Assert . True ( ( workingDirectory / $ "Octopus.Tentacle-{ NetCore } -win-x86.msi") . FileExists ( ) , $ "Missing Octopus.Tentacle-{ NetCore } -win-x86.msi") ;
550+ Assert . True ( ( workingDirectory / $ "Octopus.Tentacle-{ NetCore } -win-x64.msi") . FileExists ( ) , $ "Missing Octopus.Tentacle-{ NetCore } -win-x64.msi") ;
551+ Assert . True ( ( workingDirectory / $ "Octopus.Tentacle-{ NetCore } -windows-win-x86.msi") . FileExists ( ) , $ "Missing Octopus.Tentacle-{ NetCore } -windows-win-x86.msi") ;
552+ Assert . True ( ( workingDirectory / $ "Octopus.Tentacle-{ NetCore } -windows-win-x64.msi") . FileExists ( ) , $ "Missing Octopus.Tentacle-{ NetCore } -windows-win-x64.msi") ;
553+ Assert . True ( ( workingDirectory / $ "Octopus.Tentacle.Upgrader-{ NetCore } -win-x86.exe") . FileExists ( ) , $ "Missing Octopus.Tentacle.Upgrader-{ NetCore } -win-x86.exe") ;
554+ Assert . True ( ( workingDirectory / $ "Octopus.Tentacle.Upgrader-{ NetCore } -win-x64.exe") . FileExists ( ) , $ "Missing Octopus.Tentacle.Upgrader-{ NetCore } -win-x64.exe") ;
548555 Assert . True ( ( workingDirectory / debAmd64PackageFilename ) . FileExists ( ) , $ "Missing { debAmd64PackageFilename } ") ;
549556 Assert . True ( ( workingDirectory / debArm64PackageFilename ) . FileExists ( ) , $ "Missing { debArm64PackageFilename } ") ;
550557 Assert . True ( ( workingDirectory / debArm32PackageFilename ) . FileExists ( ) , $ "Missing { debArm32PackageFilename } ") ;
551558 Assert . True ( ( workingDirectory / rpmArm64PackageFilename ) . FileExists ( ) , $ "Missing { rpmArm64PackageFilename } ") ;
552559 Assert . True ( ( workingDirectory / rpmArm32PackageFilename ) . FileExists ( ) , $ "Missing { rpmArm32PackageFilename } ") ;
553560 Assert . True ( ( workingDirectory / rpmx64PackageFilename ) . FileExists ( ) , $ "Missing { rpmx64PackageFilename } ") ;
554561
555- const string description = "The deployment agent that is installed on each machine you plan to deploy to using Octopus." ;
562+ const string id = "Octopus.Tentacle.CrossPlatformBundle" ;
563+
556564 const string author = "Octopus Deploy" ;
557565 const string title = "Octopus Tentacle cross platform bundle" ;
566+ const string description = "The deployment agent that is installed on each machine you plan to deploy to using Octopus." ;
558567
559- const string id = "Octopus.Tentacle.CrossPlatformBundle" ;
560- var outFolder = ArtifactsDirectory / "nuget" ;
561-
562- var octopus = InstallOctopusCli ( ) ;
563- // Note: Nuke automatically escapes this string by using the string interpolation syntax
564- ProcessTasks . StartProcess (
565- octopus ,
566- $ "package nuget create --id { id } --version { FullSemVer } --base-path { workingDirectory } --out-folder { outFolder } --author { author } --title { title } --description { description } --no-prompt"
567- ) . WaitForExit ( ) ;
568+ CreateNugetPackage ( workingDirectory , id , description , author , title ) ;
569+ } ) ;
570+
571+ [ PublicAPI ]
572+ Target PackCrossPlatformBundleForServer => _ => _
573+ . Description ( "Packs the cross-platform Tentacle.nupkg used by Octopus Server to dynamically upgrade Tentacles." )
574+ . Executes ( ( ) =>
575+ {
576+ ( ArtifactsDirectory / "nuget" ) . CreateDirectory ( ) ;
577+
578+ var workingDirectory = BuildDirectory / "Octopus.Tentacle.CrossPlatformBundle.Server" ;
579+ workingDirectory . CreateDirectory ( ) ;
580+
581+ // Get the .NET Framework 4.8 installers for Tentacle
582+ FileSystemTasks . CopyFile ( ArtifactsDirectory / "msi" / $ "Octopus.Tentacle.{ FullSemVer } .msi", workingDirectory / "Octopus.Tentacle.msi" ) ;
583+ FileSystemTasks . CopyFile ( ArtifactsDirectory / "msi" / $ "Octopus.Tentacle.{ FullSemVer } -x64.msi", workingDirectory / "Octopus.Tentacle-x64.msi" ) ;
584+
585+ // Get the .NET 8.0 installers for Tentacle
586+ FileSystemTasks . CopyFile ( ArtifactsDirectory / "msi" / $ "Octopus.Tentacle.{ FullSemVer } -net8.0-win-x86.msi", workingDirectory / "Octopus.Tentacle-net8.0-win-x86.msi" ) ;
587+ FileSystemTasks . CopyFile ( ArtifactsDirectory / "msi" / $ "Octopus.Tentacle.{ FullSemVer } -net8.0-win-x64.msi", workingDirectory / "Octopus.Tentacle-net8.0-win-x64.msi" ) ;
588+
589+ // Get the .NET 8.0 installers for the Tentacle Upgrader
590+ FileSystemTasks . CopyFile ( BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x86" / "Octopus.Tentacle.Upgrader.exe" , workingDirectory / "Octopus.Tentacle.Upgrader-net8.0-win-x86.exe" ) ;
591+ FileSystemTasks . CopyFile ( BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x64" / "Octopus.Tentacle.Upgrader.exe" , workingDirectory / "Octopus.Tentacle.Upgrader-net8.0-win-x64.exe" ) ;
592+
593+ // Get the .NET Framework 4.8 installers for the Tentacle Upgrader
594+ var octopusTentacleUpgraderDirectory = BuildDirectory / "Octopus.Tentacle.Upgrader" / NetFramework / "win" ;
595+ octopusTentacleUpgraderDirectory . GlobFiles ( "*" ) . ForEach ( x => FileSystemTasks . CopyFileToDirectory ( x , workingDirectory ) ) ;
596+
597+ // Get the archives for all required runtimes
598+ foreach ( var runtimeId in CrossPlatformBundleForServerRequiredRuntimes )
599+ {
600+ // We don't need the zip archives for Windows runtimes
601+ // as we've already manually grabbed the installers
602+ if ( runtimeId . StartsWith ( "win" ) ) continue ;
603+
604+ FileSystemTasks . CopyFile ( ArtifactsDirectory / "zip" / $ "tentacle-{ FullSemVer } -{ NetCore } -{ runtimeId } .{ "tar.gz" } ",
605+ workingDirectory / $ "tentacle-{ NetCore } -{ runtimeId } .{ "tar.gz" } ") ;
606+ }
607+
608+ // Assert all the expected files have been successfully copied
609+ Assert . True ( ( workingDirectory / "Octopus.Tentacle.msi" ) . FileExists ( ) , "Missing Octopus.Tentacle.msi" ) ;
610+ Assert . True ( ( workingDirectory / "Octopus.Tentacle-x64.msi" ) . FileExists ( ) , "Missing Octopus.Tentacle-x64.msi" ) ;
611+ Assert . True ( ( workingDirectory / "Octopus.Tentacle.Upgrader.exe" ) . FileExists ( ) , "Missing Octopus.Tentacle.Upgrader.exe" ) ;
612+ Assert . True ( ( workingDirectory / $ "Octopus.Tentacle-{ NetCore } -win-x86.msi") . FileExists ( ) , $ "Missing Octopus.Tentacle-{ NetCore } -win-x86.msi") ;
613+ Assert . True ( ( workingDirectory / $ "Octopus.Tentacle-{ NetCore } -win-x64.msi") . FileExists ( ) , $ "Missing Octopus.Tentacle-{ NetCore } -win-x64.msi") ;
614+ Assert . True ( ( workingDirectory / $ "Octopus.Tentacle.Upgrader-{ NetCore } -win-x86.exe") . FileExists ( ) , $ "Missing Octopus.Tentacle.Upgrader-{ NetCore } -win-x86.exe") ;
615+ Assert . True ( ( workingDirectory / $ "Octopus.Tentacle.Upgrader-{ NetCore } -win-x64.exe") . FileExists ( ) , $ "Missing Octopus.Tentacle.Upgrader-{ NetCore } -win-x64.exe") ;
616+
617+ const string id = "Octopus.Tentacle.CrossPlatformBundle.Server" ;
618+
619+ const string author = "Octopus Deploy" ;
620+ const string title = "Octopus Tentacle cross platform bundle (for Octopus Server)" ;
621+ const string description = "The deployment agent that is installed on each machine you plan to deploy to using Octopus." ;
622+
623+ CreateNugetPackage ( workingDirectory , id , author , title , description ) ;
568624 } ) ;
569625
626+ void CreateNugetPackage (
627+ AbsolutePath workingDirectory ,
628+ string id ,
629+ string author ,
630+ string title ,
631+ string description )
632+ {
633+ var outFolder = ArtifactsDirectory / "nuget" ;
634+ var octopus = InstallOctopusCli ( ) ;
635+
636+ // Note: Nuke automatically escapes this string by using the string interpolation syntax
637+ ProcessTasks . StartProcess (
638+ octopus ,
639+ $ "package nuget create --id { id } --version { FullSemVer } --base-path { workingDirectory } --out-folder { outFolder } --author { author } --title { title } --description { description } --no-prompt"
640+ ) . WaitForExit ( ) ;
641+ }
642+
570643 [ PublicAPI ]
571644 Target Pack => _ => _
572645 . Description ( "Pack all the artifacts. Notional task - running this on a single host is possible but cumbersome." )
573646 . DependsOn ( PackCrossPlatformBundle )
647+ . DependsOn ( PackCrossPlatformBundleForServer )
574648 . DependsOn ( PackContracts )
575649 . DependsOn ( PackCore )
576650 . DependsOn ( PackClient ) ;
@@ -597,7 +671,7 @@ void PackTarballs(string framework, string runtimeId)
597671 $ "tentacle-{ FullSemVer } -{ framework } -{ runtimeId } .tar.gz") ;
598672 }
599673
600- void BuildAndPushOrLoadKubernetesTentacleContainerImage ( bool push , bool load , string runtimeDepsImageTag , string ? host = null , bool includeDebugger = false , string ? tagSuffix = null )
674+ void BuildAndPushOrLoadKubernetesTentacleContainerImage ( bool push , bool load , string runtimeDepsImageTag , string ? host = null , bool includeDebugger = false , string ? tagSuffix = null )
601675 {
602676 var hostPrefix = host is not null ? $ "{ host } /" : string . Empty ;
603677 DockerTasks . DockerBuildxBuild ( settings =>
@@ -654,7 +728,7 @@ void CopyDebianPackageToDockerFolder(string runtimeId)
654728
655729 FileSystemTasks . CopyFile ( packageFilePath , dockerDir / $ "tentacle_{ FullSemVer } _linux-{ dockerArch } .deb") ;
656730 }
657-
731+
658732 string GetMicrok8sIpAddress ( )
659733 {
660734 var microk8sInfoOutput = Multipass . Invoke ( "info microk8s-vm --format json" ) ;
0 commit comments