2020-08-26 16:49:43 -04:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google LLC All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
|
|
|
import {getCaretakerConfig} from '../config';
|
|
|
|
|
2020-09-14 14:24:15 -04:00
|
|
|
import {CiModule} from './ci';
|
|
|
|
import {G3Module} from './g3';
|
|
|
|
import {GithubQueriesModule} from './github';
|
|
|
|
import {ServicesModule} from './services';
|
2020-08-26 16:49:43 -04:00
|
|
|
|
2020-09-14 14:24:15 -04:00
|
|
|
/** List of modules checked for the caretaker check command. */
|
|
|
|
const moduleList = [
|
|
|
|
GithubQueriesModule,
|
|
|
|
ServicesModule,
|
|
|
|
CiModule,
|
|
|
|
G3Module,
|
|
|
|
];
|
2020-08-26 16:49:43 -04:00
|
|
|
|
|
|
|
/** Check the status of services which Angular caretakers need to monitor. */
|
2021-04-08 15:34:55 -04:00
|
|
|
export async function checkServiceStatuses() {
|
2020-08-26 16:49:43 -04:00
|
|
|
/** The configuration for the caretaker commands. */
|
|
|
|
const config = getCaretakerConfig();
|
2020-09-14 14:24:15 -04:00
|
|
|
/** List of instances of Caretaker Check modules */
|
2021-04-08 15:34:55 -04:00
|
|
|
const caretakerCheckModules = moduleList.map(module => new module(config));
|
2020-08-26 16:49:43 -04:00
|
|
|
|
2020-09-14 14:24:15 -04:00
|
|
|
// Module's `data` is casted as Promise<unknown> because the data types of the `module`'s `data`
|
|
|
|
// promises do not match typings, however our usage here is only to determine when the promise
|
|
|
|
// resolves.
|
|
|
|
await Promise.all(caretakerCheckModules.map(module => module.data as Promise<unknown>));
|
|
|
|
|
|
|
|
for (const module of caretakerCheckModules) {
|
|
|
|
await module.printToTerminal();
|
|
|
|
}
|
2020-08-26 16:49:43 -04:00
|
|
|
}
|