Skip to content

Commit 4ca4d03

Browse files
authored
Merge pull request #640 from dagood/vsts-update-def
[release/2.1] Add "vsts_prodcon_update" build to perform VSTS ProdCon updates
2 parents 71a7395 + 2dc3589 commit 4ca4d03

7 files changed

+148
-5
lines changed

Diff for: .vsts-ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ phases:
2626
buildOfflineTarball: true
2727

2828
steps:
29-
- template: ./vsts-build-templates/docker-cleanup-linux.yml
29+
- template: ./.vsts.pipelines/steps/docker-cleanup-linux.yml
3030

3131
# create working directory and copy source into it
3232
- script: |
@@ -128,4 +128,4 @@ phases:
128128
ArtifactName: drop
129129
ArtifactType: Container
130130

131-
- template: ./vsts-build-templates/docker-cleanup-linux.yml
131+
- template: ./.vsts.pipelines/steps/docker-cleanup-linux.yml

Diff for: .vsts.pipelines/builds/vsts_prodcon_update.yml

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
phases:
2+
- phase: vsts_prodcon_update
3+
variables:
4+
# autoUpdate.skipBuildToolsUpdate: (User input: Should the BuildTools update be skipped? This is useful to isolate the update to ProdCon.)
5+
# pb.feed.buildId: (User input: What build id is the prodcon blob feed from? This shows up in the commit.)
6+
# pb.feed.indexJsonUrl: (User input: Where is the prodcon blob feed?)
7+
# pb.feed.replaceNew: (User input for ProdConBlobFeedReplaceNew.)
8+
# pb.feed.replaceOld: (User input for ProdConBlobFeedReplaceOld.)
9+
manifestDir: $(repo.orchestrationUtilities.dir)\bin\obj\manifest-temp
10+
manifestFile: $(manifestDir)\build.xml
11+
repo.orchestrationUtilities.dir: $(Build.BinariesDirectory)\utilities
12+
repo.orchestrationUtilities.url: https://usernameplaceholder:$(user.PAT)@devdiv.visualstudio.com/DefaultCollection/DevDiv/_git/DotNet-Orchestration-Utilities
13+
repo.sourceBuild.url: https://usernameplaceholder:$(user.PAT)@devdiv.visualstudio.com/DefaultCollection/DevDiv/_git/DotNet-Source-Build-Trusted
14+
15+
queue:
16+
name: DotNet-Build
17+
demands: agent.os -equals windows_nt
18+
timeoutInMinutes: 180
19+
20+
steps:
21+
- powershell: |
22+
$prefix = "refs/heads/"
23+
$branch = "$(Build.SourceBranch)"
24+
$branchName = $branch
25+
if ($branchName.StartsWith($prefix))
26+
{
27+
$branchName = $branchName.Substring($prefix.Length)
28+
}
29+
Write-Host "For Build.SourceBranch $branch, FullBranchName is $branchName"
30+
Write-Host "##vso[task.setvariable variable=FullBranchName;]$branchName"
31+
displayName: Find true SourceBranchName
32+
33+
- powershell: |
34+
# Ignore failure for the first command. It will intentionally fail if the commit is only
35+
# available in VSTS. "submodule update --init" is the simplest way to set up the submodule
36+
# directory. ("submodule init" only sets up .git/config, not the e.g. src/coreclr/.git and
37+
# .git/modules/src/coreclr/ directories.)
38+
git submodule update --init --recursive
39+
# This fetches old commits (allowing the next update to succeed) and populates the git repo
40+
# with the potential commits that may be upgraded to.
41+
./fetch-vsts-commits.ps1 $(user.PAT)
42+
git submodule update --init --recursive
43+
displayName: Fetch internal vsts commits
44+
45+
- powershell: |
46+
# Ensure no straggling artifacts could interfere with manifest generation.
47+
rm -Recurse -Force -ErrorAction Ignore "$(repo.orchestrationUtilities.dir)"
48+
git clone "$(repo.orchestrationUtilities.url)" "$(repo.orchestrationUtilities.dir)"
49+
displayName: Initialize DotNet-Orchestration-Utilities
50+
51+
- powershell: |
52+
.\init-tools.cmd
53+
Tools\dotnetcli\dotnet msbuild .\src\publish.proj `
54+
/t:CreateFeedOrchestratedBuildManifest `
55+
/p:ExpectedFeedUrl=$(pb.feed.indexJsonUrl) `
56+
/p:AccountKey=$(pb.feed.accountKey) `
57+
/p:ManifestName=cli `
58+
/p:ManifestBuildId=$(pb.feed.buildId) `
59+
/v:N /flp:v=Diag
60+
workingDirectory: $(repo.orchestrationUtilities.dir)
61+
displayName: Create orchestrated build manifest
62+
63+
- powershell: |
64+
.\build.cmd /t:InitBuild /p:SkipPatches=true
65+
.\build.cmd `
66+
/t:UpdateDependencies `
67+
/p:SkipBuildToolsUpdate=$(autoUpdate.skipBuildToolsUpdate) `
68+
/p:UpdateFromManifestFile=$(manifestFile) `
69+
/p:ProdConBlobFeedReplaceOld=$(pb.feed.replaceOld) `
70+
/p:ProdConBlobFeedReplaceNew=$(pb.feed.replaceNew) `
71+
/clp:v=Normal
72+
displayName: Perform auto-update changes
73+
74+
- powershell: |
75+
git `
76+
-c user.name=dotnet-maestro-bot `
77+
78+
commit -a -m "Update to ProdCon $(pb.feed.buildId)"
79+
git push -f $(repo.sourceBuild.url) HEAD:refs/heads/auto-update/$(FullBranchName)
80+
displayName: Push auto-update commit
81+
82+
- task: CopyFiles@2
83+
condition: always()
84+
continueOnError: true
85+
inputs:
86+
sourceFolder: $(manifestDir)
87+
targetFolder: $(Build.ArtifactStagingDirectory)\manifestDir
88+
89+
- task: PublishBuildArtifacts@1
90+
displayName: Publish artifacts
91+
condition: always()
92+
continueOnError: true
93+
inputs:
94+
PathtoPublish: $(Build.ArtifactStagingDirectory)
95+
ArtifactName: artifacts
96+
ArtifactType: Container
97+
98+
- powershell: rm -Recurse -Force "$(repo.orchestrationUtilities.dir)"
99+
condition: always()
100+
continueOnError: true
101+
displayName: Clean up DotNet-Orchestration-Utilities

Diff for: BuildToolsVersion.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.0-rc1-02911-02
1+
2.1.0-rc1-03006-01

Diff for: dependencies.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<PropertyGroup>
88
<ProdConCurrentRef>d1e2bedf58a4a66aadda4f5751ecdaf3ad4f62fe</ProdConCurrentRef>
99
<CoreClrCurrentRef>79731c509a9d31b921f531ee63c48daa8e0c30d5</CoreClrCurrentRef>
10-
<BuildToolsCurrentRef>ba7a90f8cbc824737d0fae5ff230635a9764a1d7</BuildToolsCurrentRef>
10+
<BuildToolsCurrentRef>91c9a3b3374ff71e72c06d5773bd26598539aa1d</BuildToolsCurrentRef>
1111
</PropertyGroup>
1212

1313
<!-- Package dependency verification/auto-upgrade configuration. -->

Diff for: dependencies.targets

+3-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@
9191
Include="ProdCon"
9292
UpdaterType="Orchestrated blob feed attribute"
9393
SingleLineFile="$(MSBuildThisFileDirectory)ProdConFeed.txt"
94-
AttributeName="Url" />
94+
AttributeName="Url"
95+
ReplacementSubstituteOld="$(ProdConBlobFeedReplaceOld)"
96+
ReplacementSubstituteNew="$(ProdConBlobFeedReplaceNew)" />
9597
</ItemGroup>
9698
</Target>
9799
</Project>

Diff for: fetch-vsts-commits.ps1

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
param (
2+
[Parameter(Mandatory=$true)][string]$pat,
3+
[string]$remote_ref_name = "vsts"
4+
)
5+
6+
function get_vsts_url(
7+
[Parameter(Mandatory=$true)][string]$name,
8+
[string]$instance = 'devdiv.visualstudio.com',
9+
[string]$project = 'DevDiv')
10+
{
11+
return "https://usernameplaceholder:${pat}@${instance}/${project}/_git/${name}/"
12+
}
13+
14+
function fetch(
15+
[Parameter(Mandatory=$true)][string]$name,
16+
[Parameter(Mandatory=$true)][string]$remote)
17+
{
18+
$cmd = @(
19+
"-C", "src/$name"
20+
# Disable credential manager if one is specified. Always use manual PAT.
21+
"-c", "credential.helper="
22+
"fetch"
23+
$remote
24+
"+refs/heads/*:refs/remotes/${remote_ref_name}/*"
25+
)
26+
echo "Fetching commits using: & git $cmd"
27+
& git @cmd
28+
}
29+
30+
function fetch_vsts(
31+
[Parameter(Mandatory=$true)][string]$name,
32+
[string]$url = (get_vsts_url "DotNet-$name-Trusted"))
33+
{
34+
fetch "$name" "$url"
35+
}
36+
37+
fetch_vsts cli
38+
fetch_vsts core-setup
39+
fetch_vsts coreclr
40+
fetch_vsts corefx

0 commit comments

Comments
 (0)