Skip to content

Commit 6996498

Browse files
committed
fix(ci): fix devolutions-agent packaging
1 parent 38d27b4 commit 6996498

File tree

5 files changed

+56
-18
lines changed

5 files changed

+56
-18
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ jobs:
715715
- name: Install Pester module
716716
id: prepare
717717
shell: pwsh
718-
run: Install-Module Pester -Force
718+
run: Install-Module Pester -RequiredVersion 5.5.0 -Force
719719

720720
- name: Build module
721721
shell: pwsh

.github/workflows/package.yml

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ jobs:
244244
if: matrix.os == 'windows' && (matrix.project == 'devolutions-gateway' || matrix.project == 'devolutions-agent')
245245
uses: microsoft/setup-msbuild@v2
246246

247-
- name: Regenerate MSI
248-
if: (matrix.project == 'devolutions-gateway' || matrix.project == 'devolutions-agent') && matrix.os == 'windows'
247+
- name: Regenerate Gateway MSI
248+
if: matrix.project == 'devolutions-gateway' && matrix.os == 'windows'
249249
shell: pwsh
250250
run: |
251251
$PackageRoot = Join-Path ${{ runner.temp }} ${{ matrix.project}}
@@ -257,10 +257,19 @@ jobs:
257257
Remove-Item $_.FullName -Force
258258
}
259259
260-
./ci/tlk.ps1 package -PackageOption generate
260+
./ci/tlk.ps1 package -Product gateway -PackageOption generate
261261
262-
- name: Sign msi runtime
263-
if: (matrix.project == 'devolutions-gateway' || matrix.project == 'devolutions-agent') && matrix.os == 'windows'
262+
- name: Regenerate Agent MSI
263+
if: matrix.project == 'devolutions-agent' && matrix.os == 'windows'
264+
shell: pwsh
265+
run: |
266+
$PackageRoot = Join-Path ${{ runner.temp }} ${{ matrix.project}}
267+
$Env:DAGENT_EXECUTABLE = Get-ChildItem -Path $PackageRoot -Recurse -Include '*DevolutionsAgent*.exe' | Select -First 1
268+
269+
./ci/tlk.ps1 package -Product agent -PackageOption generate
270+
271+
- name: Sign Gateway MSI runtime
272+
if: matrix.project == 'devolutions-gateway' && matrix.os == 'windows'
264273
shell: pwsh
265274
working-directory: package/WindowsManaged/Release
266275
run: |
@@ -276,7 +285,24 @@ jobs:
276285
AzureSignTool @Params $_.FullName
277286
}
278287
279-
- name: Repackage gateway
288+
- name: Sign Agent MSI runtime
289+
if: matrix.project == 'devolutions-agent' && matrix.os == 'windows'
290+
shell: pwsh
291+
working-directory: package/AgentWindowsManaged/Release
292+
run: |
293+
Get-ChildItem -Path .\* -Include "*.exe" | % {
294+
$Params = @('sign',
295+
'-kvt', '${{ secrets.AZURE_TENANT_ID }}',
296+
'-kvu', '${{ secrets.CODE_SIGNING_KEYVAULT_URL }}',
297+
'-kvi', '${{ secrets.CODE_SIGNING_CLIENT_ID }}',
298+
'-kvs', '${{ secrets.CODE_SIGNING_CLIENT_SECRET }}',
299+
'-kvc', '${{ secrets.CODE_SIGNING_CERTIFICATE_NAME }}',
300+
'-tr', '${{ vars.CODE_SIGNING_TIMESTAMP_SERVER }}',
301+
'-v')
302+
AzureSignTool @Params $_.FullName
303+
}
304+
305+
- name: Repackage Gateway
280306
if: matrix.project == 'devolutions-gateway' && matrix.os == 'windows'
281307
shell: pwsh
282308
run: |
@@ -285,7 +311,7 @@ jobs:
285311
286312
./ci/tlk.ps1 package -Product gateway -PackageOption assemble
287313
288-
- name: Repackage agent
314+
- name: Repackage Agent
289315
if: matrix.project == 'devolutions-agent' && matrix.os == 'windows'
290316
shell: pwsh
291317
run: |
@@ -298,6 +324,11 @@ jobs:
298324
if: (matrix.project == 'devolutions-gateway' || matrix.project == 'devolutions-agent') && matrix.os == 'windows'
299325
shell: pwsh
300326
run: |
327+
$ContentDescription = switch ('${{ matrix.project }}') {
328+
'devolutions-gateway' { 'Devolutions Gateway' }
329+
'devolutions-agent' { 'Devolutions Agent' }
330+
}
331+
301332
Get-ChildItem -Path ${{ runner.temp }} -Recurse -Include '*.msi' | % {
302333
$Params = @('sign',
303334
'-kvt', '${{ secrets.AZURE_TENANT_ID }}',
@@ -306,7 +337,7 @@ jobs:
306337
'-kvs', '${{ secrets.CODE_SIGNING_CLIENT_SECRET }}',
307338
'-kvc', '${{ secrets.CODE_SIGNING_CERTIFICATE_NAME }}',
308339
'-tr', '${{ vars.CODE_SIGNING_TIMESTAMP_SERVER }}',
309-
'-d', 'Devolutions Gateway',
340+
'-d', $ContentDescription,
310341
'-v')
311342
AzureSignTool @Params $_.FullName
312343
}

ci/tlk.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,13 @@ class TlkRecipe
429429

430430
[void] Package_Windows_Managed_Assemble() {
431431
Push-Location
432-
Set-Location "$($this.SourcePath)/package/$($this.Target.Platform)Managed"
432+
433+
$InputPackagePathPrefix = switch ($this.Product) {
434+
"gateway" { "" }
435+
"agent" { "Agent" }
436+
}
437+
438+
Set-Location "$($this.SourcePath)/package/$($InputPackagePathPrefix)$($this.Target.Platform)Managed"
433439

434440
$TargetConfiguration = "Release"
435441

@@ -441,7 +447,8 @@ class TlkRecipe
441447
foreach ($PackageLanguage in $([TlkRecipe]::PackageLanguages | Select-Object -Skip 1)) {
442448
# Build the localized MSI
443449
& ".\$TargetConfiguration\$($PackageLanguage.Name)\Build_$($this.PackageName()).cmd"
444-
$LangMsi = Join-Path $TargetConfiguration $($PackageLanguage.Name) "$($this.PackageName()).msi"
450+
$LangDir = Join-Path $TargetConfiguration $PackageLanguage.Name
451+
$LangMsi = Join-Path $LangDir "$($this.PackageName()).msi"
445452
$Transform = Join-Path $TargetConfiguration "$($PackageLanguage.Name).mst"
446453
# Generate a language transform
447454
& 'torch.exe' "$BaseMsi" "$LangMsi" "-o" "$Transform" | Out-Host

package/AgentWindowsManaged/Actions/GatewayActions.cs renamed to package/AgentWindowsManaged/Actions/AgentActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace DevolutionsAgent.Actions;
1010

11-
internal static class GatewayActions
11+
internal static class AgentActions
1212
{
1313
// Immediate sequence
1414

package/AgentWindowsManaged/Program.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static void Main()
142142
{
143143
new()
144144
{
145-
Cabinet = "dgateway.cab",
145+
Cabinet = "dagent.cab",
146146
EmbedCab = true,
147147
CompressionLevel = CompressionLevel.mszip,
148148
}
@@ -195,7 +195,7 @@ static void Main()
195195
{
196196
Type = SvcType.ownProcess,
197197
// In contrast to Devolutions Gateway, Devolutions Agent uses LocalSystem
198-
// accout to be able to perform administrative operations
198+
// accout to be able to perform administrative operations
199199
// such as MSI installation (Updating, restarting DevolutionsGateway).
200200
Interactive = false,
201201
Vital = true,
@@ -217,7 +217,7 @@ static void Main()
217217
project.ResolveWildCards(true);
218218

219219
project.DefaultRefAssemblies.Add(typeof(ZipArchive).Assembly.Location);
220-
project.Actions = GatewayActions.Actions;
220+
project.Actions = AgentActions.Actions;
221221
project.RegValues = new RegValue[]
222222
{
223223
new (RegistryHive.LocalMachine, $"Software\\{Includes.VENDOR_NAME}\\{Includes.SHORT_NAME}", "InstallDir", $"[{AgentProperties.InstallDir}]")
@@ -240,7 +240,7 @@ static void Main()
240240

241241
project.UnhandledException += Project_UnhandledException;
242242
project.UIInitialized += Project_UIInitialized;
243-
243+
244244
if (SourceOnlyBuild)
245245
{
246246
project.Language = ProjectLangId;
@@ -269,7 +269,7 @@ static void Main()
269269

270270
msi.EmbedTransform(mstFile);
271271
}
272-
272+
273273
msi.SetPackageLanguages(string.Join(",", Languages.Keys).ToLcidList());
274274
}
275275
}
@@ -351,7 +351,7 @@ string I18n(string key)
351351
e.ManagedUI.Shell.ErrorDetected = true;
352352
e.Result = ActionResult.UserExit;
353353
}
354-
354+
355355
if (netfx45Version < 528040)
356356
{
357357
if (MessageBox.Show(I18n(Strings.DotNet48IsStrongRecommendedDownloadNow), I18n(Strings.AgentDlg_Title),

0 commit comments

Comments
 (0)