From 850773ea1dc2cc1151ea784b3dd78adffc9263a4 Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Tue, 4 Jun 2024 13:58:53 -0700 Subject: [PATCH 01/13] moving along now. we're going to do a small update to the scan tool and then use it to generate all thefiles --- .../get-involved-assets.ps1 | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tools/assets-automation/assets-task-scripts/get-involved-assets.ps1 diff --git a/tools/assets-automation/assets-task-scripts/get-involved-assets.ps1 b/tools/assets-automation/assets-task-scripts/get-involved-assets.ps1 new file mode 100644 index 00000000000..2baa7c1247b --- /dev/null +++ b/tools/assets-automation/assets-task-scripts/get-involved-assets.ps1 @@ -0,0 +1,25 @@ + + +<# +.SYNOPSIS +# Retrieve a copy of all the assets files related to a folder in one or multiple repos +# and dumps the results into a folder .results alongside the script. + +.PARAMETER ConfigFilePath +The query configuration file, which contains targeted repos, branches, and paths. +#> + +param( + [string]$ConfigFilePath +) + +Set-StrictMode -Version 4 + +if (Test-Path $ConfigFilePath -PathType Leaf) { + $Config = Get-Content $ConfigFilePath | ConvertFrom-Json +} else { + Write-Error "Config file not found: $ConfigFilePath" + exit 1 +} + +Write-Host ($Config | ConvertTo-Json) \ No newline at end of file From 0e73dc5f02b58ca217758a12255ed96052917ea3 Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Tue, 4 Jun 2024 13:59:09 -0700 Subject: [PATCH 02/13] moving along now. we're going to do a small update to the scan tool and then use it to generate all thefiles --- .../Model/RepoConfiguration.cs | 9 ++++- .../Scan/AssetsScanner.cs | 8 ++--- .../integration-test-repo-configuration.yml | 34 +++++++++++++++++++ 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs index 04d062e7005..dd9d5c201b0 100644 --- a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs +++ b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs @@ -25,10 +25,17 @@ public RepoConfiguration() { /// need to go further back then that when examining the SHAs in the language repos. There is no possibility of an /// assets.json past this date! /// - public DateTime ScanStartDate { get; set; } = DateTime.Parse("2022-12-01"); + public DateTime ScanStartDate { get; set; } = DateTime.Parse("2023-12-01"); /// /// The set of branches that we will examine. Defaults to just 'main'. /// public List Branches { get; set; } = new List { "main" }; + + /// + /// The folder patterns that are used to filter the repo. Functionally, these strings + /// will be combined with **/assets.json while searching for assets. Non-presence indicates + /// the intent to scan the entire repository. + /// + public List ScanFolders { get; set; } = new List{}; } diff --git a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs index 99656ab335a..56d17936fc1 100644 --- a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs +++ b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs @@ -100,7 +100,7 @@ private List ScanRepo(RepoConfiguration config, AssetsResultSet? p var commitsOnBranch = GetBranchCommits(targetRepoUri, branch, config.ScanStartDate, workingDirectory); var unretrievedCommits = ResolveUnhandledCommits(commitsOnBranch, previousOutput); - results.AddRange(GetAssetsResults(config.LanguageRepo, unretrievedCommits, workingDirectory)); + results.AddRange(GetAssetsResults(config.LanguageRepo, unretrievedCommits, workingDirectory, config.ScanFolders)); if (previousOutput != null) { @@ -207,7 +207,7 @@ public Assets() /// Find all assets.jsons beneath a targeted folder. /// /// AssetsResults for each discovered assets.json, populating other metadata as necessary. - private List ScanDirectory(string repo, string commit, string workingDirectory) + private List ScanDirectory(string repo, string commit, string workingDirectory, List scanFolders) { Matcher matcher = new(); List locatedAssets = new List(); @@ -233,14 +233,14 @@ private List ScanDirectory(string repo, string commit, string work /// Walks a set of targeted commits, extracting all available assets.jsons from each. /// /// A list of AssetsResults reflecting all discovered assets.jsons from each targeted commit. - private List GetAssetsResults(string repo, List commits, string workingDirectory) + private List GetAssetsResults(string repo, List commits, string workingDirectory, List folderGlobs) { var allResults = new List(); foreach (var commit in commits) { handler.Run($"checkout {commit}", workingDirectory); Cleanup(workingDirectory); - allResults.AddRange(ScanDirectory(repo, commit, workingDirectory)); + allResults.AddRange(ScanDirectory(repo, commit, workingDirectory, folderGlobs)); } return allResults; diff --git a/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.yml b/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.yml index e69de29bb2d..eeaffc11502 100644 --- a/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.yml +++ b/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.yml @@ -0,0 +1,34 @@ +{ + "LanguageRepos": [ + { + "LanguageRepo": "Azure/azure-sdk-for-java", + "ScanFolders": [ + "sdk/containerregistry" + ] + }, + { + "LanguageRepo": "Azure/azure-sdk-for-python", + "ScanFolders": [ + "sdk/containerregistry" + ] + }, + { + "LanguageRepo": "Azure/azure-sdk-for-go", + "ScanFolders": [ + "sdk/containers" + ] + }, + { + "LanguageRepo": "Azure/azure-sdk-for-net", + "ScanFolders": [ + "sdk/containerregistry" + ] + }, + { + "LanguageRepo": "Azure/azure-sdk-for-js", + "ScanFolders": [ + "sdk/containerregistry" + ] + }, + ] +} \ No newline at end of file From 889fbe6cf9eb6a0da4fc0eed19a575fe1d0047f0 Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Wed, 5 Jun 2024 12:24:46 -0700 Subject: [PATCH 03/13] getting closer to actually having this work the way it should --- .gitignore | 2 ++ .../Model/RepoConfiguration.cs | 2 +- .../Program.cs | 2 +- .../Scan/AssetsScanner.cs | 14 +++++++---- ... integration-test-repo-configuration.json} | 2 +- .../get-involved-assets.ps1 | 24 ++++++++++++------- .../assets-task-scripts/utilities.ps1 | 11 +++++++++ 7 files changed, 41 insertions(+), 16 deletions(-) rename tools/assets-automation/assets-maintenance-tool/{integration-test-repo-configuration.yml => integration-test-repo-configuration.json} (98%) create mode 100644 tools/assets-automation/assets-task-scripts/utilities.ps1 diff --git a/.gitignore b/.gitignore index ed9b21b0c4e..fdacc65c4d0 100644 --- a/.gitignore +++ b/.gitignore @@ -485,8 +485,10 @@ local.settings.json # Java tooling *.iml +# generated by test-proxy related scripts and packages when testing .assets .testruns +.results # oav converter tools/oav-traffic-converter/input-example/ diff --git a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs index dd9d5c201b0..cb91563586e 100644 --- a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs +++ b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs @@ -25,7 +25,7 @@ public RepoConfiguration() { /// need to go further back then that when examining the SHAs in the language repos. There is no possibility of an /// assets.json past this date! /// - public DateTime ScanStartDate { get; set; } = DateTime.Parse("2023-12-01"); + public DateTime ScanStartDate { get; set; } = DateTime.Parse("2024-06-01"); /// /// The set of branches that we will examine. Defaults to just 'main'. diff --git a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Program.cs b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Program.cs index 6e71d3af60b..cabaeb502f1 100644 --- a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Program.cs +++ b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Program.cs @@ -53,7 +53,7 @@ public static void Run(object commandObj) case BaseOptions configOptions: AssetsScanner scanner = new AssetsScanner(); var runConfig = new RunConfiguration(configOptions.ConfigLocation); - AssetsResultSet results = scanner.Scan(runConfig); + AssetsResultSet results = scanner.Scan(runConfig, Directory.GetCurrentDirectory()); scanner.Save(results); break; diff --git a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs index 56d17936fc1..8767aa805cd 100644 --- a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs +++ b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs @@ -33,14 +33,14 @@ public AssetsScanner(string? workingDirectory = null) /// /// /// A set of results which combines any previous output with a new scan. - public AssetsResultSet Scan(RunConfiguration config) + public AssetsResultSet Scan(RunConfiguration config, string workDirectory) { var resultSet = new List(); AssetsResultSet? existingResults = ParseExistingResults(); Parallel.ForEach(config.LanguageRepos, repoConfig => { - resultSet.AddRange(ScanRepo(repoConfig, existingResults)); + resultSet.AddRange(ScanRepo(repoConfig, existingResults, workDirectory)); }); return new AssetsResultSet(resultSet); @@ -75,7 +75,7 @@ public AssetsResultSet Scan(RunConfiguration config) /// /// /// - private List ScanRepo(RepoConfiguration config, AssetsResultSet? previousOutput) + private List ScanRepo(RepoConfiguration config, AssetsResultSet? previousOutput, string workDirectory) { string? envOverride = Environment.GetEnvironmentVariable(GitTokenEnvVar); var authString = string.Empty; @@ -85,7 +85,7 @@ private List ScanRepo(RepoConfiguration config, AssetsResultSet? p } var targetRepoUri = $"https://{authString}github.com/{config.LanguageRepo}.git"; - var workingDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); + var workingDirectory = Path.Combine(workDirectory, config.LanguageRepo.Replace("/", "_")); var results = new List(); try @@ -319,7 +319,11 @@ public void Save(AssetsResultSet newResults) { using (var stream = System.IO.File.OpenWrite(ResultsFile)) { - stream.Write(Encoding.UTF8.GetBytes(JsonSerializer.Serialize(newResults.Results))); + var options = new JsonSerializerOptions + { + WriteIndented = true + }; + stream.Write(Encoding.UTF8.GetBytes(JsonSerializer.Serialize(newResults.Results, options: options))); } } } diff --git a/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.yml b/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.json similarity index 98% rename from tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.yml rename to tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.json index eeaffc11502..1fd5c73693a 100644 --- a/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.yml +++ b/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.json @@ -29,6 +29,6 @@ "ScanFolders": [ "sdk/containerregistry" ] - }, + } ] } \ No newline at end of file diff --git a/tools/assets-automation/assets-task-scripts/get-involved-assets.ps1 b/tools/assets-automation/assets-task-scripts/get-involved-assets.ps1 index 2baa7c1247b..50412e083bb 100644 --- a/tools/assets-automation/assets-task-scripts/get-involved-assets.ps1 +++ b/tools/assets-automation/assets-task-scripts/get-involved-assets.ps1 @@ -1,9 +1,10 @@ - - <# .SYNOPSIS -# Retrieve a copy of all the assets files related to a folder in one or multiple repos -# and dumps the results into a folder .results alongside the script. +Retrieve a copy of all the assets files related to a folder in one or multiple repos +and dumps the results into a folder .results alongside the script. + +.DESCRIPTION +Uses the Azure.Sdk.Tools.Assets.MaintenanceTool to retrieve a copy of all the assets files related to a folder in one or multiple repos. .PARAMETER ConfigFilePath The query configuration file, which contains targeted repos, branches, and paths. @@ -14,12 +15,19 @@ param( ) Set-StrictMode -Version 4 +. $PSScriptRoot\utilities.ps1 -if (Test-Path $ConfigFilePath -PathType Leaf) { - $Config = Get-Content $ConfigFilePath | ConvertFrom-Json -} else { +if (!(Test-Path $ConfigFilePath -PathType Leaf)) { Write-Error "Config file not found: $ConfigFilePath" exit 1 } -Write-Host ($Config | ConvertTo-Json) \ No newline at end of file +$ResultsFolder = Create-If-Not-Exists "$PSScriptRoot\.results" + +try { + Push-Location $ResultsFolder + Azure.Sdk.Tools.Assets.MaintenanceTool scan --config $ConfigFilePath +} +finally { + Pop-Location +} \ No newline at end of file diff --git a/tools/assets-automation/assets-task-scripts/utilities.ps1 b/tools/assets-automation/assets-task-scripts/utilities.ps1 new file mode 100644 index 00000000000..8f50175898d --- /dev/null +++ b/tools/assets-automation/assets-task-scripts/utilities.ps1 @@ -0,0 +1,11 @@ +function Create-If-Not-Exists { + param( + [string]$Path + ) + + if (!(Test-Path $Path)) { + New-Item -ItemType Directory -Path $Path -Force + } + + return $Path +} \ No newline at end of file From 70d0eb956ef112fe79d8596d23c7a8be0479196d Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Wed, 5 Jun 2024 17:02:53 -0700 Subject: [PATCH 04/13] small updates to the maintenance tool to allow me to easily get a blast radius going --- .../Model/RepoConfiguration.cs | 4 +- .../Scan/AssetsScanner.cs | 45 ++++++++++--------- .../integration-test-repo-configuration.json | 5 +++ ...d-assets.ps1 => locate-involved-tests.ps1} | 15 +++++-- .../assets-task-scripts/utilities.ps1 | 36 +++++++++++++++ 5 files changed, 79 insertions(+), 26 deletions(-) rename tools/assets-automation/assets-task-scripts/{get-involved-assets.ps1 => locate-involved-tests.ps1} (51%) diff --git a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs index cb91563586e..e24e3231659 100644 --- a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs +++ b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs @@ -24,8 +24,10 @@ public RepoConfiguration() { /// almost arbitrarily. Official test-proxy began supported external assets in late November of 2022, so we don't /// need to go further back then that when examining the SHAs in the language repos. There is no possibility of an /// assets.json past this date! + /// + /// If provided with "latest" argument, only the most recent commit on each considered branch will be included. /// - public DateTime ScanStartDate { get; set; } = DateTime.Parse("2024-06-01"); + public string ScanStartDate { get; set; } = "2024-06-01"; /// /// The set of branches that we will examine. Defaults to just 'main'. diff --git a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs index 8767aa805cd..e2d73220c66 100644 --- a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs +++ b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs @@ -88,33 +88,27 @@ private List ScanRepo(RepoConfiguration config, AssetsResultSet? p var workingDirectory = Path.Combine(workDirectory, config.LanguageRepo.Replace("/", "_")); var results = new List(); - try + if (!Directory.Exists(workingDirectory)) { - if (!Directory.Exists(workingDirectory)) - { - Directory.CreateDirectory(workingDirectory); - } + Directory.CreateDirectory(workingDirectory); + } - foreach (var branch in config.Branches) - { - var commitsOnBranch = GetBranchCommits(targetRepoUri, branch, config.ScanStartDate, workingDirectory); - var unretrievedCommits = ResolveUnhandledCommits(commitsOnBranch, previousOutput); + foreach (var branch in config.Branches) + { + var commitsOnBranch = GetBranchCommits(targetRepoUri, branch, config.ScanStartDate, workingDirectory); + var unretrievedCommits = ResolveUnhandledCommits(commitsOnBranch, previousOutput); - results.AddRange(GetAssetsResults(config.LanguageRepo, unretrievedCommits, workingDirectory, config.ScanFolders)); + results.AddRange(GetAssetsResults(config.LanguageRepo, unretrievedCommits, workingDirectory, config.ScanFolders)); - if (previousOutput != null) + if (previousOutput != null) + { + foreach (var commit in commitsOnBranch.Where(commit => !unretrievedCommits.Contains(commit))) { - foreach (var commit in commitsOnBranch.Where(commit => !unretrievedCommits.Contains(commit))) - { - results.AddRange(previousOutput.ByOriginSHA[commit]); - } + results.AddRange(previousOutput.ByOriginSHA[commit]); } } } - finally - { - CleanupWorkingDirectory(workingDirectory); - } + return results; } @@ -123,9 +117,10 @@ private List ScanRepo(RepoConfiguration config, AssetsResultSet? p /// Clones a specific branch, then returns all commit shas newer than our targeted date. /// /// A list of commits (limited to after a startdate) from the targeted branch. - private List GetBranchCommits(string uri, string branch, DateTime since, string workingDirectory) + private List GetBranchCommits(string uri, string branch, string since, string workingDirectory) { var commitSHAs = new List(); + try { // if git is already initialized, we just need to checkout a specific branch @@ -141,7 +136,15 @@ private List GetBranchCommits(string uri, string branch, DateTime since, Cleanup(workingDirectory); } - var tagResult = handler.Run($"log --since={since.ToString("yyyy-MM-dd")} --format=format:%H", workingDirectory); + CommandResult tagResult; + if (since == "latest") + { + tagResult = handler.Run($"log -n 1 --format=format:%H", workingDirectory); + } + else + { + tagResult = handler.Run($"log --since={since} --format=format:%H", workingDirectory); + } commitSHAs.AddRange(tagResult.StdOut.Split(Environment.NewLine).Select(x => x.Trim()).Where(x => !string.IsNullOrWhiteSpace(x))); } catch (GitProcessException gitException) diff --git a/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.json b/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.json index 1fd5c73693a..4b637533e20 100644 --- a/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.json +++ b/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.json @@ -2,30 +2,35 @@ "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" ] diff --git a/tools/assets-automation/assets-task-scripts/get-involved-assets.ps1 b/tools/assets-automation/assets-task-scripts/locate-involved-tests.ps1 similarity index 51% rename from tools/assets-automation/assets-task-scripts/get-involved-assets.ps1 rename to tools/assets-automation/assets-task-scripts/locate-involved-tests.ps1 index 50412e083bb..2a752d2c612 100644 --- a/tools/assets-automation/assets-task-scripts/get-involved-assets.ps1 +++ b/tools/assets-automation/assets-task-scripts/locate-involved-tests.ps1 @@ -1,10 +1,16 @@ <# .SYNOPSIS -Retrieve a copy of all the assets files related to a folder in one or multiple repos -and dumps the results into a folder .results alongside the script. +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 related to a folder in one or multiple repos. +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. + +The output will be a list of links directly to individual files on github that match the search string. + +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. .PARAMETER ConfigFilePath The query configuration file, which contains targeted repos, branches, and paths. @@ -30,4 +36,5 @@ try { } finally { Pop-Location -} \ No newline at end of file +} + diff --git a/tools/assets-automation/assets-task-scripts/utilities.ps1 b/tools/assets-automation/assets-task-scripts/utilities.ps1 index 8f50175898d..eef96948303 100644 --- a/tools/assets-automation/assets-task-scripts/utilities.ps1 +++ b/tools/assets-automation/assets-task-scripts/utilities.ps1 @@ -1,3 +1,5 @@ +Set-StrictMode -Version 4 + function Create-If-Not-Exists { param( [string]$Path @@ -8,4 +10,38 @@ function Create-If-Not-Exists { } return $Path +} + +function Get-AssetsRepoSlice { + param( + # the assets repo tag + [Parameter(Mandatory=$true)] + [string]$Tag, + # WorkDirectory should be targeted at the .results folder + [Parameter(Mandatory=$true)] + [string]$WorkDirectory, + # the target repo to clone, we will default to the assets repo, but will support others just in case + [string]$TargetRepo = "Azure/azure-sdk-assets", + ) + $CloneUri = "https://github.com/$TargetRepo.git" + + $TagFolder = Create-If-Not-Exists (Join-Path $WorkDirectory $Tag.Replace("/", "|")) + + if (Test-Path $TagFolder) { + return $TagFolder + } + else { + New-Item -ItemType Directory -Path $TagFolder -Force + 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 + } } \ No newline at end of file From d23e4a7966e3dddc86f155225aae10b151e299d7 Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Wed, 5 Jun 2024 18:02:11 -0700 Subject: [PATCH 05/13] we're populating our output directory now --- .../locate-involved-tests.ps1 | 23 +++++++++++++++++-- .../assets-task-scripts/utilities.ps1 | 15 +++++++----- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/tools/assets-automation/assets-task-scripts/locate-involved-tests.ps1 b/tools/assets-automation/assets-task-scripts/locate-involved-tests.ps1 index 2a752d2c612..869f386a1ce 100644 --- a/tools/assets-automation/assets-task-scripts/locate-involved-tests.ps1 +++ b/tools/assets-automation/assets-task-scripts/locate-involved-tests.ps1 @@ -12,15 +12,22 @@ The output will be a list of links directly to individual files on github that m 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 + .PARAMETER ConfigFilePath The query configuration file, which contains targeted repos, branches, and paths. #> param( - [string]$ConfigFilePath + [string]$ConfigFilePath, + [string]$SearchString = "application/vnd.docker.distribution.manifest.v2+json" ) Set-StrictMode -Version 4 +$ErrorActionPreference = "Stop" . $PSScriptRoot\utilities.ps1 if (!(Test-Path $ConfigFilePath -PathType Leaf)) { @@ -29,12 +36,24 @@ if (!(Test-Path $ConfigFilePath -PathType Leaf)) { } $ResultsFolder = Create-If-Not-Exists "$PSScriptRoot\.results" +$ScanOutputJson = Join-Path $ResultsFolder "output.json" try { Push-Location $ResultsFolder - Azure.Sdk.Tools.Assets.MaintenanceTool scan --config $ConfigFilePath + + 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 +} \ No newline at end of file diff --git a/tools/assets-automation/assets-task-scripts/utilities.ps1 b/tools/assets-automation/assets-task-scripts/utilities.ps1 index eef96948303..ab21ad97115 100644 --- a/tools/assets-automation/assets-task-scripts/utilities.ps1 +++ b/tools/assets-automation/assets-task-scripts/utilities.ps1 @@ -6,7 +6,7 @@ function Create-If-Not-Exists { ) if (!(Test-Path $Path)) { - New-Item -ItemType Directory -Path $Path -Force + New-Item -ItemType Directory -Path $Path -Force | Out-Null } return $Path @@ -21,21 +21,24 @@ function Get-AssetsRepoSlice { [Parameter(Mandatory=$true)] [string]$WorkDirectory, # the target repo to clone, we will default to the assets repo, but will support others just in case - [string]$TargetRepo = "Azure/azure-sdk-assets", + [string]$TargetRepo = "Azure/azure-sdk-assets" ) $CloneUri = "https://github.com/$TargetRepo.git" + $TagFolderName = Join-Path $WorkDirectory "tags" $Tag.Replace("/", "-") - $TagFolder = Create-If-Not-Exists (Join-Path $WorkDirectory $Tag.Replace("/", "|")) + $TagFolder = Create-If-Not-Exists -Path $TagFolderName - if (Test-Path $TagFolder) { + Write-Host "TagFolder is $TagFolder" + + if (Test-Path $TagFolder/.git) { + Write-Host "TagFolder already exists, skipping clone, returning $TagFolder" return $TagFolder } else { - New-Item -ItemType Directory -Path $TagFolder -Force 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 fetch origin "refs/tags/$($Tag):refs/tags/$Tag" git checkout $Tag } finally { From e23e665fa58d2218226740e593c91478c692973e Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Wed, 5 Jun 2024 18:20:08 -0700 Subject: [PATCH 06/13] properly filtering? --- .../Scan/AssetsScanner.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs index e2d73220c66..6d5133581a7 100644 --- a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs +++ b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs @@ -108,7 +108,6 @@ private List ScanRepo(RepoConfiguration config, AssetsResultSet? p } } } - return results; } @@ -214,7 +213,20 @@ private List ScanDirectory(string repo, string commit, string work { Matcher matcher = new(); List locatedAssets = new List(); - matcher.AddIncludePatterns(new[] { "**/assets.json" }); + + if (scanFolders.Count > 0) + { + foreach (string folder in scanFolders) + { + + matcher.AddIncludePatterns(new[] { Path.Combine(folder, "**/assets.json") }); + } + } + else + { + matcher.AddIncludePatterns(new[] { "**/assets.json" }); + } + IEnumerable assetsJsons = matcher.GetResultsInFullPath(workingDirectory); foreach (var assetsJson in assetsJsons) From 18de618d7e8036b39b239721146aabdadcd43eab Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Wed, 5 Jun 2024 18:23:49 -0700 Subject: [PATCH 07/13] revert my changes to the integration-test, add it directly next to the script --- ...> integration-test-repo-configuration.yml} | 0 ...d-tests.ps1 => locate-involved-assets.ps1} | 0 .../sample-query-config.json | 39 +++++++++++++++++++ 3 files changed, 39 insertions(+) rename tools/assets-automation/assets-maintenance-tool/{integration-test-repo-configuration.json => integration-test-repo-configuration.yml} (100%) rename tools/assets-automation/assets-task-scripts/{locate-involved-tests.ps1 => locate-involved-assets.ps1} (100%) create mode 100644 tools/assets-automation/assets-task-scripts/sample-query-config.json diff --git a/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.json b/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.yml similarity index 100% rename from tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.json rename to tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.yml diff --git a/tools/assets-automation/assets-task-scripts/locate-involved-tests.ps1 b/tools/assets-automation/assets-task-scripts/locate-involved-assets.ps1 similarity index 100% rename from tools/assets-automation/assets-task-scripts/locate-involved-tests.ps1 rename to tools/assets-automation/assets-task-scripts/locate-involved-assets.ps1 diff --git a/tools/assets-automation/assets-task-scripts/sample-query-config.json b/tools/assets-automation/assets-task-scripts/sample-query-config.json new file mode 100644 index 00000000000..4b637533e20 --- /dev/null +++ b/tools/assets-automation/assets-task-scripts/sample-query-config.json @@ -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" + ] + } + ] +} \ No newline at end of file From 8d0f694c7a6e430f7c447c8b761f92492e1c6ffb Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Thu, 6 Jun 2024 16:51:49 -0700 Subject: [PATCH 08/13] working rg output --- .../ScanTests.cs | 4 +-- .../locate-involved-assets.ps1 | 21 ++++++++---- .../sample-query-config.json | 0 .../assets-task-scripts/utilities.ps1 | 32 +++++++++++++++++-- 4 files changed, 45 insertions(+), 12 deletions(-) rename tools/assets-automation/assets-task-scripts/{ => find-assets-files}/locate-involved-assets.ps1 (73%) rename tools/assets-automation/assets-task-scripts/{ => find-assets-files}/sample-query-config.json (100%) diff --git a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool.Tests/ScanTests.cs b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool.Tests/ScanTests.cs index a5d3344ee96..e91a41feed9 100644 --- a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool.Tests/ScanTests.cs +++ b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool.Tests/ScanTests.cs @@ -77,7 +77,7 @@ public void TestBasicScanSingleBranch() var config = RunConfiguration; config.LanguageRepos.RemoveAt(0); config.LanguageRepos.First().Branches.RemoveAt(1); - var results = scanner.Scan(config); + var results = scanner.Scan(config, Directory.GetCurrentDirectory()); Assert.IsNotNull(results); Assert.That(results.Results.Count(), Is.EqualTo(3)); @@ -112,7 +112,7 @@ public void TestBasicScanMultipleBranches() var scanner = new AssetsScanner(TestDirectory); var config = RunConfiguration; config.LanguageRepos.RemoveAt(0); - var results = scanner.Scan(config); + var results = scanner.Scan(config, TestDirectory); Assert.IsNotNull(results); Assert.That(results.Results.Count(), Is.EqualTo(6)); diff --git a/tools/assets-automation/assets-task-scripts/locate-involved-assets.ps1 b/tools/assets-automation/assets-task-scripts/find-assets-files/locate-involved-assets.ps1 similarity index 73% rename from tools/assets-automation/assets-task-scripts/locate-involved-assets.ps1 rename to tools/assets-automation/assets-task-scripts/find-assets-files/locate-involved-assets.ps1 index 869f386a1ce..7e3d74fe4ca 100644 --- a/tools/assets-automation/assets-task-scripts/locate-involved-assets.ps1 +++ b/tools/assets-automation/assets-task-scripts/find-assets-files/locate-involved-assets.ps1 @@ -7,8 +7,6 @@ Uses the Azure.Sdk.Tools.Assets.MaintenanceTool to retrieve a copy of all the as 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. -The output will be a list of links directly to individual files on github that match the search string. - 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. @@ -16,26 +14,32 @@ 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, - [string]$SearchString = "application/vnd.docker.distribution.manifest.v2+json" + [Parameter(Mandatory = $true)] + [string]$SearchString ) Set-StrictMode -Version 4 $ErrorActionPreference = "Stop" -. $PSScriptRoot\utilities.ps1 +. (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 "$PSScriptRoot\.results" +$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 { @@ -56,4 +60,7 @@ $DiscoveredAssets = Get-Content $ScanOutputJson | ConvertFrom-Json foreach ($asset in $DiscoveredAssets) { $TagFolder = Get-AssetsRepoSlice -Tag $asset.Tag -WorkDirectory $ResultsFolder -} \ No newline at end of file +} + +Write-Host "rg $SearchString -g `"*.json`" $TagsFolder" +rg $SearchString -g "*.json" $TagsFolder diff --git a/tools/assets-automation/assets-task-scripts/sample-query-config.json b/tools/assets-automation/assets-task-scripts/find-assets-files/sample-query-config.json similarity index 100% rename from tools/assets-automation/assets-task-scripts/sample-query-config.json rename to tools/assets-automation/assets-task-scripts/find-assets-files/sample-query-config.json diff --git a/tools/assets-automation/assets-task-scripts/utilities.ps1 b/tools/assets-automation/assets-task-scripts/utilities.ps1 index ab21ad97115..696aedf650f 100644 --- a/tools/assets-automation/assets-task-scripts/utilities.ps1 +++ b/tools/assets-automation/assets-task-scripts/utilities.ps1 @@ -12,15 +12,41 @@ function Create-If-Not-Exists { 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/ + / + + / + + / + + ... + +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( - # the assets repo tag [Parameter(Mandatory=$true)] [string]$Tag, - # WorkDirectory should be targeted at the .results folder [Parameter(Mandatory=$true)] [string]$WorkDirectory, - # the target repo to clone, we will default to the assets repo, but will support others just in case [string]$TargetRepo = "Azure/azure-sdk-assets" ) $CloneUri = "https://github.com/$TargetRepo.git" From a29318502f7b59f01128f4fb17cec1cd0cdabc52 Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Thu, 6 Jun 2024 17:20:42 -0700 Subject: [PATCH 09/13] repair the tests --- .../ScanTests.cs | 10 ++-------- .../Model/RepoConfiguration.cs | 2 +- .../Program.cs | 2 +- .../Scan/AssetsScanner.cs | 12 ++++++------ 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool.Tests/ScanTests.cs b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool.Tests/ScanTests.cs index e91a41feed9..a10edc6adc9 100644 --- a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool.Tests/ScanTests.cs +++ b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool.Tests/ScanTests.cs @@ -63,12 +63,6 @@ public void Setup() TestDirectory = workingDirectory; } - [TearDown] - public void TearDown() - { - Directory.Delete(TestDirectory, true); - } - [Test] [GitTokenSkip] public void TestBasicScanSingleBranch() @@ -77,7 +71,7 @@ public void TestBasicScanSingleBranch() var config = RunConfiguration; config.LanguageRepos.RemoveAt(0); config.LanguageRepos.First().Branches.RemoveAt(1); - var results = scanner.Scan(config, Directory.GetCurrentDirectory()); + var results = scanner.Scan(config); Assert.IsNotNull(results); Assert.That(results.Results.Count(), Is.EqualTo(3)); @@ -112,7 +106,7 @@ public void TestBasicScanMultipleBranches() var scanner = new AssetsScanner(TestDirectory); var config = RunConfiguration; config.LanguageRepos.RemoveAt(0); - var results = scanner.Scan(config, TestDirectory); + var results = scanner.Scan(config); Assert.IsNotNull(results); Assert.That(results.Results.Count(), Is.EqualTo(6)); diff --git a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs index e24e3231659..3c148afbc2c 100644 --- a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs +++ b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Model/RepoConfiguration.cs @@ -27,7 +27,7 @@ public RepoConfiguration() { /// /// If provided with "latest" argument, only the most recent commit on each considered branch will be included. /// - public string ScanStartDate { get; set; } = "2024-06-01"; + public string ScanStartDate { get; set; } = "2022-12-01"; /// /// The set of branches that we will examine. Defaults to just 'main'. diff --git a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Program.cs b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Program.cs index cabaeb502f1..6e71d3af60b 100644 --- a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Program.cs +++ b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Program.cs @@ -53,7 +53,7 @@ public static void Run(object commandObj) case BaseOptions configOptions: AssetsScanner scanner = new AssetsScanner(); var runConfig = new RunConfiguration(configOptions.ConfigLocation); - AssetsResultSet results = scanner.Scan(runConfig, Directory.GetCurrentDirectory()); + AssetsResultSet results = scanner.Scan(runConfig); scanner.Save(results); break; diff --git a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs index 6d5133581a7..a71ae421fb0 100644 --- a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs +++ b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs @@ -33,14 +33,14 @@ public AssetsScanner(string? workingDirectory = null) /// /// /// A set of results which combines any previous output with a new scan. - public AssetsResultSet Scan(RunConfiguration config, string workDirectory) + public AssetsResultSet Scan(RunConfiguration config) { var resultSet = new List(); AssetsResultSet? existingResults = ParseExistingResults(); Parallel.ForEach(config.LanguageRepos, repoConfig => { - resultSet.AddRange(ScanRepo(repoConfig, existingResults, workDirectory)); + resultSet.AddRange(ScanRepo(repoConfig, existingResults)); }); return new AssetsResultSet(resultSet); @@ -75,7 +75,7 @@ public AssetsResultSet Scan(RunConfiguration config, string workDirectory) /// /// /// - private List ScanRepo(RepoConfiguration config, AssetsResultSet? previousOutput, string workDirectory) + private List ScanRepo(RepoConfiguration config, AssetsResultSet? previousOutput) { string? envOverride = Environment.GetEnvironmentVariable(GitTokenEnvVar); var authString = string.Empty; @@ -85,7 +85,7 @@ private List ScanRepo(RepoConfiguration config, AssetsResultSet? p } var targetRepoUri = $"https://{authString}github.com/{config.LanguageRepo}.git"; - var workingDirectory = Path.Combine(workDirectory, config.LanguageRepo.Replace("/", "_")); + var workingDirectory = Path.Combine(WorkingDirectory, config.LanguageRepo.Replace("/", "_")); var results = new List(); if (!Directory.Exists(workingDirectory)) @@ -290,7 +290,7 @@ private void Cleanup(string workingDirectory) /// This is necessary because certain `.pack` files created by git cannot be deleted without /// adjusting these permissions. /// - private void SetPermissionsAndDelete(string gitfolder) + public static void SetPermissionsAndDelete(string gitfolder) { File.SetAttributes(gitfolder, FileAttributes.Normal); @@ -315,7 +315,7 @@ private void SetPermissionsAndDelete(string gitfolder) /// The .git folder's .pack files can be super finicky to delete from code. /// This function abstracts the necessary permissions update and cleans that folder for us. /// - private void CleanupWorkingDirectory(string workingDirectory) + public static void CleanupGitDirectory(string workingDirectory) { var gitDir = Path.Combine(workingDirectory, ".git"); From 152cbb527d799989e1235436432e0ecb86b47905 Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Thu, 6 Jun 2024 17:22:12 -0700 Subject: [PATCH 10/13] revert the yml to its original state --- .../integration-test-repo-configuration.yml | 39 ------------------- 1 file changed, 39 deletions(-) diff --git a/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.yml b/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.yml index 4b637533e20..e69de29bb2d 100644 --- a/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.yml +++ b/tools/assets-automation/assets-maintenance-tool/integration-test-repo-configuration.yml @@ -1,39 +0,0 @@ -{ - "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" - ] - } - ] -} \ No newline at end of file From 0c659566110175c27e7c4a87f447f14207d023d5 Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Thu, 6 Jun 2024 17:22:55 -0700 Subject: [PATCH 11/13] get rid of extra new line --- .../Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs index a71ae421fb0..1e38ebb5b2e 100644 --- a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs +++ b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool/Scan/AssetsScanner.cs @@ -218,7 +218,6 @@ private List ScanDirectory(string repo, string commit, string work { foreach (string folder in scanFolders) { - matcher.AddIncludePatterns(new[] { Path.Combine(folder, "**/assets.json") }); } } From d453db7ee9010f1c201c91b6b0bb1f589bcda9b7 Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Thu, 6 Jun 2024 17:47:30 -0700 Subject: [PATCH 12/13] remove removal --- .../ScanTests.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool.Tests/ScanTests.cs b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool.Tests/ScanTests.cs index a10edc6adc9..a5d3344ee96 100644 --- a/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool.Tests/ScanTests.cs +++ b/tools/assets-automation/assets-maintenance-tool/Azure.Sdk.Tools.Assets.MaintenanceTool.Tests/ScanTests.cs @@ -63,6 +63,12 @@ public void Setup() TestDirectory = workingDirectory; } + [TearDown] + public void TearDown() + { + Directory.Delete(TestDirectory, true); + } + [Test] [GitTokenSkip] public void TestBasicScanSingleBranch() From 62df80fb4eb28e45b5fc28abf5aa4d55eb5a2aa5 Mon Sep 17 00:00:00 2001 From: Scott Beddall <45376673+scbedd@users.noreply.github.com> Date: Mon, 10 Jun 2024 11:41:01 -0700 Subject: [PATCH 13/13] Update tools/assets-automation/assets-task-scripts/find-assets-files/locate-involved-assets.ps1 Co-authored-by: Ben Broderick Phillips --- .../find-assets-files/locate-involved-assets.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/assets-automation/assets-task-scripts/find-assets-files/locate-involved-assets.ps1 b/tools/assets-automation/assets-task-scripts/find-assets-files/locate-involved-assets.ps1 index 7e3d74fe4ca..5c0713d7565 100644 --- a/tools/assets-automation/assets-task-scripts/find-assets-files/locate-involved-assets.ps1 +++ b/tools/assets-automation/assets-task-scripts/find-assets-files/locate-involved-assets.ps1 @@ -47,6 +47,7 @@ try { if (!(Test-Path $ScanOutputJson)) { Azure.Sdk.Tools.Assets.MaintenanceTool scan --config $ConfigFilePath + if ($LASTEXITCODE) { exit $LASTEXITCODE } } else { Write-Host "Skipping scan, using cached results"