diff --git a/action.yml b/action.yml index 839b1b50..a0917501 100644 --- a/action.yml +++ b/action.yml @@ -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: '' diff --git a/dist/index.js b/dist/index.js index 38c11e76..dc1e13f6 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/dist/index.js.map b/dist/index.js.map index 569350f0..9c176184 100644 Binary files a/dist/index.js.map and b/dist/index.js.map differ diff --git a/src/model/__mocks__/input.ts b/src/model/__mocks__/input.ts index 87f6c91a..33f1091a 100644 --- a/src/model/__mocks__/input.ts +++ b/src/model/__mocks__/input.ts @@ -10,6 +10,7 @@ export const mockGetFromUser = jest.fn().mockResolvedValue({ buildMethod: undefined, buildVersion: '1.3.37', customParameters: '', + sshAgent: '', chownFilesTo: '', }); diff --git a/src/model/build-parameters.ts b/src/model/build-parameters.ts index e4e119e9..e3a48fad 100644 --- a/src/model/build-parameters.ts +++ b/src/model/build-parameters.ts @@ -22,6 +22,7 @@ class BuildParameters { public androidKeyaliasName!: string; public androidKeyaliasPass!: string; public customParameters!: string; + public sshAgent!: string; public remoteBuildCluster!: string; public awsStackName!: string; public kubeConfig!: string; @@ -60,6 +61,7 @@ class BuildParameters { androidKeyaliasName: Input.androidKeyaliasName, androidKeyaliasPass: Input.androidKeyaliasPass, customParameters: Input.customParameters, + sshAgent: Input.sshAgent, chownFilesTo: Input.chownFilesTo, remoteBuildCluster: Input.remoteBuildCluster, awsStackName: Input.awsStackName, diff --git a/src/model/docker.ts b/src/model/docker.ts index 7c39ce36..d0f8915f 100644 --- a/src/model/docker.ts +++ b/src/model/docker.ts @@ -36,6 +36,7 @@ class Docker { androidKeyaliasName, androidKeyaliasPass, customParameters, + sshAgent, chownFilesTo, } = parameters; @@ -79,10 +80,13 @@ class Docker { --env RUNNER_TOOL_CACHE \ --env RUNNER_TEMP \ --env RUNNER_WORKSPACE \ + ${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" \ + ${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \ + ${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''} \ ${image}`; await exec(command, undefined, { silent }); diff --git a/src/model/input.ts b/src/model/input.ts index 42f15489..5c5b8667 100644 --- a/src/model/input.ts +++ b/src/model/input.ts @@ -85,6 +85,10 @@ class Input { return core.getInput('customParameters') || ''; } + static get sshAgent() { + return core.getInput('sshAgent') || ''; + } + static get chownFilesTo() { return core.getInput('chownFilesTo') || ''; }