Skip to content

Commit

Permalink
build: Fix Component Governance in Composer DevOps pipeline (microsof…
Browse files Browse the repository at this point in the history
…t#9257)

* Test copy-rename file.

* Add dir workspace

* Set up for CG

* Copy all

* Gin up yarn.lock files

* Instead, delete all 'npm:'

* Replace 'resolution:' in lock file

* Revert the "resolution" hack.

* Cleanup
  • Loading branch information
BruceHaley authored Jun 24, 2022
1 parent a78db0b commit b6032af
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,33 @@ jobs:
pool:
vmImage: ubuntu-latest
steps:
- powershell: |
# Gin up imitation v1 yarn.lock files to aid Component Governance Detection analysis. The method:
# Find v3 yarn-berry.lock files. From each, generate a yarn.lock file, deleting all occurrences of 'npm:'.
# This allows CG to work with yarn v3.
$find = 'npm:';
$replace = '';
Get-ChildItem -Recurse -Path '**/yarn-berry.lock' | % {
$source = $_.FullName;
$dest = $_.DirectoryName + "/yarn.lock"
Write-Host $source;
Write-Host $dest;
Copy-Item -Path $source -Destination $dest -Force
$content = Get-Content -Raw $dest;
$content -Replace "$find", "$replace" | Set-Content $dest;
'--------------------'; get-content $dest; '====================';
}
displayName: Generate "yarn.lock" files for CG Detection
continueOnError: true
- task: ComponentGovernanceComponentDetection@0
displayName: Component Detection
inputs:
scanType: "Register"
verbosity: "Verbose"
alertWarningLevel: "High"
failOnAlert: true

0 comments on commit b6032af

Please sign in to comment.