avoid building a custom image
parent
9a40b8903e
commit
82e0c4af51
|
|
@ -64,8 +64,8 @@ function runMain() {
|
||||||
mac_builder_1.default.run(actionFolder, workspace, buildParameters);
|
mac_builder_1.default.run(actionFolder, workspace, buildParameters);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
builtImage = yield model_1.Docker.build({ path: actionFolder, dockerfile, baseImage });
|
//builtImage = await Docker.build({ path: actionFolder, dockerfile, baseImage });
|
||||||
yield model_1.Docker.run(builtImage, Object.assign({ workspace }, buildParameters));
|
yield model_1.Docker.run(baseImage, Object.assign({ workspace, actionFolder }, buildParameters));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Set output
|
// Set output
|
||||||
|
|
@ -3307,18 +3307,19 @@ class Docker {
|
||||||
}
|
}
|
||||||
static run(image, parameters, silent = false) {
|
static run(image, parameters, silent = false) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const { workspace, unitySerial, runnerTempPath, sshAgent } = parameters;
|
const { workspace, actionFolder, unitySerial, runnerTempPath, sshAgent } = parameters;
|
||||||
const baseOsSpecificArguments = this.getBaseOsSpecificArguments(process.platform, workspace, unitySerial, runnerTempPath, sshAgent);
|
const baseOsSpecificArguments = this.getBaseOsSpecificArguments(process.platform, workspace, actionFolder, unitySerial, runnerTempPath, sshAgent);
|
||||||
const runCommand = `docker run \
|
const runCommand = `docker run \
|
||||||
--workdir /github/workspace \
|
--workdir /github/workspace \
|
||||||
--rm \
|
--rm \
|
||||||
${image_environment_factory_1.default.getEnvVarString(parameters)} \
|
${image_environment_factory_1.default.getEnvVarString(parameters)} \
|
||||||
${baseOsSpecificArguments} \
|
${baseOsSpecificArguments} \
|
||||||
${image}`;
|
${image} -- \
|
||||||
|
/usr/bin/bash -c /entrypoint.sh`;
|
||||||
yield exec_1.exec(runCommand, undefined, { silent });
|
yield exec_1.exec(runCommand, undefined, { silent });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static getBaseOsSpecificArguments(baseOs, workspace, unitySerial, runnerTemporaryPath, sshAgent) {
|
static getBaseOsSpecificArguments(baseOs, workspace, actionFolder, unitySerial, runnerTemporaryPath, sshAgent) {
|
||||||
switch (baseOs) {
|
switch (baseOs) {
|
||||||
case 'linux': {
|
case 'linux': {
|
||||||
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
|
const githubHome = path_1.default.join(runnerTemporaryPath, '_github_home');
|
||||||
|
|
@ -3333,6 +3334,9 @@ class Docker {
|
||||||
--volume "${githubHome}":"/root:z" \
|
--volume "${githubHome}":"/root:z" \
|
||||||
--volume "${githubWorkflow}":"/github/workflow:z" \
|
--volume "${githubWorkflow}":"/github/workflow:z" \
|
||||||
--volume "${workspace}":"/github/workspace:z" \
|
--volume "${workspace}":"/github/workspace:z" \
|
||||||
|
--volume "${actionFolder}/default-build-script:/UnityBuilderAction:z" \
|
||||||
|
--volume "${actionFolder}/platforms/ubuntu/steps:/steps:z" \
|
||||||
|
--volume "${actionFolder}/platforms/ubuntu/entrypoint.sh:/entrypoint.sh:z" \
|
||||||
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
||||||
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''}`;
|
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''}`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -27,8 +27,8 @@ async function runMain() {
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
MacBuilder.run(actionFolder, workspace, buildParameters);
|
MacBuilder.run(actionFolder, workspace, buildParameters);
|
||||||
} else {
|
} else {
|
||||||
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(baseImage, { workspace, actionFolder, ...buildParameters });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,12 @@ class Docker {
|
||||||
}
|
}
|
||||||
|
|
||||||
static async run(image, parameters, silent = false) {
|
static async run(image, parameters, silent = false) {
|
||||||
const { workspace, unitySerial, runnerTempPath, sshAgent } = parameters;
|
const { workspace, actionFolder, unitySerial, runnerTempPath, sshAgent } = parameters;
|
||||||
|
|
||||||
const baseOsSpecificArguments = this.getBaseOsSpecificArguments(
|
const baseOsSpecificArguments = this.getBaseOsSpecificArguments(
|
||||||
process.platform,
|
process.platform,
|
||||||
workspace,
|
workspace,
|
||||||
|
actionFolder,
|
||||||
unitySerial,
|
unitySerial,
|
||||||
runnerTempPath,
|
runnerTempPath,
|
||||||
sshAgent,
|
sshAgent,
|
||||||
|
|
@ -36,12 +37,13 @@ class Docker {
|
||||||
--rm \
|
--rm \
|
||||||
${ImageEnvironmentFactory.getEnvVarString(parameters)} \
|
${ImageEnvironmentFactory.getEnvVarString(parameters)} \
|
||||||
${baseOsSpecificArguments} \
|
${baseOsSpecificArguments} \
|
||||||
${image}`;
|
${image} -- \
|
||||||
|
/usr/bin/bash -c /entrypoint.sh`;
|
||||||
|
|
||||||
await exec(runCommand, undefined, { silent });
|
await exec(runCommand, undefined, { silent });
|
||||||
}
|
}
|
||||||
|
|
||||||
static getBaseOsSpecificArguments(baseOs, workspace, unitySerial, runnerTemporaryPath, sshAgent): string {
|
static getBaseOsSpecificArguments(baseOs, workspace, actionFolder, unitySerial, runnerTemporaryPath, sshAgent): string {
|
||||||
switch (baseOs) {
|
switch (baseOs) {
|
||||||
case 'linux': {
|
case 'linux': {
|
||||||
const githubHome = path.join(runnerTemporaryPath, '_github_home');
|
const githubHome = path.join(runnerTemporaryPath, '_github_home');
|
||||||
|
|
@ -55,6 +57,9 @@ class Docker {
|
||||||
--volume "${githubHome}":"/root:z" \
|
--volume "${githubHome}":"/root:z" \
|
||||||
--volume "${githubWorkflow}":"/github/workflow:z" \
|
--volume "${githubWorkflow}":"/github/workflow:z" \
|
||||||
--volume "${workspace}":"/github/workspace:z" \
|
--volume "${workspace}":"/github/workspace:z" \
|
||||||
|
--volume "${actionFolder}/default-build-script:/UnityBuilderAction:z" \
|
||||||
|
--volume "${actionFolder}/platforms/ubuntu/steps:/steps:z" \
|
||||||
|
--volume "${actionFolder}/platforms/ubuntu/entrypoint.sh:/entrypoint.sh:z" \
|
||||||
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
||||||
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''}`;
|
${sshAgent ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' : ''}`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue