sshAgent as input parameter
parent
27f6f54c06
commit
c75e11dc6a
|
|
@ -106,6 +106,10 @@ inputs:
|
|||
|
||||
Parameters must start with a hyphen (-) and may be followed by a value (without hyphen).
|
||||
Parameters without a value will be considered booleans (with a value of true).
|
||||
sshAgent:
|
||||
required: false
|
||||
default: ''
|
||||
description: 'SSH Agent path to forward to the container'
|
||||
chownFilesTo:
|
||||
required: false
|
||||
default: ''
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ async function run() {
|
|||
Action.checkCompatibility();
|
||||
Cache.verify();
|
||||
|
||||
const { dockerfile, workspace, actionFolder, sshAgent } = Action;
|
||||
const { dockerfile, workspace, actionFolder } = Action;
|
||||
|
||||
const buildParameters = await BuildParameters.create();
|
||||
const baseImage = new ImageTag(buildParameters);
|
||||
|
|
@ -27,7 +27,7 @@ async function run() {
|
|||
default:
|
||||
core.info('Building locally');
|
||||
builtImage = await Docker.build({ path: actionFolder, dockerfile, baseImage });
|
||||
await Docker.run(builtImage, { workspace, sshAgent, ...buildParameters });
|
||||
await Docker.run(builtImage, { workspace, ...buildParameters });
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ export const mockGetFromUser = jest.fn().mockResolvedValue({
|
|||
buildMethod: undefined,
|
||||
buildVersion: '1.3.37',
|
||||
customParameters: '',
|
||||
sshAgent: '',
|
||||
chownFilesTo: '',
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ class BuildParameters {
|
|||
androidKeyaliasName: Input.androidKeyaliasName,
|
||||
androidKeyaliasPass: Input.androidKeyaliasPass,
|
||||
customParameters: Input.customParameters,
|
||||
sshAgent: Input.sshAgent,
|
||||
chownFilesTo: Input.chownFilesTo,
|
||||
remoteBuildCluster: Input.remoteBuildCluster,
|
||||
awsStackName: Input.awsStackName,
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ class Docker {
|
|||
androidKeyaliasName,
|
||||
androidKeyaliasPass,
|
||||
customParameters,
|
||||
chownFilesTo,
|
||||
sshAgent,
|
||||
chownFilesTo,
|
||||
} = parameters;
|
||||
|
||||
const command = `docker run \
|
||||
|
|
@ -80,13 +80,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 "${runnerTempPath}/_github_home":"/root" \
|
||||
--volume "${runnerTempPath}/_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' : ''} \
|
||||
${image}`;
|
||||
|
||||
await exec(command, undefined, { silent });
|
||||
|
|
|
|||
|
|
@ -85,6 +85,10 @@ class Input {
|
|||
return core.getInput('customParameters') || '';
|
||||
}
|
||||
|
||||
static get sshAgent() {
|
||||
return core.getInput('sshAgent') || '';
|
||||
}
|
||||
|
||||
static get chownFilesTo() {
|
||||
return core.getInput('chownFilesTo') || '';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue