Skip to content

Commit 0605c35

Browse files
authored
Squashed commit of the following:
commit edfb51a Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Wed Feb 2 11:01:15 2022 +0000 Better comments commit 94aa16b Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Wed Feb 2 10:56:21 2022 +0000 Only in debug commit e2f4c6c Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Wed Feb 2 10:53:46 2022 +0000 Formatting commit c13ebc3 Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Wed Feb 2 10:50:44 2022 +0000 Formatting commit 70f8576 Merge: 8d3ae51 8f160bc Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Wed Feb 2 10:44:25 2022 +0000 Merge branch 'main' of https://github.com/actions/runner into fhammerl/mock-update commit 8d3ae51 Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Wed Feb 2 10:40:59 2022 +0000 Remove test changes commit 4c5e005 Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Wed Feb 2 10:39:04 2022 +0000 Update test version-map, remove hardcoded 'true' commit 8f160bc Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Wed Feb 2 11:16:01 2022 +0100 Reopen 'Make run.sh|cmd handle update without quitting so containers using them as entrypoints don't exit on update ' (#1646) * Only execute post for actions that have one * Working container runner update with run.sh * Revert "Only execute post for actions that have one" This reverts commit 9675941. * Relaunch the listener without quitting run.cmd * Fix typo * Extract most os run.sh logic so we can update it * Add bash line endings * Extract the logic from run.cmd * Add EoF lines * Add unexpected ERRORLEVEL messages to cmd * Simplify contract between run and helper * Remove unused exit * WIP: run a copy of the helper so it's safe to update * Throw NonRetryableException if not configured * Log and format * Fix typo * Fix typo * Use helper template system for bash as well * Update run.sh * Remove unnecessary comments * Use ping instead of timeout * Use localhost in ping-timeout (n times, w timeout) Co-authored-by: Ferenc Hammerl <hammerl.ferenc@gmail.com> commit 47ba120 Author: Thomas Boop <52323235+thboop@users.noreply.github.com> Date: Tue Feb 1 09:19:04 2022 -0500 Revert "Make `run.sh|cmd` handle update without quitting so container… (#1635) * Revert "Make `run.sh|cmd` handle update without quitting so containers using them as entrypoints don't exit on update (#1494)" d8251bf * update runnerversion as well commit dc8b1b6 Author: Thomas Boop <52323235+thboop@users.noreply.github.com> Date: Thu Jan 27 11:28:40 2022 -0500 Runner 2.287.0 Release Notes (#1631) * Update runner to 2.287.0 * Update release notes commit 8eacbdc Author: Tingluo Huang <tingluohuang@github.com> Date: Wed Jan 26 13:23:24 2022 -0500 Runner config option to disable auto-update. (#1558) * Runner config option to disable auto-update. * Update src/Runner.Listener/Configuration/ConfigurationManager.cs Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com> * Update src/Runner.Listener/Configuration/ConfigurationManager.cs Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com> * Update src/Runner.Listener/Configuration/ConfigurationManager.cs Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com> * Update src/Runner.Listener/Configuration/ConfigurationManager.cs Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com> * feedback. Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com> commit 689035e Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Wed Jan 26 14:32:30 2022 +0000 Use KV map to mock update commit 6b4a95c Author: Pavel Iakovenko <paveliak@users.noreply.github.com> Date: Mon Jan 24 13:57:05 2022 -0500 Use default 8Mb chunking for the FileContainer uploads (#1626) commit c95d5ea Author: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Fri Jan 21 11:35:50 2022 -0500 Update 0276-problem-matchers.md (#1105) * Update 0276-problem-matchers.md Update to reflect current behavior * Update docs/adrs/0276-problem-matchers.md Co-authored-by: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> commit ea67ff9 Author: Rob Cowsill <42620235+rcowsill@users.noreply.github.com> Date: Fri Jan 21 16:35:29 2022 +0000 Update Required Dev Dependencies (#1379) * Add cURL to Linux requirements * Add VS2017 to Windows requirements commit d7d38e1 Author: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Fri Jan 21 11:35:14 2022 -0500 Update 0354-runner-machine-info.md (#1108) commit ac31fd1 Author: Tingluo Huang <tingluohuang@github.com> Date: Wed Jan 19 10:31:17 2022 -0500 Introduce GITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY=1 to skip SSL cert verification for the runner. (#1616) commit d8251bf Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Wed Jan 19 14:38:43 2022 +0100 Make `run.sh|cmd` handle update without quitting so containers using them as entrypoints don't exit on update (#1494) * Only execute post for actions that have one * Working container runner update with run.sh * Revert "Only execute post for actions that have one" This reverts commit 9675941. * Relaunch the listener without quitting run.cmd * Fix typo * Extract most os run.sh logic so we can update it * Add bash line endings * Extract the logic from run.cmd * Add EoF lines * Add unexpected ERRORLEVEL messages to cmd * Simplify contract between run and helper * Remove unused exit * WIP: run a copy of the helper so it's safe to update * Throw NonRetryableException if not configured * Log and format * Fix typo * Fix typo * Use helper template system for bash as well * Update run.sh * Remove unnecessary comments * Use ping instead of timeout * Use localhost in ping-timeout (n times, w timeout) Co-authored-by: Ferenc Hammerl <hammerl.ferenc@gmail.com> commit d8351e3 Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Wed Jan 19 10:27:36 2022 +0000 Use local ping commit 1406602 Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Tue Jan 18 22:55:56 2022 +0000 Ping instead of timeout commit 66cce79 Merge: 4768372 1bf42ba Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Tue Jan 18 13:24:16 2022 +0000 Merge branch 'fhammerl/run-sh-handle-update-containers' of https://github.com/actions/runner into fhammerl/mock-update commit 4768372 Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Tue Jan 18 12:07:45 2022 +0000 Use old method commit bc9b076 Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Tue Jan 18 12:01:51 2022 +0000 Mock message not files commit 0f470c6 Author: Ferenc Hammerl <fhammerl@github.com> Date: Tue Jan 18 10:37:15 2022 +0100 More logging commit 8367d76 Author: Ferenc Hammerl <fhammerl@github.com> Date: Tue Jan 18 10:26:50 2022 +0100 Add update logging commit 1bf42ba Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Thu Jan 13 15:26:29 2022 +0100 Update run.sh commit 68e45d7 Author: Ferenc Hammerl <fhammerl@github.com> Date: Thu Jan 13 14:28:28 2022 +0100 Make wait for debugger optional commit 38332e1 Author: Ferenc Hammerl <fhammerl@github.com> Date: Thu Jan 13 13:42:33 2022 +0100 Use files not env commit 161666a Author: Ferenc Hammerl <fhammerl@github.com> Date: Wed Jan 12 20:58:45 2022 +0100 Remove if debug commit 2116e71 Author: Ferenc Hammerl <fhammerl@github.com> Date: Wed Jan 12 20:41:50 2022 +0100 Remove if debug add logs commit d938bdf Author: Ferenc Hammerl <fhammerl@github.com> Date: Wed Jan 12 20:35:57 2022 +0100 Add debugger and logging to self update commit c353760 Author: Ferenc Hammerl <fhammerl@github.com> Date: Wed Jan 12 17:45:48 2022 +0100 Add mock logging commit df18086 Merge: 5c72801 3b8475d Author: Ferenc Hammerl <fhammerl@github.com> Date: Mon Jan 10 11:55:25 2022 +0100 Merge branch 'main' of github.com:actions/runner into fhammerl/mock-update commit 5c72801 Merge: beaa6fe f2e210e Author: Ferenc Hammerl <fhammerl@github.com> Date: Fri Jan 7 17:33:03 2022 +0100 Merge branch 'main' of github.com:actions/runner into fhammerl/mock-update commit beaa6fe Author: Ferenc Hammerl <fhammerl@github.com> Date: Wed Jan 5 14:29:43 2022 +0100 Add note about how to trigger runner updates commit 6ed5d6c Merge: b5c5b5c 46da23e Author: Ferenc Hammerl <fhammerl@github.com> Date: Wed Jan 5 14:22:35 2022 +0100 Merge branch 'main' of github.com:actions/runner into fhammerl/mock-update commit b5c5b5c Author: Ferenc Hammerl <fhammerl@github.com> Date: Wed Jan 5 14:22:11 2022 +0100 Suffix with correct archive format commit 6fabd82 Author: Ferenc Hammerl <fhammerl@github.com> Date: Wed Jan 5 14:14:45 2022 +0100 Allow mocked updates commit 9a7a674 Author: Ferenc Hammerl <fhammerl@github.com> Date: Mon Jan 3 09:54:41 2022 +0100 Use helper template system for bash as well commit 7e7c4c1 Author: Ferenc Hammerl <fhammerl@github.com> Date: Wed Dec 15 16:35:58 2021 +0100 Fix typo commit 7251905 Author: Ferenc Hammerl <fhammerl@github.com> Date: Tue Dec 14 16:47:53 2021 +0100 Fix typo commit 2a4e99f Author: Ferenc Hammerl <fhammerl@github.com> Date: Mon Dec 13 11:53:20 2021 +0100 Log and format commit b2598a6 Author: Ferenc Hammerl <hammerl.ferenc@gmail.com> Date: Fri Dec 10 14:41:27 2021 +0100 Throw NonRetryableException if not configured commit 7574efa Author: Ferenc Hammerl <fhammerl@github.com> Date: Fri Dec 10 13:58:27 2021 +0100 WIP: run a copy of the helper so it's safe to update commit 24f70b7 Author: Ferenc Hammerl <fhammerl@github.com> Date: Fri Dec 10 13:51:43 2021 +0100 Remove unused exit commit ada666b Author: Ferenc Hammerl <fhammerl@github.com> Date: Fri Dec 10 11:10:26 2021 +0100 Simplify contract between run and helper commit e62aa73 Author: Ferenc Hammerl <fhammerl@github.com> Date: Fri Dec 10 10:15:27 2021 +0100 Add unexpected ERRORLEVEL messages to cmd commit 9839a76 Merge: 8660d05 dde7130 Author: Ferenc Hammerl <fhammerl@github.com> Date: Wed Dec 8 15:20:57 2021 +0100 Merge branch 'fhammerl/run-sh-handle-update-containers' of github.com:actions/runner into fhammerl/run-sh-handle-update-containers commit dde7130 Author: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Fri Dec 3 19:23:02 2021 +0100 Add EoF lines commit 493abce Author: Ferenc Hammerl <hammerl.ferenc@gmail.com> Date: Thu Dec 2 16:02:41 2021 +0100 Extract the logic from run.cmd commit 8660d05 Author: Ferenc Hammerl <fhammerl@github.com> Date: Thu Dec 2 15:21:19 2021 +0100 Add bash line endings commit 66dde76 Author: Ferenc Hammerl <fhammerl@github.com> Date: Thu Dec 2 15:10:42 2021 +0100 Extract most os run.sh logic so we can update it commit edb6483 Author: Ferenc Hammerl <hammerl.ferenc@gmail.com> Date: Tue Nov 30 15:40:02 2021 +0100 Fix typo commit c850c8c Author: Ferenc Hammerl <hammerl.ferenc@gmail.com> Date: Mon Nov 29 15:12:59 2021 +0100 Relaunch the listener without quitting run.cmd commit 7d34d02 Author: Ferenc Hammerl <fhammerl@github.com> Date: Thu Nov 18 18:12:42 2021 +0100 Revert "Only execute post for actions that have one" This reverts commit 9675941. commit 87054ff Author: Ferenc Hammerl <fhammerl@github.com> Date: Thu Nov 18 15:54:27 2021 +0100 Working container runner update with run.sh commit 9675941 Author: Ferenc Hammerl <fhammerl@github.com> Date: Fri Nov 12 13:31:37 2021 +0100 Only execute post for actions that have one
1 parent 715bb7c commit 0605c35

23 files changed

+349
-117
lines changed

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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
@echo off
2+
3+
"%~dp0\bin\Runner.Listener.exe" run %*
4+
5+
rem using `if %ERRORLEVEL% EQU N` insterad of `if ERRORLEVEL N`
6+
rem `if ERRORLEVEL N` means: error level is N or MORE
7+
8+
if %ERRORLEVEL% EQU 0 (
9+
echo "Runner listener exit with 0 return code, stop the service, no retry needed."
10+
exit /b 0
11+
)
12+
13+
if %ERRORLEVEL% EQU 1 (
14+
echo "Runner listener exit with terminated error, stop the service, no retry needed."
15+
exit /b 0
16+
)
17+
18+
if %ERRORLEVEL% EQU 2 (
19+
echo "Runner listener exit with retryable error, re-launch runner in 5 seconds."
20+
ping 127.0.0.1 -n 6 -w 1000 >NUL
21+
exit /b 1
22+
)
23+
24+
if %ERRORLEVEL% EQU 3 (
25+
rem Sleep 5 seconds to wait for the runner update process finish
26+
echo "Runner listener exit because of updating, re-launch runner in 5 seconds"
27+
ping 127.0.0.1 -n 6 -w 1000 >NUL
28+
exit /b 1
29+
)
30+
31+
if %ERRORLEVEL% EQU 4 (
32+
rem Sleep 5 seconds to wait for the ephemeral runner update process finish
33+
echo "Runner listener exit because of updating, re-launch ephemeral runner in 5 seconds"
34+
ping 127.0.0.1 -n 6 -w 1000 >NUL
35+
exit /b 1
36+
)
37+
38+
echo "Exiting after unknown error code: %ERRORLEVEL%"
39+
exit /b 0
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
# Validate not sudo
4+
user_id=`id -u`
5+
if [ $user_id -eq 0 -a -z "$RUNNER_ALLOW_RUNASROOT" ]; then
6+
echo "Must not run interactively with sudo"
7+
exit 1
8+
fi
9+
10+
# Run
11+
shopt -s nocasematch
12+
13+
safe_sleep() {
14+
if [ ! -x "$(command -v sleep)" ]; then
15+
if [ ! -x "$(command -v ping)" ]; then
16+
COUNT="0"
17+
while [[ $COUNT != 5000 ]]; do
18+
echo "SLEEP" > /dev/null
19+
COUNT=$[$COUNT+1]
20+
done
21+
else
22+
ping -c 5 127.0.0.1 > /dev/null
23+
fi
24+
else
25+
sleep 5
26+
fi
27+
}
28+
29+
bin/Runner.Listener run $*
30+
returnCode=$?
31+
if [[ $returnCode == 0 ]]; then
32+
echo "Runner listener exit with 0 return code, stop the service, no retry needed."
33+
exit 0
34+
elif [[ $returnCode == 1 ]]; then
35+
echo "Runner listener exit with terminated error, stop the service, no retry needed."
36+
exit 0
37+
elif [[ $returnCode == 2 ]]; then
38+
echo "Runner listener exit with retryable error, re-launch runner in 5 seconds."
39+
safe_sleep
40+
exit 1
41+
elif [[ $returnCode == 3 ]]; then
42+
# Sleep 5 seconds to wait for the runner update process finish
43+
echo "Runner listener exit because of updating, re-launch runner in 5 seconds"
44+
safe_sleep
45+
exit 1
46+
elif [[ $returnCode == 4 ]]; then
47+
# Sleep 5 seconds to wait for the ephemeral runner update process finish
48+
echo "Runner listener exit because of updating, re-launch ephemeral runner in 5 seconds"
49+
safe_sleep
50+
exit 1
51+
else
52+
echo "Exiting with unknown error code: ${returnCode}"
53+
exit 0
54+
fi

src/Misc/layoutroot/run.cmd

+14-16
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,19 @@ if defined VERBOSE_ARG (
1313
rem Unblock files in the root of the layout folder. E.g. .cmd files.
1414
powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$VerbosePreference = %VERBOSE_ARG% ; Get-ChildItem -LiteralPath '%~dp0' | ForEach-Object { Write-Verbose ('Unblock: {0}' -f $_.FullName) ; $_ } | Unblock-File | Out-Null"
1515

16-
if /i "%~1" equ "localRun" (
17-
rem ********************************************************************************
18-
rem Local run.
19-
rem ********************************************************************************
20-
"%~dp0bin\Runner.Listener.exe" %*
21-
) else (
22-
rem ********************************************************************************
23-
rem Run.
24-
rem ********************************************************************************
25-
"%~dp0bin\Runner.Listener.exe" run %*
2616

27-
rem Return code 4 means the run once runner received an update message.
28-
rem Sleep 5 seconds to wait for the update process finish and run the runner again.
29-
if ERRORLEVEL 4 (
30-
timeout /t 5 /nobreak > NUL
31-
"%~dp0bin\Runner.Listener.exe" run %*
32-
)
17+
rem ********************************************************************************
18+
rem Run.
19+
rem ********************************************************************************
20+
21+
:launch_helper
22+
copy run-helper.cmd.template run-helper.cmd /Y
23+
call "%~dp0run-helper.cmd" %*
24+
25+
if %ERRORLEVEL% EQU 1 (
26+
echo "Restarting runner..."
27+
goto :launch_helper
28+
) else (
29+
echo "Exiting runner..."
30+
exit 0
3331
)

src/Misc/layoutroot/run.sh

+13-53
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,24 @@
11
#!/bin/bash
22

3-
# Validate not sudo
4-
user_id=`id -u`
5-
if [ $user_id -eq 0 -a -z "$RUNNER_ALLOW_RUNASROOT" ]; then
6-
echo "Must not run interactively with sudo"
7-
exit 1
8-
fi
9-
103
# Change directory to the script root directory
114
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
125
SOURCE="${BASH_SOURCE[0]}"
136
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
14-
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
15-
SOURCE="$(readlink "$SOURCE")"
16-
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
7+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
8+
SOURCE="$(readlink "$SOURCE")"
9+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
1710
done
1811
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
19-
20-
# Do not "cd $DIR". For localRun, the current directory is expected to be the repo location on disk.
21-
22-
# Run
23-
shopt -s nocasematch
24-
if [[ "$1" == "localRun" ]]; then
25-
"$DIR"/bin/Runner.Listener $*
26-
else
27-
"$DIR"/bin/Runner.Listener run $*
28-
29-
# Return code 3 means the run once runner received an update message.
30-
# Sleep 5 seconds to wait for the update process finish
12+
cp -f run-helper.sh.template run-helper.sh
13+
# run the helper process which keep the listener alive
14+
while :;
15+
do
16+
"$DIR"/run-helper.sh $*
3117
returnCode=$?
32-
if [[ $returnCode == 3 ]]; then
33-
if [ ! -x "$(command -v sleep)" ]; then
34-
if [ ! -x "$(command -v ping)" ]; then
35-
COUNT="0"
36-
while [[ $COUNT != 5000 ]]; do
37-
echo "SLEEP" > /dev/null
38-
COUNT=$[$COUNT+1]
39-
done
40-
else
41-
ping -c 5 127.0.0.1 > /dev/null
42-
fi
43-
else
44-
sleep 5
45-
fi
46-
elif [[ $returnCode == 4 ]]; then
47-
if [ ! -x "$(command -v sleep)" ]; then
48-
if [ ! -x "$(command -v ping)" ]; then
49-
COUNT="0"
50-
while [[ $COUNT != 5000 ]]; do
51-
echo "SLEEP" > /dev/null
52-
COUNT=$[$COUNT+1]
53-
done
54-
else
55-
ping -c 5 127.0.0.1 > /dev/null
56-
fi
57-
else
58-
sleep 5
59-
fi
60-
"$DIR"/bin/Runner.Listener run $*
18+
if [[ $returnCode == 1 ]]; then
19+
echo "Restarting runner..."
6120
else
62-
exit $returnCode
21+
echo "Exiting runner..."
22+
exit 0
6323
fi
64-
fi
24+
done

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);

0 commit comments

Comments
 (0)