Mount .ssh/known_hosts from user home directory to support self-hosted runners

pull/215/head
Andy Miller 2023-03-07 17:14:12 -08:00 committed by jenkins
parent cfa9076acb
commit a876a13576
4 changed files with 1106 additions and 1094 deletions

6
dist/entrypoint.sh vendored
View File

@ -22,6 +22,12 @@ source /steps/return_license.sh
rm -r "$ACTIVATE_LICENSE_PATH"
#
# Create base .ssh directory
#
mkdir -m 700 -p ~/.ssh
#
# Instructions for debugging
#

5
dist/index.js generated vendored
View File

@ -265,6 +265,7 @@ const Docker = {
(0, fs_1.mkdirSync)(githubWorkflow);
const cidfile = containerIdFilePath(parameters);
const testPlatforms = (testMode === 'all' ? ['playmode', 'editmode', 'COMBINE_RESULTS'] : [testMode]).join(';');
const runnerUserHome = process.env['HOME'];
return `docker run \
--workdir /github/workspace \
--cidfile "${cidfile}" \
@ -307,7 +308,9 @@ const Docker = {
--volume "${actionFolder}/entrypoint.sh:/entrypoint.sh:z" \
--volume "${actionFolder}/unity-config:/usr/share/unity3d/config/:z" \
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
${sshAgent ? `--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro` : ''} \
${sshAgent
? `--volume ${runnerUserHome}/.ssh/known_hosts:/root/.ssh/known_hosts:ro`
: ''} \
${useHostNetwork ? '--net=host' : ''} \
${githubToken ? '--env USE_EXIT_CODE=false' : '--env USE_EXIT_CODE=true'} \
${image} \

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -77,6 +77,7 @@ const Docker = {
const testPlatforms = (
testMode === 'all' ? ['playmode', 'editmode', 'COMBINE_RESULTS'] : [testMode]
).join(';');
const runnerUserHome = process.env['HOME'];
return `docker run \
--workdir /github/workspace \
@ -121,7 +122,9 @@ const Docker = {
--volume "${actionFolder}/unity-config:/usr/share/unity3d/config/:z" \
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
${
sshAgent ? `--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro` : ''
sshAgent
? `--volume ${runnerUserHome}/.ssh/known_hosts:/root/.ssh/known_hosts:ro`
: ''
} \
${useHostNetwork ? '--net=host' : ''} \
${githubToken ? '--env USE_EXIT_CODE=false' : '--env USE_EXIT_CODE=true'} \