diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a8e6e298..9f21c3435 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -715,7 +715,7 @@ jobs: - name: Install Pester module id: prepare shell: pwsh - run: Install-Module Pester -Force + run: Install-Module Pester -RequiredVersion 5.5.0 -Force - name: Build module shell: pwsh diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index fe22306a9..dfb488360 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -244,8 +244,8 @@ jobs: if: matrix.os == 'windows' && (matrix.project == 'devolutions-gateway' || matrix.project == 'devolutions-agent') uses: microsoft/setup-msbuild@v2 - - name: Regenerate MSI - if: (matrix.project == 'devolutions-gateway' || matrix.project == 'devolutions-agent') && matrix.os == 'windows' + - name: Regenerate Gateway MSI + if: matrix.project == 'devolutions-gateway' && matrix.os == 'windows' shell: pwsh run: | $PackageRoot = Join-Path ${{ runner.temp }} ${{ matrix.project}} @@ -257,10 +257,19 @@ jobs: Remove-Item $_.FullName -Force } - ./ci/tlk.ps1 package -PackageOption generate + ./ci/tlk.ps1 package -Product gateway -PackageOption generate - - name: Sign msi runtime - if: (matrix.project == 'devolutions-gateway' || matrix.project == 'devolutions-agent') && matrix.os == 'windows' + - name: Regenerate Agent MSI + if: matrix.project == 'devolutions-agent' && matrix.os == 'windows' + shell: pwsh + run: | + $PackageRoot = Join-Path ${{ runner.temp }} ${{ matrix.project}} + $Env:DAGENT_EXECUTABLE = Get-ChildItem -Path $PackageRoot -Recurse -Include '*DevolutionsAgent*.exe' | Select -First 1 + + ./ci/tlk.ps1 package -Product agent -PackageOption generate + + - name: Sign Gateway MSI runtime + if: matrix.project == 'devolutions-gateway' && matrix.os == 'windows' shell: pwsh working-directory: package/WindowsManaged/Release run: | @@ -276,7 +285,24 @@ jobs: AzureSignTool @Params $_.FullName } - - name: Repackage gateway + - name: Sign Agent MSI runtime + if: matrix.project == 'devolutions-agent' && matrix.os == 'windows' + shell: pwsh + working-directory: package/AgentWindowsManaged/Release + run: | + Get-ChildItem -Path .\* -Include "*.exe" | % { + $Params = @('sign', + '-kvt', '${{ secrets.AZURE_TENANT_ID }}', + '-kvu', '${{ secrets.CODE_SIGNING_KEYVAULT_URL }}', + '-kvi', '${{ secrets.CODE_SIGNING_CLIENT_ID }}', + '-kvs', '${{ secrets.CODE_SIGNING_CLIENT_SECRET }}', + '-kvc', '${{ secrets.CODE_SIGNING_CERTIFICATE_NAME }}', + '-tr', '${{ vars.CODE_SIGNING_TIMESTAMP_SERVER }}', + '-v') + AzureSignTool @Params $_.FullName + } + + - name: Repackage Gateway if: matrix.project == 'devolutions-gateway' && matrix.os == 'windows' shell: pwsh run: | @@ -285,7 +311,7 @@ jobs: ./ci/tlk.ps1 package -Product gateway -PackageOption assemble - - name: Repackage agent + - name: Repackage Agent if: matrix.project == 'devolutions-agent' && matrix.os == 'windows' shell: pwsh run: | @@ -298,6 +324,11 @@ jobs: if: (matrix.project == 'devolutions-gateway' || matrix.project == 'devolutions-agent') && matrix.os == 'windows' shell: pwsh run: | + $ContentDescription = switch ('${{ matrix.project }}') { + 'devolutions-gateway' { 'Devolutions Gateway' } + 'devolutions-agent' { 'Devolutions Agent' } + } + Get-ChildItem -Path ${{ runner.temp }} -Recurse -Include '*.msi' | % { $Params = @('sign', '-kvt', '${{ secrets.AZURE_TENANT_ID }}', @@ -306,7 +337,7 @@ jobs: '-kvs', '${{ secrets.CODE_SIGNING_CLIENT_SECRET }}', '-kvc', '${{ secrets.CODE_SIGNING_CERTIFICATE_NAME }}', '-tr', '${{ vars.CODE_SIGNING_TIMESTAMP_SERVER }}', - '-d', 'Devolutions Gateway', + '-d', $ContentDescription, '-v') AzureSignTool @Params $_.FullName } diff --git a/ci/tlk.ps1 b/ci/tlk.ps1 index f109b36d7..9d9335e53 100644 --- a/ci/tlk.ps1 +++ b/ci/tlk.ps1 @@ -429,7 +429,13 @@ class TlkRecipe [void] Package_Windows_Managed_Assemble() { Push-Location - Set-Location "$($this.SourcePath)/package/$($this.Target.Platform)Managed" + + $InputPackagePathPrefix = switch ($this.Product) { + "gateway" { "" } + "agent" { "Agent" } + } + + Set-Location "$($this.SourcePath)/package/$($InputPackagePathPrefix)$($this.Target.Platform)Managed" $TargetConfiguration = "Release" @@ -441,7 +447,8 @@ class TlkRecipe foreach ($PackageLanguage in $([TlkRecipe]::PackageLanguages | Select-Object -Skip 1)) { # Build the localized MSI & ".\$TargetConfiguration\$($PackageLanguage.Name)\Build_$($this.PackageName()).cmd" - $LangMsi = Join-Path $TargetConfiguration $($PackageLanguage.Name) "$($this.PackageName()).msi" + $LangDir = Join-Path $TargetConfiguration $PackageLanguage.Name + $LangMsi = Join-Path $LangDir "$($this.PackageName()).msi" $Transform = Join-Path $TargetConfiguration "$($PackageLanguage.Name).mst" # Generate a language transform & 'torch.exe' "$BaseMsi" "$LangMsi" "-o" "$Transform" | Out-Host diff --git a/package/AgentWindowsManaged/Actions/GatewayActions.cs b/package/AgentWindowsManaged/Actions/AgentActions.cs similarity index 99% rename from package/AgentWindowsManaged/Actions/GatewayActions.cs rename to package/AgentWindowsManaged/Actions/AgentActions.cs index 2cc596651..d637b2471 100644 --- a/package/AgentWindowsManaged/Actions/GatewayActions.cs +++ b/package/AgentWindowsManaged/Actions/AgentActions.cs @@ -8,7 +8,7 @@ namespace DevolutionsAgent.Actions; -internal static class GatewayActions +internal static class AgentActions { // Immediate sequence diff --git a/package/AgentWindowsManaged/Program.cs b/package/AgentWindowsManaged/Program.cs index b0050aa93..78d689254 100644 --- a/package/AgentWindowsManaged/Program.cs +++ b/package/AgentWindowsManaged/Program.cs @@ -142,7 +142,7 @@ static void Main() { new() { - Cabinet = "dgateway.cab", + Cabinet = "dagent.cab", EmbedCab = true, CompressionLevel = CompressionLevel.mszip, } @@ -195,7 +195,7 @@ static void Main() { Type = SvcType.ownProcess, // In contrast to Devolutions Gateway, Devolutions Agent uses LocalSystem - // accout to be able to perform administrative operations + // accout to be able to perform administrative operations // such as MSI installation (Updating, restarting DevolutionsGateway). Interactive = false, Vital = true, @@ -217,7 +217,7 @@ static void Main() project.ResolveWildCards(true); project.DefaultRefAssemblies.Add(typeof(ZipArchive).Assembly.Location); - project.Actions = GatewayActions.Actions; + project.Actions = AgentActions.Actions; project.RegValues = new RegValue[] { new (RegistryHive.LocalMachine, $"Software\\{Includes.VENDOR_NAME}\\{Includes.SHORT_NAME}", "InstallDir", $"[{AgentProperties.InstallDir}]") @@ -240,7 +240,7 @@ static void Main() project.UnhandledException += Project_UnhandledException; project.UIInitialized += Project_UIInitialized; - + if (SourceOnlyBuild) { project.Language = ProjectLangId; @@ -269,7 +269,7 @@ static void Main() msi.EmbedTransform(mstFile); } - + msi.SetPackageLanguages(string.Join(",", Languages.Keys).ToLcidList()); } } @@ -351,7 +351,7 @@ string I18n(string key) e.ManagedUI.Shell.ErrorDetected = true; e.Result = ActionResult.UserExit; } - + if (netfx45Version < 528040) { if (MessageBox.Show(I18n(Strings.DotNet48IsStrongRecommendedDownloadNow), I18n(Strings.AgentDlg_Title),