Skip to content

Commit

Permalink
Bump runtime to dotnet 6 (#1471)
Browse files Browse the repository at this point in the history
* bump runtime to dotnet 6
  • Loading branch information
TingluoHuang authored Dec 1, 2021
1 parent 6332f9a commit 801a02e
Show file tree
Hide file tree
Showing 28 changed files with 60 additions and 63 deletions.
3 changes: 1 addition & 2 deletions src/Runner.Common/Runner.Common.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Library</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<NoWarn>NU1701;NU1603</NoWarn>
<Version>$(Version)</Version>
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/Runner.Listener/CommandSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ public string GetUrl(bool suppressPromptIfEmpty = false)
validator: Validators.ServerUrlValidator);
}

#if OS_WINDOWS
public string GetWindowsLogonAccount(string defaultValue, string descriptionMsg)
{
return GetArgOrPrompt(
Expand All @@ -260,7 +261,7 @@ public string GetWindowsLogonPassword(string accountName)
defaultValue: string.Empty,
validator: Validators.NonEmptyValidator);
}

#endif
public string GetWork()
{
return GetArgOrPrompt(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#if OS_WINDOWS
#pragma warning disable CA1416
using System;
using System.Collections;
using System.Collections.Generic;
Expand Down Expand Up @@ -1327,4 +1328,5 @@ public struct PROFILEINFO
public IntPtr hProfile;
}
}
#pragma warning restore CA1416
#endif
4 changes: 4 additions & 0 deletions src/Runner.Listener/Configuration/Validators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public static bool NonEmptyValidator(string value)
return !string.IsNullOrEmpty(value);
}

#if OS_WINDOWS
#pragma warning disable CA1416
public static bool NTAccountValidator(string arg)
{
if (string.IsNullOrEmpty(arg) || String.IsNullOrEmpty(arg.TrimStart('.', '\\')))
Expand All @@ -87,5 +89,7 @@ public static bool NTAccountValidator(string arg)

return true;
}
#pragma warning restore CA1416
#endif
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#if OS_WINDOWS
#pragma warning disable CA1416
using System;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -169,4 +170,5 @@ private void GetAccountSegments(string account, out string domain, out string us
}
}
}
#pragma warning restore CA1416
#endif
5 changes: 2 additions & 3 deletions src/Runner.Listener/Runner.Listener.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<NoWarn>NU1701;NU1603</NoWarn>
<Version>$(Version)</Version>
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishReadyToRunComposite>true</PublishReadyToRunComposite>
</PropertyGroup>

<ItemGroup>
Expand Down
5 changes: 2 additions & 3 deletions src/Runner.PluginHost/Runner.PluginHost.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<NoWarn>NU1701;NU1603</NoWarn>
<Version>$(Version)</Version>
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishReadyToRunComposite>true</PublishReadyToRunComposite>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Runner.Plugins/Artifact/FileContainerServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ private async Task<DownloadResult> DownloadAsync(RunnerActionPluginExecutionCont
{
// We should never
context.Error($"Error '{ex.Message}' when downloading file '{fileToDownload}'. (Downloader {downloaderId})");
throw ex;
throw;
}
}

Expand Down Expand Up @@ -528,7 +528,7 @@ private async Task<UploadResult> UploadAsync(RunnerActionPluginExecutionContext
catch (Exception ex)
{
context.Output($"File error '{ex.Message}' when uploading file '{fileToUpload}'.");
throw ex;
throw;
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/Runner.Plugins/Runner.Plugins.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Library</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<NoWarn>NU1701;NU1603</NoWarn>
<Version>$(Version)</Version>
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions src/Runner.Sdk/Runner.Sdk.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Library</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<NoWarn>NU1701;NU1603</NoWarn>
<Version>$(Version)</Version>
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions src/Runner.Worker/ContainerOperationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ public async Task StartContainersAsync(IExecutionContext executionContext, objec
// Our container feature requires to map working directory from host to the container.
// If we are already inside a container, we will not able to find out the real working direcotry path on the host.
#if OS_WINDOWS
#pragma warning disable CA1416
// service CExecSvc is Container Execution Agent.
ServiceController[] scServices = ServiceController.GetServices();
if (scServices.Any(x => String.Equals(x.ServiceName, "cexecsvc", StringComparison.OrdinalIgnoreCase) && x.Status == ServiceControllerStatus.Running))
{
throw new NotSupportedException("Container feature is not supported when runner is already running inside container.");
}
#pragma warning restore CA1416
#else
var initProcessCgroup = File.ReadLines("/proc/1/cgroup");
if (initProcessCgroup.Any(x => x.IndexOf(":/docker/", StringComparison.OrdinalIgnoreCase) >= 0))
Expand All @@ -70,6 +72,7 @@ public async Task StartContainersAsync(IExecutionContext executionContext, objec
#endif

#if OS_WINDOWS
#pragma warning disable CA1416
// Check OS version (Windows server 1803 is required)
object windowsInstallationType = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "InstallationType", defaultValue: null);
ArgUtil.NotNull(windowsInstallationType, nameof(windowsInstallationType));
Expand All @@ -88,6 +91,7 @@ public async Task StartContainersAsync(IExecutionContext executionContext, objec
{
throw new ArgumentOutOfRangeException(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ReleaseId");
}
#pragma warning restore CA1416
#endif

// Check docker client/server version
Expand Down
5 changes: 2 additions & 3 deletions src/Runner.Worker/Runner.Worker.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<NoWarn>NU1701;NU1603</NoWarn>
<Version>$(Version)</Version>
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishReadyToRunComposite>true</PublishReadyToRunComposite>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ public Uri RequestUri
}
}

public IDictionary<string, object> Properties
{
get
{
return m_request.Properties;
}
}

IEnumerable<String> IHttpHeaders.GetValues(String name)
{
IEnumerable<String> values;
Expand Down
5 changes: 0 additions & 5 deletions src/Sdk/Common/Common/Authentication/IHttpRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,5 @@ Uri RequestUri
{
get;
}

IDictionary<string, object> Properties
{
get;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static VssHttpMethod GetHttpMethod(this HttpRequestMessage message)
public static VssTraceActivity GetActivity(this HttpRequestMessage message)
{
Object traceActivity;
if (!message.Properties.TryGetValue(VssTraceActivity.PropertyName, out traceActivity))
if (!message.Options.TryGetValue(VssTraceActivity.PropertyName, out traceActivity))
{
return VssTraceActivity.Empty;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sdk/Common/Common/VssHttpMessageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ protected override async Task<HttpResponseMessage> SendAsync(
}

// Add ourselves to the message so the underlying token issuers may use it if necessary
request.Properties[VssHttpMessageHandler.PropertyName] = this;
request.Options.Set(new HttpRequestOptionsKey<VssHttpMessageHandler>(VssHttpMessageHandler.PropertyName), this);

Boolean succeeded = false;
Boolean lastResponseDemandedProxyAuth = false;
Expand Down Expand Up @@ -409,7 +409,7 @@ protected virtual async Task BufferResponseContentAsync(
// Read the completion option provided by the caller. If we don't find the property then we
// assume it is OK to buffer by default.
HttpCompletionOption completionOption;
if (!request.Properties.TryGetValue(VssHttpRequestSettings.HttpCompletionOptionPropertyName, out completionOption))
if (!request.Options.TryGetValue(VssHttpRequestSettings.HttpCompletionOptionPropertyName, out completionOption))
{
completionOption = HttpCompletionOption.ResponseContentRead;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Sdk/Common/Common/VssHttpMessageHandlerTraceInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ internal void TraceTrailingTime()
public static void SetTraceInfo(HttpRequestMessage message, VssHttpMessageHandlerTraceInfo traceInfo)
{
object existingTraceInfo;
if (!message.Properties.TryGetValue(TfsTraceInfoKey, out existingTraceInfo))
if (!message.Options.TryGetValue(TfsTraceInfoKey, out existingTraceInfo))
{
message.Properties.Add(TfsTraceInfoKey, traceInfo);
message.Options.Set(new HttpRequestOptionsKey<VssHttpMessageHandlerTraceInfo>(TfsTraceInfoKey), traceInfo);
}
}

Expand All @@ -92,7 +92,7 @@ public static VssHttpMessageHandlerTraceInfo GetTraceInfo(HttpRequestMessage mes
{
VssHttpMessageHandlerTraceInfo traceInfo = null;

if (message.Properties.TryGetValue(TfsTraceInfoKey, out object traceInfoObject))
if (message.Options.TryGetValue(TfsTraceInfoKey, out object traceInfoObject))
{
traceInfo = traceInfoObject as VssHttpMessageHandlerTraceInfo;
}
Expand Down
5 changes: 3 additions & 2 deletions src/Sdk/Common/Common/VssHttpRequestSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Threading;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using GitHub.Services.Common;

namespace GitHub.Services.Common
{
Expand Down Expand Up @@ -291,12 +292,12 @@ protected internal virtual Boolean IsHostLocal(String hostName)
protected internal virtual Boolean ApplyTo(HttpRequestMessage request)
{
// Make sure we only apply the settings to the request once
if (request.Properties.ContainsKey(PropertyName))
if (request.Options.TryGetValue<object>(PropertyName, out _))
{
return false;
}

request.Properties.Add(PropertyName, this);
request.Options.Set(new HttpRequestOptionsKey<VssHttpRequestSettings>(PropertyName), this);

if (this.AcceptLanguages != null && this.AcceptLanguages.Count > 0)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Sdk/Common/Common/VssHttpRetryMessageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public VssHttpRetryMessageHandler(VssHttpRetryOptions options)
}

public VssHttpRetryMessageHandler(
VssHttpRetryOptions options,
VssHttpRetryOptions options,
HttpMessageHandler innerHandler)
: base(innerHandler)
{
Expand All @@ -55,7 +55,7 @@ protected override async Task<HttpResponseMessage> SendAsync(
// Allow overriding default retry options per request
VssHttpRetryOptions retryOptions = m_retryOptions;
object retryOptionsObject;
if (request.Properties.TryGetValue(HttpRetryOptionsKey, out retryOptionsObject)) // NETSTANDARD compliant, TryGetValue<T> is not
if (request.Options.TryGetValue(HttpRetryOptionsKey, out retryOptionsObject)) // NETSTANDARD compliant, TryGetValue<T> is not
{
// Fallback to default options if object of unexpected type was passed
retryOptions = retryOptionsObject as VssHttpRetryOptions ?? m_retryOptions;
Expand All @@ -66,7 +66,7 @@ protected override async Task<HttpResponseMessage> SendAsync(

IVssHttpRetryInfo retryInfo = null;
object retryInfoObject;
if (request.Properties.TryGetValue(HttpRetryInfoKey, out retryInfoObject)) // NETSTANDARD compliant, TryGetValue<T> is not
if (request.Options.TryGetValue(HttpRetryInfoKey, out retryInfoObject)) // NETSTANDARD compliant, TryGetValue<T> is not
{
retryInfo = retryInfoObject as IVssHttpRetryInfo;
}
Expand Down Expand Up @@ -183,7 +183,7 @@ protected virtual void TraceRaw(HttpRequestMessage request, int tracepoint, Trac
{
// implement in Server so retries are recorded in ProductTrace
}

protected virtual void TraceHttpRequestFailed(VssTraceActivity activity, HttpRequestMessage request, HttpStatusCode statusCode, string afdRefInfo)
{
VssHttpEventSource.Log.HttpRequestFailed(activity, request, statusCode, afdRefInfo);
Expand Down Expand Up @@ -212,7 +212,7 @@ protected virtual void TraceHttpRequestRetrying(VssTraceActivity activity, HttpR
private static bool IsLowPriority(HttpRequestMessage request)
{
bool isLowPriority = false;

IEnumerable<string> headers;

if (request.Headers.TryGetValues(HttpHeaders.VssRequestPriority, out headers) && headers != null)
Expand Down
3 changes: 1 addition & 2 deletions src/Sdk/Sdk.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Library</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
Expand All @@ -10,7 +10,6 @@
<DefineConstants>TRACE</DefineConstants>
<LangVersion>7.3</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 801a02e

Please sign in to comment.