Skip to content
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

test feed #20583

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
dae205a
test feed
merlynomsft Oct 21, 2024
b8e24c2
update feed to PipelineTools-test
merlynomsft Oct 23, 2024
75c488d
update feed to DistributedTasks-test
merlynomsft Oct 23, 2024
dd9e4ed
enable localpackage
merlynomsft Oct 23, 2024
317cc8b
build fix
merlynomsft Oct 23, 2024
288616d
Fix for new buildconfigs - we need to retain package-lock.json from b…
merlynomsft Oct 23, 2024
02ea7af
fix task source changes mismatch
merlynomsft Oct 23, 2024
5caea91
temp fix (wip)
merlynomsft Oct 24, 2024
f83b7c6
DeployVisualStudioTestAgentV2 doesn't build
merlynomsft Oct 24, 2024
d570c1f
Merge remote-tracking branch 'origin/master' into dev/merlynop/localp…
merlynomsft Oct 24, 2024
831c7c4
add package-lock.json and npm-shrinkwrap for LocalPackages
merlynomsft Oct 24, 2024
d6268f7
fix
merlynomsft Oct 24, 2024
e338486
add option to skip tests
merlynomsft Oct 25, 2024
2966c02
skiptests
merlynomsft Oct 25, 2024
ef23020
collect test errors
merlynomsft Oct 25, 2024
351018c
handle test errors
merlynomsft Oct 25, 2024
360f224
fix
merlynomsft Oct 25, 2024
f37f61a
fix
merlynomsft Oct 25, 2024
ef07bdb
increase build timeout (due to time needed to build all tasks)
merlynomsft Oct 25, 2024
8695de1
formatfix for build all tasks when forceCourtesyPush == true
merlynomsft Oct 26, 2024
3a6351c
for LocalPackage config, place updted package-lock, npm-shrinkwrap in…
merlynomsft Oct 28, 2024
435ede2
move package-lock.json, etc artifacts to _generated
merlynomsft Oct 29, 2024
6439ab5
Merge remote-tracking branch 'origin/master' into dev/merlynop/localp…
merlynomsft Oct 29, 2024
d5acd26
timeout
merlynomsft Oct 29, 2024
1cbd3b0
Update to automatically update globalversion.txt. Note: globalversio…
merlynomsft Oct 30, 2024
f451668
update globalversion
merlynomsft Oct 30, 2024
9cffed8
updating out-of-sync files
merlynomsft Oct 30, 2024
8d0b1ad
updates
merlynomsft Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 50 additions & 17 deletions BuildConfigGen/EnsureUpdateModeVerifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@ public IEnumerable<string> GetVerifyErrors(bool skipContentCheck)

if (!skipContentCheck)
{
foreach(var r in RedirectedToTempl)
{
string? sourceFile;
string procesed = "";

string? tempToKeep = null;
sourceFile = r.Value;
procesed = $"(processed temp={sourceFile}) ";
tempToKeep = sourceFile;

string? contentError = null;
contentError = CompareFile(r, sourceFile, procesed, tempToKeep, contentError);

if (contentError is not null)
{
yield return contentError;
}
}

foreach (var r in CopiedFilesToCheck)
{
string? sourceFile;
Expand All @@ -49,30 +68,44 @@ public IEnumerable<string> GetVerifyErrors(bool skipContentCheck)
sourceFile = r.Value;
}

FileInfo fi = new FileInfo(r.Key);
string? contentError = null;
contentError = CompareFile(r, sourceFile, procesed, tempToKeep, contentError);

if (fi.Name.Equals("resources.resjson", StringComparison.OrdinalIgnoreCase))
if (contentError is not null)
{
// resources.resjson is generated by make.js and does not need to be verified
// it can differ between configs if configs have different inputs (causes verifier to fail);
yield return contentError;
}
else
}
}
}

private string? CompareFile(KeyValuePair<string, string> r, string sourceFile, string procesed, string? tempToKeep, string? contentError)
{
FileInfo fi = new FileInfo(r.Key);

if (fi.Name.Equals("resources.resjson", StringComparison.OrdinalIgnoreCase))
{
// resources.resjson is generated by make.js and does not need to be verified
// it can differ between configs if configs have different inputs (causes verifier to fail);
}
else
{
if (Helpers.FilesEqual(sourceFile, r.Key))
{
// if overwrite and content match, everything is good! Verification passed.
}
else
{
if (tempToKeep != null)
{
if (Helpers.FilesEqual(sourceFile, r.Key))
{
// if overwrite and content match, everything is good! Verification passed.
}
else
{
if (tempToKeep != null)
{
this.tempsToKeep.Add(tempToKeep!);
}
yield return $"Content doesn't match {r.Value} {procesed}to {r.Key} (overwrite=true). Dest file doesn't match source.";
}
this.tempsToKeep.Add(tempToKeep!);
}

contentError = $"Content doesn't match {r.Value} {procesed}to {r.Key} (overwrite=true). Dest file doesn't match source.";
}
}

return contentError;
}

public void CleanupTempFiles()
Expand Down
58 changes: 40 additions & 18 deletions BuildConfigGen/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private static void MainInner(string? task, string? configs, int? currentSprintN
}

UpdateMaxPatchForSprint(taskVersionInfo[t.Value.Name], currentSprint, ref maxPatchForCurrentSprint);
CheckForDuplicates(t.Value.Name, taskVersionInfo[t.Value.Name].configTaskVersionMapping);
CheckForDuplicates(t.Value.Name, taskVersionInfo[t.Value.Name].configTaskVersionMapping, checkGlobalVersion: false);
}

if (tasksNeedingUpdates.Count > 0)
Expand All @@ -201,11 +201,14 @@ private static void MainInner(string? task, string? configs, int? currentSprintN
}

// bump patch number for global if any tasks invalidated or if there is no existing global version
if (taskVersionInfo.Values.Any(x => x.versionsUpdated.Any()) || globalVersion is null)
bool anyTaskVersionUpdated = taskVersionInfo.Values.Any(x => x.versionsUpdated.Any());
bool noCurrentGlobalVersion = globalVersion is null;
bool maxPatchForCurrentSprintGreaterOrEqualToGlobalPatch = globalVersion is not null && maxPatchForCurrentSprint >= globalVersion.Patch;
if (anyTaskVersionUpdated || noCurrentGlobalVersion || maxPatchForCurrentSprintGreaterOrEqualToGlobalPatch)
{
maxPatchForCurrentSprint = maxPatchForCurrentSprint + 1;

Console.WriteLine($"Global version: maxPatchForCurrentSprint = maxPatchForCurrentSprint + 1");
Console.WriteLine($"Global version: maxPatchForCurrentSprint = maxPatchForCurrentSprint + 1 anyTaskVersionUpdated={anyTaskVersionUpdated} noCurrentGlobalVersion={noCurrentGlobalVersion} maxPatchForCurrentSprintGreaterOrEqualToGlobalPatch={maxPatchForCurrentSprintGreaterOrEqualToGlobalPatch}");
}

Console.WriteLine($"Global version update: globalVersion = {globalVersion} maxPatchForCurrentSprint={maxPatchForCurrentSprint}");
Expand All @@ -218,7 +221,7 @@ private static void MainInner(string? task, string? configs, int? currentSprintN
IEnumerable<string> configsList = FilterConfigsForTask(configs, t);
HashSet<Config.ConfigRecord> targetConfigs = GetConfigRecords(configsList, writeUpdates);
UpdateVersionsForTask(t.Value.Name, taskVersionInfo[t.Value.Name], targetConfigs, currentSprint, globalVersionPath, globalVersion, generatedFolder);
CheckForDuplicates(t.Value.Name, taskVersionInfo[t.Value.Name].configTaskVersionMapping);
CheckForDuplicates(t.Value.Name, taskVersionInfo[t.Value.Name].configTaskVersionMapping, checkGlobalVersion: true);
}
}

Expand Down Expand Up @@ -264,7 +267,7 @@ private static void MainInner(string? task, string? configs, int? currentSprintN
HashSet<Config.ConfigRecord> targetConfigs = GetConfigRecords(configsList, writeUpdates);

UpdateVersionsGlobal(t.Value.Name, taskVersionInfo[t.Value.Name], targetConfigs, globalVersion);
CheckForDuplicates(t.Value.Name, taskVersionInfo[t.Value.Name].configTaskVersionMapping);
CheckForDuplicates(t.Value.Name, taskVersionInfo[t.Value.Name].configTaskVersionMapping, checkGlobalVersion: true);
}
}

Expand Down Expand Up @@ -335,15 +338,25 @@ private static IEnumerable<string> FilterConfigsForTask(string? configs, KeyValu
return configsList;
}

private static void CheckForDuplicates(string task, Dictionary<Config.ConfigRecord, TaskVersion> configTaskVersionMapping)
private static void CheckForDuplicates(string task, Dictionary<Config.ConfigRecord, TaskVersion> configTaskVersionMapping, bool checkGlobalVersion)
{
var duplicateVersions = configTaskVersionMapping.GroupBy(x => x.Value).Select(x => new { version = x.Key, configName = String.Join(",", x.Select(x => x.Key.name)), count = x.Count() }).Where(x => x.count > 1);
var duplicateVersions = configTaskVersionMapping
.Where(x => checkGlobalVersion || !x.Key.useGlobalVersion)
.GroupBy(x => x.Value)
.Select(x => new { version = x.Key, hasGlobal = x.Where(x => x.Key.useGlobalVersion).Any(), configName = String.Join(",", x.Select(x => x.Key.name)), count = x.Count() }).Where(x => x.count > 1);
if (duplicateVersions.Any())
{
StringBuilder dupConfigsStr = new StringBuilder();
foreach (var x in duplicateVersions)
{
dupConfigsStr.AppendLine($"task={task} version={x.version} specified in multiple configName={x.configName} config count={x.count}");
if (x.hasGlobal)
{
dupConfigsStr.AppendLine($"task={task} version={x.version} specified in multiple configName={x.configName} config count={x.count}. To fix, check-in globalversion.txt change generated by running 'node make.js build --task {task} --includeLocalPackagesBuildConfig'");
}
else
{
dupConfigsStr.AppendLine($"task={task} version={x.version} specified in multiple configName={x.configName} config count={x.count}");
}
}

throw new Exception(dupConfigsStr.ToString());
Expand Down Expand Up @@ -549,7 +562,7 @@ private static void MainUpdateTask(

if (config.enableBuildConfigOverrides)
{
EnsureBuildConfigFileOverrides(config, taskTargetPath);
EnsureBuildConfigFileOverrides(config, taskTargetPath, generatedFolder, task);
}

try
Expand Down Expand Up @@ -600,7 +613,7 @@ private static void MainUpdateTask(

if (config.enableBuildConfigOverrides)
{
CopyConfigOverrides(gitRootPath, taskTargetPath, taskOutput, config);
CopyConfigOverrides(gitRootPath, taskTargetPath, taskOutput, config, generatedFolder, task);
}

// if some files aren't present in destination, stop as following code assumes they're present and we'll just get a FileNotFoundException
Expand All @@ -620,7 +633,7 @@ private static void MainUpdateTask(

if (config.isNode)
{
GetBuildConfigFileOverridePaths(config, taskTargetPath, out string configTaskPath, out string readmePath);
GetBuildConfigFileOverridePaths(config, taskTargetPath, out string configTaskPath, out string readmePath, generatedFolder, task);

string buildConfigPackageJsonPath = Path.Combine(taskTargetPath, buildConfigs, configTaskPath, "package.json");

Expand Down Expand Up @@ -781,15 +794,15 @@ private static bool HasTaskInputContainsPreprocessorInstructions(string gitRootP
return hasPreprocessorDirectives;
}

private static void EnsureBuildConfigFileOverrides(Config.ConfigRecord config, string taskTargetPath)
private static void EnsureBuildConfigFileOverrides(Config.ConfigRecord config, string taskTargetPath, string generatedFolder, string taskName)
{
if (!config.enableBuildConfigOverrides)
{
throw new Exception("BUG: should not get here: !config.enableBuildConfigOverrides");
}

string path, readmeFile;
GetBuildConfigFileOverridePaths(config, taskTargetPath, out path, out readmeFile);
GetBuildConfigFileOverridePaths(config, taskTargetPath, out path, out readmeFile, generatedFolder, taskName);

if (!Directory.Exists(path))
{
Expand All @@ -799,7 +812,7 @@ private static void EnsureBuildConfigFileOverrides(Config.ConfigRecord config, s
ensureUpdateModeVerifier!.WriteAllText(readmeFile, "Place files overridden for this config in this directory", suppressValidationErrorIfTargetPathDoesntExist: !Knob.Default.SourceDirectoriesMustContainPlaceHolders);
}

private static void GetBuildConfigFileOverridePaths(Config.ConfigRecord config, string taskTargetPath, out string path, out string readmeFile)
private static void GetBuildConfigFileOverridePaths(Config.ConfigRecord config, string taskTargetPath, out string path, out string readmeFile, string generatedFolder, string taskName)
{
string directoryName = config.name;

Expand All @@ -813,19 +826,28 @@ private static void GetBuildConfigFileOverridePaths(Config.ConfigRecord config,
directoryName = config.overriddenDirectoryName;
}

path = Path.Combine(taskTargetPath, buildConfigs, directoryName);
readmeFile = Path.Combine(taskTargetPath, buildConfigs, directoryName, filesOverriddenForConfigGoHereReadmeTxt);
if (config.useGlobalVersion)
{
// for global version, place artifacts in _generated (such as package-lock)
path = Path.Combine(generatedFolder, buildConfigs, taskName, directoryName);
readmeFile = Path.Combine(generatedFolder, buildConfigs, taskName, directoryName, filesOverriddenForConfigGoHereReadmeTxt);
}
else
{
path = Path.Combine(taskTargetPath, buildConfigs, directoryName);
readmeFile = Path.Combine(taskTargetPath, buildConfigs, directoryName, filesOverriddenForConfigGoHereReadmeTxt);
}
}

private static void CopyConfigOverrides(string gitRootPath, string taskTargetPath, string taskOutput, Config.ConfigRecord config)
private static void CopyConfigOverrides(string gitRootPath, string taskTargetPath, string taskOutput, Config.ConfigRecord config, string generatedFolder, string taskName)
{
if (!config.enableBuildConfigOverrides)
{
throw new Exception("BUG: should not get here: !config.enableBuildConfigOverrides");
}

string overridePathForBuildConfig;
GetBuildConfigFileOverridePaths(config, taskTargetPath, out overridePathForBuildConfig, out _);
GetBuildConfigFileOverridePaths(config, taskTargetPath, out overridePathForBuildConfig, out _, generatedFolder, taskName);

bool doCopy;
if (Knob.Default.SourceDirectoriesMustContainPlaceHolders)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading