cleanup
parent
8247c6a024
commit
08edeacb31
|
|
@ -411,7 +411,7 @@ class CLI {
|
||||||
if (results.length === 0) {
|
if (results.length === 0) {
|
||||||
throw new Error('no CLI mode found');
|
throw new Error('no CLI mode found');
|
||||||
}
|
}
|
||||||
cloud_runner_logger_1.default.log(`Entrypoint: ${results[0].name}`);
|
cloud_runner_logger_1.default.log(`Entrypoint: ${results[0].key}`);
|
||||||
return yield results[0].asyncFunc();
|
return yield results[0].asyncFunc();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -2954,56 +2954,6 @@ class CustomWorkflow {
|
||||||
exports.CustomWorkflow = CustomWorkflow;
|
exports.CustomWorkflow = CustomWorkflow;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 37092:
|
|
||||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
||||||
exports.EphemeralGitHubRunnerWorkflow = void 0;
|
|
||||||
const cloud_runner_logger_1 = __importDefault(__webpack_require__(22855));
|
|
||||||
const cloud_runner_state_1 = __webpack_require__(70912);
|
|
||||||
class EphemeralGitHubRunnerWorkflow {
|
|
||||||
run(cloudRunnerStepState) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
try {
|
|
||||||
return yield EphemeralGitHubRunnerWorkflow.runJobAsEphemeralGitHubRunner(cloudRunnerStepState.image, cloudRunnerStepState.environment, cloudRunnerStepState.secrets);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
static runJobAsEphemeralGitHubRunner(image, environmentVariables, secrets) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
try {
|
|
||||||
cloud_runner_logger_1.default.log(`Cloud Runner is running in ephemeral GitHub runner mode`);
|
|
||||||
const installAndStartRunner = ' cd ../.. && ls && mkdir actions-runner && cd actions-runner && curl -O -L https://github.com/actions/runner/releases/download/v2.283.1/actions-runner-linux-x64-2.283.1.tar.gz && tar xzf ./actions-runner-linux-x64-2.283.1.tar.gz';
|
|
||||||
return yield cloud_runner_state_1.CloudRunnerState.CloudRunnerProviderPlatform.runTask(cloud_runner_state_1.CloudRunnerState.buildParams.buildGuid, image, installAndStartRunner, `/runner`, `/runner`, environmentVariables, secrets);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.EphemeralGitHubRunnerWorkflow = EphemeralGitHubRunnerWorkflow;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 54204:
|
/***/ 54204:
|
||||||
|
|
@ -3020,18 +2970,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.WorkflowCompositionRoot = void 0;
|
exports.WorkflowCompositionRoot = void 0;
|
||||||
const cloud_runner_state_1 = __webpack_require__(70912);
|
const cloud_runner_state_1 = __webpack_require__(70912);
|
||||||
const cloud_runner_step_state_1 = __webpack_require__(64854);
|
const cloud_runner_step_state_1 = __webpack_require__(64854);
|
||||||
const setup_step_1 = __webpack_require__(58923);
|
|
||||||
const custom_workflow_1 = __webpack_require__(3786);
|
const custom_workflow_1 = __webpack_require__(3786);
|
||||||
const ephemeral_github_runner_workflow_1 = __webpack_require__(37092);
|
|
||||||
const build_automation_workflow_1 = __webpack_require__(94655);
|
const build_automation_workflow_1 = __webpack_require__(94655);
|
||||||
const cloud_runner_logger_1 = __importDefault(__webpack_require__(22855));
|
|
||||||
const task_parameter_serializer_1 = __webpack_require__(35346);
|
const task_parameter_serializer_1 = __webpack_require__(35346);
|
||||||
class WorkflowCompositionRoot {
|
class WorkflowCompositionRoot {
|
||||||
run(cloudRunnerStepState) {
|
run(cloudRunnerStepState) {
|
||||||
|
|
@ -3047,19 +2991,10 @@ class WorkflowCompositionRoot {
|
||||||
static runJob(baseImage) {
|
static runJob(baseImage) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
cloud_runner_logger_1.default.log(`Workflow specified: ${cloud_runner_state_1.CloudRunnerState.buildParams.customJob}`);
|
if (cloud_runner_state_1.CloudRunnerState.buildParams.customJob !== '') {
|
||||||
if (cloud_runner_state_1.CloudRunnerState.buildParams.customJob === '') {
|
|
||||||
return yield new build_automation_workflow_1.BuildAutomationWorkflow().run(new cloud_runner_step_state_1.CloudRunnerStepState(baseImage, task_parameter_serializer_1.TaskParameterSerializer.readBuildEnvironmentVariables(), cloud_runner_state_1.CloudRunnerState.defaultSecrets));
|
|
||||||
}
|
|
||||||
else if (cloud_runner_state_1.CloudRunnerState.buildParams.customJob === 'ephemeral') {
|
|
||||||
return yield new ephemeral_github_runner_workflow_1.EphemeralGitHubRunnerWorkflow().run(new cloud_runner_step_state_1.CloudRunnerStepState(baseImage, task_parameter_serializer_1.TaskParameterSerializer.readBuildEnvironmentVariables(), cloud_runner_state_1.CloudRunnerState.defaultSecrets));
|
|
||||||
}
|
|
||||||
else if (cloud_runner_state_1.CloudRunnerState.buildParams.customJob === 'download') {
|
|
||||||
return yield new setup_step_1.SetupStep().run(new cloud_runner_step_state_1.CloudRunnerStepState('alpine/git', task_parameter_serializer_1.TaskParameterSerializer.readBuildEnvironmentVariables(), cloud_runner_state_1.CloudRunnerState.defaultSecrets));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return yield custom_workflow_1.CustomWorkflow.runCustomJob(cloud_runner_state_1.CloudRunnerState.buildParams.customJob);
|
return yield custom_workflow_1.CustomWorkflow.runCustomJob(cloud_runner_state_1.CloudRunnerState.buildParams.customJob);
|
||||||
}
|
}
|
||||||
|
return yield new build_automation_workflow_1.BuildAutomationWorkflow().run(new cloud_runner_step_state_1.CloudRunnerStepState(baseImage, task_parameter_serializer_1.TaskParameterSerializer.readBuildEnvironmentVariables(), cloud_runner_state_1.CloudRunnerState.defaultSecrets));
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -29,7 +29,7 @@ export class CLI {
|
||||||
throw new Error('no CLI mode found');
|
throw new Error('no CLI mode found');
|
||||||
}
|
}
|
||||||
|
|
||||||
CloudRunnerLogger.log(`Entrypoint: ${results[0].name}`);
|
CloudRunnerLogger.log(`Entrypoint: ${results[0].key}`);
|
||||||
|
|
||||||
return await results[0].asyncFunc();
|
return await results[0].asyncFunc();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
import CloudRunnerEnvironmentVariable from '../services/cloud-runner-environment-variable';
|
|
||||||
import CloudRunnerLogger from '../services/cloud-runner-logger';
|
|
||||||
import CloudRunnerSecret from '../services/cloud-runner-secret';
|
|
||||||
import { CloudRunnerState } from '../state/cloud-runner-state';
|
|
||||||
import { CloudRunnerStepState } from '../state/cloud-runner-step-state';
|
|
||||||
import { WorkflowInterface } from './workflow-interface';
|
|
||||||
|
|
||||||
export class EphemeralGitHubRunnerWorkflow implements WorkflowInterface {
|
|
||||||
async run(cloudRunnerStepState: CloudRunnerStepState) {
|
|
||||||
try {
|
|
||||||
return await EphemeralGitHubRunnerWorkflow.runJobAsEphemeralGitHubRunner(
|
|
||||||
cloudRunnerStepState.image,
|
|
||||||
cloudRunnerStepState.environment,
|
|
||||||
cloudRunnerStepState.secrets,
|
|
||||||
);
|
|
||||||
} catch (error) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async runJobAsEphemeralGitHubRunner(
|
|
||||||
image: string,
|
|
||||||
environmentVariables: CloudRunnerEnvironmentVariable[],
|
|
||||||
secrets: CloudRunnerSecret[],
|
|
||||||
) {
|
|
||||||
try {
|
|
||||||
CloudRunnerLogger.log(`Cloud Runner is running in ephemeral GitHub runner mode`);
|
|
||||||
const installAndStartRunner =
|
|
||||||
' cd ../.. && ls && mkdir actions-runner && cd actions-runner && curl -O -L https://github.com/actions/runner/releases/download/v2.283.1/actions-runner-linux-x64-2.283.1.tar.gz && tar xzf ./actions-runner-linux-x64-2.283.1.tar.gz';
|
|
||||||
return await CloudRunnerState.CloudRunnerProviderPlatform.runTask(
|
|
||||||
CloudRunnerState.buildParams.buildGuid,
|
|
||||||
image,
|
|
||||||
installAndStartRunner,
|
|
||||||
`/runner`,
|
|
||||||
`/runner`,
|
|
||||||
environmentVariables,
|
|
||||||
secrets,
|
|
||||||
);
|
|
||||||
} catch (error) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
import { CloudRunnerState } from '../state/cloud-runner-state';
|
import { CloudRunnerState } from '../state/cloud-runner-state';
|
||||||
import { CloudRunnerStepState } from '../state/cloud-runner-step-state';
|
import { CloudRunnerStepState } from '../state/cloud-runner-step-state';
|
||||||
import { SetupStep } from '../steps/setup-step';
|
|
||||||
import { CustomWorkflow } from './custom-workflow';
|
import { CustomWorkflow } from './custom-workflow';
|
||||||
import { EphemeralGitHubRunnerWorkflow } from './ephemeral-github-runner-workflow';
|
|
||||||
import { WorkflowInterface } from './workflow-interface';
|
import { WorkflowInterface } from './workflow-interface';
|
||||||
import { BuildAutomationWorkflow } from './build-automation-workflow';
|
import { BuildAutomationWorkflow } from './build-automation-workflow';
|
||||||
import CloudRunnerLogger from '../services/cloud-runner-logger';
|
|
||||||
import { TaskParameterSerializer } from '../services/task-parameter-serializer';
|
import { TaskParameterSerializer } from '../services/task-parameter-serializer';
|
||||||
|
|
||||||
export class WorkflowCompositionRoot implements WorkflowInterface {
|
export class WorkflowCompositionRoot implements WorkflowInterface {
|
||||||
|
|
@ -19,34 +16,16 @@ export class WorkflowCompositionRoot implements WorkflowInterface {
|
||||||
|
|
||||||
private static async runJob(baseImage: any) {
|
private static async runJob(baseImage: any) {
|
||||||
try {
|
try {
|
||||||
CloudRunnerLogger.log(`Workflow specified: ${CloudRunnerState.buildParams.customJob}`);
|
if (CloudRunnerState.buildParams.customJob !== '') {
|
||||||
if (CloudRunnerState.buildParams.customJob === '') {
|
|
||||||
return await new BuildAutomationWorkflow().run(
|
|
||||||
new CloudRunnerStepState(
|
|
||||||
baseImage,
|
|
||||||
TaskParameterSerializer.readBuildEnvironmentVariables(),
|
|
||||||
CloudRunnerState.defaultSecrets,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else if (CloudRunnerState.buildParams.customJob === 'ephemeral') {
|
|
||||||
return await new EphemeralGitHubRunnerWorkflow().run(
|
|
||||||
new CloudRunnerStepState(
|
|
||||||
baseImage,
|
|
||||||
TaskParameterSerializer.readBuildEnvironmentVariables(),
|
|
||||||
CloudRunnerState.defaultSecrets,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else if (CloudRunnerState.buildParams.customJob === 'download') {
|
|
||||||
return await new SetupStep().run(
|
|
||||||
new CloudRunnerStepState(
|
|
||||||
'alpine/git',
|
|
||||||
TaskParameterSerializer.readBuildEnvironmentVariables(),
|
|
||||||
CloudRunnerState.defaultSecrets,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return await CustomWorkflow.runCustomJob(CloudRunnerState.buildParams.customJob);
|
return await CustomWorkflow.runCustomJob(CloudRunnerState.buildParams.customJob);
|
||||||
}
|
}
|
||||||
|
return await new BuildAutomationWorkflow().run(
|
||||||
|
new CloudRunnerStepState(
|
||||||
|
baseImage,
|
||||||
|
TaskParameterSerializer.readBuildEnvironmentVariables(),
|
||||||
|
CloudRunnerState.defaultSecrets,
|
||||||
|
),
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue