Skip to content

Commit

Permalink
Merge branch 'main' into yueqianli/SBConfigAndRepo
Browse files Browse the repository at this point in the history
  • Loading branch information
LiYueqian-James authored Sep 5, 2024
2 parents e6eca5b + f5c087f commit 8a0ca65
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 73 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.15.15
1.15.18
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public MemtierBenchmarkClientExecutor(IServiceCollection dependencies, IDictiona
// Ensure the duration is in integer (seconds) form.
int duration = this.Duration;
this.Parameters[nameof(this.Duration)] = duration;
this.processOutputDescriptions = new List<ProcessOutputDescription>();
}

/// <summary>
Expand Down Expand Up @@ -231,6 +230,7 @@ protected override async Task ExecuteAsync(EventContext telemetryContext, Cancel
{
IPAddress ipAddress;
List<Task> clientWorkloadTasks = new List<Task>();
this.processOutputDescriptions = new List<ProcessOutputDescription>();

if (this.IsMultiRoleLayout())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace VirtualClient.Contracts
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -237,7 +238,8 @@ public static bool IsFullyQualifiedPath(string path)
/// <returns></returns>
public static bool IsRunningInContainer()
{
return (Convert.ToBoolean(Environment.GetEnvironmentVariable("DOTNET_RUNNING_IN_CONTAINER")) == true);
// DOTNET does not properly recognize some containers. Adding /.dockerenv file as back up.
return (Convert.ToBoolean(Environment.GetEnvironmentVariable("DOTNET_RUNNING_IN_CONTAINER")) == true || File.Exists("/.dockerenv"));
}

/// <summary>
Expand Down
39 changes: 37 additions & 2 deletions src/VirtualClient/VirtualClient.Core/PackageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace VirtualClient
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.IO.Abstractions;
using System.IO.Compression;
Expand All @@ -27,6 +28,11 @@ namespace VirtualClient
/// </summary>
public class PackageManager : IPackageManager, IDisposable
{
/// <summary>
/// The metadata key for built-it toolsets/packages.
/// </summary>
public const string BuiltIn = "built-in";

/// <summary>
/// The name of the built-in package containing the lshw toolset.
/// </summary>
Expand Down Expand Up @@ -369,6 +375,7 @@ public Task<IEnumerable<DependencyPath>> DiscoverPackagesAsync(CancellationToken

if (toolsPackages?.Any() == true)
{
PackageManager.SetAsBuiltInToolset(toolsPackages?.ToArray());
discoveredPackages.AddRange(toolsPackages);
}

Expand Down Expand Up @@ -703,9 +710,16 @@ public Task RegisterPackageAsync(DependencyPath package, CancellationToken cance

return this.Logger.LogMessageAsync($"{nameof(PackageManager)}.RegisterPackage", LogLevel.Trace, telemetryContext, async () =>
{
string packageDirectory = Path.GetDirectoryName(package.Path);
// We register packages in the packages directory by default. Built-in toolsets are registered
// in the tools directory.
string registrationDirectory = this.PlatformSpecifics.GetPackagePath();
if (PackageManager.IsBuiltInToolset(package))
{
registrationDirectory = this.PlatformSpecifics.GetToolsPath();
}

string registrationFileName = $"{package.Name.ToLowerInvariant()}{PackageManager.VCPkgRegExtension}";
string registrationFilePath = this.PlatformSpecifics.Combine(packageDirectory, registrationFileName);
string registrationFilePath = this.PlatformSpecifics.Combine(registrationDirectory, registrationFileName);
string registrationFileContent = package.ToJson();

await RetryPolicies.FileOperations.ExecuteAsync(() =>
Expand Down Expand Up @@ -874,6 +888,27 @@ protected virtual async Task ExtractTarballAsync(string archiveFilepath, string
}
}

private static bool IsBuiltInToolset(DependencyPath package)
{
if (package.Metadata.TryGetValue(PackageManager.BuiltIn, out IConvertible builtIn))
{
return true;
}

return false;
}

private static void SetAsBuiltInToolset(params DependencyPath[] packages)
{
if (packages?.Any() == true)
{
foreach (DependencyPath package in packages)
{
package.Metadata[PackageManager.BuiltIn] = true;
}
}
}

private void CreateDirectoryIfNotExists(string directoryPath)
{
if (!this.FileSystem.Directory.Exists(directoryPath))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static async Task MakeFileExecutableAsync(this ISystemManagement systemMa

if (!systemManagement.FileSystem.File.Exists(filePath))
{
throw new DependencyException($"The binary at path '{filePath}' does not exist.", ErrorReason.WorkloadDependencyMissing);
throw new DependencyException($"The file at path '{filePath}' does not exist.", ErrorReason.WorkloadDependencyMissing);
}

switch (platform)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@
win-x64
=============================================================================================
-->
<file src="$BinConfigDir$\x64\VirtualClient.Main\net8.0\win-x64\**\*" target="content\win-x64" />
<file src="$BinConfigDir$\x64\VirtualClient.Main\net8.0\win-x64\**\*" exclude="**\*.pdb;*.xml" target="content\win-x64" />

<!--
win-arm64
=============================================================================================
-->

<file src="$BinConfigDir$\ARM64\VirtualClient.Main\net8.0\win-arm64\**\*" target="content\win-arm64" />
<file src="$BinConfigDir$\ARM64\VirtualClient.Main\net8.0\win-arm64\**\*" exclude="**\*.pdb;*.xml" target="content\win-arm64" />

<!--
linux-x64
=============================================================================================
-->
<file src="$BinConfigDir$\x64\VirtualClient.Main\net8.0\linux-x64\**\*" target="content\linux-x64" />
<file src="$BinConfigDir$\x64\VirtualClient.Main\net8.0\linux-x64\**\*" exclude="**\*.pdb;*.xml" target="content\linux-x64" />

<!--
linux-arm64
=============================================================================================
-->
<file src="$BinConfigDir$\ARM64\VirtualClient.Main\net8.0\linux-arm64\**\*" target="content\linux-arm64" />
<file src="$BinConfigDir$\ARM64\VirtualClient.Main\net8.0\linux-arm64\**\*" exclude="**\*.pdb;*.xml" target="content\linux-arm64" />
</files>
</package>
44 changes: 10 additions & 34 deletions website/package-lock.json

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

41 changes: 12 additions & 29 deletions website/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2055,22 +2055,6 @@
dependencies:
"@types/ms" "*"

"@types/eslint-scope@^3.7.3":
version "3.7.7"
resolved "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz"
integrity sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==
dependencies:
"@types/eslint" "*"
"@types/estree" "*"

"@types/eslint@*":
version "8.56.10"
resolved "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.10.tgz"
integrity sha512-Shavhk87gCtY2fhXDctcfS3e6FdxWkCx1iUZ9eEUbh7rTqlZT0/IzOkCOVt0fCjcFuZ9FPYfuezTBImfHCDBGQ==
dependencies:
"@types/estree" "*"
"@types/json-schema" "*"

"@types/estree-jsx@^1.0.0":
version "1.0.5"
resolved "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz"
Expand Down Expand Up @@ -2161,7 +2145,7 @@
dependencies:
"@types/istanbul-lib-report" "*"

"@types/json-schema@*", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9":
"@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9":
version "7.0.15"
resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz"
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
Expand Down Expand Up @@ -4061,10 +4045,10 @@ encodeurl@~1.0.2:
resolved "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz"
integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==

enhanced-resolve@^5.17.0:
version "5.17.0"
resolved "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.0.tgz"
integrity sha512-dwDPwZL0dmye8Txp2gzFmA6sxALaSvdRDjPH0viLcKrtlOL3tw62nWWweVD1SdILDTJrbrL6tdWVN58Wo6U3eA==
enhanced-resolve@^5.17.1:
version "5.17.1"
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz#67bfbbcc2f81d511be77d686a90267ef7f898a15"
integrity sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==
dependencies:
graceful-fs "^4.2.4"
tapable "^2.2.0"
Expand Down Expand Up @@ -6535,9 +6519,9 @@ micromark@^4.0.0:
micromark-util-types "^2.0.0"

micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5:
version "4.0.7"
resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz"
integrity sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==
version "4.0.8"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202"
integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==
dependencies:
braces "^3.0.3"
picomatch "^2.3.1"
Expand Down Expand Up @@ -8895,11 +8879,10 @@ webpack-sources@^3.2.3:
integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==

webpack@^5.88.1:
version "5.92.0"
resolved "https://registry.npmjs.org/webpack/-/webpack-5.92.0.tgz"
integrity sha512-Bsw2X39MYIgxouNATyVpCNVWBCuUwDgWtN78g6lSdPJRLaQ/PUVm/oXcaRAyY/sMFoKFQrsPeqvTizWtq7QPCA==
version "5.94.0"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.94.0.tgz#77a6089c716e7ab90c1c67574a28da518a20970f"
integrity sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg==
dependencies:
"@types/eslint-scope" "^3.7.3"
"@types/estree" "^1.0.5"
"@webassemblyjs/ast" "^1.12.1"
"@webassemblyjs/wasm-edit" "^1.12.1"
Expand All @@ -8908,7 +8891,7 @@ webpack@^5.88.1:
acorn-import-attributes "^1.9.5"
browserslist "^4.21.10"
chrome-trace-event "^1.0.2"
enhanced-resolve "^5.17.0"
enhanced-resolve "^5.17.1"
es-module-lexer "^1.2.1"
eslint-scope "5.1.1"
events "^3.2.0"
Expand Down

0 comments on commit 8a0ca65

Please sign in to comment.