Skip to content

Commit 78857ec

Browse files
authored
Handle CG Failures (#37204)
* handle CG failures by cleaning up previous publishing artifacts from the downloaded platform-specific artifacts
1 parent 16aa1e2 commit 78857ec

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

eng/pipelines/templates/steps/build-extended-artifacts.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,23 @@ steps:
8888
workingDirectory: $(Pipeline.Workspace)
8989
displayName: Update package properties with namespaces
9090

91+
# Component governance collates discovered dependencies from a combination of
92+
# manifest files, splatted json output from CG detections, setup.py files, and other sources.
93+
# At this point in the job, we have downloadeded package artifacts from 3 previous platform-specific build jobs,
94+
# so the directory that will be published as packages_extended _already contains_ a collated set of dependencies by
95+
# json file. When we attempt to publish the packages_extended artifact, CG re-collates data from the current job, but ALSO
96+
# includes all the data from json files left behind by the previous jobs. While this doesn't result in double counting,
97+
# we've been running into some nasty timeout issues of the CG running on this job specifically.
98+
#
99+
# Given that we've ALREADY RUN CG on the previous jobs, we can clean up these artifacts to avoid
100+
# incurring an increased CG runtime. What's present within IS accurate.
101+
- pwsh: |
102+
Get-ChildItem -Path "$(Build.ArtifactStagingDirectory)" -Filter GovCompDisc* | % { Write-Host "Removing $($_.FullName)"; Remove-Item $_ }
103+
Get-ChildItem -Path "$(Build.ArtifactStagingDirectory)" -Filter ScanTelemetry* | % { Write-Host "Removing $($_.FullName)"; Remove-Item $_ }
104+
Remove-Item -Recurse -Force -Path "$(Build.ArtifactStagingDirectory)/bcde-output"
105+
Remove-Item -Recurse -Force -Path "$(Build.ArtifactStagingDirectory)/_manifest"
106+
displayName: Clean up Artifact Directory
107+
91108
- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
92109
parameters:
93110
ArtifactPath: '$(Build.ArtifactStagingDirectory)'

0 commit comments

Comments
 (0)