check environment before running autobuild or analyze
This commit is contained in:
parent
a542021200
commit
f80d660e33
3 changed files with 22 additions and 3 deletions
9
lib/runner.js
generated
9
lib/runner.js
generated
|
|
@ -60,6 +60,13 @@ function getToolsDir(userInput) {
|
|||
}
|
||||
return toolsDir;
|
||||
}
|
||||
function checkEnvironmentSetup(config) {
|
||||
if (config.languages.some(languages_1.isTracedLanguage) && !('ODASA_TRACER_CONFIGURATION' in process.env)) {
|
||||
throw new Error("Could not detect 'ODASA_TRACER_CONFIGURATION' in environment. " +
|
||||
"Make sure that environment variables were correctly exported to future processes. " +
|
||||
"See end out output from 'init' command for instructions.");
|
||||
}
|
||||
}
|
||||
const logger = logging_1.getRunnerLogger();
|
||||
program
|
||||
.command('init')
|
||||
|
|
@ -135,6 +142,7 @@ program
|
|||
.action(async (cmd) => {
|
||||
try {
|
||||
const config = await config_utils_1.getConfig(getTempDir(cmd.tempDir), logger);
|
||||
checkEnvironmentSetup(config);
|
||||
let language = undefined;
|
||||
if (cmd.language !== undefined) {
|
||||
language = languages_1.parseLanguage(cmd.language);
|
||||
|
|
@ -173,6 +181,7 @@ program
|
|||
const tempDir = getTempDir(cmd.tempDir);
|
||||
const outputDir = cmd.outputDir || path.join(tempDir, 'codeql-sarif');
|
||||
const config = await config_utils_1.getConfig(getTempDir(cmd.tempDir), logger);
|
||||
checkEnvironmentSetup(config);
|
||||
await analyze_1.runAnalyze(repository_1.parseRepositoryNwo(cmd.repository), cmd.commit, cmd.ref, undefined, undefined, undefined, cmd.checkoutPath || process.cwd(), undefined, cmd.githubAuth, parseGithubUrl(cmd.githubUrl), cmd.upload, 'runner', outputDir, config, logger);
|
||||
}
|
||||
catch (e) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue