sshAgent as input parameter

pull/124/head
Ivan Hernandez 2021-05-17 16:10:45 +02:00
parent feef1199bd
commit 9fbf8eb290
6 changed files with 14 additions and 11 deletions

View File

@ -28,6 +28,10 @@ inputs:
customParameters:
required: false
description: 'Extra parameters to configure the Unity editor run.'
sshAgent:
required: false
default: ''
description: 'SSH Agent path to forward to the container'
githubToken:
required: false
default: ''

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@ import { Action, Docker, Input, ImageTag, Output, ResultsCheck } from './model';
async function action() {
Action.checkCompatibility();
const { dockerfile, workspace, actionFolder, sshAgent } = Action;
const { dockerfile, workspace, actionFolder } = Action;
const {
unityVersion,
customImage,
@ -13,6 +13,7 @@ async function action() {
artifactsPath,
useHostNetwork,
customParameters,
sshAgent,
githubToken,
checkName,
} = Input.getFromUser();
@ -31,8 +32,8 @@ async function action() {
artifactsPath,
useHostNetwork,
customParameters,
githubToken,
sshAgent,
githubToken,
});
} finally {
// Set output

View File

@ -37,10 +37,6 @@ class Action {
return process.env.GITHUB_WORKSPACE;
}
static get sshAgent() {
return process.env.SSH_AUTH_SOCK;
}
static checkCompatibility() {
const currentPlatform = process.platform;
if (!Action.supportedPlatforms.includes(currentPlatform)) {

View File

@ -26,8 +26,8 @@ class Docker {
artifactsPath,
useHostNetwork,
customParameters,
githubToken,
sshAgent,
githubToken,
} = parameters;
const command = `docker run \
@ -58,13 +58,13 @@ class Docker {
--env RUNNER_TOOL_CACHE \
--env RUNNER_TEMP \
--env RUNNER_WORKSPACE \
--env SSH_AUTH_SOCK=/ssh-agent \
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
--volume "/var/run/docker.sock":"/var/run/docker.sock" \
--volume "/home/runner/work/_temp/_github_home":"/root" \
--volume "/home/runner/work/_temp/_github_workflow":"/github/workflow" \
--volume "${workspace}":"/github/workspace" \
--volume "${sshAgent}":"/ssh-agent" \
--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro \
${sshAgent ? "--volume " + sshAgent + ":/ssh-agent" : ''} \
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''} \
${useHostNetwork ? '--net=host' : ''} \
${githubToken ? '--env USE_EXIT_CODE=false' : '--env USE_EXIT_CODE=true'} \
${image}`;

View File

@ -22,6 +22,7 @@ class Input {
const rawArtifactsPath = getInput('artifactsPath') || 'artifacts';
const rawUseHostNetwork = getInput('useHostNetwork') || 'false';
const customParameters = getInput('customParameters') || '';
const sshAgent = getInput('sshAgent') || '';
const githubToken = getInput('githubToken') || '';
const checkName = getInput('checkName') || 'Test Results';
@ -58,6 +59,7 @@ class Input {
artifactsPath,
useHostNetwork,
customParameters,
sshAgent,
githubToken,
checkName,
};