Skip to content

Commit 564e70b

Browse files
committed
Install DSCv3 early due to error outside of winget code on server
1 parent ce44a79 commit 564e70b

4 files changed

Lines changed: 14 additions & 7 deletions

File tree

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ jobs:
520520
# Build and test PowerShell module
521521

522522
- job: 'BuildPowerShellModule'
523-
timeoutInMinutes: 240
523+
timeoutInMinutes: 120
524524
dependsOn: 'Build'
525525
condition: succeeded('Build')
526526
variables:
@@ -604,7 +604,7 @@ jobs:
604604
condition: succeededOrFailed()
605605

606606
- task: PowerShell@2
607-
displayName: Copy winget logs
607+
displayName: Copy WinGet Logs
608608
inputs:
609609
pwsh: true
610610
targetType: inline

src/PowerShell/Microsoft.WinGet.Configuration.Engine/Commands/ConfigurationCommand.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,7 @@ private async Task InstallDSCv3Package(OpenConfigurationParameters openParams)
424424
this.Write(StreamType.Information, Resources.ConfigurationInstallDscPackage);
425425

426426
InitialSessionState initialSessionState = InitialSessionState.CreateDefault();
427-
428-
// initialSessionState.ExecutionPolicy = openParams.ExecutionPolicy;
427+
initialSessionState.ExecutionPolicy = openParams.ExecutionPolicy;
429428
Runspace runspace = RunspaceFactory.CreateRunspace(initialSessionState);
430429
runspace.Open();
431430
PowerShell installDSCv3 = PowerShell.Create(runspace).AddScript(

src/PowerShell/tests/Microsoft.WinGet.Configuration.Tests.ps1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,16 @@ BeforeAll {
2222

2323
Import-Module Microsoft.WinGet.Configuration
2424

25-
# The msstore source will be used to install DSCv3 package
25+
# TODO: Installing within the test run on the build server (only) somehow causes below error:
26+
# [CORE] Started MSStore package execution. ProductId: 9PCX3HX4HZ0Z PackageFamilyName: Microsoft.DesiredStateConfiguration-Preview_8wekyb3d8bbwe
27+
# [CLI ] MSStore install failed. ProductId: 9PCX3HX4HZ0Z HResult: 0x80010002
28+
# So install the DSCv3 package here.
2629
Import-Module Microsoft.WinGet.Client
30+
$installResult = Install-WingetPackage -Id 9PCX3HX4HZ0Z -Source msstore
31+
if ($installResult.Status -ne 'Ok')
32+
{
33+
Write-Error "Failed to install DSCv3 package. Status: $($installResult.Status). ExtendedErrorCode: $($installResult.ExtendedErrorCode)." -ErrorAction Stop
34+
}
2735

2836
function CreatePolicyKeyIfNotExists()
2937
{

src/PowerShell/tests/RunTests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ if (-not [System.String]::IsNullOrEmpty($packageLayoutPath))
4444
{
4545
$local:wingetExeName = "wingetdev.exe"
4646
}
47-
47+
4848
$local:settingsExport = ConvertFrom-Json (& $local:wingetExeName settings export)
4949
$local:settingsFilePath = $local:settingsExport.userSettingsFile
50-
$local:settingsFileContent = ConvertTo-Json @{ debugging= @{ enableSelfInitiatedMinidump=$true ; keepAllLogFiles=$true } }
50+
$local:settingsFileContent = ConvertTo-Json @{ debugging= @{ enableSelfInitiatedMinidump=$true ; keepAllLogFiles=$true }; experimentalFeatures= @{ dsc3=$true } }
5151

5252
Set-Content -Path $local:settingsFilePath -Value $local:settingsFileContent
5353
}

0 commit comments

Comments
 (0)