From a410ea71efa85dab39cda342399adf66bb557c45 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Tue, 5 Nov 2024 10:30:06 -0800 Subject: [PATCH 1/3] disable InitializeCIArtifacts until we get a better loop for usage --- eng/common/scripts/Package-Properties.ps1 | 30 ++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/eng/common/scripts/Package-Properties.ps1 b/eng/common/scripts/Package-Properties.ps1 index cf9c1b391eb1..e41753604171 100644 --- a/eng/common/scripts/Package-Properties.ps1 +++ b/eng/common/scripts/Package-Properties.ps1 @@ -106,20 +106,22 @@ class PackageProps { } [void]InitializeCIArtifacts() { - $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot ".." ".." "..") - - $ciFolderPath = Join-Path -Path $RepoRoot -ChildPath (Join-Path "sdk" $this.ServiceDirectory) - $ciFiles = Get-ChildItem -Path $ciFolderPath -Filter "ci*.yml" -File - - if (-not $this.ArtifactDetails) { - foreach ($ciFile in $ciFiles) { - $ciArtifactResult = $this.ParseYmlForArtifact($ciFile.FullName) - if ($ciArtifactResult) { - $this.ArtifactDetails = [Hashtable]$ciArtifactResult.ArtifactConfig - $this.CIMatrixConfigs = $ciArtifactResult.MatrixConfigs - # if this package appeared in this ci file, then we should - # treat this CI file as the source of the Matrix for this package - break + if ($env:TF_BUILD -or $env:GITHUB_ACTIONS) { + $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot ".." ".." "..") + + $ciFolderPath = Join-Path -Path $RepoRoot -ChildPath (Join-Path "sdk" $this.ServiceDirectory) + $ciFiles = Get-ChildItem -Path $ciFolderPath -Filter "ci*.yml" -File + + if (-not $this.ArtifactDetails) { + foreach ($ciFile in $ciFiles) { + $ciArtifactResult = $this.ParseYmlForArtifact($ciFile.FullName) + if ($ciArtifactResult) { + $this.ArtifactDetails = [Hashtable]$ciArtifactResult.ArtifactConfig + $this.CIMatrixConfigs = $ciArtifactResult.MatrixConfigs + # if this package appeared in this ci file, then we should + # treat this CI file as the source of the Matrix for this package + break + } } } } From d7e2f05bf0c0b2c83ac0b91fa109eb8323f6205f Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Tue, 5 Nov 2024 10:44:05 -0800 Subject: [PATCH 2/3] feedback from Ben --- eng/common/scripts/Package-Properties.ps1 | 34 ++++++++++++----------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/eng/common/scripts/Package-Properties.ps1 b/eng/common/scripts/Package-Properties.ps1 index e41753604171..22b109ca6e26 100644 --- a/eng/common/scripts/Package-Properties.ps1 +++ b/eng/common/scripts/Package-Properties.ps1 @@ -106,22 +106,24 @@ class PackageProps { } [void]InitializeCIArtifacts() { - if ($env:TF_BUILD -or $env:GITHUB_ACTIONS) { - $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot ".." ".." "..") - - $ciFolderPath = Join-Path -Path $RepoRoot -ChildPath (Join-Path "sdk" $this.ServiceDirectory) - $ciFiles = Get-ChildItem -Path $ciFolderPath -Filter "ci*.yml" -File - - if (-not $this.ArtifactDetails) { - foreach ($ciFile in $ciFiles) { - $ciArtifactResult = $this.ParseYmlForArtifact($ciFile.FullName) - if ($ciArtifactResult) { - $this.ArtifactDetails = [Hashtable]$ciArtifactResult.ArtifactConfig - $this.CIMatrixConfigs = $ciArtifactResult.MatrixConfigs - # if this package appeared in this ci file, then we should - # treat this CI file as the source of the Matrix for this package - break - } + if ($env:SYSTEM_TEAMPROJECTID -or $env:GITHUB_ACTIONS) { + return + } + + $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot ".." ".." "..") + + $ciFolderPath = Join-Path -Path $RepoRoot -ChildPath (Join-Path "sdk" $this.ServiceDirectory) + $ciFiles = Get-ChildItem -Path $ciFolderPath -Filter "ci*.yml" -File + + if (-not $this.ArtifactDetails) { + foreach ($ciFile in $ciFiles) { + $ciArtifactResult = $this.ParseYmlForArtifact($ciFile.FullName) + if ($ciArtifactResult) { + $this.ArtifactDetails = [Hashtable]$ciArtifactResult.ArtifactConfig + $this.CIMatrixConfigs = $ciArtifactResult.MatrixConfigs + # if this package appeared in this ci file, then we should + # treat this CI file as the source of the Matrix for this package + break } } } From 77988454c6dad869d5f350e4a0f9df5bda6dae68 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Tue, 5 Nov 2024 11:07:45 -0800 Subject: [PATCH 3/3] ensure InitializeCIArtifacts only runs on CI machines --- eng/common/scripts/Package-Properties.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/Package-Properties.ps1 b/eng/common/scripts/Package-Properties.ps1 index 22b109ca6e26..bd67230b7fe0 100644 --- a/eng/common/scripts/Package-Properties.ps1 +++ b/eng/common/scripts/Package-Properties.ps1 @@ -106,7 +106,7 @@ class PackageProps { } [void]InitializeCIArtifacts() { - if ($env:SYSTEM_TEAMPROJECTID -or $env:GITHUB_ACTIONS) { + if (-not $env:SYSTEM_TEAMPROJECTID -and -not $env:GITHUB_ACTIONS) { return }