pull/310/head
Frostebite 2021-12-30 03:01:38 +00:00
parent 2b82bcf4b1
commit 60301c78f1
6 changed files with 17 additions and 22 deletions

16
dist/index.js vendored
View File

@ -390,7 +390,7 @@ class CLI {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
core.info(`Entrypoint: ${options.mode}`); core.info(`Entrypoint: ${options.mode}`);
if (options.mode === 'remote-cli') { if (options.mode === 'remote-cli') {
yield remote_client_1.RemoteClient.Run(options); yield remote_client_1.RemoteClient.Run();
} }
else { else {
options.versioning = 'None'; options.versioning = 'None';
@ -707,15 +707,11 @@ exports.RemoteClient = void 0;
const cloud_runner_state_1 = __webpack_require__(70912); const cloud_runner_state_1 = __webpack_require__(70912);
const cloud_runner_repository_setup_1 = __webpack_require__(21811); const cloud_runner_repository_setup_1 = __webpack_require__(21811);
class RemoteClient { class RemoteClient {
static Run(options) { static Run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const buildParameter = JSON.parse(process.env.buildParameters || '{}'); const buildParameter = JSON.parse(process.env.buildParameters || '{}');
cloud_runner_state_1.CloudRunnerState.setup(buildParameter); cloud_runner_state_1.CloudRunnerState.setup(buildParameter);
switch (options.remoteClientState) {
default:
yield cloud_runner_repository_setup_1.CloudRunnerRepositorySetup.run(); yield cloud_runner_repository_setup_1.CloudRunnerRepositorySetup.run();
break;
}
}); });
} }
} }
@ -968,7 +964,7 @@ class AWSError {
core.error(JSON.stringify(error, undefined, 4)); core.error(JSON.stringify(error, undefined, 4));
cloud_runner_logger_1.default.log('Getting events and resources for task stack'); cloud_runner_logger_1.default.log('Getting events and resources for task stack');
const events = (_a = (yield CF.describeStackEvents({ StackName: taskDefStackName }).promise()).StackEvents) === null || _a === void 0 ? void 0 : _a.filter((x) => { const events = (_a = (yield CF.describeStackEvents({ StackName: taskDefStackName }).promise()).StackEvents) === null || _a === void 0 ? void 0 : _a.filter((x) => {
x.ResourceStatus === `CREATE_FAILED`; x.ResourceStatus !== `DELETE_COMPLETE` && x.ResourceStatus !== `CREATE_COMPLETE`;
}); });
cloud_runner_logger_1.default.log(JSON.stringify(events, undefined, 4)); cloud_runner_logger_1.default.log(JSON.stringify(events, undefined, 4));
}); });
@ -2359,9 +2355,11 @@ class KubernetesTaskRunner {
let success = false; let success = false;
cloud_runner_logger_1.default.log(`Watching ${podName} ${namespace}`); cloud_runner_logger_1.default.log(`Watching ${podName} ${namespace}`);
yield async_wait_until_1.default(() => __awaiter(this, void 0, void 0, function* () { yield async_wait_until_1.default(() => __awaiter(this, void 0, void 0, function* () {
var _a, _b; var _a;
const phase = (_b = (_a = (yield kubeClient.readNamespacedPodStatus(podName, namespace))) === null || _a === void 0 ? void 0 : _a.body.status) === null || _b === void 0 ? void 0 : _b.phase; const status = yield kubeClient.readNamespacedPodStatus(podName, namespace);
const phase = (_a = status === null || status === void 0 ? void 0 : status.body.status) === null || _a === void 0 ? void 0 : _a.phase;
success = phase === 'Running'; success = phase === 'Running';
cloud_runner_logger_1.default.log(`${JSON.stringify(status.body.status, undefined, 4)}`);
if (success || phase !== 'Pending') if (success || phase !== 'Pending')
return true; return true;
return false; return false;

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -3,13 +3,12 @@ import { BuildParameters, CloudRunner, ImageTag, Input } from '..';
import * as core from '@actions/core'; import * as core from '@actions/core';
import { RemoteClient } from './remote-client'; import { RemoteClient } from './remote-client';
import { ActionYamlReader } from '../input-readers/action-yaml'; import { ActionYamlReader } from '../input-readers/action-yaml';
export class CLI { export class CLI {
static async RunCli(options: any) { static async RunCli(options: any): Promise<void> {
core.info(`Entrypoint: ${options.mode}`); core.info(`Entrypoint: ${options.mode}`);
if (options.mode === 'remote-cli') { if (options.mode === 'remote-cli') {
await RemoteClient.Run(options); await RemoteClient.Run();
} else { } else {
options.versioning = 'None'; options.versioning = 'None';
Input.cliOptions = options; Input.cliOptions = options;

View File

@ -2,13 +2,9 @@ import { CloudRunnerState } from '../../cloud-runner/state/cloud-runner-state';
import { CloudRunnerRepositorySetup } from './cloud-runner-repository-setup'; import { CloudRunnerRepositorySetup } from './cloud-runner-repository-setup';
export class RemoteClient { export class RemoteClient {
static async Run(options) { static async Run() {
const buildParameter = JSON.parse(process.env.buildParameters || '{}'); const buildParameter = JSON.parse(process.env.buildParameters || '{}');
CloudRunnerState.setup(buildParameter); CloudRunnerState.setup(buildParameter);
switch (options.remoteClientState) {
default:
await CloudRunnerRepositorySetup.run(); await CloudRunnerRepositorySetup.run();
break;
}
} }
} }

View File

@ -9,7 +9,7 @@ export class AWSError {
CloudRunnerLogger.log('Getting events and resources for task stack'); CloudRunnerLogger.log('Getting events and resources for task stack');
const events = (await CF.describeStackEvents({ StackName: taskDefStackName }).promise()).StackEvents?.filter( const events = (await CF.describeStackEvents({ StackName: taskDefStackName }).promise()).StackEvents?.filter(
(x) => { (x) => {
x.ResourceStatus === `CREATE_FAILED`; x.ResourceStatus !== `DELETE_COMPLETE` && x.ResourceStatus !== `CREATE_COMPLETE`;
}, },
); );
CloudRunnerLogger.log(JSON.stringify(events, undefined, 4)); CloudRunnerLogger.log(JSON.stringify(events, undefined, 4));

View File

@ -76,8 +76,10 @@ class KubernetesTaskRunner {
CloudRunnerLogger.log(`Watching ${podName} ${namespace}`); CloudRunnerLogger.log(`Watching ${podName} ${namespace}`);
await waitUntil( await waitUntil(
async () => { async () => {
const phase = (await kubeClient.readNamespacedPodStatus(podName, namespace))?.body.status?.phase; const status = await kubeClient.readNamespacedPodStatus(podName, namespace);
const phase = status?.body.status?.phase;
success = phase === 'Running'; success = phase === 'Running';
CloudRunnerLogger.log(`${JSON.stringify(status.body.status, undefined, 4)}`);
if (success || phase !== 'Pending') return true; if (success || phase !== 'Pending') return true;
return false; return false;
}, },