From 3cb990592e7aa8e2039cedc197fe4c3c28a4f754 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL HE/HIM) (from Dev Box)" Date: Tue, 27 Aug 2024 09:57:04 -0700 Subject: [PATCH 01/12] Change installing modules for testing to use AzArtifacts feed --- build.ps1 | 9 +++++++-- dsc/Cargo.lock | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build.ps1 b/build.ps1 index 8a64b8dc..45d29922 100644 --- a/build.ps1 +++ b/build.ps1 @@ -352,18 +352,23 @@ if (!$Clippy -and !$SkipBuild) { if ($Test) { $failed = $false + if ($null -eq (Get-PSResourceRepository -Name CFS -ErrorAction Ignore)) { + "Registering CFS repository" + Register-PSResourceRepository -uri 'https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2' -Name CFS -Trusted + } + if ($IsWindows) { # PSDesiredStateConfiguration module is needed for Microsoft.Windows/WindowsPowerShell adapter $FullyQualifiedName = @{ModuleName="PSDesiredStateConfiguration";ModuleVersion="2.0.7"} if (-not(Get-Module -ListAvailable -FullyQualifiedName $FullyQualifiedName)) { "Installing module PSDesiredStateConfiguration 2.0.7" - Install-PSResource -Name PSDesiredStateConfiguration -Version 2.0.7 -Repository PSGallery -TrustRepository + Install-PSResource -Name PSDesiredStateConfiguration -Version 2.0.7 -Repository CFS } } if (-not(Get-Module -ListAvailable -Name Pester)) { "Installing module Pester" - Install-PSResource Pester -WarningAction Ignore -Repository PSGallery -TrustRepository + Install-PSResource Pester -WarningAction Ignore -Repository CFS } foreach ($project in $projects) { diff --git a/dsc/Cargo.lock b/dsc/Cargo.lock index 176c9844..3452b44b 100644 --- a/dsc/Cargo.lock +++ b/dsc/Cargo.lock @@ -469,7 +469,7 @@ dependencies = [ [[package]] name = "dsc" -version = "3.0.0-preview.9" +version = "3.0.0-preview.10" dependencies = [ "atty", "clap", From 99ebf5108b6cbaefd3fb8b2327f74786474e804a Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL HE/HIM) (from Dev Box)" Date: Tue, 27 Aug 2024 13:15:28 -0700 Subject: [PATCH 02/12] add verbose output to installing modules --- build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.ps1 b/build.ps1 index 45d29922..046d7303 100644 --- a/build.ps1 +++ b/build.ps1 @@ -362,13 +362,13 @@ if ($Test) { $FullyQualifiedName = @{ModuleName="PSDesiredStateConfiguration";ModuleVersion="2.0.7"} if (-not(Get-Module -ListAvailable -FullyQualifiedName $FullyQualifiedName)) { "Installing module PSDesiredStateConfiguration 2.0.7" - Install-PSResource -Name PSDesiredStateConfiguration -Version 2.0.7 -Repository CFS + Install-PSResource -Name PSDesiredStateConfiguration -Version 2.0.7 -Repository CFS -Verbose } } if (-not(Get-Module -ListAvailable -Name Pester)) { "Installing module Pester" - Install-PSResource Pester -WarningAction Ignore -Repository CFS + Install-PSResource Pester -WarningAction Ignore -Repository CFS -Verbose } foreach ($project in $projects) { From 3b9ad33c3c9119dd238658f00e39defa63161e42 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL HE/HIM) (from Dev Box)" Date: Tue, 27 Aug 2024 13:34:11 -0700 Subject: [PATCH 03/12] change where modules are installed from depending on GitHub or ADO --- build.ps1 | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/build.ps1 b/build.ps1 index 046d7303..511a1a3d 100644 --- a/build.ps1 +++ b/build.ps1 @@ -352,9 +352,17 @@ if (!$Clippy -and !$SkipBuild) { if ($Test) { $failed = $false - if ($null -eq (Get-PSResourceRepository -Name CFS -ErrorAction Ignore)) { - "Registering CFS repository" - Register-PSResourceRepository -uri 'https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2' -Name CFS -Trusted + $usingADO = ($null -ne $env:TF_BUILD) + + if ($usingADO) { + $repository = 'CFS' + if ($null -eq (Get-PSResourceRepository -Name CFS -ErrorAction Ignore)) { + "Registering CFS repository" + Register-PSResourceRepository -uri 'https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2' -Name CFS -Trusted + } + } + else { + $repository = 'PSGallery' } if ($IsWindows) { @@ -362,13 +370,13 @@ if ($Test) { $FullyQualifiedName = @{ModuleName="PSDesiredStateConfiguration";ModuleVersion="2.0.7"} if (-not(Get-Module -ListAvailable -FullyQualifiedName $FullyQualifiedName)) { "Installing module PSDesiredStateConfiguration 2.0.7" - Install-PSResource -Name PSDesiredStateConfiguration -Version 2.0.7 -Repository CFS -Verbose + Install-PSResource -Name PSDesiredStateConfiguration -Version 2.0.7 -Repository $repository } } if (-not(Get-Module -ListAvailable -Name Pester)) { "Installing module Pester" - Install-PSResource Pester -WarningAction Ignore -Repository CFS -Verbose + Install-PSResource Pester -WarningAction Ignore -Repository $repository } foreach ($project in $projects) { From 188d57d0a8cce0f6a7dd30f3befcd9adba97bf1a Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL HE/HIM) (from Dev Box)" Date: Tue, 27 Aug 2024 13:36:25 -0700 Subject: [PATCH 04/12] also update save-psresource to use correct repository --- build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index 511a1a3d..432778c7 100644 --- a/build.ps1 +++ b/build.ps1 @@ -421,7 +421,7 @@ if ($Test) { if (-not(Get-Module -ListAvailable -Name Pester)) { "Installing module Pester" $InstallTargetDir = ($env:PSModulePath -split ";")[0] - Find-PSResource -Name 'Pester' -Repository 'PSGallery' | Save-PSResource -Path $InstallTargetDir -TrustRepository + Find-PSResource -Name 'Pester' -Repository $repository | Save-PSResource -Path $InstallTargetDir -TrustRepository } "Updated Pester module location:" From 1b74ddcac9292f76585eda9b710f0de4f8a8f772 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL HE/HIM) (from Dev Box)" Date: Tue, 27 Aug 2024 14:33:00 -0700 Subject: [PATCH 05/12] change $repository to be defined by default --- build.ps1 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build.ps1 b/build.ps1 index 432778c7..0f3c7acf 100644 --- a/build.ps1 +++ b/build.ps1 @@ -353,6 +353,7 @@ if ($Test) { $failed = $false $usingADO = ($null -ne $env:TF_BUILD) + $repository = 'PSGallery' if ($usingADO) { $repository = 'CFS' @@ -361,15 +362,12 @@ if ($Test) { Register-PSResourceRepository -uri 'https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v2' -Name CFS -Trusted } } - else { - $repository = 'PSGallery' - } if ($IsWindows) { # PSDesiredStateConfiguration module is needed for Microsoft.Windows/WindowsPowerShell adapter $FullyQualifiedName = @{ModuleName="PSDesiredStateConfiguration";ModuleVersion="2.0.7"} if (-not(Get-Module -ListAvailable -FullyQualifiedName $FullyQualifiedName)) - { "Installing module PSDesiredStateConfiguration 2.0.7" + { Install-PSResource -Name PSDesiredStateConfiguration -Version 2.0.7 -Repository $repository } } From 585a3a7f7aab0fd994968e198ffaeda22901468d Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL HE/HIM) (from Dev Box)" Date: Tue, 27 Aug 2024 14:59:05 -0700 Subject: [PATCH 06/12] add verbose output --- build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index 0f3c7acf..6b907cb1 100644 --- a/build.ps1 +++ b/build.ps1 @@ -368,7 +368,7 @@ if ($Test) { $FullyQualifiedName = @{ModuleName="PSDesiredStateConfiguration";ModuleVersion="2.0.7"} if (-not(Get-Module -ListAvailable -FullyQualifiedName $FullyQualifiedName)) { - Install-PSResource -Name PSDesiredStateConfiguration -Version 2.0.7 -Repository $repository + Install-PSResource -Name PSDesiredStateConfiguration -Version 2.0.7 -Repository $repository -Verbose } } From 8eb3183271556f44bf2ee23d0e1bb98818db74e5 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL HE/HIM) (from Dev Box)" Date: Tue, 27 Aug 2024 16:37:13 -0700 Subject: [PATCH 07/12] add tracing of the repo --- build.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/build.ps1 b/build.ps1 index 6b907cb1..67bf2a4d 100644 --- a/build.ps1 +++ b/build.ps1 @@ -368,6 +368,7 @@ if ($Test) { $FullyQualifiedName = @{ModuleName="PSDesiredStateConfiguration";ModuleVersion="2.0.7"} if (-not(Get-Module -ListAvailable -FullyQualifiedName $FullyQualifiedName)) { + write-verbose -verbose "Using '$repository' repository" Install-PSResource -Name PSDesiredStateConfiguration -Version 2.0.7 -Repository $repository -Verbose } } From 2d085d306e6dd7450be14aa22e9dda842de152a3 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL HE/HIM) (from Dev Box)" Date: Tue, 27 Aug 2024 16:55:28 -0700 Subject: [PATCH 08/12] add -trustrepository --- build.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build.ps1 b/build.ps1 index 67bf2a4d..8c877ef3 100644 --- a/build.ps1 +++ b/build.ps1 @@ -368,14 +368,13 @@ if ($Test) { $FullyQualifiedName = @{ModuleName="PSDesiredStateConfiguration";ModuleVersion="2.0.7"} if (-not(Get-Module -ListAvailable -FullyQualifiedName $FullyQualifiedName)) { - write-verbose -verbose "Using '$repository' repository" - Install-PSResource -Name PSDesiredStateConfiguration -Version 2.0.7 -Repository $repository -Verbose + Install-PSResource -Name PSDesiredStateConfiguration -Version 2.0.7 -Repository $repository -TrustRepository } } if (-not(Get-Module -ListAvailable -Name Pester)) { "Installing module Pester" - Install-PSResource Pester -WarningAction Ignore -Repository $repository + Install-PSResource Pester -WarningAction Ignore -Repository $repository -TrustRepository } foreach ($project in $projects) { From 7a9121ae53b8a3a14b98f0a1f893bc7e262d69a8 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL HE/HIM) (from Dev Box)" Date: Wed, 28 Aug 2024 10:44:36 -0700 Subject: [PATCH 09/12] add netlock --- .pipelines/DSC-Official.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pipelines/DSC-Official.yml b/.pipelines/DSC-Official.yml index 73a257d6..890da037 100644 --- a/.pipelines/DSC-Official.yml +++ b/.pipelines/DSC-Official.yml @@ -28,6 +28,7 @@ extends: WindowsHostVersion: Disk: Large Version: 2022 + Network: NetLock customTags: 'ES365AIMigrationTooling' globalSdl: disableLegacyManifest: true From ffb24d574b266b46ddf06335e8f9da8ac89c6749 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL HE/HIM) (from Dev Box)" Date: Wed, 28 Aug 2024 12:09:39 -0700 Subject: [PATCH 10/12] comment out netlock as it breaks npm tool installs --- .pipelines/DSC-Official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/DSC-Official.yml b/.pipelines/DSC-Official.yml index 890da037..a8f7ff26 100644 --- a/.pipelines/DSC-Official.yml +++ b/.pipelines/DSC-Official.yml @@ -28,7 +28,7 @@ extends: WindowsHostVersion: Disk: Large Version: 2022 - Network: NetLock +# Network: NetLock customTags: 'ES365AIMigrationTooling' globalSdl: disableLegacyManifest: true From c545f26726c15670b65ce786384d1702421c0190 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL HE/HIM) (from Dev Box)" Date: Wed, 28 Aug 2024 12:11:11 -0700 Subject: [PATCH 11/12] schedule weekly build --- .pipelines/DSC-Official.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pipelines/DSC-Official.yml b/.pipelines/DSC-Official.yml index a8f7ff26..8bbdb4e9 100644 --- a/.pipelines/DSC-Official.yml +++ b/.pipelines/DSC-Official.yml @@ -7,6 +7,14 @@ pr: - onebranch - release* +schedules: +- cron: '0 3 * * 1' + displayName: Weekly Build + branches: + include: + - main + always: true + variables: BuildConfiguration: 'release' PackageRoot: '$(System.ArtifactsDirectory)/Packages' From b2957a7844c60b2f6b2fd5531933f1fec4d9dd41 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL HE/HIM) (from Dev Box)" Date: Wed, 28 Aug 2024 14:07:59 -0700 Subject: [PATCH 12/12] add comment about KS3 --- .pipelines/DSC-Official.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.pipelines/DSC-Official.yml b/.pipelines/DSC-Official.yml index 8bbdb4e9..8ba2c670 100644 --- a/.pipelines/DSC-Official.yml +++ b/.pipelines/DSC-Official.yml @@ -33,9 +33,11 @@ extends: template: v2/OneBranch.Official.CrossPlat.yml@onebranchTemplates parameters: featureFlags: - WindowsHostVersion: + WindowsHostVersion: Disk: Large - Version: 2022 + Version: 2022 + Network: KS3 # this retricts network access to public upstream repositories +# Currently can't be used as some NPM pkgs like tree-sitter-cli reach out to GitHub to get the actual zip pkg # Network: NetLock customTags: 'ES365AIMigrationTooling' globalSdl: @@ -57,7 +59,7 @@ extends: apiscan: enabled: false - stages: + stages: - stage: BuildAndSign displayName: Build Native Binaries dependsOn: []