Skip to content

Commit 70f8576

Browse files
authored
Merge branch 'main' of https://github.com/actions/runner into fhammerl/mock-update
2 parents 8d3ae51 + 8f160bc commit 70f8576

28 files changed

+1459
-185
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
devScript: ./dev.sh
3838

3939
- runtime: win-x64
40-
os: windows-latest
40+
os: windows-2019
4141
devScript: ./dev
4242

4343
runs-on: ${{ matrix.os }}

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
devScript: ./dev.sh
8888

8989
- runtime: win-x64
90-
os: windows-latest
90+
os: windows-2019
9191
devScript: ./dev
9292

9393
runs-on: ${{ matrix.os }}

docs/adrs/0276-problem-matchers.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,31 @@ Compilation failures during a CI build should surface good error messages.
1010

1111
For example, the actual compile errors from the typescript compiler should bubble as issues in the UI. And not simply "tsc exited with exit code 1".
1212

13-
VSCode has an extensible model for solving this type of problem. VSCode allows users to configure which problems matchers to use, when scanning output. For example, a user can apply the `tsc` problem matcher to receive a rich error output experience in VSCode, when compiling their typescript project.
13+
VSCode has an extensible model for solving this type of problem. VSCode allows users to configure which [problems matchers](https://code.visualstudio.com/docs/editor/tasks#_defining-a-problem-matcher) to use, when scanning output. For example, a user can apply the `tsc` problem matcher to receive a rich error output experience in VSCode, when compiling their typescript project.
1414

1515
The problem-matcher concept fits well with "setup" actions. For example, the `setup-nodejs` action will download node.js, add it to the PATH, and register the `tsc` problem matcher. For the duration of the job, the `tsc` problem matcher will be applied against the output.
1616

1717
## Decision
1818

1919
### Registration
2020

21-
#### Using `##` command
21+
#### Using `::` command
2222

23-
`##[add-matcher]path-to-problem-matcher-config.json`
23+
`::add-matcher::path-to-problem-matcher-config.json`
2424

25-
Using a `##` command allows for flexibility:
25+
Using a `::` command allows for flexibility:
2626
- Ad hoc scripts can register problem matchers
2727
- Allows problem matchers to be conditionally registered
2828

2929
Note, if a matcher with the same name is registered a second time, it will clobber the first instance.
3030

31-
#### Unregister using `##` command
31+
Note, at some point the syntax changed from `##` to `::`.
32+
33+
#### Unregister using `::` command
3234

3335
A way out for rare cases where scoping is a problem.
3436

35-
`##[remove-matcher]owner`
37+
`::remove-matcher::owner`
3638

3739
For this to be usable, the `owner` needs to be discoverable. Therefore, debug print the owner on registration.
3840

@@ -104,7 +106,7 @@ message: ; expected
104106
fromPath: C:\myrepo\myproject\ConsoleApp1\ClassLibrary1\ClassLibrary1.csproj
105107
```
106108

107-
Additionally the line will appear red in the web UI (prefix with `##[error]`).
109+
Additionally the line will appear red in the web UI (prefix with `::error`).
108110

109111
Note, an error does not imply task failure. Exit codes communicate failure.
110112

docs/adrs/0354-runner-machine-info.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The runner will look for a file `.setup_info` under the runner's root directory,
2424
}
2525
]
2626
```
27-
The runner will use `##[group]` and `##[endgroup]` to fold all detail info into an expandable group.
27+
The runner will use `::group` and `::endgroup` to fold all detail info into an expandable group.
2828

2929
Both [virtual-environments](https://github.com/actions/virtual-environments) and self-hosted runners can use this mechanism to add extra logging info to the `Set up job` step's log.
3030

docs/contribute.md

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ An ADR is an Architectural Decision Record. This allows consensus on the direct
2323

2424
![Win](res/win_sm.png) ![*nix](res/linux_sm.png) Git for Windows and Linux [Install Here](https://git-scm.com/downloads) (needed for dev sh script)
2525

26+
![*nix](res/linux_sm.png) cURL [Install here](https://curl.se/download.html) (needed for external sh script)
27+
28+
![Win](res/win_sm.png) Visual Studio 2017 or newer [Install here](https://visualstudio.microsoft.com) (needed for dev sh script)
29+
2630
## Quickstart: Run a job from a real repository
2731

2832
If you just want to get from building the sourcecode to using it to execute an action, you will need:

releaseNote.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
## Features
22

3-
- Bump runtime to dotnet 6 (#1471)
4-
- Show service container logs on teardown (#1563)
3+
- Add Runner Configuration option to disable auto update `--disableupdate` (#1558)
4+
- Introduce `GITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY` env variable to skip SSL Cert Verification on the Runner (#1616)
5+
- Adds support for downloading trimmed versions of the runner when the entire package does not need to be upgraded (#1568)
56

67
## Bugs
7-
8-
- Add masks for multiline secrets from ::add-mask:: (#1521)
9-
- fix Log size and retention settings not work (#1507)
10-
- Refactor SelfUpdater adding L0 tests. (#1564)
11-
- Fix test failure: /bin/sleep on Macos 11 (Monterey) does not accept the suffix s. (#1472)
12-
8+
- Set Outcome/Conclusion for composite action steps (#1600)
139

1410
## Misc
1511

16-
- Update dependency check for dotnet 6. (#1551)
17-
- Produce trimmed down runner packages. (#1556)
18-
- Deleted extra background in github-praph.png, which is displayed in README.md (#1432)
12+
- Update `run.sh` to more gracefully handle updates (#1494)
13+
- Use 8Mb default chunking for File Container Uploads (#1626)
14+
- Performance improvements in handling large amounts of live logs (#1592)
15+
- Allow `./svc.sh stop` to exit as soon as runner process exits (#1580)
16+
- Add additional tracing to help troubleshoot job message corruption (#1587)
1917

2018

2119
## Windows x64

src/Misc/layoutroot/run.cmd

-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ rem ****************************************************************************
2121
:launch_helper
2222
copy run-helper.cmd.template run-helper.cmd /Y
2323
call "%~dp0run-helper.cmd" %*
24-
25-
rem using `if %ERRORLEVEL% EQU N` insterad of `if ERRORLEVEL N`
26-
rem `if ERRORLEVEL N` means: error level is N or MORE
2724

2825
if %ERRORLEVEL% EQU 1 (
2926
echo "Restarting runner..."

src/Runner.Common/ConfigurationStore.cs

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public sealed class RunnerSettings
3333
[DataMember(EmitDefaultValue = false)]
3434
public string PoolName { get; set; }
3535

36+
[DataMember(EmitDefaultValue = false)]
37+
public bool DisableUpdate { get; set; }
38+
3639
[DataMember(EmitDefaultValue = false)]
3740
public bool Ephemeral { get; set; }
3841

src/Runner.Common/Constants.cs

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public static class Flags
129129
public static readonly string Ephemeral = "ephemeral";
130130
public static readonly string Help = "help";
131131
public static readonly string Replace = "replace";
132+
public static readonly string DisableUpdate = "disableupdate";
132133
public static readonly string Once = "once"; // Keep this around since customers still relies on it
133134
public static readonly string RunAsService = "runasservice";
134135
public static readonly string Unattended = "unattended";

src/Runner.Common/HostContext.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ public HostContext(string hostType, string logFile = null)
193193
_trace.Info($"No proxy settings were found based on environmental variables (http_proxy/https_proxy/HTTP_PROXY/HTTPS_PROXY)");
194194
}
195195

196+
if (StringUtil.ConvertToBoolean(Environment.GetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY")))
197+
{
198+
_trace.Warning($"Runner is running under insecure mode: HTTPS server certifcate validation has been turned off by GITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY environment variable.");
199+
}
200+
196201
var credFile = GetConfigFile(WellKnownConfigFile.Credentials);
197202
if (File.Exists(credFile))
198203
{
@@ -350,7 +355,7 @@ public string GetConfigFile(WellKnownConfigFile configFile)
350355
GetDirectory(WellKnownDirectory.Root),
351356
".setup_info");
352357
break;
353-
358+
354359
case WellKnownConfigFile.Telemetry:
355360
path = Path.Combine(
356361
GetDirectory(WellKnownDirectory.Diag),

src/Runner.Common/HttpClientHandlerFactory.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Net.Http;
23
using GitHub.Runner.Sdk;
34

@@ -13,7 +14,14 @@ public class HttpClientHandlerFactory : RunnerService, IHttpClientHandlerFactory
1314
{
1415
public HttpClientHandler CreateClientHandler(RunnerWebProxy webProxy)
1516
{
16-
return new HttpClientHandler() { Proxy = webProxy };
17+
var client = new HttpClientHandler() { Proxy = webProxy };
18+
19+
if (StringUtil.ConvertToBoolean(Environment.GetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY")))
20+
{
21+
client.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
22+
}
23+
24+
return client;
1725
}
1826
}
1927
}

src/Runner.Listener/CommandSettings.cs

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public sealed class CommandSettings
2929
{
3030
Constants.Runner.CommandLine.Flags.Check,
3131
Constants.Runner.CommandLine.Flags.Commit,
32+
Constants.Runner.CommandLine.Flags.DisableUpdate,
3233
Constants.Runner.CommandLine.Flags.Ephemeral,
3334
Constants.Runner.CommandLine.Flags.Help,
3435
Constants.Runner.CommandLine.Flags.Once,
@@ -68,6 +69,7 @@ public sealed class CommandSettings
6869
public bool Unattended => TestFlag(Constants.Runner.CommandLine.Flags.Unattended);
6970
public bool Version => TestFlag(Constants.Runner.CommandLine.Flags.Version);
7071
public bool Ephemeral => TestFlag(Constants.Runner.CommandLine.Flags.Ephemeral);
72+
public bool DisableUpdate => TestFlag(Constants.Runner.CommandLine.Flags.DisableUpdate);
7173

7274
// Keep this around since customers still relies on it
7375
public bool RunOnce => TestFlag(Constants.Runner.CommandLine.Flags.Once);

src/Runner.Listener/Configuration/ConfigurationManager.cs

+29-4
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ public async Task ConfigureAsync(CommandSettings command)
196196
TaskAgent agent;
197197
while (true)
198198
{
199+
runnerSettings.DisableUpdate = command.DisableUpdate;
199200
runnerSettings.Ephemeral = command.Ephemeral;
200201
runnerSettings.AgentName = command.GetRunnerName();
201202

@@ -213,11 +214,22 @@ public async Task ConfigureAsync(CommandSettings command)
213214
if (command.GetReplace())
214215
{
215216
// Update existing agent with new PublicKey, agent version.
216-
agent = UpdateExistingAgent(agent, publicKey, userLabels, runnerSettings.Ephemeral);
217+
agent = UpdateExistingAgent(agent, publicKey, userLabels, runnerSettings.Ephemeral, command.DisableUpdate);
217218

218219
try
219220
{
220221
agent = await _runnerServer.ReplaceAgentAsync(runnerSettings.PoolId, agent);
222+
if (command.DisableUpdate &&
223+
command.DisableUpdate != agent.DisableUpdate)
224+
{
225+
throw new NotSupportedException("The GitHub server does not support configuring a self-hosted runner with 'DisableUpdate' flag.");
226+
}
227+
if (command.Ephemeral &&
228+
command.Ephemeral != agent.Ephemeral)
229+
{
230+
throw new NotSupportedException("The GitHub server does not support configuring a self-hosted runner with 'Ephemeral' flag.");
231+
}
232+
221233
_term.WriteSuccessMessage("Successfully replaced the runner");
222234
break;
223235
}
@@ -236,11 +248,22 @@ public async Task ConfigureAsync(CommandSettings command)
236248
else
237249
{
238250
// Create a new agent.
239-
agent = CreateNewAgent(runnerSettings.AgentName, publicKey, userLabels, runnerSettings.Ephemeral);
251+
agent = CreateNewAgent(runnerSettings.AgentName, publicKey, userLabels, runnerSettings.Ephemeral, command.DisableUpdate);
240252

241253
try
242254
{
243255
agent = await _runnerServer.AddAgentAsync(runnerSettings.PoolId, agent);
256+
if (command.DisableUpdate &&
257+
command.DisableUpdate != agent.DisableUpdate)
258+
{
259+
throw new NotSupportedException("The GitHub server does not support configuring a self-hosted runner with 'DisableUpdate' flag.");
260+
}
261+
if (command.Ephemeral &&
262+
command.Ephemeral != agent.Ephemeral)
263+
{
264+
throw new NotSupportedException("The GitHub server does not support configuring a self-hosted runner with 'Ephemeral' flag.");
265+
}
266+
244267
_term.WriteSuccessMessage("Runner successfully added");
245268
break;
246269
}
@@ -466,7 +489,7 @@ private ICredentialProvider GetCredentialProvider(CommandSettings command, strin
466489
}
467490

468491

469-
private TaskAgent UpdateExistingAgent(TaskAgent agent, RSAParameters publicKey, ISet<string> userLabels, bool ephemeral)
492+
private TaskAgent UpdateExistingAgent(TaskAgent agent, RSAParameters publicKey, ISet<string> userLabels, bool ephemeral, bool disableUpdate)
470493
{
471494
ArgUtil.NotNull(agent, nameof(agent));
472495
agent.Authorization = new TaskAgentAuthorization
@@ -478,6 +501,7 @@ private TaskAgent UpdateExistingAgent(TaskAgent agent, RSAParameters publicKey,
478501
agent.Version = BuildConstants.RunnerPackage.Version;
479502
agent.OSDescription = RuntimeInformation.OSDescription;
480503
agent.Ephemeral = ephemeral;
504+
agent.DisableUpdate = disableUpdate;
481505
agent.MaxParallelism = 1;
482506

483507
agent.Labels.Clear();
@@ -494,7 +518,7 @@ private TaskAgent UpdateExistingAgent(TaskAgent agent, RSAParameters publicKey,
494518
return agent;
495519
}
496520

497-
private TaskAgent CreateNewAgent(string agentName, RSAParameters publicKey, ISet<string> userLabels, bool ephemeral)
521+
private TaskAgent CreateNewAgent(string agentName, RSAParameters publicKey, ISet<string> userLabels, bool ephemeral, bool disableUpdate)
498522
{
499523
TaskAgent agent = new TaskAgent(agentName)
500524
{
@@ -506,6 +530,7 @@ private TaskAgent CreateNewAgent(string agentName, RSAParameters publicKey, ISet
506530
Version = BuildConstants.RunnerPackage.Version,
507531
OSDescription = RuntimeInformation.OSDescription,
508532
Ephemeral = ephemeral,
533+
DisableUpdate = disableUpdate
509534
};
510535

511536
agent.Labels.Add(new AgentLabel("self-hosted", LabelType.System));

src/Runner.Listener/Runner.Listener.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
88
<NoWarn>NU1701;NU1603</NoWarn>
99
<Version>$(Version)</Version>
10+
<PredefinedCulturesOnly>false</PredefinedCulturesOnly>
1011
<PublishReadyToRunComposite>true</PublishReadyToRunComposite>
1112
</PropertyGroup>
1213

src/Runner.Listener/Runner.cs

+1
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ private void PrintUsage(CommandSettings command)
560560
--work string Relative runner work directory (default {Constants.Path.WorkDirectory})
561561
--replace Replace any existing runner with the same name (default false)
562562
--pat GitHub personal access token used for checking network connectivity when executing `.{separator}run.{ext} --check`
563+
--disableupdate Disable self-hosted runner automatic update to the latest released version`
563564
--ephemeral Configure the runner to only take one job and then let the service un-configure the runner after the job finishes (default false)");
564565

565566
#if OS_WINDOWS

0 commit comments

Comments
 (0)