diff --git a/.github/workflows/increment-version.yml b/.github/workflows/increment-version.yml deleted file mode 100644 index b2981ae933..0000000000 --- a/.github/workflows/increment-version.yml +++ /dev/null @@ -1,25 +0,0 @@ -# This action is used to automatically increment the version within the VERSION file whenever it's not manually incremented. -name: Increment Version - -on: - pull_request: - branches: - - main - types: - - closed - -jobs: - if_merged: - if: github.event.pull_request.merged == true - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Checkout - uses: actions/checkout@main - with: - fetch-depth: 3 - - name: Run-Script - run: | - chmod +x ./increment-version.sh - ./increment-version.sh diff --git a/.pipelines/azure-pipelines-linux.yml b/.pipelines/azure-pipelines-linux.yml index 9f78d07db1..2f5bf15cd0 100644 --- a/.pipelines/azure-pipelines-linux.yml +++ b/.pipelines/azure-pipelines-linux.yml @@ -16,7 +16,7 @@ resources: options: --entrypoint="" variables: - VcVersion : 1.14.34 + VcVersion : 1.0.0 ROOT: $(Build.SourcesDirectory) CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning ENABLE_PRS_DELAYSIGN: 1 @@ -43,7 +43,7 @@ stages: version=$(Build.SourcesDirectory)/VERSION # Set the file content as a pipeline variable - echo "##vso[task.setvariable variable=VcVersion;isOutput=true]$version" + echo "##vso[task.setvariable variable=VcVersion]$version" displayName: 'Set VC Version' - script: chmod -R +x $(Build.SourcesDirectory) diff --git a/VERSION b/VERSION index 2bef6e59d5..ac35d4c47d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.14.35 \ No newline at end of file +1.14.36 \ No newline at end of file diff --git a/build.cmd b/build.cmd index 35e57aff3b..008662ab89 100644 --- a/build.cmd +++ b/build.cmd @@ -6,6 +6,8 @@ if /i "%~1" == "/?" Goto :Usage if /i "%~1" == "-?" Goto :Usage if /i "%~1" == "--help" Goto :Usage +set "VCBuildVersion=" + REM The "VCBuildVersion" environment variable is referenced by the MSBuild processes during build. REM All binaries will be compiled with this version (e.g. .dlls + .exes). The packaging process uses REM the same environment variable to define the version of the NuGet package(s) produced. The build @@ -14,8 +16,9 @@ if /i NOT "%~1" == "" ( set VCBuildVersion=%~1 ) +REM Default version to the VERSION file but append -alpha for manual builds if /i "%VCBuildVersion%" == "" ( - set VCBuildVersion=0.0.1.0 + set /p VCBuildVersion= VERSION - - git config user.email "yanpan@microsoft.com" - git config user.name "yangpanMS" - git add -f VERSION - git commit -m "Updating to $new_version" - git push -else - echo "version already updated, no need to update further" -fi \ No newline at end of file diff --git a/src/VirtualClient/VirtualClient.Core/SystemManagement.cs b/src/VirtualClient/VirtualClient.Core/SystemManagement.cs index 9d6b310eb3..46f5ec27b0 100644 --- a/src/VirtualClient/VirtualClient.Core/SystemManagement.cs +++ b/src/VirtualClient/VirtualClient.Core/SystemManagement.cs @@ -11,6 +11,7 @@ namespace VirtualClient using System.Linq; using System.Net; using System.Runtime.InteropServices; + using System.Security.Principal; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; @@ -248,6 +249,7 @@ public bool IsLocalIPAddress(string ipAddress) /// /// Overwrite the default of 260 char in windows file path length to 32,767. /// https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry + /// Does not throw if doesn't have priviledge /// public void EnableLongPathInWindows() { @@ -258,8 +260,16 @@ public void EnableLongPathInWindows() // Name of the DWORD value const string valueName = "LongPathsEnabled"; - // Set the value to enable long paths - Registry.SetValue(keyPath, valueName, 1, RegistryValueKind.DWord); + try + { + // Set the value to enable long paths + Registry.SetValue(keyPath, valueName, 1, RegistryValueKind.DWord); + } + catch + { + // Does not throw if missing admin priviledge + } + } } diff --git a/src/VirtualClient/VirtualClient.Dependencies/DotNet/DotNetInstallation.cs b/src/VirtualClient/VirtualClient.Dependencies/DotNet/DotNetInstallation.cs index 3974c1de0a..6f0afbc649 100644 --- a/src/VirtualClient/VirtualClient.Dependencies/DotNet/DotNetInstallation.cs +++ b/src/VirtualClient/VirtualClient.Dependencies/DotNet/DotNetInstallation.cs @@ -24,7 +24,7 @@ public class DotNetInstallation : VirtualClientComponent private const string WindowsInstallScriptName = "dotnet-install.ps1"; private string installDirectory; - private ISystemManagement systemManager; + private ISystemManagement systemManagement; private IFileSystem fileSystem; /// @@ -37,7 +37,7 @@ public class DotNetInstallation : VirtualClientComponent public DotNetInstallation(IServiceCollection dependencies, IDictionary parameters = null) : base(dependencies, parameters) { - this.systemManager = this.Dependencies.GetService(); + this.systemManagement = this.Dependencies.GetService(); this.fileSystem = this.Dependencies.GetService(); this.installDirectory = this.PlatformSpecifics.Combine(this.PlatformSpecifics.PackagesDirectory, "dotnet"); @@ -62,6 +62,8 @@ public string DotNetVersion /// protected override async Task ExecuteAsync(EventContext telemetryContext, CancellationToken cancellationToken) { + this.systemManagement.EnableLongPathInWindows(); + if (!this.fileSystem.Directory.Exists(this.installDirectory)) { this.fileSystem.Directory.CreateDirectory(this.installDirectory); @@ -74,7 +76,7 @@ protected override async Task ExecuteAsync(EventContext telemetryContext, Cancel if (this.Platform == PlatformID.Unix) { - await this.systemManager.MakeFileExecutableAsync(destinyFile, this.Platform, cancellationToken).ConfigureAwait(false); + await this.systemManagement.MakeFileExecutableAsync(destinyFile, this.Platform, cancellationToken).ConfigureAwait(false); await this.ExecuteCommandAsync(destinyFile, this.GetInstallArgument(), this.installDirectory, telemetryContext, cancellationToken).ConfigureAwait(false); } else @@ -83,7 +85,7 @@ protected override async Task ExecuteAsync(EventContext telemetryContext, Cancel } DependencyPath dotnetPackage = new DependencyPath(this.PackageName, this.installDirectory, "DotNet SDK", this.DotNetVersion); - await this.systemManager.PackageManager.RegisterPackageAsync(dotnetPackage, cancellationToken).ConfigureAwait(false); + await this.systemManagement.PackageManager.RegisterPackageAsync(dotnetPackage, cancellationToken).ConfigureAwait(false); } private string GetInstallArgument() @@ -107,7 +109,7 @@ private string GetInstallArgument() private async Task ExecuteCommandAsync(string pathToExe, string commandLineArguments, string workingDirectory, EventContext telemetryContext, CancellationToken cancellationToken) { EventContext relatedContext = telemetryContext.Clone(); - using (IProcessProxy process = this.systemManager.ProcessManager.CreateElevatedProcess(this.Platform, pathToExe, commandLineArguments, workingDirectory)) + using (IProcessProxy process = this.systemManagement.ProcessManager.CreateElevatedProcess(this.Platform, pathToExe, commandLineArguments, workingDirectory)) { this.CleanupTasks.Add(() => process.SafeKill()); this.Logger.LogTraceMessage($"Executing process '{pathToExe}' '{commandLineArguments}' at directory '{workingDirectory}'.", EventContext.Persisted()); diff --git a/src/VirtualClient/VirtualClient.Main/RunProfileCommand.cs b/src/VirtualClient/VirtualClient.Main/RunProfileCommand.cs index 45deafa6a6..f97d16c912 100644 --- a/src/VirtualClient/VirtualClient.Main/RunProfileCommand.cs +++ b/src/VirtualClient/VirtualClient.Main/RunProfileCommand.cs @@ -302,8 +302,6 @@ protected override IServiceCollection InitializeDependencies(string[] args) platformSpecifics.CpuArchitecture, logger); - systemManagement.EnableLongPathInWindows(); - IApiManager apiManager = new ApiManager(systemManagement.FirewallManager); // Note that a bug was found in the version of "lshw" (B.02.18) that is installed on some Ubuntu images. The bug causes the