mirror of
https://github.com/actions/runner.git
synced 2025-12-10 12:36:23 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1413297394 | ||
|
|
6a063ae7be | ||
|
|
76bb4961fb | ||
|
|
bf3d32e631 | ||
|
|
11aa006d30 | ||
|
|
586c8a7fa5 | ||
|
|
f1c58c33b6 | ||
|
|
7b158fff05 | ||
|
|
6225b22870 | ||
|
|
53da198867 | ||
|
|
3a43d853be | ||
|
|
9d7b0a2405 | ||
|
|
05f0b938ac | ||
|
|
f5f14d4811 | ||
|
|
2f261f2c31 | ||
|
|
c3b11b36e9 | ||
|
|
8777686c11 |
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@@ -4,6 +4,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- releases/*
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
@@ -19,7 +20,7 @@ jobs:
|
||||
- os: macOS-latest
|
||||
devScript: ./dev.sh
|
||||
- os: windows-latest
|
||||
devScript: dev.cmd
|
||||
devScript: ./dev
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
@@ -5,36 +5,55 @@
|
||||
## Supported Distributions and Versions
|
||||
|
||||
x64
|
||||
- Red Hat Enterprise Linux 6 (see note 1), 7
|
||||
- CentOS 6 (see note 1), 7
|
||||
- Red Hat Enterprise Linux 7
|
||||
- CentOS 7
|
||||
- Oracle Linux 7
|
||||
- Fedora 28, 27
|
||||
- Debian 9, 8.7 or later versions
|
||||
- Ubuntu 18.04, Ubuntu 16.04, Ubuntu 14.04
|
||||
- Linux Mint 18, 17
|
||||
- openSUSE 42.3 or later versions
|
||||
- SUSE Enterprise Linux (SLES) 12 SP2 or later versions
|
||||
- Fedora 29+
|
||||
- Debian 9+
|
||||
- Ubuntu 16.04+
|
||||
- Linux Mint 18+
|
||||
- openSUSE 15+
|
||||
- SUSE Enterprise Linux (SLES) 12 SP2+
|
||||
|
||||
ARM32 (see note 2)
|
||||
- Debian 9 or later versions
|
||||
- Ubuntu 18.04 or later versions
|
||||
## Install .Net Core 3.x Linux Dependencies
|
||||
|
||||
> Note 1: Red Hat Enterprise Linux 6 and CentOS 6 require installing the specialized "rhel.6-x64" agent package
|
||||
> Note 2: ARM instruction set [ARMv7](https://en.wikipedia.org/wiki/List_of_ARM_microarchitectures) or above is required, you can get your device's information by executing `uname -a`
|
||||
|
||||
## Install .Net Core 2.x Linux Dependencies
|
||||
|
||||
The `./config.sh` will check .Net Core 2.x dependencies during agent configuration.
|
||||
The `./config.sh` will check .Net Core 3.x dependencies during runner configuration.
|
||||
You might see something like this which indicate a dependency's missing.
|
||||
```bash
|
||||
./config.sh
|
||||
libunwind.so.8 => not found
|
||||
libunwind-x86_64.so.8 => not found
|
||||
Dependencies is missing for Dotnet Core 2.1
|
||||
Execute ./bin/installdependencies.sh to install any missing Dotnet Core 2.1 dependencies.
|
||||
Dependencies is missing for Dotnet Core 3.0
|
||||
Execute ./bin/installdependencies.sh to install any missing Dotnet Core 3.0 dependencies.
|
||||
```
|
||||
You can easily correct the problem by executing `./bin/installdependencies.sh`.
|
||||
The `installdependencies.sh` script should install all required dependencies on all supported Linux versions
|
||||
> Note: The `installdependencies.sh` script will try to use the default package management mechanism on your Linux flavor (ex. `yum`/`apt-get`/`apt`). You might need to deal with error coming from the package management mechanism related to your setup, like [#1353](https://github.com/Microsoft/vsts-agent/issues/1353)
|
||||
|
||||
### Full dependencies list
|
||||
|
||||
Debian based OS (Debian, Ubuntu, Linux Mint)
|
||||
|
||||
- liblttng-ust0
|
||||
- libkrb5-3
|
||||
- zlib1g
|
||||
- libssl1.1, libssl1.0.2 or libssl1.0.0
|
||||
- libicu63, libicu60, libicu57 or libicu55
|
||||
|
||||
Fedora based OS (Fedora, Redhat, Centos, Oracle Linux 7)
|
||||
|
||||
- lttng-ust
|
||||
- openssl-libs
|
||||
- krb5-libs
|
||||
- zlib
|
||||
- libicu
|
||||
|
||||
SUSE based OS (OpenSUSE, SUSE Enterprise)
|
||||
|
||||
- lttng-ust
|
||||
- libopenssl1_1
|
||||
- krb5
|
||||
- zlib
|
||||
- libicu60_2
|
||||
|
||||
## [More .Net Core Prerequisites Information](https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x)
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
## Features
|
||||
- Runner config auth via GitHub.com. (#107) (#117)
|
||||
- Adding wrapper action to support post job cleanup, adding checkout v1.1 (#91)
|
||||
- Improving terminal experience (#110)
|
||||
- Add runner support for cache action. (#120)
|
||||
- N/A
|
||||
|
||||
## Bugs
|
||||
- Set GITHUB_ACTIONS in containers. (#119)
|
||||
- Fix issue data column/col mismatch. (#122)
|
||||
- Reverted removal of additional fields error and warning fields (#147)
|
||||
- Actions cache would incorrectly cache the action if the tag was updated (#148)
|
||||
|
||||
## Misc
|
||||
- Use GitHub actions for CI/PR (#112)
|
||||
- Code Cleanup (#123) (#124) (#125)
|
||||
- Updated to .NET Core 3.0 (#127)
|
||||
|
||||
## Agent Downloads
|
||||
|
||||
|
||||
@@ -60,10 +60,9 @@ then
|
||||
print_errormessage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ubuntu 18 uses libcurl4
|
||||
# ubuntu 14, 16 and other linux use libcurl3
|
||||
apt install -y libcurl3 || apt install -y libcurl4
|
||||
|
||||
# libissl version prefer: libssl1.1 -> libssl1.0.2 -> libssl1.0.0
|
||||
apt install -y libssl1.1$ || apt install -y libssl1.0.2$ || apt install -y libssl1.0.0$
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "'apt' failed with exit code '$?'"
|
||||
@@ -71,18 +70,8 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# debian 9 use libssl1.0.2
|
||||
# other debian linux use libssl1.0.0
|
||||
apt install -y libssl1.0.0 || apt install -y libssl1.0.2
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "'apt' failed with exit code '$?'"
|
||||
print_errormessage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# libicu version prefer: libicu52 -> libicu55 -> libicu57 -> libicu60
|
||||
apt install -y libicu52 || apt install -y libicu55 || apt install -y libicu57 || apt install -y libicu60
|
||||
# libicu version prefer: libicu63 -> libicu60 -> libicu57 -> libicu55 -> libicu52
|
||||
apt install -y libicu63 || apt install -y libicu60 || apt install -y libicu57 || apt install -y libicu55 || apt install -y libicu52
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "'apt' failed with exit code '$?'"
|
||||
@@ -101,9 +90,8 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ubuntu 18 uses libcurl4
|
||||
# ubuntu 14, 16 and other linux use libcurl3
|
||||
apt-get install -y libcurl3 || apt-get install -y libcurl4
|
||||
# libissl version prefer: libssl1.1 -> libssl1.0.2 -> libssl1.0.0
|
||||
apt-get install -y libssl1.1$ || apt-get install -y libssl1.0.2$ || apt install -y libssl1.0.0$
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "'apt-get' failed with exit code '$?'"
|
||||
@@ -111,18 +99,8 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# debian 9 use libssl1.0.2
|
||||
# other debian linux use libssl1.0.0
|
||||
apt-get install -y libssl1.0.0 || apt install -y libssl1.0.2
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "'apt-get' failed with exit code '$?'"
|
||||
print_errormessage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# libicu version prefer: libicu52 -> libicu55 -> libicu57 -> libicu60
|
||||
apt-get install -y libicu52 || apt install -y libicu55 || apt install -y libicu57 || apt install -y libicu60
|
||||
# libicu version prefer: libicu63 -> libicu60 -> libicu57 -> libicu55 -> libicu52
|
||||
apt-get install -y libicu63 || apt-get install -y libicu60 || apt install -y libicu57 || apt install -y libicu55 || apt install -y libicu52
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "'apt-get' failed with exit code '$?'"
|
||||
@@ -149,46 +127,7 @@ then
|
||||
command -v dnf
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
useCompatSsl=0
|
||||
grep -i 'fedora release 28' /etc/fedora-release
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
useCompatSsl=1
|
||||
else
|
||||
grep -i 'fedora release 27' /etc/fedora-release
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
useCompatSsl=1
|
||||
else
|
||||
grep -i 'fedora release 26' /etc/fedora-release
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
useCompatSsl=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $useCompatSsl -eq 1 ]
|
||||
then
|
||||
echo "Use compat-openssl10-devel instead of openssl-devel for Fedora 27/28 (dotnet core requires openssl 1.0.x)"
|
||||
dnf install -y compat-openssl10
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "'dnf' failed with exit code '$?'"
|
||||
print_errormessage
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
dnf install -y openssl-libs
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "'dnf' failed with exit code '$?'"
|
||||
print_errormessage
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
dnf install -y lttng-ust libcurl krb5-libs zlib libicu
|
||||
dnf install -y lttng-ust openssl-libs krb5-libs zlib libicu
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "'dnf' failed with exit code '$?'"
|
||||
@@ -204,22 +143,13 @@ then
|
||||
command -v yum
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
yum install -y openssl-libs libcurl krb5-libs zlib libicu
|
||||
yum install -y lttng-ust openssl-libs krb5-libs zlib libicu
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "'yum' failed with exit code '$?'"
|
||||
print_errormessage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# install lttng-ust separately since it's not part of offical package repository
|
||||
yum install -y wget && wget -P /etc/yum.repos.d/ https://packages.efficios.com/repo.files/EfficiOS-RHEL7-x86-64.repo && rpmkeys --import https://packages.efficios.com/rhel/repo.key && yum updateinfo && yum install -y lttng-ust
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "'lttng-ust' installation failed with exit code '$?'"
|
||||
print_errormessage
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Can not find 'yum'"
|
||||
print_errormessage
|
||||
@@ -230,13 +160,14 @@ then
|
||||
# we might on OpenSUSE
|
||||
OSTYPE=$(grep ID_LIKE /etc/os-release | cut -f2 -d=)
|
||||
echo $OSTYPE
|
||||
if [ $OSTYPE == '"suse"' ]
|
||||
echo $OSTYPE | grep "suse"
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "The current OS is SUSE based"
|
||||
command -v zypper
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
zypper -n install lttng-ust libopenssl1_0_0 libcurl4 krb5 zlib libicu52_1
|
||||
zypper -n install lttng-ust libopenssl1_1 krb5 zlib libicu60_2
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "'zypper' failed with exit code '$?'"
|
||||
|
||||
@@ -8,7 +8,7 @@ if [ $user_id -eq 0 -a -z "$AGENT_ALLOW_RUNASROOT" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check dotnet core 2.1 dependencies for Linux
|
||||
# Check dotnet core 3.0 dependencies for Linux
|
||||
if [[ (`uname` == "Linux") ]]
|
||||
then
|
||||
command -v ldd > /dev/null
|
||||
@@ -20,29 +20,22 @@ then
|
||||
|
||||
ldd ./bin/libcoreclr.so | grep 'not found'
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Dependencies is missing for Dotnet Core 2.1"
|
||||
echo "Execute ./bin/installdependencies.sh to install any missing Dotnet Core 2.1 dependencies."
|
||||
echo "Dependencies is missing for Dotnet Core 3.0"
|
||||
echo "Execute ./bin/installdependencies.sh to install any missing Dotnet Core 3.0 dependencies."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ldd ./bin/System.Security.Cryptography.Native.OpenSsl.so | grep 'not found'
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Dependencies is missing for Dotnet Core 2.1"
|
||||
echo "Execute ./bin/installdependencies.sh to install any missing Dotnet Core 2.1 dependencies."
|
||||
echo "Dependencies is missing for Dotnet Core 3.0"
|
||||
echo "Execute ./bin/installdependencies.sh to install any missing Dotnet Core 3.0 dependencies."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ldd ./bin/System.IO.Compression.Native.so | grep 'not found'
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Dependencies is missing for Dotnet Core 2.1"
|
||||
echo "Execute ./bin/installdependencies.sh to install any missing Dotnet Core 2.1 dependencies."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ldd ./bin/System.Net.Http.Native.so | grep 'not found'
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Dependencies is missing for Dotnet Core 2.1"
|
||||
echo "Execute ./bin/installdependencies.sh to install any missing Dotnet Core 2.1 dependencies."
|
||||
echo "Dependencies is missing for Dotnet Core 3.0"
|
||||
echo "Execute ./bin/installdependencies.sh to install any missing Dotnet Core 3.0 dependencies."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -59,8 +52,8 @@ then
|
||||
libpath=${LD_LIBRARY_PATH:-}
|
||||
$LDCONFIG_COMMAND -NXv ${libpath//:/} 2>&1 | grep libicu >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Libicu's dependencies is missing for Dotnet Core 2.1"
|
||||
echo "Execute ./bin/installdependencies.sh to install any missing Dotnet Core 2.1 dependencies."
|
||||
echo "Libicu's dependencies is missing for Dotnet Core 3.0"
|
||||
echo "Execute ./bin/installdependencies.sh to install any missing Dotnet Core 3.0 dependencies."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using GitHub.Runner.Common.Util;
|
||||
using GitHub.Runner.Sdk;
|
||||
|
||||
namespace GitHub.Runner.Common.Capabilities
|
||||
{
|
||||
[ServiceLocator(Default = typeof(CapabilitiesManager))]
|
||||
public interface ICapabilitiesManager : IRunnerService
|
||||
{
|
||||
Task<Dictionary<string, string>> GetCapabilitiesAsync(RunnerSettings settings, CancellationToken token);
|
||||
}
|
||||
|
||||
public sealed class CapabilitiesManager : RunnerService, ICapabilitiesManager
|
||||
{
|
||||
public async Task<Dictionary<string, string>> GetCapabilitiesAsync(RunnerSettings settings, CancellationToken cancellationToken)
|
||||
{
|
||||
Trace.Entering();
|
||||
ArgUtil.NotNull(settings, nameof(settings));
|
||||
|
||||
// Initialize a dictionary of capabilities.
|
||||
var capabilities = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
if (settings.SkipCapabilitiesScan)
|
||||
{
|
||||
Trace.Info("Skip capabilities scan.");
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
// Get the providers.
|
||||
var extensionManager = HostContext.GetService<IExtensionManager>();
|
||||
IEnumerable<ICapabilitiesProvider> providers =
|
||||
extensionManager
|
||||
.GetExtensions<ICapabilitiesProvider>()
|
||||
?.OrderBy(x => x.Order);
|
||||
|
||||
// Add each capability returned from each provider.
|
||||
foreach (ICapabilitiesProvider provider in providers ?? new ICapabilitiesProvider[0])
|
||||
{
|
||||
foreach (Capability capability in await provider.GetCapabilitiesAsync(settings, cancellationToken) ?? new List<Capability>())
|
||||
{
|
||||
// Make sure we mask secrets in capabilities values.
|
||||
capabilities[capability.Name] = HostContext.SecretMasker.MaskSecrets(capability.Value);
|
||||
}
|
||||
}
|
||||
|
||||
return capabilities;
|
||||
}
|
||||
}
|
||||
|
||||
public interface ICapabilitiesProvider : IExtension
|
||||
{
|
||||
int Order { get; }
|
||||
|
||||
Task<List<Capability>> GetCapabilitiesAsync(RunnerSettings settings, CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
public sealed class Capability
|
||||
{
|
||||
public string Name { get; }
|
||||
public string Value { get; }
|
||||
|
||||
public Capability(string name, string value)
|
||||
{
|
||||
ArgUtil.NotNullOrEmpty(name, nameof(name));
|
||||
Name = name;
|
||||
Value = value ?? string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
using GitHub.Runner.Common.Util;
|
||||
using GitHub.Runner.Sdk;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GitHub.Runner.Common.Capabilities
|
||||
{
|
||||
public sealed class RunnerCapabilitiesProvider : RunnerService, ICapabilitiesProvider
|
||||
{
|
||||
public Type ExtensionType => typeof(ICapabilitiesProvider);
|
||||
|
||||
public int Order => 99; // Process last to override prior.
|
||||
|
||||
public Task<List<Capability>> GetCapabilitiesAsync(RunnerSettings settings, CancellationToken cancellationToken)
|
||||
{
|
||||
ArgUtil.NotNull(settings, nameof(settings));
|
||||
var capabilities = new List<Capability>();
|
||||
Add(capabilities, "Runner.Name", settings.AgentName ?? string.Empty);
|
||||
Add(capabilities, "Runner.OS", VarUtil.OS);
|
||||
Add(capabilities, "Runner.OSArchitecture", VarUtil.OSArchitecture);
|
||||
#if OS_WINDOWS
|
||||
Add(capabilities, "Runner.OSVersion", GetOSVersionString());
|
||||
#endif
|
||||
Add(capabilities, "InteractiveSession", (HostContext.StartupType != StartupType.Service).ToString());
|
||||
Add(capabilities, "Runner.Version", BuildConstants.RunnerPackage.Version);
|
||||
Add(capabilities, "Runner.ComputerName", Environment.MachineName ?? string.Empty);
|
||||
Add(capabilities, "Runner.HomeDirectory", HostContext.GetDirectory(WellKnownDirectory.Root));
|
||||
return Task.FromResult(capabilities);
|
||||
}
|
||||
|
||||
private void Add(List<Capability> capabilities, string name, string value)
|
||||
{
|
||||
Trace.Info($"Adding '{name}': '{value}'");
|
||||
capabilities.Add(new Capability(name, value));
|
||||
}
|
||||
|
||||
private object GetHklmValue(string keyName, string valueName)
|
||||
{
|
||||
keyName = $@"HKEY_LOCAL_MACHINE\{keyName}";
|
||||
object value = Registry.GetValue(keyName, valueName, defaultValue: null);
|
||||
if (object.ReferenceEquals(value, null))
|
||||
{
|
||||
Trace.Info($"Key name '{keyName}', value name '{valueName}' is null.");
|
||||
return null;
|
||||
}
|
||||
|
||||
Trace.Info($"Key name '{keyName}', value name '{valueName}': '{value}'");
|
||||
return value;
|
||||
}
|
||||
|
||||
private string GetOSVersionString()
|
||||
{
|
||||
// Do not use System.Environment.OSVersion.Version to resolve the OS version number.
|
||||
// It leverages the GetVersionEx function which may report an incorrect version
|
||||
// depending on the app's manifest. For details, see:
|
||||
// https://msdn.microsoft.com/library/windows/desktop/ms724451(v=vs.85).aspx
|
||||
|
||||
// Attempt to retrieve the major/minor version from the new registry values added in
|
||||
// in Windows 10.
|
||||
//
|
||||
// The registry value "CurrentVersion" is unreliable in Windows 10. It contains the
|
||||
// value "6.3" instead of "10.0".
|
||||
object major = GetHklmValue(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CurrentMajorVersionNumber");
|
||||
object minor = GetHklmValue(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CurrentMinorVersionNumber");
|
||||
string majorMinorString;
|
||||
if (major != null && minor != null)
|
||||
{
|
||||
majorMinorString = StringUtil.Format("{0}.{1}", major, minor);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fallback to the registry value "CurrentVersion".
|
||||
majorMinorString = GetHklmValue(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CurrentVersion") as string;
|
||||
}
|
||||
|
||||
// Opted to use the registry value "CurrentBuildNumber" over "CurrentBuild". Based on brief
|
||||
// internet investigation, the only difference appears to be that on Windows XP "CurrentBuild"
|
||||
// was unreliable and "CurrentBuildNumber" was the correct choice.
|
||||
string build = GetHklmValue(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CurrentBuildNumber") as string;
|
||||
return StringUtil.Format("{0}.{1}", majorMinorString, build);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,10 +39,6 @@ namespace GitHub.Runner.Common
|
||||
var extensions = new List<IExtension>();
|
||||
switch (typeof(T).FullName)
|
||||
{
|
||||
// Listener capabilities providers.
|
||||
case "GitHub.Runner.Common.Capabilities.ICapabilitiesProvider":
|
||||
Add<T>(extensions, "GitHub.Runner.Common.Capabilities.RunnerCapabilitiesProvider, Runner.Common");
|
||||
break;
|
||||
// Action command extensions.
|
||||
case "GitHub.Runner.Worker.IActionCommandExtension":
|
||||
Add<T>(extensions, "GitHub.Runner.Worker.InternalPluginSetRepoPathCommandExtension, Runner.Worker");
|
||||
|
||||
@@ -84,9 +84,6 @@ namespace GitHub.Runner.Common
|
||||
this.SecretMasker.AddValueEncoder(ValueEncoders.Base64StringEscape);
|
||||
this.SecretMasker.AddValueEncoder(ValueEncoders.Base64StringEscapeShift1);
|
||||
this.SecretMasker.AddValueEncoder(ValueEncoders.Base64StringEscapeShift2);
|
||||
this.SecretMasker.AddValueEncoder(ValueEncoders.Base64StringEscapeShift3);
|
||||
this.SecretMasker.AddValueEncoder(ValueEncoders.Base64StringEscapeShift4);
|
||||
this.SecretMasker.AddValueEncoder(ValueEncoders.Base64StringEscapeShift5);
|
||||
this.SecretMasker.AddValueEncoder(ValueEncoders.ExpressionStringEscape);
|
||||
this.SecretMasker.AddValueEncoder(ValueEncoders.JsonStringEscape);
|
||||
this.SecretMasker.AddValueEncoder(ValueEncoders.UriDataEscape);
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<OutputType>Library</OutputType>
|
||||
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
|
||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
||||
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
|
||||
<NoWarn>NU1701;NU1603</NoWarn>
|
||||
<Version>$(Version)</Version>
|
||||
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace GitHub.Runner.Common
|
||||
Task DeleteAgentAsync(int agentPoolId, int agentId);
|
||||
Task<List<TaskAgentPool>> GetAgentPoolsAsync(string agentPoolName = null, TaskAgentPoolType poolType = TaskAgentPoolType.Automation);
|
||||
Task<List<TaskAgent>> GetAgentsAsync(int agentPoolId, string agentName = null);
|
||||
Task<TaskAgent> UpdateAgentAsync(int agentPoolId, TaskAgent agent);
|
||||
Task<TaskAgent> ReplaceAgentAsync(int agentPoolId, TaskAgent agent);
|
||||
|
||||
// messagequeue
|
||||
Task<TaskAgentSession> CreateAgentSessionAsync(Int32 poolId, TaskAgentSession session, CancellationToken cancellationToken);
|
||||
@@ -257,7 +257,7 @@ namespace GitHub.Runner.Common
|
||||
return _genericTaskAgentClient.GetAgentsAsync(agentPoolId, agentName, false);
|
||||
}
|
||||
|
||||
public Task<TaskAgent> UpdateAgentAsync(int agentPoolId, TaskAgent agent)
|
||||
public Task<TaskAgent> ReplaceAgentAsync(int agentPoolId, TaskAgent agent)
|
||||
{
|
||||
CheckConnection(RunnerConnectionType.Generic);
|
||||
return _genericTaskAgentClient.ReplaceAgentAsync(agentPoolId, agent);
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
using GitHub.DistributedTask.WebApi;
|
||||
using GitHub.Runner.Common.Capabilities;
|
||||
using GitHub.Runner.Common.Util;
|
||||
using GitHub.Services.Common;
|
||||
using GitHub.Services.OAuth;
|
||||
using GitHub.Services.WebApi;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Principal;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.InteropServices;
|
||||
using GitHub.Runner.Common;
|
||||
using GitHub.Runner.Sdk;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
|
||||
namespace GitHub.Runner.Listener.Configuration
|
||||
{
|
||||
@@ -168,7 +163,8 @@ namespace GitHub.Runner.Listener.Configuration
|
||||
{
|
||||
// Get the URL
|
||||
var inputUrl = command.GetUrl();
|
||||
if (!inputUrl.Contains("github.com", StringComparison.OrdinalIgnoreCase))
|
||||
if (!inputUrl.Contains("github.com", StringComparison.OrdinalIgnoreCase) &&
|
||||
!inputUrl.Contains("github.localhost", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
runnerSettings.ServerUrl = inputUrl;
|
||||
// Get the credentials
|
||||
@@ -238,11 +234,8 @@ namespace GitHub.Runner.Listener.Configuration
|
||||
{
|
||||
runnerSettings.AgentName = command.GetAgentName();
|
||||
|
||||
// Get the system capabilities.
|
||||
Dictionary<string, string> systemCapabilities = await HostContext.GetService<ICapabilitiesManager>().GetCapabilitiesAsync(runnerSettings, CancellationToken.None);
|
||||
|
||||
_term.WriteLine();
|
||||
|
||||
|
||||
var agents = await _runnerServer.GetAgentsAsync(runnerSettings.PoolId, runnerSettings.AgentName);
|
||||
Trace.Verbose("Returns {0} agents", agents.Count);
|
||||
agent = agents.FirstOrDefault();
|
||||
@@ -251,12 +244,12 @@ namespace GitHub.Runner.Listener.Configuration
|
||||
_term.WriteLine("A runner exists with the same name", ConsoleColor.Yellow);
|
||||
if (command.GetReplace())
|
||||
{
|
||||
// Update existing agent with new PublicKey, agent version and SystemCapabilities.
|
||||
agent = UpdateExistingAgent(agent, publicKey, systemCapabilities);
|
||||
// Update existing agent with new PublicKey, agent version.
|
||||
agent = UpdateExistingAgent(agent, publicKey);
|
||||
|
||||
try
|
||||
{
|
||||
agent = await _runnerServer.UpdateAgentAsync(runnerSettings.PoolId, agent);
|
||||
agent = await _runnerServer.ReplaceAgentAsync(runnerSettings.PoolId, agent);
|
||||
_term.WriteSuccessMessage("Successfully replaced the runner");
|
||||
break;
|
||||
}
|
||||
@@ -275,7 +268,7 @@ namespace GitHub.Runner.Listener.Configuration
|
||||
else
|
||||
{
|
||||
// Create a new agent.
|
||||
agent = CreateNewAgent(runnerSettings.AgentName, publicKey, systemCapabilities);
|
||||
agent = CreateNewAgent(runnerSettings.AgentName, publicKey);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -435,7 +428,7 @@ namespace GitHub.Runner.Listener.Configuration
|
||||
{
|
||||
ArgUtil.Equal(RunMode.Normal, HostContext.RunMode, nameof(HostContext.RunMode));
|
||||
string currentAction = string.Empty;
|
||||
|
||||
|
||||
_term.WriteSection("Runner removal");
|
||||
|
||||
try
|
||||
@@ -499,7 +492,7 @@ namespace GitHub.Runner.Listener.Configuration
|
||||
else
|
||||
{
|
||||
await _runnerServer.DeleteAgentAsync(settings.PoolId, settings.AgentId);
|
||||
|
||||
|
||||
_term.WriteLine();
|
||||
_term.WriteSuccessMessage("Runner removed successfully");
|
||||
}
|
||||
@@ -573,7 +566,7 @@ namespace GitHub.Runner.Listener.Configuration
|
||||
}
|
||||
|
||||
|
||||
private TaskAgent UpdateExistingAgent(TaskAgent agent, RSAParameters publicKey, Dictionary<string, string> systemCapabilities)
|
||||
private TaskAgent UpdateExistingAgent(TaskAgent agent, RSAParameters publicKey)
|
||||
{
|
||||
ArgUtil.NotNull(agent, nameof(agent));
|
||||
agent.Authorization = new TaskAgentAuthorization
|
||||
@@ -585,15 +578,14 @@ namespace GitHub.Runner.Listener.Configuration
|
||||
agent.Version = BuildConstants.RunnerPackage.Version;
|
||||
agent.OSDescription = RuntimeInformation.OSDescription;
|
||||
|
||||
foreach (KeyValuePair<string, string> capability in systemCapabilities)
|
||||
{
|
||||
agent.SystemCapabilities[capability.Key] = capability.Value ?? string.Empty;
|
||||
}
|
||||
agent.Labels.Add("self-hosted");
|
||||
agent.Labels.Add(VarUtil.OS);
|
||||
agent.Labels.Add(VarUtil.OSArchitecture);
|
||||
|
||||
return agent;
|
||||
}
|
||||
|
||||
private TaskAgent CreateNewAgent(string agentName, RSAParameters publicKey, Dictionary<string, string> systemCapabilities)
|
||||
private TaskAgent CreateNewAgent(string agentName, RSAParameters publicKey)
|
||||
{
|
||||
TaskAgent agent = new TaskAgent(agentName)
|
||||
{
|
||||
@@ -606,10 +598,9 @@ namespace GitHub.Runner.Listener.Configuration
|
||||
OSDescription = RuntimeInformation.OSDescription,
|
||||
};
|
||||
|
||||
foreach (KeyValuePair<string, string> capability in systemCapabilities)
|
||||
{
|
||||
agent.SystemCapabilities[capability.Key] = capability.Value ?? string.Empty;
|
||||
}
|
||||
agent.Labels.Add("self-hosted");
|
||||
agent.Labels.Add(VarUtil.OS);
|
||||
agent.Labels.Add(VarUtil.OSArchitecture);
|
||||
|
||||
return agent;
|
||||
}
|
||||
@@ -638,7 +629,7 @@ namespace GitHub.Runner.Listener.Configuration
|
||||
private async Task<GitHubAuthResult> GetTenantCredential(string githubUrl, string githubToken)
|
||||
{
|
||||
var gitHubUrl = new UriBuilder(githubUrl);
|
||||
var githubApiUrl = $"https://api.github.com/repos/{gitHubUrl.Path.Trim('/')}/actions-runners/registration";
|
||||
var githubApiUrl = $"https://api.{gitHubUrl.Host}/repos/{gitHubUrl.Path.Trim('/')}/actions-runners/registration";
|
||||
using (var httpClientHandler = HostContext.CreateHttpClientHandler())
|
||||
using (var httpClient = new HttpClient(httpClientHandler))
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using GitHub.DistributedTask.WebApi;
|
||||
using GitHub.Runner.Common.Capabilities;
|
||||
using GitHub.Runner.Listener.Configuration;
|
||||
using GitHub.Runner.Common.Util;
|
||||
using GitHub.Services.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,7 +8,6 @@ using System.Threading.Tasks;
|
||||
using System.Security.Cryptography;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using GitHub.Services.WebApi;
|
||||
using GitHub.Services.OAuth;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -59,9 +56,6 @@ namespace GitHub.Runner.Listener
|
||||
var serverUrl = _settings.ServerUrl;
|
||||
Trace.Info(_settings);
|
||||
|
||||
// Capabilities.
|
||||
Dictionary<string, string> systemCapabilities = await HostContext.GetService<ICapabilitiesManager>().GetCapabilitiesAsync(_settings, token);
|
||||
|
||||
// Create connection.
|
||||
Trace.Info("Loading Credentials");
|
||||
var credMgr = HostContext.GetService<ICredentialManager>();
|
||||
@@ -75,7 +69,7 @@ namespace GitHub.Runner.Listener
|
||||
OSDescription = RuntimeInformation.OSDescription,
|
||||
};
|
||||
string sessionName = $"{Environment.MachineName ?? "RUNNER"}";
|
||||
var taskAgentSession = new TaskAgentSession(sessionName, agent, systemCapabilities);
|
||||
var taskAgentSession = new TaskAgentSession(sessionName, agent);
|
||||
|
||||
string errorMessage = string.Empty;
|
||||
bool encounteringError = false;
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
|
||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
||||
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
|
||||
<NoWarn>NU1701;NU1603</NoWarn>
|
||||
<Version>$(Version)</Version>
|
||||
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
|
||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
||||
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
|
||||
<NoWarn>NU1701;NU1603</NoWarn>
|
||||
<Version>$(Version)</Version>
|
||||
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<OutputType>Library</OutputType>
|
||||
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
|
||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
||||
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
|
||||
<NoWarn>NU1701;NU1603</NoWarn>
|
||||
<Version>$(Version)</Version>
|
||||
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -70,13 +70,6 @@ namespace GitHub.Runner.Sdk
|
||||
|
||||
VssClientHttpRequestSettings.Default.UserAgent = headerValues;
|
||||
|
||||
#if OS_LINUX || OS_OSX
|
||||
// The .NET Core 2.1 runtime switched its HTTP default from HTTP 1.1 to HTTP 2.
|
||||
// This causes problems with some versions of the Curl handler.
|
||||
// See GitHub issue https://github.com/dotnet/corefx/issues/32376
|
||||
VssClientHttpRequestSettings.Default.UseHttp11 = true;
|
||||
#endif
|
||||
|
||||
var certSetting = GetCertConfiguration();
|
||||
if (certSetting != null)
|
||||
{
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<OutputType>Library</OutputType>
|
||||
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
|
||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
||||
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
|
||||
<NoWarn>NU1701;NU1603</NoWarn>
|
||||
<Version>$(Version)</Version>
|
||||
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -27,13 +27,6 @@ namespace GitHub.Runner.Sdk
|
||||
|
||||
VssClientHttpRequestSettings.Default.UserAgent = headerValues;
|
||||
VssClientHttpRequestSettings.Default.ClientCertificateManager = clientCert;
|
||||
#if OS_LINUX || OS_OSX
|
||||
// The .NET Core 2.1 runtime switched its HTTP default from HTTP 1.1 to HTTP 2.
|
||||
// This causes problems with some versions of the Curl handler.
|
||||
// See GitHub issue https://github.com/dotnet/corefx/issues/32376
|
||||
VssClientHttpRequestSettings.Default.UseHttp11 = true;
|
||||
#endif
|
||||
|
||||
VssHttpMessageHandler.DefaultWebProxy = proxy;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,9 @@ namespace GitHub.Runner.Worker
|
||||
executionContext.Warning("The 'PREVIEW_ACTION_TOKEN' secret is depreciated. Please remove it from the repository's secrets");
|
||||
}
|
||||
|
||||
// Clear the cache (local runner)
|
||||
IOUtil.DeleteDirectory(HostContext.GetDirectory(WellKnownDirectory.Actions), executionContext.CancellationToken);
|
||||
|
||||
foreach (var action in actions)
|
||||
{
|
||||
if (action.Reference.Type == Pipelines.ActionSourceType.ContainerRegistry)
|
||||
@@ -445,7 +448,7 @@ namespace GitHub.Runner.Worker
|
||||
}
|
||||
else
|
||||
{
|
||||
// make sure we get an clean folder ready to use.
|
||||
// make sure we get a clean folder ready to use.
|
||||
IOUtil.DeleteDirectory(destDirectory, executionContext.CancellationToken);
|
||||
Directory.CreateDirectory(destDirectory);
|
||||
executionContext.Output($"Download action repository '{repositoryReference.Name}@{repositoryReference.Ref}'");
|
||||
|
||||
@@ -2,19 +2,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using GitHub.DistributedTask.WebApi;
|
||||
using GitHub.Runner.Common.Util;
|
||||
using GitHub.Runner.Worker;
|
||||
using GitHub.Runner.Common.Capabilities;
|
||||
using GitHub.Services.WebApi;
|
||||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Pipelines = GitHub.DistributedTask.Pipelines;
|
||||
using GitHub.Runner.Common;
|
||||
|
||||
@@ -60,10 +60,16 @@ namespace GitHub.Runner.Worker.Handlers
|
||||
if (string.IsNullOrEmpty(shell))
|
||||
{
|
||||
#if OS_WINDOWS
|
||||
shellCommand = "cmd";
|
||||
shellCommand = "pwsh";
|
||||
if(validateShellOnHost)
|
||||
{
|
||||
shellCommandPath = System.Environment.GetEnvironmentVariable("ComSpec");
|
||||
shellCommandPath = WhichUtil.Which(shellCommand, require: false, Trace);
|
||||
if (string.IsNullOrEmpty(shellCommandPath))
|
||||
{
|
||||
shellCommand = "powershell";
|
||||
Trace.Info($"Defaulting to {shellCommand}");
|
||||
shellCommandPath = WhichUtil.Which(shellCommand, require: true, Trace);
|
||||
}
|
||||
}
|
||||
#else
|
||||
shellCommand = "sh";
|
||||
@@ -143,9 +149,15 @@ namespace GitHub.Runner.Worker.Handlers
|
||||
if (string.IsNullOrEmpty(shell))
|
||||
{
|
||||
#if OS_WINDOWS
|
||||
shellCommand = "cmd";
|
||||
commandPath = System.Environment.GetEnvironmentVariable("ComSpec");
|
||||
ArgUtil.NotNullOrEmpty(commandPath, "%ComSpec%");
|
||||
shellCommand = "pwsh";
|
||||
commandPath = WhichUtil.Which(shellCommand, require: false, Trace);
|
||||
if (string.IsNullOrEmpty(commandPath))
|
||||
{
|
||||
shellCommand = "powershell";
|
||||
Trace.Info($"Defaulting to {shellCommand}");
|
||||
commandPath = WhichUtil.Which(shellCommand, require: true, Trace);
|
||||
}
|
||||
ArgUtil.NotNullOrEmpty(commandPath, "Default Shell");
|
||||
#else
|
||||
shellCommand = "sh";
|
||||
commandPath = WhichUtil.Which("bash", false, Trace) ?? WhichUtil.Which("sh", true, Trace);
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
|
||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
||||
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
|
||||
<NoWarn>NU1701;NU1603</NoWarn>
|
||||
<Version>$(Version)</Version>
|
||||
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace GitHub.DistributedTask.Expressions2
|
||||
|
||||
// Attempt to match a named-value or index operator.
|
||||
// Note, do not push children of the index operator.
|
||||
if (node is NamedValue || node is Index)
|
||||
if (node is NamedValue || node is Sdk.Operators.Index)
|
||||
{
|
||||
// Lazy initialize the pattern segments
|
||||
if (segmentedPatterns is null)
|
||||
@@ -201,7 +201,7 @@ namespace GitHub.DistributedTask.Expressions2
|
||||
result.Push(node);
|
||||
}
|
||||
// Node is an index
|
||||
else if (node is Index index)
|
||||
else if (node is Sdk.Operators.Index index)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
@@ -218,7 +218,7 @@ namespace GitHub.DistributedTask.Expressions2
|
||||
break;
|
||||
}
|
||||
// Parameter 0 is an index
|
||||
else if (parameter0 is Index index2)
|
||||
else if (parameter0 is Sdk.Operators.Index index2)
|
||||
{
|
||||
index = index2;
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace GitHub.DistributedTask.Expressions2.Tokens
|
||||
{
|
||||
case TokenKind.StartIndex: // "["
|
||||
case TokenKind.Dereference: // "."
|
||||
return new Index();
|
||||
return new Sdk.Operators.Index();
|
||||
|
||||
case TokenKind.LogicalOperator:
|
||||
switch (RawValue)
|
||||
|
||||
@@ -17,10 +17,16 @@ namespace GitHub.DistributedTask.Logging
|
||||
return Convert.ToBase64String(Encoding.UTF8.GetBytes(value));
|
||||
}
|
||||
|
||||
// Base64 is 6 bytes -> char
|
||||
// Base64 is 6 bits -> char
|
||||
// A byte is 8 bits
|
||||
// When end user doing somthing like base64(user:password)
|
||||
// The length of the leading content will cause different base64 encoding result on the password
|
||||
// So we add base64(value - 1/2/3/4/5 bytes) as secret as well.
|
||||
// So we add base64(value shifted 1 and two bytes) as secret as well.
|
||||
// B1 B2 B3 B4 B5 B6 B7
|
||||
// 000000|00 0000|0000 00|000000| 000000|00 0000|0000 00|000000|
|
||||
// Char1 Char2 Char3 Char4
|
||||
// See the above, the first byte has a character beginning at index 0, the second byte has a character beginning at index 4, the third byte has a character beginning at index 2 and then the pattern repeats
|
||||
// We register byte offsets for all these possible values
|
||||
public static String Base64StringEscapeShift1(String value)
|
||||
{
|
||||
return Base64StringEscapeShift(value, 1);
|
||||
@@ -31,21 +37,6 @@ namespace GitHub.DistributedTask.Logging
|
||||
return Base64StringEscapeShift(value, 2);
|
||||
}
|
||||
|
||||
public static String Base64StringEscapeShift3(String value)
|
||||
{
|
||||
return Base64StringEscapeShift(value, 3);
|
||||
}
|
||||
|
||||
public static String Base64StringEscapeShift4(String value)
|
||||
{
|
||||
return Base64StringEscapeShift(value, 4);
|
||||
}
|
||||
|
||||
public static String Base64StringEscapeShift5(String value)
|
||||
{
|
||||
return Base64StringEscapeShift(value, 5);
|
||||
}
|
||||
|
||||
public static String ExpressionStringEscape(String value)
|
||||
{
|
||||
return Expressions.ExpressionUtil.StringEscape(value);
|
||||
|
||||
@@ -55,14 +55,9 @@ namespace GitHub.DistributedTask.WebApi
|
||||
m_properties = new PropertiesCollection(agentToBeCloned.m_properties);
|
||||
}
|
||||
|
||||
if (agentToBeCloned.m_systemCapabilities != null && agentToBeCloned.m_systemCapabilities.Count > 0)
|
||||
if (agentToBeCloned.m_labels != null && agentToBeCloned.m_labels.Count > 0)
|
||||
{
|
||||
m_systemCapabilities = new Dictionary<String, String>(agentToBeCloned.m_systemCapabilities, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
if (agentToBeCloned.m_userCapabilities != null && agentToBeCloned.m_userCapabilities.Count > 0)
|
||||
{
|
||||
m_userCapabilities = new Dictionary<String, String>(agentToBeCloned.m_userCapabilities, StringComparer.OrdinalIgnoreCase);
|
||||
m_labels = new HashSet<string>(agentToBeCloned.m_labels, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
if (agentToBeCloned.PendingUpdate != null)
|
||||
@@ -152,32 +147,17 @@ namespace GitHub.DistributedTask.WebApi
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System-defined capabilities supported by this agent's host.
|
||||
/// The labels of the runner
|
||||
/// </summary>
|
||||
public IDictionary<String, String> SystemCapabilities
|
||||
public ISet<string> Labels
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_systemCapabilities == null)
|
||||
if (m_labels == null)
|
||||
{
|
||||
m_systemCapabilities = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
|
||||
m_labels = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
return m_systemCapabilities;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// User-defined capabilities supported by this agent's host.
|
||||
/// </summary>
|
||||
public IDictionary<String, String> UserCapabilities
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_userCapabilities == null)
|
||||
{
|
||||
m_userCapabilities = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
return m_userCapabilities;
|
||||
return m_labels;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,10 +194,7 @@ namespace GitHub.DistributedTask.WebApi
|
||||
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "Properties")]
|
||||
private PropertiesCollection m_properties;
|
||||
|
||||
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "SystemCapabilities")]
|
||||
private Dictionary<String, String> m_systemCapabilities;
|
||||
|
||||
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "UserCapabilities")]
|
||||
private Dictionary<String, String> m_userCapabilities;
|
||||
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "Labels")]
|
||||
private HashSet<string> m_labels;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,8 +246,7 @@ namespace GitHub.DistributedTask.WebApi
|
||||
PlanType = hubName,
|
||||
ScopeId = scopeIdentifier,
|
||||
PlanId = planId,
|
||||
JobId = jobId,
|
||||
Demands = demands,
|
||||
JobId = jobId
|
||||
};
|
||||
|
||||
return QueueAgentRequestByPoolAsync(poolId, request, userState, cancellationToken);
|
||||
|
||||
@@ -35,7 +35,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
this.PoolId = requestToBeCloned.PoolId;
|
||||
this.JobId = requestToBeCloned.JobId;
|
||||
this.JobName = requestToBeCloned.JobName;
|
||||
this.Demands = new List<Demand>(requestToBeCloned.Demands ?? new Demand[0]);
|
||||
this.LockToken = requestToBeCloned.LockToken;
|
||||
this.ExpectedDuration = requestToBeCloned.ExpectedDuration;
|
||||
this.OrchestrationId = requestToBeCloned.OrchestrationId;
|
||||
@@ -68,6 +67,11 @@ namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
this.AgentSpecification = new JObject(requestToBeCloned.AgentSpecification);
|
||||
}
|
||||
|
||||
if (requestToBeCloned.Labels != null)
|
||||
{
|
||||
this.Labels = new HashSet<string>(requestToBeCloned.Labels, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -229,6 +233,7 @@ namespace GitHub.DistributedTask.WebApi
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Order = 16, EmitDefaultValue = false)]
|
||||
[Obsolete("No more demands, use labels", true)]
|
||||
public IList<Demand> Demands
|
||||
{
|
||||
get;
|
||||
@@ -386,6 +391,13 @@ namespace GitHub.DistributedTask.WebApi
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(Order = 33, EmitDefaultValue = false)]
|
||||
public ISet<string> Labels
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
internal Guid? LockToken
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
@@ -27,29 +26,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
this.OwnerName = ownerName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new <c>TaskAgentSession</c> isntance with the specified owner name, agent, and capabilities.
|
||||
/// </summary>
|
||||
/// <param name="ownerName">The name of the owner for this session. This should typically be the agent machine</param>
|
||||
/// <param name="agent">The target agent for the session</param>
|
||||
/// <param name="systemCapabilities">A collection of capabilities to publish on session creation</param>
|
||||
public TaskAgentSession(
|
||||
String ownerName,
|
||||
TaskAgentReference agent,
|
||||
IDictionary<String, String> systemCapabilities)
|
||||
{
|
||||
this.Agent = agent;
|
||||
this.OwnerName = ownerName;
|
||||
|
||||
foreach (var capability in systemCapabilities)
|
||||
{
|
||||
if (capability.Value != null)
|
||||
{
|
||||
this.SystemCapabilities.Add(capability.Key, capability.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique identifier for this session.
|
||||
/// </summary>
|
||||
@@ -89,33 +65,5 @@ namespace GitHub.DistributedTask.WebApi
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of system capabilities used for this session.
|
||||
/// </summary>
|
||||
public IDictionary<String, String> SystemCapabilities
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_systemCapabilities == null)
|
||||
{
|
||||
m_systemCapabilities = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
return m_systemCapabilities;
|
||||
}
|
||||
}
|
||||
|
||||
[OnSerializing]
|
||||
private void OnSerializing(StreamingContext context)
|
||||
{
|
||||
if (m_systemCapabilities?.Count == 0)
|
||||
{
|
||||
m_systemCapabilities = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "SystemCapabilities")]
|
||||
private IDictionary<String, String> m_systemCapabilities;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<OutputType>Library</OutputType>
|
||||
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
|
||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
||||
@@ -11,6 +11,7 @@
|
||||
<DefineConstants>NETSTANDARD;NET_STANDARD;TRACE</DefineConstants>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -21,11 +22,7 @@
|
||||
<PackageReference Include="System.Security.Cryptography.Cng" Version="4.4.0" />
|
||||
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="4.4.0" />
|
||||
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="4.4.0" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.4.0" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.0" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="3.19.4" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.9.1" />
|
||||
<PackageReference Include="WindowsAzure.Storage" Version="8.7.0" />
|
||||
<PackageReference Include="Minimatch" Version="2.0.0" />
|
||||
<PackageReference Include="YamlDotNet.Signed" Version="5.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using GitHub.Runner.Common.Capabilities;
|
||||
using GitHub.Runner.Worker;
|
||||
using GitHub.Runner.Worker;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -21,12 +20,12 @@ namespace GitHub.Runner.Common.Tests
|
||||
manager.Initialize(tc);
|
||||
|
||||
// Act.
|
||||
List<ICapabilitiesProvider> extensions = manager.GetExtensions<ICapabilitiesProvider>();
|
||||
List<IActionCommandExtension> extensions = manager.GetExtensions<IActionCommandExtension>();
|
||||
|
||||
// Assert.
|
||||
Assert.True(
|
||||
extensions.Any(x => x is RunnerCapabilitiesProvider),
|
||||
$"Expected {nameof(RunnerCapabilitiesProvider)} extension to be returned as a job extension.");
|
||||
extensions.Any(x => x is SetEnvCommandExtension),
|
||||
$"Expected {nameof(SetEnvCommandExtension)} extension to be returned as a job extension.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +41,9 @@ namespace GitHub.Runner.Common.Tests
|
||||
manager.Initialize(tc);
|
||||
|
||||
// Act/Assert.
|
||||
AssertContains<GitHub.Runner.Common.Capabilities.ICapabilitiesProvider>(
|
||||
AssertContains<GitHub.Runner.Worker.IActionCommandExtension>(
|
||||
manager,
|
||||
concreteType: typeof(GitHub.Runner.Common.Capabilities.RunnerCapabilitiesProvider));
|
||||
concreteType: typeof(GitHub.Runner.Worker.SetEnvCommandExtension));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using GitHub.Runner.Common.Util;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Xunit;
|
||||
|
||||
@@ -67,6 +69,44 @@ namespace GitHub.Runner.Common.Tests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
[Trait("Category", "Common")]
|
||||
public void DefaultSecretMaskers()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Arrange.
|
||||
Setup();
|
||||
|
||||
// Act.
|
||||
_hc.SecretMasker.AddValue("Password123!");
|
||||
_hc.SecretMasker.AddValue("Pass\"word\"123!");
|
||||
_hc.SecretMasker.AddValue("Pass word 123!");
|
||||
_hc.SecretMasker.AddValue("Pass<word>123!");
|
||||
_hc.SecretMasker.AddValue("Pass'word'123!");
|
||||
|
||||
// Assert.
|
||||
Assert.Equal("123***123", _hc.SecretMasker.MaskSecrets("123Password123!123"));
|
||||
Assert.Equal("password123", _hc.SecretMasker.MaskSecrets("password123"));
|
||||
Assert.Equal("123***123", _hc.SecretMasker.MaskSecrets("123Pass\\\"word\\\"123!123"));
|
||||
Assert.Equal("123***123", _hc.SecretMasker.MaskSecrets("123Pass%20word%20123%21123"));
|
||||
Assert.Equal("123***123", _hc.SecretMasker.MaskSecrets("123Pass<word>123!123"));
|
||||
Assert.Equal("123***123", _hc.SecretMasker.MaskSecrets("123Pass''word''123!123"));
|
||||
Assert.Equal("OlBh***", _hc.SecretMasker.MaskSecrets(Convert.ToBase64String(Encoding.UTF8.GetBytes($":Password123!"))));
|
||||
Assert.Equal("YTpQ***", _hc.SecretMasker.MaskSecrets(Convert.ToBase64String(Encoding.UTF8.GetBytes($"a:Password123!"))));
|
||||
Assert.Equal("YWI6***", _hc.SecretMasker.MaskSecrets(Convert.ToBase64String(Encoding.UTF8.GetBytes($"ab:Password123!"))));
|
||||
Assert.Equal("YWJjOlBh***", _hc.SecretMasker.MaskSecrets(Convert.ToBase64String(Encoding.UTF8.GetBytes($"abc:Password123!"))));
|
||||
Assert.Equal("YWJjZDpQ***", _hc.SecretMasker.MaskSecrets(Convert.ToBase64String(Encoding.UTF8.GetBytes($"abcd:Password123!"))));
|
||||
Assert.Equal("YWJjZGU6***", _hc.SecretMasker.MaskSecrets(Convert.ToBase64String(Encoding.UTF8.GetBytes($"abcde:Password123!"))));
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Cleanup.
|
||||
Teardown();
|
||||
}
|
||||
}
|
||||
|
||||
public void Setup([CallerMemberName] string testName = "")
|
||||
{
|
||||
_tokenSource = new CancellationTokenSource();
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
using GitHub.Runner.Common.Capabilities;
|
||||
using GitHub.Runner.Listener.Configuration;
|
||||
using Moq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace GitHub.Runner.Common.Tests.Listener
|
||||
{
|
||||
public sealed class AgentCapabilitiesProviderTestL0
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
[Trait("Category", "Agent")]
|
||||
public async void TestGetCapabilities()
|
||||
{
|
||||
using (var hc = new TestHostContext(this))
|
||||
using (var tokenSource = new CancellationTokenSource())
|
||||
{
|
||||
Mock<IConfigurationManager> configurationManager = new Mock<IConfigurationManager>();
|
||||
hc.SetSingleton<IConfigurationManager>(configurationManager.Object);
|
||||
|
||||
// Arrange
|
||||
var provider = new RunnerCapabilitiesProvider();
|
||||
provider.Initialize(hc);
|
||||
var settings = new RunnerSettings() { AgentName = "IAmAgent007" };
|
||||
|
||||
// Act
|
||||
List<Capability> capabilities = await provider.GetCapabilitiesAsync(settings, tokenSource.Token);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(capabilities);
|
||||
Capability runnerNameCapability = capabilities.SingleOrDefault(x => string.Equals(x.Name, "Runner.Name", StringComparison.Ordinal));
|
||||
Assert.NotNull(runnerNameCapability);
|
||||
Assert.Equal("IAmAgent007", runnerNameCapability.Value);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
[Trait("Category", "Agent")]
|
||||
public async void TestInteractiveSessionCapability()
|
||||
{
|
||||
using (var hc = new TestHostContext(this))
|
||||
using (var tokenSource = new CancellationTokenSource())
|
||||
{
|
||||
hc.StartupType = StartupType.AutoStartup;
|
||||
await VerifyInteractiveSessionCapability(hc, tokenSource.Token, true);
|
||||
|
||||
hc.StartupType = StartupType.Service;
|
||||
await VerifyInteractiveSessionCapability(hc, tokenSource.Token, false);
|
||||
|
||||
hc.StartupType = StartupType.Manual;
|
||||
await VerifyInteractiveSessionCapability(hc, tokenSource.Token, true);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task VerifyInteractiveSessionCapability(IHostContext hc, CancellationToken token, bool expectedValue)
|
||||
{
|
||||
// Arrange
|
||||
var provider = new RunnerCapabilitiesProvider();
|
||||
provider.Initialize(hc);
|
||||
var settings = new RunnerSettings() { AgentName = "IAmAgent007" };
|
||||
|
||||
// Act
|
||||
List<Capability> capabilities = await provider.GetCapabilitiesAsync(settings, token);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(capabilities);
|
||||
Capability iSessionCapability = capabilities.SingleOrDefault(x => string.Equals(x.Name, "InteractiveSession", StringComparison.Ordinal));
|
||||
Assert.NotNull(iSessionCapability);
|
||||
bool.TryParse(iSessionCapability.Value, out bool isInteractive);
|
||||
Assert.Equal(expectedValue, isInteractive);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using GitHub.DistributedTask.WebApi;
|
||||
using GitHub.Runner.Listener;
|
||||
using GitHub.Runner.Common.Capabilities;
|
||||
using GitHub.Runner.Listener.Configuration;
|
||||
using GitHub.Runner.Common.Util;
|
||||
using GitHub.Services.WebApi;
|
||||
@@ -40,8 +39,6 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration
|
||||
#endif
|
||||
|
||||
private Mock<IRSAKeyManager> _rsaKeyManager;
|
||||
private ICapabilitiesManager _capabilitiesManager;
|
||||
// private DeploymentGroupAgentConfigProvider _deploymentGroupAgentConfigProvider;
|
||||
private string _expectedToken = "expectedToken";
|
||||
private string _expectedServerUrl = "https://localhost";
|
||||
private string _expectedAgentName = "expectedAgentName";
|
||||
@@ -78,8 +75,6 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration
|
||||
_serviceControlManager = new Mock<ILinuxServiceControlManager>();
|
||||
#endif
|
||||
|
||||
_capabilitiesManager = new CapabilitiesManager();
|
||||
|
||||
var expectedAgent = new TaskAgent(_expectedAgentName) { Id = 1 };
|
||||
var expectedDeploymentMachine = new DeploymentMachine() { Agent = expectedAgent, Id = _expectedDeploymentMachineId };
|
||||
expectedAgent.Authorization = new TaskAgentAuthorization
|
||||
@@ -127,7 +122,7 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration
|
||||
_agentServer.Setup(x => x.GetAgentsAsync(It.IsAny<int>(), It.IsAny<string>())).Returns(Task.FromResult(expectedAgents));
|
||||
|
||||
_agentServer.Setup(x => x.AddAgentAsync(It.IsAny<int>(), It.IsAny<TaskAgent>())).Returns(Task.FromResult(expectedAgent));
|
||||
_agentServer.Setup(x => x.UpdateAgentAsync(It.IsAny<int>(), It.IsAny<TaskAgent>())).Returns(Task.FromResult(expectedAgent));
|
||||
_agentServer.Setup(x => x.ReplaceAgentAsync(It.IsAny<int>(), It.IsAny<TaskAgent>())).Returns(Task.FromResult(expectedAgent));
|
||||
|
||||
rsa = new RSACryptoServiceProvider(2048);
|
||||
|
||||
@@ -143,8 +138,6 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration
|
||||
tc.SetSingleton<IExtensionManager>(_extnMgr.Object);
|
||||
tc.SetSingleton<IRunnerServer>(_agentServer.Object);
|
||||
tc.SetSingleton<ILocationServer>(_locationServer.Object);
|
||||
// tc.SetSingleton<IDeploymentGroupServer>(_machineGroupServer.Object);
|
||||
tc.SetSingleton<ICapabilitiesManager>(_capabilitiesManager);
|
||||
tc.SetSingleton<IRunnerWebProxy>(_runnerWebProxy.Object);
|
||||
tc.SetSingleton<IRunnerCertificateManager>(_cert.Object);
|
||||
|
||||
@@ -208,12 +201,7 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration
|
||||
// validate GetAgentPoolsAsync gets called once with automation pool type
|
||||
_agentServer.Verify(x => x.GetAgentPoolsAsync(It.IsAny<string>(), It.Is<TaskAgentPoolType>(p => p == TaskAgentPoolType.Automation)), Times.Once);
|
||||
|
||||
// validate GetAgentPoolsAsync not called with deployment pool type
|
||||
_agentServer.Verify(x => x.GetAgentPoolsAsync(It.IsAny<string>(), It.Is<TaskAgentPoolType>(p => p == TaskAgentPoolType.Deployment)), Times.Never);
|
||||
|
||||
// For build and release agent / deployment pool, tags logic should not get trigger;
|
||||
// _machineGroupServer.Verify(x =>
|
||||
// x.UpdateDeploymentTargetsAsync(It.IsAny<Guid>(), It.IsAny<int>(), It.IsAny<List<DeploymentMachine>>()), Times.Never);
|
||||
_agentServer.Verify(x => x.AddAgentAsync(It.IsAny<int>(), It.Is<TaskAgent>(a => a.Labels.Contains("self-hosted") && a.Labels.Contains(VarUtil.OS) && a.Labels.Contains(VarUtil.OSArchitecture))), Times.Once);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using GitHub.Services.Common;
|
||||
using GitHub.Services.WebApi;
|
||||
using GitHub.Runner.Listener;
|
||||
using GitHub.Runner.Common.Capabilities;
|
||||
using GitHub.Runner.Listener.Configuration;
|
||||
using Moq;
|
||||
using System;
|
||||
@@ -21,7 +20,6 @@ namespace GitHub.Runner.Common.Tests.Listener
|
||||
private Mock<IConfigurationManager> _config;
|
||||
private Mock<IRunnerServer> _agentServer;
|
||||
private Mock<ICredentialManager> _credMgr;
|
||||
private Mock<ICapabilitiesManager> _capabilitiesManager;
|
||||
|
||||
public MessageListenerL0()
|
||||
{
|
||||
@@ -30,7 +28,6 @@ namespace GitHub.Runner.Common.Tests.Listener
|
||||
_config.Setup(x => x.LoadSettings()).Returns(_settings);
|
||||
_agentServer = new Mock<IRunnerServer>();
|
||||
_credMgr = new Mock<ICredentialManager>();
|
||||
_capabilitiesManager = new Mock<ICapabilitiesManager>();
|
||||
}
|
||||
|
||||
private TestHostContext CreateTestContext([CallerMemberName] String testName = "")
|
||||
@@ -39,7 +36,6 @@ namespace GitHub.Runner.Common.Tests.Listener
|
||||
tc.SetSingleton<IConfigurationManager>(_config.Object);
|
||||
tc.SetSingleton<IRunnerServer>(_agentServer.Object);
|
||||
tc.SetSingleton<ICredentialManager>(_credMgr.Object);
|
||||
tc.SetSingleton<ICapabilitiesManager>(_capabilitiesManager.Object);
|
||||
return tc;
|
||||
}
|
||||
|
||||
@@ -62,8 +58,6 @@ namespace GitHub.Runner.Common.Tests.Listener
|
||||
tokenSource.Token))
|
||||
.Returns(Task.FromResult(expectedSession));
|
||||
|
||||
_capabilitiesManager.Setup(x => x.GetCapabilitiesAsync(_settings, It.IsAny<CancellationToken>())).Returns(Task.FromResult(new Dictionary<string, string>()));
|
||||
|
||||
_credMgr.Setup(x => x.LoadCredentials()).Returns(new VssCredentials());
|
||||
|
||||
// Act.
|
||||
@@ -106,8 +100,6 @@ namespace GitHub.Runner.Common.Tests.Listener
|
||||
tokenSource.Token))
|
||||
.Returns(Task.FromResult(expectedSession));
|
||||
|
||||
_capabilitiesManager.Setup(x => x.GetCapabilitiesAsync(_settings, It.IsAny<CancellationToken>())).Returns(Task.FromResult(new Dictionary<string, string>()));
|
||||
|
||||
_credMgr.Setup(x => x.LoadCredentials()).Returns(new VssCredentials());
|
||||
|
||||
// Act.
|
||||
@@ -153,8 +145,6 @@ namespace GitHub.Runner.Common.Tests.Listener
|
||||
tokenSource.Token))
|
||||
.Returns(Task.FromResult(expectedSession));
|
||||
|
||||
_capabilitiesManager.Setup(x => x.GetCapabilitiesAsync(_settings, It.IsAny<CancellationToken>())).Returns(Task.FromResult(new Dictionary<string, string>()));
|
||||
|
||||
_credMgr.Setup(x => x.LoadCredentials()).Returns(new VssCredentials());
|
||||
|
||||
// Act.
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using GitHub.Runner.Listener;
|
||||
using GitHub.Runner.Common.Capabilities;
|
||||
using GitHub.Runner.Listener.Configuration;
|
||||
using GitHub.Runner.Worker;
|
||||
using GitHub.Runner.Worker.Handlers;
|
||||
@@ -44,7 +43,6 @@ namespace GitHub.Runner.Common.Tests
|
||||
typeof(IHostContext),
|
||||
typeof(ITraceManager),
|
||||
typeof(IThrottlingReporter),
|
||||
typeof(ICapabilitiesProvider)
|
||||
};
|
||||
Validate(
|
||||
assembly: typeof(IHostContext).GetTypeInfo().Assembly,
|
||||
|
||||
@@ -233,6 +233,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
[Trait("Category", "Worker")]
|
||||
@@ -272,6 +273,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
Teardown();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
@@ -306,6 +308,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
#if OS_LINUX
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
@@ -772,6 +775,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
||||
Teardown();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
[Fact]
|
||||
[Trait("Level", "L0")]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm;rhel.6-x64;osx-x64</RuntimeIdentifiers>
|
||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
||||
<AssetTargetFallback>portable-net45+win8</AssetTargetFallback>
|
||||
|
||||
@@ -16,7 +16,7 @@ LAYOUT_DIR="$SCRIPT_DIR/../_layout"
|
||||
DOWNLOAD_DIR="$SCRIPT_DIR/../_downloads/netcore2x"
|
||||
PACKAGE_DIR="$SCRIPT_DIR/../_package"
|
||||
DOTNETSDK_ROOT="$SCRIPT_DIR/../_dotnetsdk"
|
||||
DOTNETSDK_VERSION="2.2.300"
|
||||
DOTNETSDK_VERSION="3.0.100"
|
||||
DOTNETSDK_INSTALLDIR="$DOTNETSDK_ROOT/$DOTNETSDK_VERSION"
|
||||
RUNNER_VERSION=$(cat runnerversion)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "2.2.300"
|
||||
"version": "3.0.100"
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
2.159.0
|
||||
2.160.0
|
||||
Reference in New Issue
Block a user