-
Notifications
You must be signed in to change notification settings - Fork 221
Discover Affected Recordings #8391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
850773e
moving along now. we're going to do a small update to the scan tool a…
scbedd 0e73dc5
moving along now. we're going to do a small update to the scan tool a…
scbedd 889fbe6
getting closer to actually having this work the way it should
scbedd 70d0eb9
small updates to the maintenance tool to allow me to easily get a bla…
scbedd d23e4a7
we're populating our output directory now
scbedd e23e665
properly filtering?
scbedd 18de618
revert my changes to the integration-test, add it directly next to th…
scbedd 8d0f694
working rg output
scbedd a293185
repair the tests
scbedd 152cbb5
revert the yml to its original state
scbedd 0c65956
get rid of extra new line
scbedd d453db7
remove removal
scbedd 62df80f
Update tools/assets-automation/assets-task-scripts/find-assets-files/…
scbedd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
tools/assets-automation/assets-task-scripts/find-assets-files/locate-involved-assets.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| Used to retrieve a list of references to test recordings that that "contain" a string in their contents. | ||
|
|
||
| .DESCRIPTION | ||
| Uses the Azure.Sdk.Tools.Assets.MaintenanceTool to retrieve a copy of all the assets files, then grep each tag's contents | ||
| for the specified string. Intermediary results are stored in the .results folder, and the final ressults will be output to the | ||
| console on successful completion of the script. | ||
|
|
||
| This will enable easy access to the test recordings that are affected by a change in the SDK, and will help to identify | ||
| which tests need to be updated. | ||
|
|
||
| PreReqs: | ||
| - Azure.Sdk.Tools.Assets.MaintenanceTool must be available on the PATH | ||
| - git is available on the PATH | ||
| - Running powershell core | ||
| - ripgrip installed on the machine. 'choco install ripgrep' on elevated terminal | ||
|
|
||
| .PARAMETER ConfigFilePath | ||
| The query configuration file, which contains targeted repos, branches, and paths. | ||
|
|
||
| .PARAMETER SearchString | ||
| The regex string to search for in the contents of the test recordings. | ||
| #> | ||
| param( | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$ConfigFilePath, | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$SearchString | ||
| ) | ||
|
|
||
| Set-StrictMode -Version 4 | ||
| $ErrorActionPreference = "Stop" | ||
| . (Join-Path $PSScriptRoot ".." "utilities.ps1") | ||
|
|
||
| if (!(Test-Path $ConfigFilePath -PathType Leaf)) { | ||
| Write-Error "Config file not found: $ConfigFilePath" | ||
| exit 1 | ||
| } | ||
|
|
||
| $ResultsFolder = Create-If-Not-Exists (Join-Path $PSScriptRoot ".results") | ||
| $TagsFolder = Create-If-Not-Exists (Join-Path $ResultsFolder "tags") | ||
| $ScanOutputJson = Join-Path $ResultsFolder "output.json" | ||
|
|
||
| try { | ||
| Push-Location $ResultsFolder | ||
|
|
||
| if (!(Test-Path $ScanOutputJson)) { | ||
| Azure.Sdk.Tools.Assets.MaintenanceTool scan --config $ConfigFilePath | ||
| } | ||
| else { | ||
| Write-Host "Skipping scan, using cached results" | ||
| } | ||
| } | ||
| finally { | ||
| Pop-Location | ||
| } | ||
|
|
||
| $DiscoveredAssets = Get-Content $ScanOutputJson | ConvertFrom-Json | ||
|
|
||
| foreach ($asset in $DiscoveredAssets) { | ||
| $TagFolder = Get-AssetsRepoSlice -Tag $asset.Tag -WorkDirectory $ResultsFolder | ||
| } | ||
|
|
||
| Write-Host "rg $SearchString -g `"*.json`" $TagsFolder" | ||
| rg $SearchString -g "*.json" $TagsFolder | ||
scbedd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
39 changes: 39 additions & 0 deletions
39
tools/assets-automation/assets-task-scripts/find-assets-files/sample-query-config.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| { | ||
| "LanguageRepos": [ | ||
| { | ||
| "LanguageRepo": "Azure/azure-sdk-for-java", | ||
| "ScanStartDate": "latest", | ||
| "ScanFolders": [ | ||
| "sdk/containerregistry" | ||
| ] | ||
| }, | ||
| { | ||
| "LanguageRepo": "Azure/azure-sdk-for-python", | ||
| "ScanStartDate": "latest", | ||
| "ScanFolders": [ | ||
| "sdk/containerregistry" | ||
| ] | ||
| }, | ||
| { | ||
| "LanguageRepo": "Azure/azure-sdk-for-go", | ||
| "ScanStartDate": "latest", | ||
| "ScanFolders": [ | ||
| "sdk/containers" | ||
| ] | ||
| }, | ||
| { | ||
| "LanguageRepo": "Azure/azure-sdk-for-net", | ||
| "ScanStartDate": "latest", | ||
| "ScanFolders": [ | ||
| "sdk/containerregistry" | ||
| ] | ||
| }, | ||
| { | ||
| "LanguageRepo": "Azure/azure-sdk-for-js", | ||
| "ScanStartDate": "latest", | ||
| "ScanFolders": [ | ||
| "sdk/containerregistry" | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| Set-StrictMode -Version 4 | ||
|
|
||
| function Create-If-Not-Exists { | ||
| param( | ||
| [string]$Path | ||
| ) | ||
|
|
||
| if (!(Test-Path $Path)) { | ||
| New-Item -ItemType Directory -Path $Path -Force | Out-Null | ||
| } | ||
|
|
||
| return $Path | ||
| } | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Retrieve a specific tag from an assets repo and store it on disk within the work directory. | ||
|
|
||
| .DESCRIPTION | ||
| Clones a specific tag from an assets repo (defaults to azure-sdk-assets) and stores it on disk | ||
| within the work directory under a folder with pattern: | ||
|
|
||
| .results <-- this should be WorkDirectory arg | ||
| tags/ | ||
| <tagname>/ | ||
| <tagged repo contents> | ||
| <tagname>/ | ||
| <tagged repo contents> | ||
| <tagname>/ | ||
| <tagged repo contents> | ||
| ... | ||
|
|
||
| Returns the location of the folder after the work is complete. | ||
|
|
||
| .PARAMETER Tag | ||
| The tag to retrieve from the assets repo. | ||
|
|
||
| .PARAMETER WorkDirectory | ||
| The path to the .results directory within which this script will operate. | ||
|
|
||
| .PARAMETER TargetRepo | ||
| Defaults to "Azure/azure-sdk-assets". This is the repo that will be cloned from. | ||
| #> | ||
| function Get-AssetsRepoSlice { | ||
| param( | ||
| [Parameter(Mandatory=$true)] | ||
| [string]$Tag, | ||
| [Parameter(Mandatory=$true)] | ||
| [string]$WorkDirectory, | ||
| [string]$TargetRepo = "Azure/azure-sdk-assets" | ||
| ) | ||
| $CloneUri = "https://github.com/$TargetRepo.git" | ||
| $TagFolderName = Join-Path $WorkDirectory "tags" $Tag.Replace("/", "-") | ||
|
|
||
| $TagFolder = Create-If-Not-Exists -Path $TagFolderName | ||
|
|
||
| Write-Host "TagFolder is $TagFolder" | ||
|
|
||
| if (Test-Path $TagFolder/.git) { | ||
| Write-Host "TagFolder already exists, skipping clone, returning $TagFolder" | ||
| return $TagFolder | ||
| } | ||
| else { | ||
| try { | ||
| Push-Location $TagFolder | ||
| git clone -c core.longpaths=true --no-checkout --filter=tree:0 $CloneUri . | ||
| git fetch origin "refs/tags/$($Tag):refs/tags/$Tag" | ||
| git checkout $Tag | ||
| } | ||
| finally { | ||
| Pop-Location | ||
| } | ||
|
|
||
| return $TagFolder | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.