Make name of debugging artifact and DB within it configurable
This commit is contained in:
parent
848e5140d4
commit
e677af3fd0
42 changed files with 244 additions and 83 deletions
6
.github/workflows/__debug-artifacts.yml
generated
vendored
6
.github/workflows/__debug-artifacts.yml
generated
vendored
|
|
@ -45,6 +45,8 @@ jobs:
|
||||||
with:
|
with:
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
debug: true
|
debug: true
|
||||||
|
debug-artifact-name: my-debug-artifacts
|
||||||
|
debug-database-name: my-db
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
|
|
@ -52,7 +54,7 @@ jobs:
|
||||||
id: analysis
|
id: analysis
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: debug-artifacts-${{ matrix.os }}-${{ matrix.version }}
|
name: my-debug-artifacts-${{ matrix.os }}-${{ matrix.version }}
|
||||||
- shell: bash
|
- shell: bash
|
||||||
run: |
|
run: |
|
||||||
LANGUAGES="cpp csharp go java javascript python"
|
LANGUAGES="cpp csharp go java javascript python"
|
||||||
|
|
@ -62,7 +64,7 @@ jobs:
|
||||||
echo "Missing a SARIF file for $language"
|
echo "Missing a SARIF file for $language"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ ! -f "$language.zip" ]] ; then
|
if [[ ! -f "my-db-$language.zip" ]] ; then
|
||||||
echo "Missing a database bundle for $language"
|
echo "Missing a database bundle for $language"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,16 @@ inputs:
|
||||||
description: Enable debugging mode. This will result in more output being produced which may be useful when debugging certain issues.
|
description: Enable debugging mode. This will result in more output being produced which may be useful when debugging certain issues.
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
|
debug-artifact-name:
|
||||||
|
description: >-
|
||||||
|
The name of the artifact to store debugging information in.
|
||||||
|
This is only used when debug mode is enabled.
|
||||||
|
required: false
|
||||||
|
debug-database-name:
|
||||||
|
description: >-
|
||||||
|
The name of the database uploaded to the debugging artifact.
|
||||||
|
This is only used when debug mode is enabled.
|
||||||
|
required: false
|
||||||
outputs:
|
outputs:
|
||||||
codeql-path:
|
codeql-path:
|
||||||
description: The path of the CodeQL binary used for analysis
|
description: The path of the CodeQL binary used for analysis
|
||||||
|
|
|
||||||
6
lib/analysis-paths.test.js
generated
6
lib/analysis-paths.test.js
generated
|
|
@ -43,6 +43,8 @@ const util = __importStar(require("./util"));
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
||||||
packs: {},
|
packs: {},
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
};
|
};
|
||||||
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
||||||
t.is(process.env["LGTM_INDEX_INCLUDE"], undefined);
|
t.is(process.env["LGTM_INDEX_INCLUDE"], undefined);
|
||||||
|
|
@ -65,6 +67,8 @@ const util = __importStar(require("./util"));
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
||||||
packs: {},
|
packs: {},
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
};
|
};
|
||||||
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
||||||
t.is(process.env["LGTM_INDEX_INCLUDE"], "path1\npath2");
|
t.is(process.env["LGTM_INDEX_INCLUDE"], "path1\npath2");
|
||||||
|
|
@ -88,6 +92,8 @@ const util = __importStar(require("./util"));
|
||||||
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||||
packs: {},
|
packs: {},
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
};
|
};
|
||||||
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
||||||
t.is(process.env["LGTM_INDEX_INCLUDE"], undefined);
|
t.is(process.env["LGTM_INDEX_INCLUDE"], undefined);
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"analysis-paths.test.js","sourceRoot":"","sources":["../src/analysis-paths.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAE7B,8CAAuB;AAEvB,gEAAkD;AAClD,mDAA6C;AAC7C,6CAA+B;AAE/B,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,IAAA,aAAI,EAAC,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC7B,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAG;YACb,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,EAAE;YACf,KAAK,EAAE,EAAE;YACT,iBAAiB,EAAE,EAAE;YACrB,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,MAAM;YACpB,SAAS,EAAE,EAAE;YACb,aAAa,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAwB;YACxE,UAAU,EAAE,IAAI,CAAC,OA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AE,EAAE;QAClD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG;YACb,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,EAAE;YACf,KAAK,EAAE,EAAE;YACT,iBAAiB,EAAE,EAAE;YACrB,OAAO;YACP,YAAY;YACZ,SAAS,EAAE,EAAE;YACb,aAAa,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAwB;YACxE,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC;YACrD,KAAK,EAAE,EAAE;YACT,SAAS,EAAE,KAAK;YAChB,iBAAiB,EAAE,IAAI,CAAC,2BAA2B;YACnD,iBAAiB,EAAE,IAAI,CAAC,2BAA2B;SACpD,CAAC;QACF,aAAa,CAAC,8BAA8B,CAAC,MAAM,CAAC,CAAC;QACrD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,SAAS,CAAC,CAAC;QACnD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC,CAAC;QAC9D,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,SAAS,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||||
14
lib/analyze-action.js
generated
14
lib/analyze-action.js
generated
|
|
@ -84,7 +84,7 @@ async function run() {
|
||||||
runStats = await (0, analyze_1.runQueries)(outputDir, memory, util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")), threads, actionsUtil.getOptionalInput("category"), config, logger);
|
runStats = await (0, analyze_1.runQueries)(outputDir, memory, util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")), threads, actionsUtil.getOptionalInput("category"), config, logger);
|
||||||
if (config.debugMode) {
|
if (config.debugMode) {
|
||||||
// Upload the SARIF files as an Actions artifact for debugging
|
// Upload the SARIF files as an Actions artifact for debugging
|
||||||
await uploadDebugArtifacts(config.languages.map((lang) => path.resolve(outputDir, `${lang}.sarif`)), outputDir);
|
await uploadDebugArtifacts(config.languages.map((lang) => path.resolve(outputDir, `${lang}.sarif`)), outputDir, config.debugArtifactName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
||||||
|
|
@ -98,10 +98,10 @@ async function run() {
|
||||||
// Multilanguage tracing: there are additional logs in the root of the cluster
|
// Multilanguage tracing: there are additional logs in the root of the cluster
|
||||||
toUpload.push(...listFolder(path.resolve(config.dbLocation, "log")));
|
toUpload.push(...listFolder(path.resolve(config.dbLocation, "log")));
|
||||||
}
|
}
|
||||||
await uploadDebugArtifacts(toUpload, config.dbLocation);
|
await uploadDebugArtifacts(toUpload, config.dbLocation, config.debugArtifactName);
|
||||||
if (!(await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING))) {
|
if (!(await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING))) {
|
||||||
// Before multi-language tracing, we wrote a compound-build-tracer.log in the temp dir
|
// Before multi-language tracing, we wrote a compound-build-tracer.log in the temp dir
|
||||||
await uploadDebugArtifacts([path.resolve(config.tempDir, "compound-build-tracer.log")], config.tempDir);
|
await uploadDebugArtifacts([path.resolve(config.tempDir, "compound-build-tracer.log")], config.tempDir, config.debugArtifactName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (actionsUtil.getOptionalInput("cleanup-level") !== "none") {
|
if (actionsUtil.getOptionalInput("cleanup-level") !== "none") {
|
||||||
|
|
@ -144,9 +144,9 @@ async function run() {
|
||||||
// Upload the database bundles as an Actions artifact for debugging
|
// Upload the database bundles as an Actions artifact for debugging
|
||||||
const toUpload = [];
|
const toUpload = [];
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
toUpload.push(await (0, util_1.bundleDb)(config, language, await (0, codeql_1.getCodeQL)(config.codeQLCmd)));
|
toUpload.push(await (0, util_1.bundleDb)(config, language, await (0, codeql_1.getCodeQL)(config.codeQLCmd), `${config.debugDatabaseName}-${language}`));
|
||||||
}
|
}
|
||||||
await uploadDebugArtifacts(toUpload, config.dbLocation);
|
await uploadDebugArtifacts(toUpload, config.dbLocation, config.debugArtifactName);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log(`Failed to upload database debug bundles: ${error}`);
|
console.log(`Failed to upload database debug bundles: ${error}`);
|
||||||
|
|
@ -187,14 +187,14 @@ async function run() {
|
||||||
await sendStatusReport(startedAt, undefined);
|
await sendStatusReport(startedAt, undefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function uploadDebugArtifacts(toUpload, rootDir) {
|
async function uploadDebugArtifacts(toUpload, rootDir, artifactName) {
|
||||||
let suffix = "";
|
let suffix = "";
|
||||||
const matrix = actionsUtil.getRequiredInput("matrix");
|
const matrix = actionsUtil.getRequiredInput("matrix");
|
||||||
if (matrix !== undefined && matrix !== "null") {
|
if (matrix !== undefined && matrix !== "null") {
|
||||||
for (const entry of Object.entries(JSON.parse(matrix)).sort())
|
for (const entry of Object.entries(JSON.parse(matrix)).sort())
|
||||||
suffix += `-${entry[1]}`;
|
suffix += `-${entry[1]}`;
|
||||||
}
|
}
|
||||||
await artifact.create().uploadArtifact(actionsUtil.sanitizeArifactName(`${util_1.DEBUG_ARTIFACT_NAME}${suffix}`), toUpload.map((file) => path.normalize(file)), path.normalize(rootDir));
|
await artifact.create().uploadArtifact(actionsUtil.sanitizeArifactName(`${artifactName}${suffix}`), toUpload.map((file) => path.normalize(file)), path.normalize(rootDir));
|
||||||
}
|
}
|
||||||
function listFolder(dir) {
|
function listFolder(dir) {
|
||||||
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
2
lib/analyze.test.js
generated
2
lib/analyze.test.js
generated
|
|
@ -126,6 +126,8 @@ const util = __importStar(require("./util"));
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
||||||
packs,
|
packs,
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
};
|
};
|
||||||
fs.mkdirSync(util.getCodeQLDatabasePath(config, language), {
|
fs.mkdirSync(util.getCodeQLDatabasePath(config, language), {
|
||||||
recursive: true,
|
recursive: true,
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
3
lib/codeql.js
generated
3
lib/codeql.js
generated
|
|
@ -638,12 +638,13 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||||
];
|
];
|
||||||
await runTool(cmd, codeqlArgs);
|
await runTool(cmd, codeqlArgs);
|
||||||
},
|
},
|
||||||
async databaseBundle(databasePath, outputFilePath) {
|
async databaseBundle(databasePath, outputFilePath, databaseName) {
|
||||||
const args = [
|
const args = [
|
||||||
"database",
|
"database",
|
||||||
"bundle",
|
"bundle",
|
||||||
databasePath,
|
databasePath,
|
||||||
`--output=${outputFilePath}`,
|
`--output=${outputFilePath}`,
|
||||||
|
`--name=${databaseName}`,
|
||||||
];
|
];
|
||||||
await new toolrunner.ToolRunner(cmd, args).exec();
|
await new toolrunner.ToolRunner(cmd, args).exec();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
14
lib/config-utils.js
generated
14
lib/config-utils.js
generated
|
|
@ -443,7 +443,7 @@ function shouldAddConfigFileQueries(queriesInput) {
|
||||||
/**
|
/**
|
||||||
* Get the default config for when the user has not supplied one.
|
* Get the default config for when the user has not supplied one.
|
||||||
*/
|
*/
|
||||||
async function getDefaultConfig(languagesInput, queriesInput, packsInput, dbLocation, debugMode, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureFlags, logger) {
|
async function getDefaultConfig(languagesInput, queriesInput, packsInput, dbLocation, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureFlags, logger) {
|
||||||
var _a;
|
var _a;
|
||||||
const languages = await getLanguages(codeQL, languagesInput, repository, apiDetails, logger);
|
const languages = await getLanguages(codeQL, languagesInput, repository, apiDetails, logger);
|
||||||
const queries = {};
|
const queries = {};
|
||||||
|
|
@ -471,13 +471,15 @@ async function getDefaultConfig(languagesInput, queriesInput, packsInput, dbLoca
|
||||||
gitHubVersion,
|
gitHubVersion,
|
||||||
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
||||||
debugMode,
|
debugMode,
|
||||||
|
debugArtifactName,
|
||||||
|
debugDatabaseName,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.getDefaultConfig = getDefaultConfig;
|
exports.getDefaultConfig = getDefaultConfig;
|
||||||
/**
|
/**
|
||||||
* Load the config from the given file.
|
* Load the config from the given file.
|
||||||
*/
|
*/
|
||||||
async function loadConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, debugMode, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureFlags, logger) {
|
async function loadConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureFlags, logger) {
|
||||||
var _a;
|
var _a;
|
||||||
let parsedYAML;
|
let parsedYAML;
|
||||||
if (isLocal(configFile)) {
|
if (isLocal(configFile)) {
|
||||||
|
|
@ -575,6 +577,8 @@ async function loadConfig(languagesInput, queriesInput, packsInput, configFile,
|
||||||
gitHubVersion,
|
gitHubVersion,
|
||||||
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
||||||
debugMode,
|
debugMode,
|
||||||
|
debugArtifactName,
|
||||||
|
debugDatabaseName,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -700,16 +704,16 @@ function dbLocationOrDefault(dbLocation, tempDir) {
|
||||||
* This will parse the config from the user input if present, or generate
|
* This will parse the config from the user input if present, or generate
|
||||||
* a default config. The parsed config is then stored to a known location.
|
* a default config. The parsed config is then stored to a known location.
|
||||||
*/
|
*/
|
||||||
async function initConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, debugMode, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureFlags, logger) {
|
async function initConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureFlags, logger) {
|
||||||
var _a, _b, _c;
|
var _a, _b, _c;
|
||||||
let config;
|
let config;
|
||||||
// If no config file was provided create an empty one
|
// If no config file was provided create an empty one
|
||||||
if (!configFile) {
|
if (!configFile) {
|
||||||
logger.debug("No configuration file was provided");
|
logger.debug("No configuration file was provided");
|
||||||
config = await getDefaultConfig(languagesInput, queriesInput, packsInput, dbLocation, debugMode, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureFlags, logger);
|
config = await getDefaultConfig(languagesInput, queriesInput, packsInput, dbLocation, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureFlags, logger);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
config = await loadConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, debugMode, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureFlags, logger);
|
config = await loadConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureFlags, logger);
|
||||||
}
|
}
|
||||||
// The list of queries should not be empty for any language. If it is then
|
// The list of queries should not be empty for any language. If it is then
|
||||||
// it is a user configuration error.
|
// it is a user configuration error.
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
48
lib/config-utils.test.js
generated
48
lib/config-utils.test.js
generated
|
|
@ -89,8 +89,8 @@ function mockListLanguages(languages) {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const config = await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), logger);
|
const config = await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), logger);
|
||||||
t.deepEqual(config, await configUtils.getDefaultConfig(languages, undefined, undefined, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), logger));
|
t.deepEqual(config, await configUtils.getDefaultConfig(languages, undefined, undefined, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), logger));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("loading config saves config", async (t) => {
|
(0, ava_1.default)("loading config saves config", async (t) => {
|
||||||
|
|
@ -112,7 +112,7 @@ function mockListLanguages(languages) {
|
||||||
t.false(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
t.false(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
||||||
// Sanity check that getConfig returns undefined before we have called initConfig
|
// Sanity check that getConfig returns undefined before we have called initConfig
|
||||||
t.deepEqual(await configUtils.getConfig(tmpDir, logger), undefined);
|
t.deepEqual(await configUtils.getConfig(tmpDir, logger), undefined);
|
||||||
const config1 = await configUtils.initConfig("javascript,python", undefined, undefined, undefined, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), logger);
|
const config1 = await configUtils.initConfig("javascript,python", undefined, undefined, undefined, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), logger);
|
||||||
// The saved config file should now exist
|
// The saved config file should now exist
|
||||||
t.true(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
t.true(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
||||||
// And that same newly-initialised config should now be returned by getConfig
|
// And that same newly-initialised config should now be returned by getConfig
|
||||||
|
|
@ -123,7 +123,7 @@ function mockListLanguages(languages) {
|
||||||
(0, ava_1.default)("load input outside of workspace", async (t) => {
|
(0, ava_1.default)("load input outside of workspace", async (t) => {
|
||||||
return await util.withTmpDir(async (tmpDir) => {
|
return await util.withTmpDir(async (tmpDir) => {
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(undefined, undefined, undefined, "../input", undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(undefined, undefined, undefined, "../input", undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
@ -136,7 +136,7 @@ function mockListLanguages(languages) {
|
||||||
// no filename given, just a repo
|
// no filename given, just a repo
|
||||||
const configFile = "octo-org/codeql-config@main";
|
const configFile = "octo-org/codeql-config@main";
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(undefined, undefined, undefined, configFile, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(undefined, undefined, undefined, configFile, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
@ -150,7 +150,7 @@ function mockListLanguages(languages) {
|
||||||
const configFile = "input";
|
const configFile = "input";
|
||||||
t.false(fs.existsSync(path.join(tmpDir, configFile)));
|
t.false(fs.existsSync(path.join(tmpDir, configFile)));
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
@ -216,10 +216,12 @@ function mockListLanguages(languages) {
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
||||||
packs: {},
|
packs: {},
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
debugArtifactName: "my-artifact",
|
||||||
|
debugDatabaseName: "my-db",
|
||||||
};
|
};
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
const actualConfig = await configUtils.initConfig(languages, undefined, undefined, configFilePath, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
const actualConfig = await configUtils.initConfig(languages, undefined, undefined, configFilePath, undefined, false, "my-artifact", "my-db", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
// Should exactly equal the object we constructed earlier
|
// Should exactly equal the object we constructed earlier
|
||||||
t.deepEqual(actualConfig, expectedConfig);
|
t.deepEqual(actualConfig, expectedConfig);
|
||||||
});
|
});
|
||||||
|
|
@ -255,7 +257,7 @@ function mockListLanguages(languages) {
|
||||||
fs.mkdirSync(path.join(tmpDir, "foo"));
|
fs.mkdirSync(path.join(tmpDir, "foo"));
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
await configUtils.initConfig(languages, undefined, undefined, configFilePath, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(languages, undefined, undefined, configFilePath, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
// Check resolve queries was called correctly
|
// Check resolve queries was called correctly
|
||||||
t.deepEqual(resolveQueriesArgs.length, 1);
|
t.deepEqual(resolveQueriesArgs.length, 1);
|
||||||
t.deepEqual(resolveQueriesArgs[0].queries, [
|
t.deepEqual(resolveQueriesArgs[0].queries, [
|
||||||
|
|
@ -298,7 +300,7 @@ function queriesToResolvedQueryForm(queries) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const config = await configUtils.initConfig(languages, undefined, undefined, configFilePath, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
const config = await configUtils.initConfig(languages, undefined, undefined, configFilePath, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
// Check resolveQueries was called correctly
|
// Check resolveQueries was called correctly
|
||||||
// It'll be called once for the default queries
|
// It'll be called once for the default queries
|
||||||
// and once for `./foo` from the config file.
|
// and once for `./foo` from the config file.
|
||||||
|
|
@ -331,7 +333,7 @@ function queriesToResolvedQueryForm(queries) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const config = await configUtils.initConfig(languages, testQueries, undefined, configFilePath, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
const config = await configUtils.initConfig(languages, testQueries, undefined, configFilePath, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
// Check resolveQueries was called correctly
|
// Check resolveQueries was called correctly
|
||||||
// It'll be called once for the default queries and once for `./override`,
|
// It'll be called once for the default queries and once for `./override`,
|
||||||
// but won't be called for './foo' from the config file.
|
// but won't be called for './foo' from the config file.
|
||||||
|
|
@ -363,7 +365,7 @@ function queriesToResolvedQueryForm(queries) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const config = await configUtils.initConfig(languages, testQueries, undefined, configFilePath, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
const config = await configUtils.initConfig(languages, testQueries, undefined, configFilePath, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
// Check resolveQueries was called correctly
|
// Check resolveQueries was called correctly
|
||||||
// It'll be called once for `./workflow-query`,
|
// It'll be called once for `./workflow-query`,
|
||||||
// but won't be called for the default one since that was disabled
|
// but won't be called for the default one since that was disabled
|
||||||
|
|
@ -389,7 +391,7 @@ function queriesToResolvedQueryForm(queries) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const config = await configUtils.initConfig(languages, testQueries, undefined, undefined, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
const config = await configUtils.initConfig(languages, testQueries, undefined, undefined, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
// Check resolveQueries was called correctly:
|
// Check resolveQueries was called correctly:
|
||||||
// It'll be called once for the default queries,
|
// It'll be called once for the default queries,
|
||||||
// and then once for each of the two queries from the workflow
|
// and then once for each of the two queries from the workflow
|
||||||
|
|
@ -428,7 +430,7 @@ function queriesToResolvedQueryForm(queries) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const config = await configUtils.initConfig(languages, testQueries, undefined, configFilePath, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
const config = await configUtils.initConfig(languages, testQueries, undefined, configFilePath, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
// Check resolveQueries was called correctly
|
// Check resolveQueries was called correctly
|
||||||
// It'll be called once for the default queries,
|
// It'll be called once for the default queries,
|
||||||
// once for each of additional1 and additional2,
|
// once for each of additional1 and additional2,
|
||||||
|
|
@ -467,7 +469,7 @@ function queriesToResolvedQueryForm(queries) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(languages, queries, undefined, undefined, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(languages, queries, undefined, undefined, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
t.fail("initConfig did not throw error");
|
t.fail("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
@ -510,7 +512,7 @@ function queriesToResolvedQueryForm(queries) {
|
||||||
fs.mkdirSync(path.join(tmpDir, "foo/bar/dev"), { recursive: true });
|
fs.mkdirSync(path.join(tmpDir, "foo/bar/dev"), { recursive: true });
|
||||||
const configFile = "octo-org/codeql-config/config.yaml@main";
|
const configFile = "octo-org/codeql-config/config.yaml@main";
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
t.assert(spyGetContents.called);
|
t.assert(spyGetContents.called);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -520,7 +522,7 @@ function queriesToResolvedQueryForm(queries) {
|
||||||
mockGetContents(dummyResponse);
|
mockGetContents(dummyResponse);
|
||||||
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(undefined, undefined, undefined, repoReference, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(undefined, undefined, undefined, repoReference, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
@ -536,7 +538,7 @@ function queriesToResolvedQueryForm(queries) {
|
||||||
mockGetContents(dummyResponse);
|
mockGetContents(dummyResponse);
|
||||||
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(undefined, undefined, undefined, repoReference, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(undefined, undefined, undefined, repoReference, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
@ -553,7 +555,7 @@ function queriesToResolvedQueryForm(queries) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(undefined, undefined, undefined, undefined, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(undefined, undefined, undefined, undefined, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
@ -565,7 +567,7 @@ function queriesToResolvedQueryForm(queries) {
|
||||||
return await util.withTmpDir(async (tmpDir) => {
|
return await util.withTmpDir(async (tmpDir) => {
|
||||||
const languages = "rubbish,english";
|
const languages = "rubbish,english";
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
@ -593,7 +595,7 @@ function queriesToResolvedQueryForm(queries) {
|
||||||
const configFile = path.join(tmpDir, "codeql-config.yaml");
|
const configFile = path.join(tmpDir, "codeql-config.yaml");
|
||||||
fs.writeFileSync(configFile, inputFileContents);
|
fs.writeFileSync(configFile, inputFileContents);
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const { packs } = await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
const { packs } = await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
t.deepEqual(packs, {
|
t.deepEqual(packs, {
|
||||||
[languages_1.Language.javascript]: [
|
[languages_1.Language.javascript]: [
|
||||||
{
|
{
|
||||||
|
|
@ -632,7 +634,7 @@ function queriesToResolvedQueryForm(queries) {
|
||||||
fs.writeFileSync(configFile, inputFileContents);
|
fs.writeFileSync(configFile, inputFileContents);
|
||||||
fs.mkdirSync(path.join(tmpDir, "foo"));
|
fs.mkdirSync(path.join(tmpDir, "foo"));
|
||||||
const languages = "javascript,python,cpp";
|
const languages = "javascript,python,cpp";
|
||||||
const { packs, queries } = await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, false, { owner: "github", repo: "example" }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
const { packs, queries } = await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, false, "", "", { owner: "github", repo: "example" }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
t.deepEqual(packs, {
|
t.deepEqual(packs, {
|
||||||
[languages_1.Language.javascript]: [
|
[languages_1.Language.javascript]: [
|
||||||
{
|
{
|
||||||
|
|
@ -685,7 +687,7 @@ function doInvalidInputTest(testName, inputFileContents, expectedErrorMessageGen
|
||||||
const inputFile = path.join(tmpDir, configFile);
|
const inputFile = path.join(tmpDir, configFile);
|
||||||
fs.writeFileSync(inputFile, inputFileContents, "utf8");
|
fs.writeFileSync(inputFile, inputFileContents, "utf8");
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
@ -884,7 +886,7 @@ async function mlPoweredQueriesMacro(t, codeQLVersion, isMlPoweredQueriesFlagEna
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const { packs } = await configUtils.initConfig("javascript", queriesInput, undefined, undefined, undefined, false, { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)(isMlPoweredQueriesFlagEnabled
|
const { packs } = await configUtils.initConfig("javascript", queriesInput, undefined, undefined, undefined, false, "", "", { owner: "github", repo: "example " }, tmpDir, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, feature_flags_1.createFeatureFlags)(isMlPoweredQueriesFlagEnabled
|
||||||
? [feature_flags_1.FeatureFlag.MlPoweredQueriesEnabled]
|
? [feature_flags_1.FeatureFlag.MlPoweredQueriesEnabled]
|
||||||
: []), (0, logging_1.getRunnerLogger)(true));
|
: []), (0, logging_1.getRunnerLogger)(true));
|
||||||
if (shouldRunMlPoweredQueries) {
|
if (shouldRunMlPoweredQueries) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
2
lib/database-upload.js
generated
2
lib/database-upload.js
generated
|
|
@ -54,7 +54,7 @@ async function uploadDatabases(repositoryNwo, config, featureFlags, apiDetails,
|
||||||
// Although we are uploading arbitrary file contents to the API, it's worth
|
// Although we are uploading arbitrary file contents to the API, it's worth
|
||||||
// noting that it's the API's job to validate that the contents is acceptable.
|
// noting that it's the API's job to validate that the contents is acceptable.
|
||||||
// This API method is available to anyone with write access to the repo.
|
// This API method is available to anyone with write access to the repo.
|
||||||
const payload = fs.readFileSync(await (0, util_1.bundleDb)(config, language, codeql));
|
const payload = fs.readFileSync(await (0, util_1.bundleDb)(config, language, codeql, language));
|
||||||
try {
|
try {
|
||||||
if (useUploadDomain) {
|
if (useUploadDomain) {
|
||||||
await client.request(`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name`, {
|
await client.request(`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name`, {
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"database-upload.js","sourceRoot":"","sources":["../src/database-upload.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,4DAA8C;AAC9C,6CAA8D;AAC9D,qCAAqC;AAErC,mDAA4D;AAG5D,6CAA+B;AAC/B,iCAAkC;AAE3B,KAAK,UAAU,eAAe,CACnC,aAA4B,EAC5B,MAAc,EACd,YAA0B,EAC1B,UAA4B,EAC5B,MAAc;IAEd,IAAI,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,MAAM,EAAE;QAC9D,MAAM,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;QACvE,OAAO;KACR;IAED,iDAAiD;IACjD,IAAI,MAAM,CAAC,aAAa,C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AAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACf,4CAA4C;YAC5C,MAAM,CAAC,OAAO,CAAC,iCAAiC,QAAQ,KAAK,CAAC,EAAE,CAAC,CAAC;SACnE;KACF;AACH,CAAC;AA9ED,0CA8EC"}
|
||||||
2
lib/database-upload.test.js
generated
2
lib/database-upload.test.js
generated
|
|
@ -61,6 +61,8 @@ function getTestConfig(tmpDir) {
|
||||||
dbLocation: tmpDir,
|
dbLocation: tmpDir,
|
||||||
packs: {},
|
packs: {},
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
debugArtifactName: util_1.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
debugDatabaseName: util_1.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
async function mockHttpRequests(featureFlags, databaseUploadStatusCode) {
|
async function mockHttpRequests(featureFlags, databaseUploadStatusCode) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
2
lib/init-action.js
generated
2
lib/init-action.js
generated
|
|
@ -91,7 +91,7 @@ async function run() {
|
||||||
codeql = initCodeQLResult.codeql;
|
codeql = initCodeQLResult.codeql;
|
||||||
toolsVersion = initCodeQLResult.toolsVersion;
|
toolsVersion = initCodeQLResult.toolsVersion;
|
||||||
await (0, util_1.enrichEnvironment)(util_1.Mode.actions, codeql);
|
await (0, util_1.enrichEnvironment)(util_1.Mode.actions, codeql);
|
||||||
config = await (0, init_1.initConfig)((0, actions_util_1.getOptionalInput)("languages"), (0, actions_util_1.getOptionalInput)("queries"), (0, actions_util_1.getOptionalInput)("packs"), (0, actions_util_1.getOptionalInput)("config-file"), (0, actions_util_1.getOptionalInput)("db-location"), (0, actions_util_1.getOptionalInput)("debug") === "true", repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), (0, util_1.getRequiredEnvParam)("RUNNER_TOOL_CACHE"), codeql, (0, util_1.getRequiredEnvParam)("GITHUB_WORKSPACE"), gitHubVersion, apiDetails, featureFlags, logger);
|
config = await (0, init_1.initConfig)((0, actions_util_1.getOptionalInput)("languages"), (0, actions_util_1.getOptionalInput)("queries"), (0, actions_util_1.getOptionalInput)("packs"), (0, actions_util_1.getOptionalInput)("config-file"), (0, actions_util_1.getOptionalInput)("db-location"), (0, actions_util_1.getOptionalInput)("debug") === "true", (0, actions_util_1.getOptionalInput)("debug-artifact-name") || util_1.DEFAULT_DEBUG_ARTIFACT_NAME, (0, actions_util_1.getOptionalInput)("debug-database-name") || util_1.DEFAULT_DEBUG_DATABASE_NAME, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), (0, util_1.getRequiredEnvParam)("RUNNER_TOOL_CACHE"), codeql, (0, util_1.getRequiredEnvParam)("GITHUB_WORKSPACE"), gitHubVersion, apiDetails, featureFlags, logger);
|
||||||
if (config.languages.includes(languages_1.Language.python) &&
|
if (config.languages.includes(languages_1.Language.python) &&
|
||||||
(0, actions_util_1.getRequiredInput)("setup-python-dependencies") === "true") {
|
(0, actions_util_1.getRequiredInput)("setup-python-dependencies") === "true") {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
4
lib/init.js
generated
4
lib/init.js
generated
|
|
@ -38,9 +38,9 @@ async function initCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant,
|
||||||
return { codeql, toolsVersion };
|
return { codeql, toolsVersion };
|
||||||
}
|
}
|
||||||
exports.initCodeQL = initCodeQL;
|
exports.initCodeQL = initCodeQL;
|
||||||
async function initConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, debugMode, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureFlags, logger) {
|
async function initConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureFlags, logger) {
|
||||||
logger.startGroup("Load language configuration");
|
logger.startGroup("Load language configuration");
|
||||||
const config = await configUtils.initConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, debugMode, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureFlags, logger);
|
const config = await configUtils.initConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, toolCacheDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureFlags, logger);
|
||||||
analysisPaths.printPathFiltersWarning(config, logger);
|
analysisPaths.printPathFiltersWarning(config, logger);
|
||||||
logger.endGroup();
|
logger.endGroup();
|
||||||
return config;
|
return config;
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,yEAA2D;AAC3D,kEAAoD;AAEpD,gEAAkD;AAElD,qCAA2E;AAC3E,4DAA8C;AAI9C,mDAAwE;AACxE,6CAA+B;AAC/B,iCAA4C;AAErC,KAAK,UAAU,UAAU,CAC9B,SAA6B,EAC7B,UAA4B,EAC5B,OAAe,EACf,YAAoB,EACpB,OAA2B,EAC3B,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,oBAAW,EAChD,SAAS,EACT,UAAU,EACV,OAAO,EACP,YAAY,EACZ,OAAO,EACP,MAAM,EACN,IAAI,CACL,CAAC;IACF,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;IAC5B,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AAClC,CAAC;AArBD,gCAqBC;AAEM,KAAK,UAAU,UAAU,CAC9B,cAAkC,EAClC,YAAgC,EAChC,UAA8B,EAC9B,UAA8B,EAC9B,UAA8B,EAC9B,SAA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AC,IAAI,EAAE,CAAC;SACX;aAAM;YACL,MAAM,IAAI,UAAU,CAAC,UAAU,CAC7B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAC7C,CAAC,IAAI,EAAE,CAAC;SACV;QACD,MAAM,MAAM,GAAG,0BAA0B,CAAC;QAC1C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;YAChC,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;gBAC/D,IAAI;gBACJ,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;gBAChC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;aAC/B,CAAC,CAAC,IAAI,EAAE,CAAC;SACX;aAAM;YACL,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,EAAE;gBAChE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;aAC/B,CAAC,CAAC,IAAI,EAAE,CAAC;SACX;KACF;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,OAAO,CACZ,gFAAgF,CAAC,IAAI;YACnF,qGAAqG;YACrG,oGAAoG;YACpG,iDAAiD,CACpD,CAAC;QACF,OAAO;KACR;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAtCD,8CAsCC"}
|
||||||
2
lib/runner.js
generated
2
lib/runner.js
generated
|
|
@ -164,7 +164,7 @@ program
|
||||||
}
|
}
|
||||||
await (0, util_1.enrichEnvironment)(util_1.Mode.runner, codeql);
|
await (0, util_1.enrichEnvironment)(util_1.Mode.runner, codeql);
|
||||||
const workspacePath = checkoutPath;
|
const workspacePath = checkoutPath;
|
||||||
const config = await (0, init_1.initConfig)(cmd.languages, cmd.queries, cmd.packs, cmd.configFile, undefined, false, (0, repository_1.parseRepositoryNwo)(cmd.repository), tempDir, toolsDir, codeql, workspacePath, gitHubVersion, apiDetails, (0, feature_flags_1.createFeatureFlags)([]), logger);
|
const config = await (0, init_1.initConfig)(cmd.languages, cmd.queries, cmd.packs, cmd.configFile, undefined, false, "", "", (0, repository_1.parseRepositoryNwo)(cmd.repository), tempDir, toolsDir, codeql, workspacePath, gitHubVersion, apiDetails, (0, feature_flags_1.createFeatureFlags)([]), logger);
|
||||||
const sourceRoot = checkoutPath;
|
const sourceRoot = checkoutPath;
|
||||||
const tracerConfig = await (0, init_1.runInit)(codeql, config, sourceRoot, parseTraceProcessName(), parseTraceProcessLevel());
|
const tracerConfig = await (0, init_1.runInit)(codeql, config, sourceRoot, parseTraceProcessName(), parseTraceProcessLevel());
|
||||||
if (tracerConfig === undefined) {
|
if (tracerConfig === undefined) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
2
lib/tracer-config.test.js
generated
2
lib/tracer-config.test.js
generated
|
|
@ -45,6 +45,8 @@ function getTestConfig(tmpDir) {
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
||||||
packs: {},
|
packs: {},
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// A very minimal setup
|
// A very minimal setup
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
16
lib/util.js
generated
16
lib/util.js
generated
|
|
@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.isGoodVersion = exports.delay = exports.bundleDb = exports.codeQlVersionAbove = exports.isHTTPError = exports.HTTPError = exports.getRequiredEnvParam = exports.isActions = exports.getMode = exports.enrichEnvironment = exports.initializeEnvironment = exports.Mode = exports.assertNever = exports.getGitHubAuth = exports.apiVersionInRange = exports.DisallowedAPIVersionReason = exports.checkGitHubVersionInRange = exports.getGitHubVersion = exports.GitHubVariant = exports.parseGitHubUrl = exports.getCodeQLDatabasePath = exports.getThreadsFlag = exports.getThreadsFlagValue = exports.getAddSnippetsFlag = exports.getMemoryFlag = exports.getMemoryFlagValue = exports.withTmpDir = exports.getToolNames = exports.getExtraOptionsEnvParam = exports.DEBUG_ARTIFACT_NAME = exports.GITHUB_DOTCOM_URL = void 0;
|
exports.isGoodVersion = exports.delay = exports.bundleDb = exports.codeQlVersionAbove = exports.isHTTPError = exports.HTTPError = exports.getRequiredEnvParam = exports.isActions = exports.getMode = exports.enrichEnvironment = exports.initializeEnvironment = exports.Mode = exports.assertNever = exports.getGitHubAuth = exports.apiVersionInRange = exports.DisallowedAPIVersionReason = exports.checkGitHubVersionInRange = exports.getGitHubVersion = exports.GitHubVariant = exports.parseGitHubUrl = exports.getCodeQLDatabasePath = exports.getThreadsFlag = exports.getThreadsFlagValue = exports.getAddSnippetsFlag = exports.getMemoryFlag = exports.getMemoryFlagValue = exports.withTmpDir = exports.getToolNames = exports.getExtraOptionsEnvParam = exports.DEFAULT_DEBUG_DATABASE_NAME = exports.DEFAULT_DEBUG_ARTIFACT_NAME = exports.GITHUB_DOTCOM_URL = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const os = __importStar(require("os"));
|
const os = __importStar(require("os"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
|
|
@ -42,9 +42,13 @@ const BROKEN_VERSIONS = ["0.0.0-20211207"];
|
||||||
*/
|
*/
|
||||||
exports.GITHUB_DOTCOM_URL = "https://github.com";
|
exports.GITHUB_DOTCOM_URL = "https://github.com";
|
||||||
/**
|
/**
|
||||||
* Name of the debugging artifact.
|
* Default name of the debugging artifact.
|
||||||
*/
|
*/
|
||||||
exports.DEBUG_ARTIFACT_NAME = "debug-artifacts";
|
exports.DEFAULT_DEBUG_ARTIFACT_NAME = "debug-artifacts";
|
||||||
|
/**
|
||||||
|
* Default name of the database in the debugging artifact.
|
||||||
|
*/
|
||||||
|
exports.DEFAULT_DEBUG_DATABASE_NAME = "db";
|
||||||
/**
|
/**
|
||||||
* Get the extra options for the codeql commands.
|
* Get the extra options for the codeql commands.
|
||||||
*/
|
*/
|
||||||
|
|
@ -492,9 +496,9 @@ async function codeQlVersionAbove(codeql, requiredVersion) {
|
||||||
}
|
}
|
||||||
exports.codeQlVersionAbove = codeQlVersionAbove;
|
exports.codeQlVersionAbove = codeQlVersionAbove;
|
||||||
// Create a bundle for the given DB, if it doesn't already exist
|
// Create a bundle for the given DB, if it doesn't already exist
|
||||||
async function bundleDb(config, language, codeql) {
|
async function bundleDb(config, language, codeql, dbName) {
|
||||||
const databasePath = getCodeQLDatabasePath(config, language);
|
const databasePath = getCodeQLDatabasePath(config, language);
|
||||||
const databaseBundlePath = path.resolve(config.dbLocation, `${databasePath}.zip`);
|
const databaseBundlePath = path.resolve(config.dbLocation, `${dbName}.zip`);
|
||||||
// For a tiny bit of added safety, delete the file if it exists.
|
// For a tiny bit of added safety, delete the file if it exists.
|
||||||
// The file is probably from an earlier call to this function, either
|
// The file is probably from an earlier call to this function, either
|
||||||
// as part of this action step or a previous one, but it could also be
|
// as part of this action step or a previous one, but it could also be
|
||||||
|
|
@ -503,7 +507,7 @@ async function bundleDb(config, language, codeql) {
|
||||||
if (fs.existsSync(databaseBundlePath)) {
|
if (fs.existsSync(databaseBundlePath)) {
|
||||||
await (0, del_1.default)(databaseBundlePath, { force: true });
|
await (0, del_1.default)(databaseBundlePath, { force: true });
|
||||||
}
|
}
|
||||||
await codeql.databaseBundle(databasePath, databaseBundlePath);
|
await codeql.databaseBundle(databasePath, databaseBundlePath, dbName);
|
||||||
return databaseBundlePath;
|
return databaseBundlePath;
|
||||||
}
|
}
|
||||||
exports.bundleDb = bundleDb;
|
exports.bundleDb = bundleDb;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -6,6 +6,8 @@ steps:
|
||||||
with:
|
with:
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
debug: true
|
debug: true
|
||||||
|
debug-artifact-name: "my-debug-artifacts"
|
||||||
|
debug-database-name: "my-db"
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
|
|
@ -13,7 +15,7 @@ steps:
|
||||||
id: analysis
|
id: analysis
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: debug-artifacts-${{ matrix.os }}-${{ matrix.version }}
|
name: my-debug-artifacts-${{ matrix.os }}-${{ matrix.version }}
|
||||||
- shell: bash
|
- shell: bash
|
||||||
run: |
|
run: |
|
||||||
LANGUAGES="cpp csharp go java javascript python"
|
LANGUAGES="cpp csharp go java javascript python"
|
||||||
|
|
@ -23,7 +25,7 @@ steps:
|
||||||
echo "Missing a SARIF file for $language"
|
echo "Missing a SARIF file for $language"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ ! -f "$language.zip" ]] ; then
|
if [[ ! -f "my-db-$language.zip" ]] ; then
|
||||||
echo "Missing a database bundle for $language"
|
echo "Missing a database bundle for $language"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ test("emptyPaths", async (t) => {
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
||||||
packs: {},
|
packs: {},
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
};
|
};
|
||||||
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
||||||
t.is(process.env["LGTM_INDEX_INCLUDE"], undefined);
|
t.is(process.env["LGTM_INDEX_INCLUDE"], undefined);
|
||||||
|
|
@ -46,6 +48,8 @@ test("nonEmptyPaths", async (t) => {
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
||||||
packs: {},
|
packs: {},
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
};
|
};
|
||||||
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
||||||
t.is(process.env["LGTM_INDEX_INCLUDE"], "path1\npath2");
|
t.is(process.env["LGTM_INDEX_INCLUDE"], "path1\npath2");
|
||||||
|
|
@ -73,6 +77,8 @@ test("exclude temp dir", async (t) => {
|
||||||
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||||
packs: {},
|
packs: {},
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
};
|
};
|
||||||
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
||||||
t.is(process.env["LGTM_INDEX_INCLUDE"], undefined);
|
t.is(process.env["LGTM_INDEX_INCLUDE"], undefined);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import { parseRepositoryNwo } from "./repository";
|
||||||
import * as upload_lib from "./upload-lib";
|
import * as upload_lib from "./upload-lib";
|
||||||
import { UploadResult } from "./upload-lib";
|
import { UploadResult } from "./upload-lib";
|
||||||
import * as util from "./util";
|
import * as util from "./util";
|
||||||
import { bundleDb, codeQlVersionAbove, DEBUG_ARTIFACT_NAME } from "./util";
|
import { bundleDb, codeQlVersionAbove } from "./util";
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-commonjs
|
// eslint-disable-next-line import/no-commonjs
|
||||||
const pkg = require("../package.json");
|
const pkg = require("../package.json");
|
||||||
|
|
@ -135,7 +135,8 @@ async function run() {
|
||||||
config.languages.map((lang) =>
|
config.languages.map((lang) =>
|
||||||
path.resolve(outputDir, `${lang}.sarif`)
|
path.resolve(outputDir, `${lang}.sarif`)
|
||||||
),
|
),
|
||||||
outputDir
|
outputDir,
|
||||||
|
config.debugArtifactName
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -156,12 +157,17 @@ async function run() {
|
||||||
// Multilanguage tracing: there are additional logs in the root of the cluster
|
// Multilanguage tracing: there are additional logs in the root of the cluster
|
||||||
toUpload.push(...listFolder(path.resolve(config.dbLocation, "log")));
|
toUpload.push(...listFolder(path.resolve(config.dbLocation, "log")));
|
||||||
}
|
}
|
||||||
await uploadDebugArtifacts(toUpload, config.dbLocation);
|
await uploadDebugArtifacts(
|
||||||
|
toUpload,
|
||||||
|
config.dbLocation,
|
||||||
|
config.debugArtifactName
|
||||||
|
);
|
||||||
if (!(await codeQlVersionAbove(codeql, CODEQL_VERSION_NEW_TRACING))) {
|
if (!(await codeQlVersionAbove(codeql, CODEQL_VERSION_NEW_TRACING))) {
|
||||||
// Before multi-language tracing, we wrote a compound-build-tracer.log in the temp dir
|
// Before multi-language tracing, we wrote a compound-build-tracer.log in the temp dir
|
||||||
await uploadDebugArtifacts(
|
await uploadDebugArtifacts(
|
||||||
[path.resolve(config.tempDir, "compound-build-tracer.log")],
|
[path.resolve(config.tempDir, "compound-build-tracer.log")],
|
||||||
config.tempDir
|
config.tempDir,
|
||||||
|
config.debugArtifactName
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -232,10 +238,19 @@ async function run() {
|
||||||
const toUpload: string[] = [];
|
const toUpload: string[] = [];
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
toUpload.push(
|
toUpload.push(
|
||||||
await bundleDb(config, language, await getCodeQL(config.codeQLCmd))
|
await bundleDb(
|
||||||
|
config,
|
||||||
|
language,
|
||||||
|
await getCodeQL(config.codeQLCmd),
|
||||||
|
`${config.debugDatabaseName}-${language}`
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await uploadDebugArtifacts(toUpload, config.dbLocation);
|
await uploadDebugArtifacts(
|
||||||
|
toUpload,
|
||||||
|
config.dbLocation,
|
||||||
|
config.debugArtifactName
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(`Failed to upload database debug bundles: ${error}`);
|
console.log(`Failed to upload database debug bundles: ${error}`);
|
||||||
}
|
}
|
||||||
|
|
@ -280,7 +295,11 @@ async function run() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function uploadDebugArtifacts(toUpload: string[], rootDir: string) {
|
async function uploadDebugArtifacts(
|
||||||
|
toUpload: string[],
|
||||||
|
rootDir: string,
|
||||||
|
artifactName: string
|
||||||
|
) {
|
||||||
let suffix = "";
|
let suffix = "";
|
||||||
const matrix = actionsUtil.getRequiredInput("matrix");
|
const matrix = actionsUtil.getRequiredInput("matrix");
|
||||||
if (matrix !== undefined && matrix !== "null") {
|
if (matrix !== undefined && matrix !== "null") {
|
||||||
|
|
@ -288,7 +307,7 @@ async function uploadDebugArtifacts(toUpload: string[], rootDir: string) {
|
||||||
suffix += `-${entry[1]}`;
|
suffix += `-${entry[1]}`;
|
||||||
}
|
}
|
||||||
await artifact.create().uploadArtifact(
|
await artifact.create().uploadArtifact(
|
||||||
actionsUtil.sanitizeArifactName(`${DEBUG_ARTIFACT_NAME}${suffix}`),
|
actionsUtil.sanitizeArifactName(`${artifactName}${suffix}`),
|
||||||
toUpload.map((file) => path.normalize(file)),
|
toUpload.map((file) => path.normalize(file)),
|
||||||
path.normalize(rootDir)
|
path.normalize(rootDir)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,8 @@ test("status report fields and search path setting", async (t) => {
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
||||||
packs,
|
packs,
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
};
|
};
|
||||||
fs.mkdirSync(util.getCodeQLDatabasePath(config, language), {
|
fs.mkdirSync(util.getCodeQLDatabasePath(config, language), {
|
||||||
recursive: true,
|
recursive: true,
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,11 @@ export interface CodeQL {
|
||||||
/**
|
/**
|
||||||
* Run 'codeql database bundle'.
|
* Run 'codeql database bundle'.
|
||||||
*/
|
*/
|
||||||
databaseBundle(databasePath: string, outputFilePath: string): Promise<void>;
|
databaseBundle(
|
||||||
|
databasePath: string,
|
||||||
|
outputFilePath: string,
|
||||||
|
dbName: string
|
||||||
|
): Promise<void>;
|
||||||
/**
|
/**
|
||||||
* Run 'codeql database run-queries'.
|
* Run 'codeql database run-queries'.
|
||||||
*/
|
*/
|
||||||
|
|
@ -957,13 +961,15 @@ async function getCodeQLForCmd(
|
||||||
},
|
},
|
||||||
async databaseBundle(
|
async databaseBundle(
|
||||||
databasePath: string,
|
databasePath: string,
|
||||||
outputFilePath: string
|
outputFilePath: string,
|
||||||
|
databaseName: string
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const args = [
|
const args = [
|
||||||
"database",
|
"database",
|
||||||
"bundle",
|
"bundle",
|
||||||
databasePath,
|
databasePath,
|
||||||
`--output=${outputFilePath}`,
|
`--output=${outputFilePath}`,
|
||||||
|
`--name=${databaseName}`,
|
||||||
];
|
];
|
||||||
await new toolrunner.ToolRunner(cmd, args).exec();
|
await new toolrunner.ToolRunner(cmd, args).exec();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,8 @@ test("load empty config", async (t) => {
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -106,6 +108,8 @@ test("load empty config", async (t) => {
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -150,6 +154,8 @@ test("loading config saves config", async (t) => {
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -180,6 +186,8 @@ test("load input outside of workspace", async (t) => {
|
||||||
"../input",
|
"../input",
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -217,6 +225,8 @@ test("load non-local input with invalid repo syntax", async (t) => {
|
||||||
configFile,
|
configFile,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -255,6 +265,8 @@ test("load non-existent input", async (t) => {
|
||||||
configFile,
|
configFile,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -340,6 +352,8 @@ test("load non-empty input", async (t) => {
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
||||||
packs: {} as configUtils.Packs,
|
packs: {} as configUtils.Packs,
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
debugArtifactName: "my-artifact",
|
||||||
|
debugDatabaseName: "my-db",
|
||||||
};
|
};
|
||||||
|
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
|
|
@ -352,6 +366,8 @@ test("load non-empty input", async (t) => {
|
||||||
configFilePath,
|
configFilePath,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"my-artifact",
|
||||||
|
"my-db",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -417,6 +433,8 @@ test("Default queries are used", async (t) => {
|
||||||
configFilePath,
|
configFilePath,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -490,6 +508,8 @@ test("Queries can be specified in config file", async (t) => {
|
||||||
configFilePath,
|
configFilePath,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -557,6 +577,8 @@ test("Queries from config file can be overridden in workflow file", async (t) =>
|
||||||
configFilePath,
|
configFilePath,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -622,6 +644,8 @@ test("Queries in workflow file can be used in tandem with the 'disable default q
|
||||||
configFilePath,
|
configFilePath,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -680,6 +704,8 @@ test("Multiple queries can be specified in workflow file, no config file require
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -759,6 +785,8 @@ test("Queries in workflow file can be added to the set of queries without overri
|
||||||
configFilePath,
|
configFilePath,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -828,6 +856,8 @@ test("Invalid queries in workflow file handled correctly", async (t) => {
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -894,6 +924,8 @@ test("API client used when reading remote config", async (t) => {
|
||||||
configFile,
|
configFile,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -922,6 +954,8 @@ test("Remote config handles the case where a directory is provided", async (t) =
|
||||||
repoReference,
|
repoReference,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -958,6 +992,8 @@ test("Invalid format of remote config handled correctly", async (t) => {
|
||||||
repoReference,
|
repoReference,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -995,6 +1031,8 @@ test("No detected languages", async (t) => {
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -1024,6 +1062,8 @@ test("Unknown languages", async (t) => {
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -1075,6 +1115,8 @@ test("Config specifies packages", async (t) => {
|
||||||
configFile,
|
configFile,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -1135,6 +1177,8 @@ test("Config specifies packages for multiple languages", async (t) => {
|
||||||
configFile,
|
configFile,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example" },
|
{ owner: "github", repo: "example" },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -1211,6 +1255,8 @@ function doInvalidInputTest(
|
||||||
configFile,
|
configFile,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
@ -1684,6 +1730,8 @@ async function mlPoweredQueriesMacro(
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
{ owner: "github", repo: "example " },
|
{ owner: "github", repo: "example " },
|
||||||
tmpDir,
|
tmpDir,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,14 @@ export interface Config {
|
||||||
* output for debugging purposes when possible.
|
* output for debugging purposes when possible.
|
||||||
*/
|
*/
|
||||||
debugMode: boolean;
|
debugMode: boolean;
|
||||||
|
/**
|
||||||
|
* Specifies the name of the debugging artifact if we are in debug mode.
|
||||||
|
*/
|
||||||
|
debugArtifactName: string;
|
||||||
|
/**
|
||||||
|
* Specifies the name of the database in the debugging artifact.
|
||||||
|
*/
|
||||||
|
debugDatabaseName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Packs = Partial<Record<Language, PackWithVersion[]>>;
|
export type Packs = Partial<Record<Language, PackWithVersion[]>>;
|
||||||
|
|
@ -852,6 +860,8 @@ export async function getDefaultConfig(
|
||||||
packsInput: string | undefined,
|
packsInput: string | undefined,
|
||||||
dbLocation: string | undefined,
|
dbLocation: string | undefined,
|
||||||
debugMode: boolean,
|
debugMode: boolean,
|
||||||
|
debugArtifactName: string,
|
||||||
|
debugDatabaseName: string,
|
||||||
repository: RepositoryNwo,
|
repository: RepositoryNwo,
|
||||||
tempDir: string,
|
tempDir: string,
|
||||||
toolCacheDir: string,
|
toolCacheDir: string,
|
||||||
|
|
@ -906,6 +916,8 @@ export async function getDefaultConfig(
|
||||||
gitHubVersion,
|
gitHubVersion,
|
||||||
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
||||||
debugMode,
|
debugMode,
|
||||||
|
debugArtifactName,
|
||||||
|
debugDatabaseName,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -919,6 +931,8 @@ async function loadConfig(
|
||||||
configFile: string,
|
configFile: string,
|
||||||
dbLocation: string | undefined,
|
dbLocation: string | undefined,
|
||||||
debugMode: boolean,
|
debugMode: boolean,
|
||||||
|
debugArtifactName: string,
|
||||||
|
debugDatabaseName: string,
|
||||||
repository: RepositoryNwo,
|
repository: RepositoryNwo,
|
||||||
tempDir: string,
|
tempDir: string,
|
||||||
toolCacheDir: string,
|
toolCacheDir: string,
|
||||||
|
|
@ -1081,6 +1095,8 @@ async function loadConfig(
|
||||||
gitHubVersion,
|
gitHubVersion,
|
||||||
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
||||||
debugMode,
|
debugMode,
|
||||||
|
debugArtifactName,
|
||||||
|
debugDatabaseName,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1251,6 +1267,8 @@ export async function initConfig(
|
||||||
configFile: string | undefined,
|
configFile: string | undefined,
|
||||||
dbLocation: string | undefined,
|
dbLocation: string | undefined,
|
||||||
debugMode: boolean,
|
debugMode: boolean,
|
||||||
|
debugArtifactName: string,
|
||||||
|
debugDatabaseName: string,
|
||||||
repository: RepositoryNwo,
|
repository: RepositoryNwo,
|
||||||
tempDir: string,
|
tempDir: string,
|
||||||
toolCacheDir: string,
|
toolCacheDir: string,
|
||||||
|
|
@ -1272,6 +1290,8 @@ export async function initConfig(
|
||||||
packsInput,
|
packsInput,
|
||||||
dbLocation,
|
dbLocation,
|
||||||
debugMode,
|
debugMode,
|
||||||
|
debugArtifactName,
|
||||||
|
debugDatabaseName,
|
||||||
repository,
|
repository,
|
||||||
tempDir,
|
tempDir,
|
||||||
toolCacheDir,
|
toolCacheDir,
|
||||||
|
|
@ -1290,6 +1310,8 @@ export async function initConfig(
|
||||||
configFile,
|
configFile,
|
||||||
dbLocation,
|
dbLocation,
|
||||||
debugMode,
|
debugMode,
|
||||||
|
debugArtifactName,
|
||||||
|
debugDatabaseName,
|
||||||
repository,
|
repository,
|
||||||
tempDir,
|
tempDir,
|
||||||
toolCacheDir,
|
toolCacheDir,
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ import {
|
||||||
setupTests,
|
setupTests,
|
||||||
} from "./testing-utils";
|
} from "./testing-utils";
|
||||||
import {
|
import {
|
||||||
|
DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
GitHubVariant,
|
GitHubVariant,
|
||||||
HTTPError,
|
HTTPError,
|
||||||
initializeEnvironment,
|
initializeEnvironment,
|
||||||
|
|
@ -58,6 +60,8 @@ function getTestConfig(tmpDir: string): Config {
|
||||||
dbLocation: tmpDir,
|
dbLocation: tmpDir,
|
||||||
packs: {},
|
packs: {},
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
debugArtifactName: DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
debugDatabaseName: DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,9 @@ export async function uploadDatabases(
|
||||||
// Although we are uploading arbitrary file contents to the API, it's worth
|
// Although we are uploading arbitrary file contents to the API, it's worth
|
||||||
// noting that it's the API's job to validate that the contents is acceptable.
|
// noting that it's the API's job to validate that the contents is acceptable.
|
||||||
// This API method is available to anyone with write access to the repo.
|
// This API method is available to anyone with write access to the repo.
|
||||||
const payload = fs.readFileSync(await bundleDb(config, language, codeql));
|
const payload = fs.readFileSync(
|
||||||
|
await bundleDb(config, language, codeql, language)
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
if (useUploadDomain) {
|
if (useUploadDomain) {
|
||||||
await client.request(
|
await client.request(
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@ import {
|
||||||
enrichEnvironment,
|
enrichEnvironment,
|
||||||
getMemoryFlagValue,
|
getMemoryFlagValue,
|
||||||
getThreadsFlagValue,
|
getThreadsFlagValue,
|
||||||
|
DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
} from "./util";
|
} from "./util";
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-commonjs
|
// eslint-disable-next-line import/no-commonjs
|
||||||
|
|
@ -177,6 +179,8 @@ async function run() {
|
||||||
getOptionalInput("config-file"),
|
getOptionalInput("config-file"),
|
||||||
getOptionalInput("db-location"),
|
getOptionalInput("db-location"),
|
||||||
getOptionalInput("debug") === "true",
|
getOptionalInput("debug") === "true",
|
||||||
|
getOptionalInput("debug-artifact-name") || DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
getOptionalInput("debug-database-name") || DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
repositoryNwo,
|
repositoryNwo,
|
||||||
getTemporaryDirectory(),
|
getTemporaryDirectory(),
|
||||||
getRequiredEnvParam("RUNNER_TOOL_CACHE"),
|
getRequiredEnvParam("RUNNER_TOOL_CACHE"),
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ export async function initConfig(
|
||||||
configFile: string | undefined,
|
configFile: string | undefined,
|
||||||
dbLocation: string | undefined,
|
dbLocation: string | undefined,
|
||||||
debugMode: boolean,
|
debugMode: boolean,
|
||||||
|
debugArtifactName: string,
|
||||||
|
debugDatabaseName: string,
|
||||||
repository: RepositoryNwo,
|
repository: RepositoryNwo,
|
||||||
tempDir: string,
|
tempDir: string,
|
||||||
toolCacheDir: string,
|
toolCacheDir: string,
|
||||||
|
|
@ -63,6 +65,8 @@ export async function initConfig(
|
||||||
configFile,
|
configFile,
|
||||||
dbLocation,
|
dbLocation,
|
||||||
debugMode,
|
debugMode,
|
||||||
|
debugArtifactName,
|
||||||
|
debugDatabaseName,
|
||||||
repository,
|
repository,
|
||||||
tempDir,
|
tempDir,
|
||||||
toolCacheDir,
|
toolCacheDir,
|
||||||
|
|
|
||||||
|
|
@ -252,6 +252,8 @@ program
|
||||||
cmd.configFile,
|
cmd.configFile,
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
parseRepositoryNwo(cmd.repository),
|
parseRepositoryNwo(cmd.repository),
|
||||||
tempDir,
|
tempDir,
|
||||||
toolsDir,
|
toolsDir,
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ function getTestConfig(tmpDir: string): configUtils.Config {
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
||||||
packs: {},
|
packs: {},
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
19
src/util.ts
19
src/util.ts
|
|
@ -26,9 +26,14 @@ const BROKEN_VERSIONS = ["0.0.0-20211207"];
|
||||||
export const GITHUB_DOTCOM_URL = "https://github.com";
|
export const GITHUB_DOTCOM_URL = "https://github.com";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the debugging artifact.
|
* Default name of the debugging artifact.
|
||||||
*/
|
*/
|
||||||
export const DEBUG_ARTIFACT_NAME = "debug-artifacts";
|
export const DEFAULT_DEBUG_ARTIFACT_NAME = "debug-artifacts";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default name of the database in the debugging artifact.
|
||||||
|
*/
|
||||||
|
export const DEFAULT_DEBUG_DATABASE_NAME = "db";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the extra options for the codeql commands.
|
* Get the extra options for the codeql commands.
|
||||||
|
|
@ -559,13 +564,11 @@ export async function codeQlVersionAbove(
|
||||||
export async function bundleDb(
|
export async function bundleDb(
|
||||||
config: Config,
|
config: Config,
|
||||||
language: Language,
|
language: Language,
|
||||||
codeql: CodeQL
|
codeql: CodeQL,
|
||||||
|
dbName: string
|
||||||
) {
|
) {
|
||||||
const databasePath = getCodeQLDatabasePath(config, language);
|
const databasePath = getCodeQLDatabasePath(config, language);
|
||||||
const databaseBundlePath = path.resolve(
|
const databaseBundlePath = path.resolve(config.dbLocation, `${dbName}.zip`);
|
||||||
config.dbLocation,
|
|
||||||
`${databasePath}.zip`
|
|
||||||
);
|
|
||||||
// For a tiny bit of added safety, delete the file if it exists.
|
// For a tiny bit of added safety, delete the file if it exists.
|
||||||
// The file is probably from an earlier call to this function, either
|
// The file is probably from an earlier call to this function, either
|
||||||
// as part of this action step or a previous one, but it could also be
|
// as part of this action step or a previous one, but it could also be
|
||||||
|
|
@ -574,7 +577,7 @@ export async function bundleDb(
|
||||||
if (fs.existsSync(databaseBundlePath)) {
|
if (fs.existsSync(databaseBundlePath)) {
|
||||||
await del(databaseBundlePath, { force: true });
|
await del(databaseBundlePath, { force: true });
|
||||||
}
|
}
|
||||||
await codeql.databaseBundle(databasePath, databaseBundlePath);
|
await codeql.databaseBundle(databasePath, databaseBundlePath, dbName);
|
||||||
return databaseBundlePath;
|
return databaseBundlePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue