Custom step file support

pull/437/head
Frostebite 2022-10-08 04:23:24 +01:00
parent a9fe02e8c4
commit 0147dac3c2
3 changed files with 38 additions and 31 deletions

9
dist/index.js vendored
View File

@ -3696,6 +3696,7 @@ const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
const docker_1 = __importDefault(__nccwpck_require__(16934)); const docker_1 = __importDefault(__nccwpck_require__(16934));
const model_1 = __nccwpck_require__(41359); const model_1 = __nccwpck_require__(41359);
const fs_1 = __nccwpck_require__(57147); const fs_1 = __nccwpck_require__(57147);
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
class LocalDockerCloudRunner { class LocalDockerCloudRunner {
inspect() { inspect() {
throw new Error('Method not implemented.'); throw new Error('Method not implemented.');
@ -3756,7 +3757,7 @@ class LocalDockerCloudRunner {
const sharedFolder = `/data/`; const sharedFolder = `/data/`;
// core.info(JSON.stringify({ workspace, actionFolder, ...this.buildParameters, ...content }, undefined, 4)); // core.info(JSON.stringify({ workspace, actionFolder, ...this.buildParameters, ...content }, undefined, 4));
const entrypointFilePath = `start.sh`; const entrypointFilePath = `start.sh`;
fs_1.writeFileSync(`${workspace}/${entrypointFilePath}`, `#!/bin/bash const fileContents = `#!/bin/bash
set -e set -e
apt-get update > /dev/null && apt-get install -y tree> /dev/null apt-get update > /dev/null && apt-get install -y tree> /dev/null
@ -3768,9 +3769,13 @@ class LocalDockerCloudRunner {
cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/ cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
tree -L 2 /github/workspace/cloud-runner-cache tree -L 2 /github/workspace/cloud-runner-cache
tree -L 3 ${sharedFolder} tree -L 3 ${sharedFolder}
`, { `;
fs_1.writeFileSync(`${workspace}/${entrypointFilePath}`, fileContents, {
flag: 'w', 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, { yield docker_1.default.run(image, Object.assign({ workspace, actionFolder }, this.buildParameters), false, `"chmod +x /github/workspace/${entrypointFilePath} && /github/workspace/${entrypointFilePath}"`, content, {
listeners: { listeners: {
stdout: (data) => { stdout: (data) => {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,7 @@ import CloudRunnerSecret from '../../services/cloud-runner-secret';
import Docker from '../../../docker'; import Docker from '../../../docker';
import { Action } from '../../../../model'; import { Action } from '../../../../model';
import { writeFileSync } from 'fs'; import { writeFileSync } from 'fs';
import CloudRunner from '../../cloud-runner';
class LocalDockerCloudRunner implements ProviderInterface { class LocalDockerCloudRunner implements ProviderInterface {
public buildParameters: BuildParameters | undefined; public buildParameters: BuildParameters | undefined;
@ -86,9 +87,7 @@ class LocalDockerCloudRunner implements ProviderInterface {
// core.info(JSON.stringify({ workspace, actionFolder, ...this.buildParameters, ...content }, undefined, 4)); // core.info(JSON.stringify({ workspace, actionFolder, ...this.buildParameters, ...content }, undefined, 4));
const entrypointFilePath = `start.sh`; const entrypointFilePath = `start.sh`;
writeFileSync( const fileContents = `#!/bin/bash
`${workspace}/${entrypointFilePath}`,
`#!/bin/bash
set -e set -e
apt-get update > /dev/null && apt-get install -y tree> /dev/null apt-get update > /dev/null && apt-get install -y tree> /dev/null
@ -100,11 +99,14 @@ class LocalDockerCloudRunner implements ProviderInterface {
cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/ cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
tree -L 2 /github/workspace/cloud-runner-cache tree -L 2 /github/workspace/cloud-runner-cache
tree -L 3 ${sharedFolder} tree -L 3 ${sharedFolder}
`, `;
{ writeFileSync(`${workspace}/${entrypointFilePath}`, fileContents, {
flag: 'w', flag: 'w',
}, });
);
if (CloudRunner.buildParameters.cloudRunnerIntegrationTests) {
CloudRunnerLogger.log(`Running local-docker: \n ${JSON.stringify(fileContents)}`);
}
await Docker.run( await Docker.run(
image, image,