Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,35 @@ jobs:
enablePublishBuildArtifacts: true
pool:
vmImage: vs2017-win2016

- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- job: Create_GraphViz
displayName: Create GraphViz
dependsOn:
- Windows_NT
- Linux
- Darwin
- Asset_Registry_Publish
pool:
name: Hosted VS2017
condition: succeeded()
variables:
# Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT
# DotNet-AllOrgs-Pats provides: dn-bot-all-orgs-pat
- group: Publish-Build-Assets
- group: DotNet-AllOrgs-Pats
steps:
- task: PowerShell@2
displayName: Generate GraphViz graph
inputs:
filePath: eng/common/generate-graphviz.ps1
arguments: -gitHubPat $(BotAccount-dotnet-maestro-bot-PAT) -azdoPat $(dn-bot-all-orgs-pat) -barToken $(MaestroAccessToken) -outputFolder '$(Build.StagingDirectory)/GraphViz/'
continueOnError: true
- task: PublishBuildArtifacts@1
displayName: Publish Graph to Artifacts
inputs:
PathtoPublish: '$(Build.StagingDirectory)/GraphViz'
PublishLocation: Container
ArtifactName: GraphViz
continueOnError: true
condition: always()
58 changes: 58 additions & 0 deletions eng/common/generate-graphviz.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Param(
[string] $barToken,
[string] $gitHubPat,
[string] $azdoPat,
[string] $outputFolder,
[string] $darcVersion = '1.1.0-beta.19154.2',
[switch] $includeToolset
)

$ErrorActionPreference = "Stop"
. $PSScriptRoot\tools.ps1

function CheckExitCode ([string]$stage)
{
$exitCode = $LASTEXITCODE
if ($exitCode -ne 0) {
Write-Host "Something failed in stage: '$stage'. Check for errors above. Exiting now..."
ExitWithExitCode $exitCode
}
}

try {
Push-Location $PSScriptRoot

Write-Host "Installing darc..."
. .\darc-init.ps1 -darcVersion $darcVersion
CheckExitCode "Running darc-init"

$DarcExe = "$env:USERPROFILE\.dotnet\tools"
$DarcExe = Resolve-Path $DarcExe

if (!(Test-Path -Path $outputFolder)) {
Create-Directory $outputFolder
}

$options = "get-dependency-graph --graphviz '$outputFolder\graphviz.txt' --github-pat $gitHubPat --azdev-pat $azdoPat --password $barToken"

if ($includeToolset) {
Write-Host "Toolsets will be included in the graph..."
$options += " --include-toolset"
}

Write-Host "Generating dependency graph..."
$darc = Invoke-Expression "& `"$DarcExe\darc.exe`" $options"
$graph = Get-Content $outputFolder\graphviz.txt
Set-Content $outputFolder\graphviz.txt -Value "Paste the following digraph object in http://www.webgraphviz.com `r`n", $graph
Write-Host "'$outputFolder\graphviz.txt' file created!"
}
catch {
if (!$includeToolset) {
Write-Host "This might be a toolset repo which includes only toolset dependencies. " -NoNewline -ForegroundColor Yellow
Write-Host "Since -includeToolset is not set there is no graph to create. Include -includeToolset and try again..." -ForegroundColor Yellow
}
Write-Host $_
Write-Host $_.Exception
Write-Host $_.ScriptStackTrace
ExitWithExitCode 1
}