Support multiple GitHub SSH deploy keys (#568)
* add sshPublicKeysDirectoryPath and GIT_CONFIG_EXTENSIONS parameters that adds git configs and mounts .ssh/config and public keys to the container, in order to allow multiple sh deploy key trick by webplatform@ssh-agent * remove sshPublicKeysDirectoryPath and GIT_CONFIG_EXTENSIONS from windows runner for now
This commit is contained in:
12
dist/index.js
generated
vendored
12
dist/index.js
generated
vendored
@@ -277,6 +277,7 @@ class BuildParameters {
|
||||
androidSymbolType: androidSymbolExportType,
|
||||
customParameters: input_1.default.customParameters,
|
||||
sshAgent: input_1.default.sshAgent,
|
||||
sshPublicKeysDirectoryPath: input_1.default.sshPublicKeysDirectoryPath,
|
||||
gitPrivateToken: input_1.default.gitPrivateToken || (await github_cli_1.GithubCliReader.GetGitHubAuthToken()),
|
||||
chownFilesTo: input_1.default.chownFilesTo,
|
||||
providerStrategy: cloud_runner_options_1.default.providerStrategy,
|
||||
@@ -5880,7 +5881,7 @@ class Docker {
|
||||
}
|
||||
}
|
||||
static getLinuxCommand(image, parameters, overrideCommands = '', additionalVariables = [], entrypointBash = false) {
|
||||
const { workspace, actionFolder, runnerTempPath, sshAgent, gitPrivateToken, dockerWorkspacePath } = parameters;
|
||||
const { workspace, actionFolder, runnerTempPath, sshAgent, sshPublicKeysDirectoryPath, gitPrivateToken, dockerWorkspacePath, } = parameters;
|
||||
const githubHome = node_path_1.default.join(runnerTempPath, '_github_home');
|
||||
if (!(0, node_fs_1.existsSync)(githubHome))
|
||||
(0, node_fs_1.mkdirSync)(githubHome);
|
||||
@@ -5894,6 +5895,7 @@ class Docker {
|
||||
${image_environment_factory_1.default.getEnvVarString(parameters, additionalVariables)} \
|
||||
--env UNITY_SERIAL \
|
||||
--env GITHUB_WORKSPACE=${dockerWorkspacePath} \
|
||||
--env GIT_CONFIG_EXTENSIONS \
|
||||
${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \
|
||||
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
||||
--volume "${githubHome}":"/root:z" \
|
||||
@@ -5904,7 +5906,10 @@ class Docker {
|
||||
--volume "${actionFolder}/platforms/ubuntu/entrypoint.sh:/entrypoint.sh:z" \
|
||||
--volume "${actionFolder}/unity-config:/usr/share/unity3d/config/:z" \
|
||||
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
||||
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''} \
|
||||
${sshAgent && !sshPublicKeysDirectoryPath
|
||||
? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro'
|
||||
: ''} \
|
||||
${sshPublicKeysDirectoryPath ? `--volume ${sshPublicKeysDirectoryPath}:/root/.ssh:ro` : ''} \
|
||||
${entrypointBash ? `--entrypoint ${commandPrefix}` : ``} \
|
||||
${image} \
|
||||
${entrypointBash ? `-c` : `${commandPrefix} -c`} \
|
||||
@@ -6862,6 +6867,9 @@ class Input {
|
||||
static get sshAgent() {
|
||||
return Input.getInput('sshAgent') || '';
|
||||
}
|
||||
static get sshPublicKeysDirectoryPath() {
|
||||
return Input.getInput('sshPublicKeysDirectoryPath') || '';
|
||||
}
|
||||
static get gitPrivateToken() {
|
||||
return Input.getInput('gitPrivateToken');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user