PowerShell/tools/releaseBuild/azureDevOps/templates/windows-component-governance.yml
Travis Plunk a872b8d5be
Add compliance to Coordinated build (#8798)
Add compliance to Coordinated build
  - Also switch to mac internal pool for release build
  - Also turn some duplicate tasks into templates
  - Also fix issue with vscode configuration which causes yaml files not to be recogized as yaml
2019-01-30 14:10:52 -08:00

77 lines
2.9 KiB
YAML

jobs:
- job: ComponentRegistrationJob
displayName: Component Registration
condition: succeeded()
pool:
name: PowerShell
steps:
- powershell: |
tools/releaseBuild/setReleaseTag.ps1 -ReleaseTag $(ReleaseTagVar) -Variable "ReleaseTagVar"
displayName: 'Set ReleaseTag Variable'
- powershell: |
$version = '$(ReleaseTagVar)'.Substring(1)
$vstsCommandString = "vso[task.setvariable variable=Version]$version"
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"
displayName: 'Set Version Variable'
- powershell: |
docker container prune --force
docker container ls --all --format '{{ json .ID }}' | ConvertFrom-Json | ForEach-Object {docker container rm --force --volumes $_}
displayName: 'Remove all containers'
# Cleanup is not critical it passes every time it runs
continueOnError: true
- powershell: |
docker image ls --format '{{ json .}}'|ConvertFrom-Json| ForEach-Object {
if($_.tag -eq '<none>')
{
$formatString = 'yyyy-MM-dd HH:mm:ss zz00'
$createdAtString = $_.CreatedAt.substring(0,$_.CreatedAt.Length -4)
$createdAt = [DateTime]::ParseExact($createdAtString, $formatString,[System.Globalization.CultureInfo]::InvariantCulture)
if($createdAt -lt (Get-Date).adddays(-1))
{
docker image rm $_.ID
}
}
}
exit 0
displayName: 'Remove old images'
# Cleanup is not critical it passes every time it runs
continueOnError: true
- powershell: |
Write-verbose "--docker info---" -verbose
docker info
Write-verbose "--docker image ls---" -verbose
docker image ls
Write-verbose "--docker container ls --all---" -verbose
docker container ls --all
displayName: 'Capture Docker Info'
# Diagnostics is not critical it passes every time it runs
continueOnError: true
- powershell: |
Import-Module $(Build.SourcesDirectory)/build.psm1 -Force
New-NugetConfigFile -NugetFeedUrl $(AzDevOpsFeed) -UserName $(AzDevOpsFeedUserName) -ClearTextPAT $(AzDevOpsFeedPAT) -FeedName AzDevOpsFeed -Destination $(Build.SourcesDirectory)/src/Modules
if(-not (Test-Path "$(Build.SourcesDirectory)/src/Modules/nuget.config"))
{
throw "nuget.config is not created"
}
displayName: 'Add nuget.config for AzDevOps feed for PSGallery modules '
- powershell: |
./tools/releaseBuild/vstsbuild.ps1 -ReleaseTag $(ReleaseTagVar) -Name win-x64-component-registration
displayName: 'Build Windows Universal - Component Registration'
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: 'Component Detection'
inputs:
sourceScanPath: '$(componentregistration)'
snapshotForceEnabled: true