sshAgent as input parameter
parent
feef1199bd
commit
9fbf8eb290
|
@ -28,6 +28,10 @@ inputs:
|
||||||
customParameters:
|
customParameters:
|
||||||
required: false
|
required: false
|
||||||
description: 'Extra parameters to configure the Unity editor run.'
|
description: 'Extra parameters to configure the Unity editor run.'
|
||||||
|
sshAgent:
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
description: 'SSH Agent path to forward to the container'
|
||||||
githubToken:
|
githubToken:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@ import { Action, Docker, Input, ImageTag, Output, ResultsCheck } from './model';
|
||||||
async function action() {
|
async function action() {
|
||||||
Action.checkCompatibility();
|
Action.checkCompatibility();
|
||||||
|
|
||||||
const { dockerfile, workspace, actionFolder, sshAgent } = Action;
|
const { dockerfile, workspace, actionFolder } = Action;
|
||||||
const {
|
const {
|
||||||
unityVersion,
|
unityVersion,
|
||||||
customImage,
|
customImage,
|
||||||
|
@ -13,6 +13,7 @@ async function action() {
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
customParameters,
|
customParameters,
|
||||||
|
sshAgent,
|
||||||
githubToken,
|
githubToken,
|
||||||
checkName,
|
checkName,
|
||||||
} = Input.getFromUser();
|
} = Input.getFromUser();
|
||||||
|
@ -31,8 +32,8 @@ async function action() {
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
customParameters,
|
customParameters,
|
||||||
githubToken,
|
|
||||||
sshAgent,
|
sshAgent,
|
||||||
|
githubToken,
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
// Set output
|
// Set output
|
||||||
|
|
|
@ -37,10 +37,6 @@ class Action {
|
||||||
return process.env.GITHUB_WORKSPACE;
|
return process.env.GITHUB_WORKSPACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static get sshAgent() {
|
|
||||||
return process.env.SSH_AUTH_SOCK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static checkCompatibility() {
|
static checkCompatibility() {
|
||||||
const currentPlatform = process.platform;
|
const currentPlatform = process.platform;
|
||||||
if (!Action.supportedPlatforms.includes(currentPlatform)) {
|
if (!Action.supportedPlatforms.includes(currentPlatform)) {
|
||||||
|
|
|
@ -26,8 +26,8 @@ class Docker {
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
customParameters,
|
customParameters,
|
||||||
githubToken,
|
|
||||||
sshAgent,
|
sshAgent,
|
||||||
|
githubToken,
|
||||||
} = parameters;
|
} = parameters;
|
||||||
|
|
||||||
const command = `docker run \
|
const command = `docker run \
|
||||||
|
@ -58,13 +58,13 @@ class Docker {
|
||||||
--env RUNNER_TOOL_CACHE \
|
--env RUNNER_TOOL_CACHE \
|
||||||
--env RUNNER_TEMP \
|
--env RUNNER_TEMP \
|
||||||
--env RUNNER_WORKSPACE \
|
--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 "/var/run/docker.sock":"/var/run/docker.sock" \
|
||||||
--volume "/home/runner/work/_temp/_github_home":"/root" \
|
--volume "/home/runner/work/_temp/_github_home":"/root" \
|
||||||
--volume "/home/runner/work/_temp/_github_workflow":"/github/workflow" \
|
--volume "/home/runner/work/_temp/_github_workflow":"/github/workflow" \
|
||||||
--volume "${workspace}":"/github/workspace" \
|
--volume "${workspace}":"/github/workspace" \
|
||||||
--volume "${sshAgent}":"/ssh-agent" \
|
${sshAgent ? "--volume " + sshAgent + ":/ssh-agent" : ''} \
|
||||||
--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro \
|
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''} \
|
||||||
${useHostNetwork ? '--net=host' : ''} \
|
${useHostNetwork ? '--net=host' : ''} \
|
||||||
${githubToken ? '--env USE_EXIT_CODE=false' : '--env USE_EXIT_CODE=true'} \
|
${githubToken ? '--env USE_EXIT_CODE=false' : '--env USE_EXIT_CODE=true'} \
|
||||||
${image}`;
|
${image}`;
|
||||||
|
|
|
@ -22,6 +22,7 @@ class Input {
|
||||||
const rawArtifactsPath = getInput('artifactsPath') || 'artifacts';
|
const rawArtifactsPath = getInput('artifactsPath') || 'artifacts';
|
||||||
const rawUseHostNetwork = getInput('useHostNetwork') || 'false';
|
const rawUseHostNetwork = getInput('useHostNetwork') || 'false';
|
||||||
const customParameters = getInput('customParameters') || '';
|
const customParameters = getInput('customParameters') || '';
|
||||||
|
const sshAgent = getInput('sshAgent') || '';
|
||||||
const githubToken = getInput('githubToken') || '';
|
const githubToken = getInput('githubToken') || '';
|
||||||
const checkName = getInput('checkName') || 'Test Results';
|
const checkName = getInput('checkName') || 'Test Results';
|
||||||
|
|
||||||
|
@ -58,6 +59,7 @@ class Input {
|
||||||
artifactsPath,
|
artifactsPath,
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
customParameters,
|
customParameters,
|
||||||
|
sshAgent,
|
||||||
githubToken,
|
githubToken,
|
||||||
checkName,
|
checkName,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue