Using SSH_AUTH_SOCK (ssh agent forwarding) to pull upm private repos (#256)

* using SSH_AUTH_SOCK (ssh agent forwarding) to pull upm private repos

* sshAgent as input parameter

* yarn run prettier --write "src/**/*.{js,ts}"

* yarn run lint --fix && yarn build

* fixed compilation after rebase

* removed RUN apt-get update && apt-get install -y openssh-client. This change needs to be done upstream. See game-ci/docker#117
This commit is contained in:
ivan-hernandez-scopely 2021-05-28 23:51:10 +02:00 committed by GitHub
parent 71ca7bdbfc
commit 497f2f7b5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 0 deletions

View File

@ -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: ''

BIN
dist/index.js generated vendored

Binary file not shown.

BIN
dist/index.js.map generated vendored

Binary file not shown.

View File

@ -10,6 +10,7 @@ export const mockGetFromUser = jest.fn().mockResolvedValue({
buildMethod: undefined,
buildVersion: '1.3.37',
customParameters: '',
sshAgent: '',
chownFilesTo: '',
});

View File

@ -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,

View File

@ -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 });

View File

@ -85,6 +85,10 @@ class Input {
return core.getInput('customParameters') || '';
}
static get sshAgent() {
return core.getInput('sshAgent') || '';
}
static get chownFilesTo() {
return core.getInput('chownFilesTo') || '';
}