using SSH_AUTH_SOCK (ssh agent forwarding) to pull upm private repos
parent
71ca7bdbfc
commit
27f6f54c06
|
|
@ -17,4 +17,6 @@ ADD entrypoint.sh /entrypoint.sh
|
|||
RUN chmod +x /entrypoint.sh
|
||||
RUN ls
|
||||
|
||||
RUN apt-get update && apt-get install -y openssh-client
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ async function run() {
|
|||
Action.checkCompatibility();
|
||||
Cache.verify();
|
||||
|
||||
const { dockerfile, workspace, actionFolder } = Action;
|
||||
const { dockerfile, workspace, actionFolder, sshAgent } = 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, ...buildParameters });
|
||||
await Docker.run(builtImage, { workspace, sshAgent, ...buildParameters });
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@ 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)) {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class Docker {
|
|||
androidKeyaliasPass,
|
||||
customParameters,
|
||||
chownFilesTo,
|
||||
sshAgent,
|
||||
} = parameters;
|
||||
|
||||
const command = `docker run \
|
||||
|
|
@ -79,10 +80,13 @@ class Docker {
|
|||
--env RUNNER_TOOL_CACHE \
|
||||
--env RUNNER_TEMP \
|
||||
--env RUNNER_WORKSPACE \
|
||||
--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 \
|
||||
${image}`;
|
||||
|
||||
await exec(command, undefined, { silent });
|
||||
|
|
|
|||
Loading…
Reference in New Issue