|
| 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 |
0 commit comments