File tree Expand file tree Collapse file tree 5 files changed +78
-12
lines changed Expand file tree Collapse file tree 5 files changed +78
-12
lines changed Original file line number Diff line number Diff line change 33 <ProductDependencies >
44 </ProductDependencies >
55 <ToolsetDependencies >
6- <Dependency Name =" Microsoft.DotNet.Arcade.Sdk" Version =" 7.0.0-beta.22111.10 " >
6+ <Dependency Name =" Microsoft.DotNet.Arcade.Sdk" Version =" 7.0.0-beta.22117.2 " >
77 <Uri >https://github.com/dotnet/arcade</Uri >
8- <Sha >ff6cc4e9c3eef575f62a33a642ca80e79d27c9bb </Sha >
8+ <Sha >49750c02e63d0ad3a77d035bba7498a0b1acd218 </Sha >
99 <SourceBuild RepoName =" arcade" ManagedOnly =" true" />
1010 </Dependency >
1111 </ToolsetDependencies >
Original file line number Diff line number Diff line change 1+
2+ Param (
3+ [Parameter (Mandatory = $true )][int ] $buildId ,
4+ [Parameter (Mandatory = $true )][string ] $azdoOrgUri ,
5+ [Parameter (Mandatory = $true )][string ] $azdoProject ,
6+ [Parameter (Mandatory = $true )][string ] $token
7+ )
8+
9+ $ErrorActionPreference = ' Stop'
10+ Set-StrictMode - Version 2.0
11+ . $PSScriptRoot \tools.ps1
12+
13+
14+ function Get-AzDOHeaders (
15+ [string ] $token )
16+ {
17+ $base64AuthInfo = [Convert ]::ToBase64String([Text.Encoding ]::ASCII.GetBytes(" :${token} " ))
18+ $headers = @ {" Authorization" = " Basic $base64AuthInfo " }
19+ return $headers
20+ }
21+
22+ function Update-BuildRetention (
23+ [string ] $azdoOrgUri ,
24+ [string ] $azdoProject ,
25+ [int ] $buildId ,
26+ [string ] $token )
27+ {
28+ $headers = Get-AzDOHeaders - token $token
29+ $requestBody = " {
30+ `" keepForever`" : `" true`"
31+ }"
32+
33+ $requestUri = " ${azdoOrgUri} /${azdoProject} /_apis/build/builds/${buildId} ?api-version=6.0"
34+ write-Host " Attempting to retain build using the following URI: ${requestUri} ..."
35+
36+ try {
37+ Invoke-RestMethod - Uri $requestUri - Method Patch - Body $requestBody - Header $headers - contentType " application/json"
38+ Write-Host " Updated retention settings for build ${buildId} ."
39+ }
40+ catch {
41+ Write-PipelineTelemetryError - Category " Build" - Message " Failed to update retention settings for build: $_ .Exception.Response.StatusDescription"
42+ ExitWithExitCode 1
43+ }
44+ }
45+
46+ Update-BuildRetention - azdoOrgUri $azdoOrgUri - azdoProject $azdoProject - buildId $buildId - token $token
47+ ExitWithExitCode 0
Original file line number Diff line number Diff line change @@ -8,10 +8,6 @@ parameters:
88 # Optional: Enable publishing using release pipelines
99 enablePublishUsingPipelines : false
1010
11- # Optional: Disable component governance detection. In general, component governance
12- # should be on for all jobs. Use only in the event of issues.
13- disableComponentGovernance : false
14-
1511 # Optional: Enable running the source-build jobs to build repo from source
1612 enableSourceBuild : false
1713
@@ -41,11 +37,6 @@ parameters:
4137# Internal resources (telemetry, microbuild) can only be accessed from non-public projects,
4238# and some (Microbuild) should only be applied to non-PR cases for internal builds.
4339
44- # Sbom related params
45- enableSbom : true
46- PackageVersion : 7.0.0
47- BuildDropPath : ' $(Build.SourcesDirectory)/artifacts'
48-
4940jobs :
5041- ${{ each job in parameters.jobs }} :
5142 - template : ../job/job.yml
Original file line number Diff line number Diff line change 1+ parameters :
2+ # Optional azure devops PAT with build execute permissions for the build's organization,
3+ # only needed if the build that should be retained ran on a different organization than
4+ # the pipeline where this template is executing from
5+ Token : ' '
6+ # Optional BuildId to retain, defaults to the current running build
7+ BuildId : ' '
8+ # Azure devops Organization URI for the build in the https://dev.azure.com/<organization> format.
9+ # Defaults to the organization the current pipeline is running on
10+ AzdoOrgUri : ' $(System.CollectionUri)'
11+ # Azure devops project for the build. Defaults to the project the current pipeline is running on
12+ AzdoProject : ' $(System.TeamProject)'
13+
14+ steps :
15+ - task : powershell@2
16+ inputs :
17+ targetType : ' filePath'
18+ filePath : eng/common/retain-build.ps1
19+ pwsh : true
20+ arguments : >
21+ -AzdoOrgUri: ${{parameters.AzdoOrgUri}}
22+ -AzdoProject ${{parameters.AzdoProject}}
23+ -Token ${{coalesce(parameters.Token, '$env:SYSTEM_ACCESSTOKEN') }}
24+ -BuildId ${{coalesce(parameters.BuildId, '$env:BUILD_ID')}}
25+ displayName : Enable permanent build retention
26+ env :
27+ SYSTEM_ACCESSTOKEN : $(System.AccessToken)
28+ BUILD_ID : $(Build.BuildId)
Original file line number Diff line number Diff line change 99 "xcopy-msbuild" : " 16.10.0-preview2"
1010 },
1111 "msbuild-sdks" : {
12- "Microsoft.DotNet.Arcade.Sdk" : " 7.0.0-beta.22111.10 "
12+ "Microsoft.DotNet.Arcade.Sdk" : " 7.0.0-beta.22117.2 "
1313 }
1414}
You can’t perform that action at this time.
0 commit comments