Skip to content

Add PR pipeline stage to validate VMR changes #1270

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

adamzip
Copy link

@adamzip adamzip commented Jun 20, 2025

test pr

@adamzip adamzip requested review from a team as code owners June 20, 2025 14:13
@adamzip adamzip force-pushed the add-vmr-change-validation-stage branch 3 times, most recently from 63faec3 to 910d34f Compare June 20, 2025 14:57
@premun
Copy link
Member

premun commented Jun 20, 2025

@adamzip as we spoke earlier - it would probably be good to comment out the other stages so that we don't block compute for no reason (and since there are iterations to be expected)

Copy link
Member

@jkoritzinsky jkoritzinsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like with the other change validation tooling, I think this could be better written as a one or two line script in a bash script.

@premun
Copy link
Member

premun commented Jun 23, 2025

@jkoritzinsky please note that there will be a whole suite of checks we will run and many will use existing functionality from Maestro to parse source-manifest and source-mappings: dotnet/arcade-services#2950

For this reason, C# will be more tenable long-term. Existing GHA checks from Ella will be ported to C# too.

@adamzip adamzip force-pushed the add-vmr-change-validation-stage branch from e056e68 to 78a6e64 Compare July 21, 2025 12:19
@@ -1,22 +0,0 @@
name: 'Check Protected Files for Changes'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably not desired? Or is it one of the tests?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the github workflow that checks the tooling files that the VMR change validation now checks instead

Comment on lines +56 to +57
Console.WriteLine("");
Console.WriteLine("");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine();
Console.WriteLine();

// Run Submodule Validation
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("2. Starting Submodule Validation...");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be rather logged from within the method itself?

Comment on lines +72 to +74
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("3. Starting Exclusion File Validation...");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The repetition of these "sections" is not great. Especially since when we will be defining more of these.

I'd imagine we define a list of validations and then have code to loop through them and run/output them.
The list could just be a list of types and the validations could inherit from an interface/base class so that we just run some Validate() method on each one. We can instantiate each from DI.

{
foreach (var line in lines)
{
Console.WriteLine($"##vso[task.logissue type=error] {line}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this page (where devs usually go first): https://github.com/dotnet/dotnet/pull/1270/checks?check_run_id=46502889155

we should consider which lines should be outputted with ##error only to make it more readable

Comment on lines +107 to +121
JArray? mappings = null;
try
{
var jsonRoot = JObject.Parse(fileContents);

if (jsonRoot.TryGetValue("mappings", out JToken? mappingsToken) && mappingsToken?.Type == JTokenType.Array)
{
mappings = (JArray)mappingsToken;
}
else
{
Console.WriteLine($"Cannot find mappings in {SourceMappingsPath}");
return [];
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just parse the file using DarcLib into an existing POCOs with an existing schema to be more type safe. This whole method could be a 2 liner then.




internal static string RunGitCommand(string arguments)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to re-use ProcessManager since we will need DarcLib anyway

return output;
}

internal static void AddProcessingMessage(List<ProcessingMessage> processingMessages, ProcessingMessage processingMessage)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we buffering the messages just for the sake of counting them at the end or is there another reason?

I think it'd be just better to output them right away and if we need the count, increment some counter then?


var newExclusionRules = GetExclusionPatternsFromBranch("HEAD");

if (newExclusionRules == null || !newExclusionRules.Any())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's entirely possible we will not have any exclusions and that is a valid scenario

Comment on lines +166 to +179
private static string FindGitRepoRoot(string startDirectory)
{
var dir = new DirectoryInfo(startDirectory);
while (dir != null)
{
var gitPath = Path.Combine(dir.FullName, ".git");
if (Directory.Exists(gitPath) || File.Exists(gitPath))
{
return dir.FullName;
}
dir = dir.Parent;
}
throw new InvalidOperationException("Could not find the Git repository root.");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is probably also available in Darclib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants