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 chmod +x /entrypoint.sh
|
||||||
RUN ls
|
RUN ls
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y openssh-client
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ async function run() {
|
||||||
Action.checkCompatibility();
|
Action.checkCompatibility();
|
||||||
Cache.verify();
|
Cache.verify();
|
||||||
|
|
||||||
const { dockerfile, workspace, actionFolder } = Action;
|
const { dockerfile, workspace, actionFolder, sshAgent } = Action;
|
||||||
|
|
||||||
const buildParameters = await BuildParameters.create();
|
const buildParameters = await BuildParameters.create();
|
||||||
const baseImage = new ImageTag(buildParameters);
|
const baseImage = new ImageTag(buildParameters);
|
||||||
|
|
@ -27,7 +27,7 @@ async function run() {
|
||||||
default:
|
default:
|
||||||
core.info('Building locally');
|
core.info('Building locally');
|
||||||
builtImage = await Docker.build({ path: actionFolder, dockerfile, baseImage });
|
builtImage = await Docker.build({ path: actionFolder, dockerfile, baseImage });
|
||||||
await Docker.run(builtImage, { workspace, ...buildParameters });
|
await Docker.run(builtImage, { workspace, sshAgent, ...buildParameters });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,10 @@ class Action {
|
||||||
return process.env.GITHUB_WORKSPACE;
|
return process.env.GITHUB_WORKSPACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get sshAgent() {
|
||||||
|
return process.env.SSH_AUTH_SOCK;
|
||||||
|
}
|
||||||
|
|
||||||
static checkCompatibility() {
|
static checkCompatibility() {
|
||||||
const currentPlatform = process.platform;
|
const currentPlatform = process.platform;
|
||||||
if (!Action.supportedPlatforms.includes(currentPlatform)) {
|
if (!Action.supportedPlatforms.includes(currentPlatform)) {
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ class Docker {
|
||||||
androidKeyaliasPass,
|
androidKeyaliasPass,
|
||||||
customParameters,
|
customParameters,
|
||||||
chownFilesTo,
|
chownFilesTo,
|
||||||
|
sshAgent,
|
||||||
} = parameters;
|
} = parameters;
|
||||||
|
|
||||||
const command = `docker run \
|
const command = `docker run \
|
||||||
|
|
@ -79,10 +80,13 @@ class Docker {
|
||||||
--env RUNNER_TOOL_CACHE \
|
--env RUNNER_TOOL_CACHE \
|
||||||
--env RUNNER_TEMP \
|
--env RUNNER_TEMP \
|
||||||
--env RUNNER_WORKSPACE \
|
--env RUNNER_WORKSPACE \
|
||||||
|
--env SSH_AUTH_SOCK=/ssh-agent \
|
||||||
--volume "/var/run/docker.sock":"/var/run/docker.sock" \
|
--volume "/var/run/docker.sock":"/var/run/docker.sock" \
|
||||||
--volume "${runnerTempPath}/_github_home":"/root" \
|
--volume "${runnerTempPath}/_github_home":"/root" \
|
||||||
--volume "${runnerTempPath}/_github_workflow":"/github/workflow" \
|
--volume "${runnerTempPath}/_github_workflow":"/github/workflow" \
|
||||||
--volume "${workspace}":"/github/workspace" \
|
--volume "${workspace}":"/github/workspace" \
|
||||||
|
--volume "${sshAgent}":"/ssh-agent" \
|
||||||
|
--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro \
|
||||||
${image}`;
|
${image}`;
|
||||||
|
|
||||||
await exec(command, undefined, { silent });
|
await exec(command, undefined, { silent });
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue