feat(precheck): now includes a precheck for more generic runner execution

This commit is contained in:
2022-10-24 21:23:14 +02:00
parent ad0e12bf7b
commit 93c7af6c91
5 changed files with 35 additions and 5 deletions

24
ts/mod_precheck/index.ts Normal file
View File

@ -0,0 +1,24 @@
import * as plugins from './plugins.js';
import * as paths from '../npmci.paths.js';
import { logger } from '../npmci.logging.js';
import { Npmci } from '../npmci.classes.npmci.js';
export const handleCli = async (npmciRefArg: Npmci, argvArg: any) => {
logger.log('info', 'checking execution context');
const presentRunnerTags = process.env.CI_RUNNER_TAGS.split(',').map((stringArg) =>
stringArg.trim()
);
let allDesiredGitlabRunnerTagsPresent = true;
for (const desiredRunnerTag of npmciRefArg.npmciConfig.getConfig().gitlabRunnerTags) {
if (!presentRunnerTags.includes(desiredRunnerTag)) {
allDesiredGitlabRunnerTagsPresent = false;
logger.log(
'error',
`Desired runnerRag ${desiredRunnerTag} is missing in current execution context.`
);
}
}
if (!allDesiredGitlabRunnerTagsPresent) {
process.exit(1);
}
};

View File

@ -0,0 +1 @@
export * from '../npmci.plugins.js';