Skip to content

Commit

Permalink
Add template for insertion creation and use for pr val
Browse files Browse the repository at this point in the history
  • Loading branch information
dibarbet committed Jul 23, 2021
1 parent f27e633 commit 8f85797
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 42 deletions.
50 changes: 8 additions & 42 deletions azure-pipelines-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,6 @@ stages:
pool:
vmImage: windows-2019
steps:
- checkout: none

- task: NuGetCommand@2
displayName: 'Install RIT from Azure Artifacts'
inputs:
command: custom
arguments: 'install RoslynTools.VisualStudioInsertionTool -PreRelease -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'

- powershell: |
$response = Invoke-RestMethod -Headers @{Authorization = "Bearer $(System.AccessToken)"} "https://dev.azure.com/dnceng/internal/_apis/git/repositories/dotnet-roslyn/items?path=eng/config/PublishData.json&api-version=6.0"
$branchName = "$(Build.SourceBranch)".Substring("refs/heads/".Length)
Expand Down Expand Up @@ -343,40 +335,14 @@ stages:
Write-Host "##vso[task.setvariable variable=VSBranchName]$($branchData.vsBranch)"
displayName: Set Insertion Variables
- powershell: |
mv RoslynTools.VisualStudioInsertionTool.* RIT
.\RIT\tools\OneOffInsertion.ps1 `
-autoComplete "$(Insertion.AutoComplete)" `
-buildQueueName "$(Build.DefinitionName)" `
-cherryPick "(default)" `
-clientId "$(ClientId)" `
-clientSecret "$(ClientSecret)" `
-componentAzdoUri "$(System.CollectionUri)" `
-componentBranchName "$(ComponentBranchName)" `
-componentGitHubRepoName "dotnet/roslyn" `
-componentName "Roslyn" `
-componentProjectName "internal" `
-createDraftPR "$(Insertion.CreateDraftPR)" `
-defaultValueSentinel "(default)" `
-dropPath "(default)" `
-insertCore "(default)" `
-insertDevDiv "(default)" `
-insertionCount "1" `
-insertToolset "$(Insertion.InsertToolset)" `
-titlePrefix "$(Insertion.TitlePrefix)" `
-titleSuffix "$(Insertion.TitleSuffix)" `
-queueValidation "true" `
-requiredValueSentinel "REQUIRED" `
-reviewerGUID "6c25b447-1d90-4840-8fde-d8b22cb8733e" `
-specificBuild "$(Build.BuildNumber)" `
-updateAssemblyVersions "(default)" `
-updateCoreXTLibraries "(default)" `
-visualStudioBranchName "$(VSBranchName)" `
-writePullRequest "prid.txt" `
displayName: 'Run OneOffInsertion.ps1'
- script: 'echo. && echo. && type "prid.txt" && echo. && echo.'
displayName: 'Report PR URL'
- template: eng/pipelines/insert.yml
parameters:
createDraftPR: $(Insertion.CreateDraftPR)
insertToolset: $(Insertion.InsertToolset)
componentBuildProjectName: internal
componentBranchName: $(ComponentBranchName)
vsBranchName: $(VSBranchName)
titlePrefix: $(Insertion.TitlePrefix)

- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: eng\common\templates\post-build\post-build.yml
Expand Down
21 changes: 21 additions & 0 deletions azure-pipelines-pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,24 @@ stages:
- task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1
displayName: Perform Cleanup Tasks
condition: succeededOrFailed()

- stage: insert
displayName: Create Insertion
dependsOn:
- build

jobs:
- job: insert
displayName: Insert to VS
pool:
vmImage: windows-2019
steps:
- template: eng/pipelines/insert.yml
parameters:
createDraftPR: true
insertToolset: $(InsertToolset)
componentBuildProjectName: DevDiv
componentBranchName: $(ComponentBranchName)
vsBranchName: $(VisualStudioBranchName)
titlePrefix: $(OptionalTitlePrefix)

65 changes: 65 additions & 0 deletions eng/pipelines/insert.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
parameters:
# These are actually a booleans but must be defined as string.
# Parameters are evaluated at compile time, but all variables are strings at compile time.
# So in order to pass a parameter that comes from a variable these must be typed as string.
- name: createDraftPR
type: string
default: ''
- name: insertToolset
type: string
default: ''

- name: componentBuildProjectName
type: string
- name: componentBranchName
type: string
- name: vsBranchName
type: string
- name: titlePrefix
type: string
default: ''

steps:
- checkout: none

- task: NuGetCommand@2
displayName: 'Install RIT from Azure Artifacts'
inputs:
command: custom
arguments: 'install RoslynTools.VisualStudioInsertionTool -PreRelease -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'

- powershell: |
Write-Host "##vso[task.setvariable variable=Insertion.AutoComplete]$(-not ${{ parameters.createDraftPR }})"
mv RoslynTools.VisualStudioInsertionTool.* RIT
.\RIT\tools\OneOffInsertion.ps1 `
-autoComplete "$(Insertion.AutoComplete)" `
-buildQueueName "$(Build.DefinitionName)" `
-cherryPick "(default)" `
-clientId "$(ClientId)" `
-clientSecret "$(ClientSecret)" `
-componentAzdoUri "$(System.CollectionUri)" `
-componentBranchName "${{ parameters.componentBranchName }}" `
-componentGitHubRepoName "dotnet/roslyn" `
-componentName "Roslyn" `
-componentProjectName "${{ parameters.componentBuildProjectName }}" `
-createDraftPR "${{ parameters.createDraftPR }}" `
-defaultValueSentinel "(default)" `
-dropPath "(default)" `
-insertCore "(default)" `
-insertDevDiv "(default)" `
-insertionCount "1" `
-insertToolset "${{ parameters.insertToolset }}" `
-titlePrefix "${{ parameters.titlePrefix }}" `
-titleSuffix "(default)" `
-queueValidation "true" `
-requiredValueSentinel "REQUIRED" `
-reviewerGUID "6c25b447-1d90-4840-8fde-d8b22cb8733e" `
-specificBuild "$(Build.BuildNumber)" `
-updateAssemblyVersions "(default)" `
-updateCoreXTLibraries "(default)" `
-visualStudioBranchName "${{ parameters.vsBranchName }}" `
-writePullRequest "prid.txt" `
displayName: 'Run OneOffInsertion.ps1'
- script: 'echo. && echo. && type "prid.txt" && echo. && echo.'
displayName: 'Report PR URL'

0 comments on commit 8f85797

Please sign in to comment.