Custom step file support
parent
a9fe02e8c4
commit
0147dac3c2
|
|
@ -3696,6 +3696,7 @@ const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
|||
const docker_1 = __importDefault(__nccwpck_require__(16934));
|
||||
const model_1 = __nccwpck_require__(41359);
|
||||
const fs_1 = __nccwpck_require__(57147);
|
||||
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
||||
class LocalDockerCloudRunner {
|
||||
inspect() {
|
||||
throw new Error('Method not implemented.');
|
||||
|
|
@ -3756,21 +3757,25 @@ class LocalDockerCloudRunner {
|
|||
const sharedFolder = `/data/`;
|
||||
// core.info(JSON.stringify({ workspace, actionFolder, ...this.buildParameters, ...content }, undefined, 4));
|
||||
const entrypointFilePath = `start.sh`;
|
||||
fs_1.writeFileSync(`${workspace}/${entrypointFilePath}`, `#!/bin/bash
|
||||
set -e
|
||||
const fileContents = `#!/bin/bash
|
||||
set -e
|
||||
|
||||
apt-get update > /dev/null && apt-get install -y tree> /dev/null
|
||||
mkdir -p /github/workspace/cloud-runner-cache
|
||||
mkdir -p /data/cache
|
||||
cp -a /github/workspace/cloud-runner-cache/. ${sharedFolder}
|
||||
tree -L 3 ${sharedFolder}
|
||||
${commands}
|
||||
cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
|
||||
tree -L 2 /github/workspace/cloud-runner-cache
|
||||
tree -L 3 ${sharedFolder}
|
||||
`, {
|
||||
apt-get update > /dev/null && apt-get install -y tree> /dev/null
|
||||
mkdir -p /github/workspace/cloud-runner-cache
|
||||
mkdir -p /data/cache
|
||||
cp -a /github/workspace/cloud-runner-cache/. ${sharedFolder}
|
||||
tree -L 3 ${sharedFolder}
|
||||
${commands}
|
||||
cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
|
||||
tree -L 2 /github/workspace/cloud-runner-cache
|
||||
tree -L 3 ${sharedFolder}
|
||||
`;
|
||||
fs_1.writeFileSync(`${workspace}/${entrypointFilePath}`, fileContents, {
|
||||
flag: 'w',
|
||||
});
|
||||
if (cloud_runner_1.default.buildParameters.cloudRunnerIntegrationTests) {
|
||||
cloud_runner_logger_1.default.log(`Running local-docker: \n ${JSON.stringify(fileContents)}`);
|
||||
}
|
||||
yield docker_1.default.run(image, Object.assign({ workspace, actionFolder }, this.buildParameters), false, `"chmod +x /github/workspace/${entrypointFilePath} && /github/workspace/${entrypointFilePath}"`, content, {
|
||||
listeners: {
|
||||
stdout: (data) => {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -6,6 +6,7 @@ import CloudRunnerSecret from '../../services/cloud-runner-secret';
|
|||
import Docker from '../../../docker';
|
||||
import { Action } from '../../../../model';
|
||||
import { writeFileSync } from 'fs';
|
||||
import CloudRunner from '../../cloud-runner';
|
||||
|
||||
class LocalDockerCloudRunner implements ProviderInterface {
|
||||
public buildParameters: BuildParameters | undefined;
|
||||
|
|
@ -86,25 +87,26 @@ class LocalDockerCloudRunner implements ProviderInterface {
|
|||
|
||||
// core.info(JSON.stringify({ workspace, actionFolder, ...this.buildParameters, ...content }, undefined, 4));
|
||||
const entrypointFilePath = `start.sh`;
|
||||
writeFileSync(
|
||||
`${workspace}/${entrypointFilePath}`,
|
||||
`#!/bin/bash
|
||||
set -e
|
||||
const fileContents = `#!/bin/bash
|
||||
set -e
|
||||
|
||||
apt-get update > /dev/null && apt-get install -y tree> /dev/null
|
||||
mkdir -p /github/workspace/cloud-runner-cache
|
||||
mkdir -p /data/cache
|
||||
cp -a /github/workspace/cloud-runner-cache/. ${sharedFolder}
|
||||
tree -L 3 ${sharedFolder}
|
||||
${commands}
|
||||
cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
|
||||
tree -L 2 /github/workspace/cloud-runner-cache
|
||||
tree -L 3 ${sharedFolder}
|
||||
`,
|
||||
{
|
||||
flag: 'w',
|
||||
},
|
||||
);
|
||||
apt-get update > /dev/null && apt-get install -y tree> /dev/null
|
||||
mkdir -p /github/workspace/cloud-runner-cache
|
||||
mkdir -p /data/cache
|
||||
cp -a /github/workspace/cloud-runner-cache/. ${sharedFolder}
|
||||
tree -L 3 ${sharedFolder}
|
||||
${commands}
|
||||
cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
|
||||
tree -L 2 /github/workspace/cloud-runner-cache
|
||||
tree -L 3 ${sharedFolder}
|
||||
`;
|
||||
writeFileSync(`${workspace}/${entrypointFilePath}`, fileContents, {
|
||||
flag: 'w',
|
||||
});
|
||||
|
||||
if (CloudRunner.buildParameters.cloudRunnerIntegrationTests) {
|
||||
CloudRunnerLogger.log(`Running local-docker: \n ${JSON.stringify(fileContents)}`);
|
||||
}
|
||||
|
||||
await Docker.run(
|
||||
image,
|
||||
|
|
|
|||
Loading…
Reference in New Issue