using SSH_AUTH_SOCK (ssh agent forwarding) to pull upm private repos
parent
5eca106c01
commit
feef1199bd
|
@ -14,4 +14,7 @@ ADD steps /steps
|
||||||
RUN chmod -R +x /steps
|
RUN chmod -R +x /steps
|
||||||
ADD entrypoint.sh /entrypoint.sh
|
ADD entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y openssh-client
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Action, Docker, Input, ImageTag, Output, ResultsCheck } from './model';
|
||||||
async function action() {
|
async function action() {
|
||||||
Action.checkCompatibility();
|
Action.checkCompatibility();
|
||||||
|
|
||||||
const { dockerfile, workspace, actionFolder } = Action;
|
const { dockerfile, workspace, actionFolder, sshAgent } = Action;
|
||||||
const {
|
const {
|
||||||
unityVersion,
|
unityVersion,
|
||||||
customImage,
|
customImage,
|
||||||
|
@ -32,6 +32,7 @@ async function action() {
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
customParameters,
|
customParameters,
|
||||||
githubToken,
|
githubToken,
|
||||||
|
sshAgent,
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
// Set output
|
// Set output
|
||||||
|
|
|
@ -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)) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ class Docker {
|
||||||
useHostNetwork,
|
useHostNetwork,
|
||||||
customParameters,
|
customParameters,
|
||||||
githubToken,
|
githubToken,
|
||||||
|
sshAgent,
|
||||||
} = parameters;
|
} = parameters;
|
||||||
|
|
||||||
const command = `docker run \
|
const command = `docker run \
|
||||||
|
@ -42,7 +43,6 @@ class Docker {
|
||||||
--env TEST_MODE="${testMode}" \
|
--env TEST_MODE="${testMode}" \
|
||||||
--env ARTIFACTS_PATH="${artifactsPath}" \
|
--env ARTIFACTS_PATH="${artifactsPath}" \
|
||||||
--env CUSTOM_PARAMETERS="${customParameters}" \
|
--env CUSTOM_PARAMETERS="${customParameters}" \
|
||||||
--env HOME=/github/home \
|
|
||||||
--env GITHUB_REF \
|
--env GITHUB_REF \
|
||||||
--env GITHUB_SHA \
|
--env GITHUB_SHA \
|
||||||
--env GITHUB_REPOSITORY \
|
--env GITHUB_REPOSITORY \
|
||||||
|
@ -58,10 +58,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 "/home/runner/work/_temp/_github_home":"/github/home" \
|
--volume "/home/runner/work/_temp/_github_home":"/root" \
|
||||||
--volume "/home/runner/work/_temp/_github_workflow":"/github/workflow" \
|
--volume "/home/runner/work/_temp/_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 \
|
||||||
${useHostNetwork ? '--net=host' : ''} \
|
${useHostNetwork ? '--net=host' : ''} \
|
||||||
${githubToken ? '--env USE_EXIT_CODE=false' : '--env USE_EXIT_CODE=true'} \
|
${githubToken ? '--env USE_EXIT_CODE=false' : '--env USE_EXIT_CODE=true'} \
|
||||||
${image}`;
|
${image}`;
|
||||||
|
|
Loading…
Reference in New Issue