remove direct accesses to RUNNER_TEMP

This commit is contained in:
Robert Brignull 2020-08-19 15:25:27 +01:00
parent 9c29fe283d
commit 360e77a083
18 changed files with 55 additions and 56 deletions

10
lib/config-utils.js generated
View file

@ -130,7 +130,7 @@ async function addLocalQueries(configFile, resultMap, localQueryPath) {
/**
* Retrieve the set of queries at the referenced remote repo and add them to resultMap.
*/
async function addRemoteQueries(configFile, resultMap, queryUses) {
async function addRemoteQueries(configFile, resultMap, queryUses, tempDir) {
let tok = queryUses.split('@');
if (tok.length !== 2) {
throw new Error(getQueryUsesInvalid(configFile, queryUses));
@ -149,7 +149,7 @@ async function addRemoteQueries(configFile, resultMap, queryUses) {
}
const nwo = tok[0] + '/' + tok[1];
// Checkout the external repository
const rootOfRepo = await externalQueries.checkoutExternalRepository(nwo, ref);
const rootOfRepo = await externalQueries.checkoutExternalRepository(nwo, ref, tempDir);
const queryPath = tok.length > 2
? path.join(rootOfRepo, tok.slice(2).join('/'))
: rootOfRepo;
@ -163,7 +163,7 @@ async function addRemoteQueries(configFile, resultMap, queryUses) {
* local paths starting with './', or references to remote repos, or
* a finite set of hardcoded terms for builtin suites.
*/
async function parseQueryUses(configFile, languages, resultMap, queryUses) {
async function parseQueryUses(configFile, languages, resultMap, queryUses, tempDir) {
queryUses = queryUses.trim();
if (queryUses === "") {
throw new Error(getQueryUsesInvalid(configFile));
@ -179,7 +179,7 @@ async function parseQueryUses(configFile, languages, resultMap, queryUses) {
return;
}
// Otherwise, must be a reference to another repo
await addRemoteQueries(configFile, resultMap, queryUses);
await addRemoteQueries(configFile, resultMap, queryUses, tempDir);
}
// Regex validating stars in paths or paths-ignore entries.
// The intention is to only allow ** to appear when immediately
@ -451,7 +451,7 @@ async function loadConfig(configFile, tempDir, toolCacheDir) {
if (!(QUERIES_USES_PROPERTY in query) || typeof query[QUERIES_USES_PROPERTY] !== "string") {
throw new Error(getQueryUsesInvalid(configFile));
}
await parseQueryUses(configFile, languages, queries, query[QUERIES_USES_PROPERTY]);
await parseQueryUses(configFile, languages, queries, query[QUERIES_USES_PROPERTY], tempDir);
}
}
if (PATHS_IGNORE_PROPERTY in parsedYAML) {