Skip to content

Commit ac29bd3

Browse files
committed
Retain builds that are inserted to VS
This retains builds for 2 years as required for SBOM preservation. It also solves our older problem of builds disappearing before we can push them to nuget.org and github releases.
1 parent c7ed840 commit ac29bd3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

azure-pipelines/vs-insertion.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,12 @@ stages:
4949
AutoCompleteMergeStrategy: Squash
5050
- task: MicroBuildCleanup@1
5151
displayName: Send Telemetry
52+
- powershell: |
53+
$contentType = 'application/json';
54+
$headers = @{ Authorization = 'Bearer $(System.AccessToken)' };
55+
$rawRequest = @{ daysValid = 365 * 2; definitionId = $(resources.pipeline.CI.pipelineID); ownerId = 'User:$(Build.RequestedForId)'; protectPipeline = $false; runId = $(resources.pipeline.CI.runId) };
56+
$request = ConvertTo-Json @($rawRequest);
57+
Write-Host $request
58+
$uri = "$(System.CollectionUri)$(System.TeamProject)/_apis/build/retention/leases?api-version=6.0-preview.1";
59+
Invoke-RestMethod -uri $uri -method POST -Headers $headers -ContentType $contentType -Body $request;
60+
displayName: Retain inserted builds

0 commit comments

Comments
 (0)