Skip to content

Instantly share code, notes, and snippets.

@azuredevopstips
Created March 30, 2020 13:22
Show Gist options
  • Save azuredevopstips/c8b2b5a598fe4ba692458ed8518b5c72 to your computer and use it in GitHub Desktop.
Save azuredevopstips/c8b2b5a598fe4ba692458ed8518b5c72 to your computer and use it in GitHub Desktop.
PlantUML Azure DevOps Pipeline
# Pipeline to create PNG files within code
# https://azuredevops.tips/2020/03/04/generate-plantuml-in-pipeline/
# Line 31 & 32 need to be modified
pool:
vmImage: 'vs2017-win2016'
trigger:
batch: true
workspace:
clean: all
steps:
- checkout: self
persistCredentials: true
- task: printAllVariables@1
- task: UseNode@1
displayName: Install Node
inputs:
version: '6.x'
- task: Npm@1
displayName: Install Node Plant UML
inputs:
command: 'custom'
customCommand: 'install node-plantuml -g'
- task: PowerShell@2
displayName: Check Out
inputs:
targetType: 'inline'
script: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git status
git checkout "$Env:BUILD_SOURCEBRANCHNAME"
- task: PowerShell@2
displayName: Build Images
inputs:
targetType: 'inline'
script: |
$sourceRoot = "$Env:Build.SourcesDirectory"
Get-ChildItem $sourceDir -Recurse -Filter "*.puml" |
Foreach-Object {
$fileWithPath = $_.Fullname
$png = Join-Path -Path $_.DirectoryName -ChildPath ("{0}.png" -f $_.Basename )
$execute = "puml generate $fileWithPath -o $png ";
Invoke-Expression -Command $execute
}
- task: PowerShell@2
displayName: Check In
inputs:
targetType: 'inline'
script: |
git add --all
git commit -m "$Env:BUILD_BUILDNUMBER [skip ci]"
#git checkout "$Env:BUILD_SOURCEBRANCHNAME"
#git merge "$Env:BUILD_SOURCEBRANCHNAME" -m "$Env:BUILD_BUILDNUMBER"
#git branch -d "$Env:BUILD_BUILDNUMBER"
git push origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment