Merge pull request #2120 from github/henrymercer/no-autobuild-action-necessary-with-build-mode
Allow omitting the autobuild Action when build mode specified
This commit is contained in:
Коммит
fc9f9e5ef9
|
@ -0,0 +1,88 @@
|
|||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
|
||||
# to regenerate this file.
|
||||
|
||||
name: PR Check - Build mode autobuild
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
build-mode-autobuild:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: nightly-latest
|
||||
name: Build mode autobuild
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v5
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/actions/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
use-all-platform-bundle: 'false'
|
||||
- name: Set environment variable for Swift enablement
|
||||
if: runner.os != 'Windows' && matrix.version == '20221211'
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- name: Set up Java test repo configuration
|
||||
run: |
|
||||
mv * .github ../action/tests/multi-language-repo/
|
||||
mv ../action/tests/multi-language-repo/.github/workflows .github
|
||||
mv ../action/tests/java-repo/* .
|
||||
|
||||
- uses: ./../action/init
|
||||
id: init
|
||||
with:
|
||||
build-mode: autobuild
|
||||
db-location: ${{ runner.temp }}/customDbLocation
|
||||
languages: java
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
|
||||
- name: Validate database build mode
|
||||
run: |
|
||||
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
|
||||
build_mode=$(yq eval '.buildMode' "$metadata_path")
|
||||
if [[ "$build_mode" != "autobuild" ]]; then
|
||||
echo "Expected build mode to be 'autobuild' but was $build_mode"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- uses: ./../action/analyze
|
||||
env:
|
||||
CODEQL_ACTION_TEST_MODE: true
|
|
@ -0,0 +1,90 @@
|
|||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
|
||||
# to regenerate this file.
|
||||
|
||||
name: PR Check - Build mode manual
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v*
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
build-mode-manual:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: nightly-latest
|
||||
name: Build mode manual
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Setup Python on MacOS
|
||||
uses: actions/setup-python@v5
|
||||
if: >-
|
||||
matrix.os == 'macos-latest' && (
|
||||
|
||||
matrix.version == 'stable-20221211' ||
|
||||
|
||||
matrix.version == 'stable-20230418' ||
|
||||
|
||||
matrix.version == 'stable-v2.13.5' ||
|
||||
|
||||
matrix.version == 'stable-v2.14.6')
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/actions/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
use-all-platform-bundle: 'false'
|
||||
- name: Set environment variable for Swift enablement
|
||||
if: runner.os != 'Windows' && matrix.version == '20221211'
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: ./../action/init
|
||||
id: init
|
||||
with:
|
||||
build-mode: manual
|
||||
db-location: ${{ runner.temp }}/customDbLocation
|
||||
languages: java
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
|
||||
- name: Validate database build mode
|
||||
run: |
|
||||
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
|
||||
build_mode=$(yq eval '.buildMode' "$metadata_path")
|
||||
if [[ "$build_mode" != "manual" ]]; then
|
||||
echo "Expected build mode to be 'manual' but was $build_mode"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- uses: ./../action/.github/actions/setup-swift
|
||||
with:
|
||||
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
|
||||
- uses: ./../action/analyze
|
||||
env:
|
||||
CODEQL_ACTION_TEST_MODE: true
|
|
@ -79,7 +79,10 @@ jobs:
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# The latest nightly supports omitting the autobuild Action when the build mode is specified.
|
||||
- uses: ./../action/autobuild
|
||||
if: matrix.version != 'nightly-latest'
|
||||
|
||||
- uses: ./../action/analyze
|
||||
env:
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
|
|
|
@ -31,7 +31,6 @@ const fs = __importStar(require("fs"));
|
|||
const path_1 = __importDefault(require("path"));
|
||||
const perf_hooks_1 = require("perf_hooks");
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const safe_which_1 = require("@chrisgavin/safe-which");
|
||||
const actionsUtil = __importStar(require("./actions-util"));
|
||||
const analyze_1 = require("./analyze");
|
||||
const api_client_1 = require("./api-client");
|
||||
|
@ -39,7 +38,6 @@ const autobuild_1 = require("./autobuild");
|
|||
const codeql_1 = require("./codeql");
|
||||
const config_utils_1 = require("./config-utils");
|
||||
const database_upload_1 = require("./database-upload");
|
||||
const diagnostics_1 = require("./diagnostics");
|
||||
const environment_1 = require("./environment");
|
||||
const feature_flags_1 = require("./feature-flags");
|
||||
const languages_1 = require("./languages");
|
||||
|
@ -111,6 +109,10 @@ async function runAutobuildIfLegacyGoWorkflow(config, logger) {
|
|||
if (!config.languages.includes(languages_1.Language.go)) {
|
||||
return;
|
||||
}
|
||||
if (config.buildMode) {
|
||||
logger.debug("Skipping legacy Go autobuild since a build mode has been specified.");
|
||||
return;
|
||||
}
|
||||
if (process.env[environment_1.EnvVar.DID_AUTOBUILD_GOLANG] === "true") {
|
||||
logger.debug("Won't run Go autobuild since it has already been run.");
|
||||
return;
|
||||
|
@ -161,29 +163,7 @@ async function run() {
|
|||
util.checkActionVersion(actionsUtil.getActionVersion(), gitHubVersion);
|
||||
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger);
|
||||
const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"], logger);
|
||||
// Check that `which go` still points at the same path it did when the `init` Action ran to ensure that no steps
|
||||
// in-between performed any setup. We encourage users to perform all setup tasks before initializing CodeQL so that
|
||||
// the setup tasks do not interfere with our analysis.
|
||||
// Furthermore, if we installed a wrapper script in the `init` Action, we need to ensure that there isn't a step
|
||||
// in the workflow after the `init` step which installs a different version of Go and takes precedence in the PATH,
|
||||
// thus potentially circumventing our workaround that allows tracing to work.
|
||||
const goInitPath = process.env[environment_1.EnvVar.GO_BINARY_LOCATION];
|
||||
if (process.env[environment_1.EnvVar.DID_AUTOBUILD_GOLANG] !== "true" &&
|
||||
goInitPath !== undefined) {
|
||||
const goBinaryPath = await (0, safe_which_1.safeWhich)("go");
|
||||
if (goInitPath !== goBinaryPath) {
|
||||
core.warning(`Expected \`which go\` to return ${goInitPath}, but got ${goBinaryPath}: please ensure that the correct version of Go is installed before the \`codeql-action/init\` Action is used.`);
|
||||
(0, diagnostics_1.addDiagnostic)(config, languages_1.Language.go, (0, diagnostics_1.makeDiagnostic)("go/workflow/go-installed-after-codeql-init", "Go was installed after the `codeql-action/init` Action was run", {
|
||||
markdownMessage: "To avoid interfering with the CodeQL analysis, perform all installation steps before calling the `github/codeql-action/init` Action.",
|
||||
visibility: {
|
||||
statusPage: true,
|
||||
telemetry: true,
|
||||
cliSummaryTable: true,
|
||||
},
|
||||
severity: "warning",
|
||||
}));
|
||||
}
|
||||
}
|
||||
await (0, analyze_1.warnIfGoInstalledAfterInit)(config, logger);
|
||||
await runAutobuildIfLegacyGoWorkflow(config, logger);
|
||||
dbCreationTimings = await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger, features);
|
||||
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
|
||||
|
@ -215,7 +195,7 @@ async function run() {
|
|||
trapCacheUploadTime = perf_hooks_1.performance.now() - trapCacheUploadStartTime;
|
||||
// We don't upload results in test mode, so don't wait for processing
|
||||
if (util.isInTestMode()) {
|
||||
core.debug("In test mode. Waiting for processing is disabled.");
|
||||
logger.debug("In test mode. Waiting for processing is disabled.");
|
||||
}
|
||||
else if (uploadResult !== undefined &&
|
||||
actionsUtil.getRequiredInput("wait-for-processing") === "true") {
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -26,16 +26,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.runCleanup = exports.runFinalize = exports.runQueries = exports.dbIsFinalized = exports.createdDBForScannedLanguages = exports.CodeQLAnalysisError = void 0;
|
||||
exports.runCleanup = exports.warnIfGoInstalledAfterInit = exports.runFinalize = exports.runQueries = exports.dbIsFinalized = exports.runExtraction = exports.CodeQLAnalysisError = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const perf_hooks_1 = require("perf_hooks");
|
||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||
const safe_which_1 = require("@chrisgavin/safe-which");
|
||||
const del_1 = __importDefault(require("del"));
|
||||
const yaml = __importStar(require("js-yaml"));
|
||||
const codeql_1 = require("./codeql");
|
||||
const config_utils_1 = require("./config-utils");
|
||||
const diagnostics_1 = require("./diagnostics");
|
||||
const environment_1 = require("./environment");
|
||||
const feature_flags_1 = require("./feature-flags");
|
||||
const languages_1 = require("./languages");
|
||||
const tools_features_1 = require("./tools-features");
|
||||
const tracer_config_1 = require("./tracer-config");
|
||||
const upload_lib_1 = require("./upload-lib");
|
||||
const util = __importStar(require("./util"));
|
||||
|
@ -75,20 +80,35 @@ async function setupPythonExtractor(logger, features, codeql) {
|
|||
logger.info(`Setting LGTM_PYTHON_SETUP_VERSION=${output}`);
|
||||
process.env["LGTM_PYTHON_SETUP_VERSION"] = output;
|
||||
}
|
||||
async function createdDBForScannedLanguages(codeql, config, logger, features) {
|
||||
async function runExtraction(codeql, config, logger, features) {
|
||||
for (const language of config.languages) {
|
||||
if ((0, languages_1.isScannedLanguage)(language) &&
|
||||
!dbIsFinalized(config, language, logger)) {
|
||||
if (dbIsFinalized(config, language, logger)) {
|
||||
logger.debug(`Database for ${language} has already been finalized, skipping extraction.`);
|
||||
continue;
|
||||
}
|
||||
if (shouldExtractLanguage(config, language)) {
|
||||
logger.startGroup(`Extracting ${language}`);
|
||||
if (language === languages_1.Language.python) {
|
||||
await setupPythonExtractor(logger, features, codeql);
|
||||
}
|
||||
await codeql.extractScannedLanguage(config, language);
|
||||
if (config.buildMode &&
|
||||
(await codeql.supportsFeature(tools_features_1.ToolsFeature.TraceCommandUseBuildMode))) {
|
||||
await codeql.extractUsingBuildMode(config, language);
|
||||
}
|
||||
else {
|
||||
await codeql.extractScannedLanguage(config, language);
|
||||
}
|
||||
logger.endGroup();
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.createdDBForScannedLanguages = createdDBForScannedLanguages;
|
||||
exports.runExtraction = runExtraction;
|
||||
function shouldExtractLanguage(config, language) {
|
||||
return (config.buildMode === config_utils_1.BuildMode.None ||
|
||||
(config.buildMode === config_utils_1.BuildMode.Autobuild &&
|
||||
process.env[environment_1.EnvVar.AUTOBUILD_DID_COMPLETE_SUCCESSFULLY] !== "true") ||
|
||||
(!config.buildMode && (0, languages_1.isScannedLanguage)(language)));
|
||||
}
|
||||
function dbIsFinalized(config, language, logger) {
|
||||
const dbPath = util.getCodeQLDatabasePath(config, language);
|
||||
try {
|
||||
|
@ -104,7 +124,7 @@ exports.dbIsFinalized = dbIsFinalized;
|
|||
async function finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger, features) {
|
||||
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
||||
const extractionStart = perf_hooks_1.performance.now();
|
||||
await createdDBForScannedLanguages(codeql, config, logger, features);
|
||||
await runExtraction(codeql, config, logger, features);
|
||||
const extractionTime = perf_hooks_1.performance.now() - extractionStart;
|
||||
const trapImportStart = perf_hooks_1.performance.now();
|
||||
for (const language of config.languages) {
|
||||
|
@ -230,6 +250,32 @@ async function runFinalize(outputDir, threadsFlag, memoryFlag, config, logger, f
|
|||
return timings;
|
||||
}
|
||||
exports.runFinalize = runFinalize;
|
||||
async function warnIfGoInstalledAfterInit(config, logger) {
|
||||
// Check that `which go` still points at the same path it did when the `init` Action ran to ensure that no steps
|
||||
// in-between performed any setup. We encourage users to perform all setup tasks before initializing CodeQL so that
|
||||
// the setup tasks do not interfere with our analysis.
|
||||
// Furthermore, if we installed a wrapper script in the `init` Action, we need to ensure that there isn't a step
|
||||
// in the workflow after the `init` step which installs a different version of Go and takes precedence in the PATH,
|
||||
// thus potentially circumventing our workaround that allows tracing to work.
|
||||
const goInitPath = process.env[environment_1.EnvVar.GO_BINARY_LOCATION];
|
||||
if (process.env[environment_1.EnvVar.DID_AUTOBUILD_GOLANG] !== "true" &&
|
||||
goInitPath !== undefined) {
|
||||
const goBinaryPath = await (0, safe_which_1.safeWhich)("go");
|
||||
if (goInitPath !== goBinaryPath) {
|
||||
logger.warning(`Expected \`which go\` to return ${goInitPath}, but got ${goBinaryPath}: please ensure that the correct version of Go is installed before the \`codeql-action/init\` Action is used.`);
|
||||
(0, diagnostics_1.addDiagnostic)(config, languages_1.Language.go, (0, diagnostics_1.makeDiagnostic)("go/workflow/go-installed-after-codeql-init", "Go was installed after the `codeql-action/init` Action was run", {
|
||||
markdownMessage: "To avoid interfering with the CodeQL analysis, perform all installation steps before calling the `github/codeql-action/init` Action.",
|
||||
visibility: {
|
||||
statusPage: true,
|
||||
telemetry: true,
|
||||
cliSummaryTable: true,
|
||||
},
|
||||
severity: "warning",
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.warnIfGoInstalledAfterInit = warnIfGoInstalledAfterInit;
|
||||
async function runCleanup(config, cleanupLevel, logger) {
|
||||
logger.startGroup("Cleaning up databases");
|
||||
for (const language of config.languages) {
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -27,7 +27,9 @@ const core = __importStar(require("@actions/core"));
|
|||
const actions_util_1 = require("./actions-util");
|
||||
const api_client_1 = require("./api-client");
|
||||
const autobuild_1 = require("./autobuild");
|
||||
const codeql_1 = require("./codeql");
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
const environment_1 = require("./environment");
|
||||
const logging_1 = require("./logging");
|
||||
const status_report_1 = require("./status-report");
|
||||
const util_1 = require("./util");
|
||||
|
@ -58,7 +60,8 @@ async function run() {
|
|||
if (config === undefined) {
|
||||
throw new Error("Config file could not be found at expected location. Has the 'init' action been called?");
|
||||
}
|
||||
languages = await (0, autobuild_1.determineAutobuildLanguages)(config, logger);
|
||||
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
||||
languages = await (0, autobuild_1.determineAutobuildLanguages)(codeql, config, logger);
|
||||
if (languages !== undefined) {
|
||||
const workingDirectory = (0, actions_util_1.getOptionalInput)("working-directory");
|
||||
if (workingDirectory) {
|
||||
|
@ -77,6 +80,7 @@ async function run() {
|
|||
await sendCompletedStatusReport(logger, startedAt, languages ?? [], currentLanguage, error);
|
||||
return;
|
||||
}
|
||||
core.exportVariable(environment_1.EnvVar.AUTOBUILD_DID_COMPLETE_SUCCESSFULLY, "true");
|
||||
await sendCompletedStatusReport(logger, startedAt, languages ?? []);
|
||||
}
|
||||
async function runWrapper() {
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAIwB;AACxB,6CAAgD;AAChD,2CAAwE;AACxE,4DAA8C;AAE9C,uCAAqD;AACrD,mDAKyB;AACzB,iCAMgB;AAShB,KAAK,UAAU,yBAAyB,CACtC,MAAc,EACd,SAAe,EACf,YAAsB,EACtB,eAAwB,EACxB,KAAa;IAEb,IAAA,4BAAqB,EAAC,IAAA,+BAAgB,GAAE,CAAC,CAAC;IAE1C,MAAM,MAAM,GAAG,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,IAAI,EAAE,EACf,eAAe,EACf,KAAK,CACN,CAAC;QACF,OAAO;IACT,CAAC;IAED,IAAI,CAAC,cAAc,CAAC,oBAAM,CAAC,mCAAmC,EAAE,MAAM,CAAC,CAAC;IAExE,MAAM,yBAAyB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;AACtE,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CAAC,4BAA4B,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
|
@ -28,12 +28,20 @@ const core = __importStar(require("@actions/core"));
|
|||
const actions_util_1 = require("./actions-util");
|
||||
const api_client_1 = require("./api-client");
|
||||
const codeql_1 = require("./codeql");
|
||||
const config_utils_1 = require("./config-utils");
|
||||
const environment_1 = require("./environment");
|
||||
const feature_flags_1 = require("./feature-flags");
|
||||
const languages_1 = require("./languages");
|
||||
const repository_1 = require("./repository");
|
||||
const tools_features_1 = require("./tools-features");
|
||||
const util_1 = require("./util");
|
||||
async function determineAutobuildLanguages(config, logger) {
|
||||
async function determineAutobuildLanguages(codeql, config, logger) {
|
||||
if ((config.buildMode === config_utils_1.BuildMode.None &&
|
||||
(await codeql.supportsFeature(tools_features_1.ToolsFeature.TraceCommandUseBuildMode))) ||
|
||||
config.buildMode === config_utils_1.BuildMode.Manual) {
|
||||
logger.info(`Using ${config.buildMode} build mode, nothing to autobuild.`);
|
||||
return undefined;
|
||||
}
|
||||
// Attempt to find a language to autobuild
|
||||
// We want pick the dominant language in the repo from the ones we're able to build
|
||||
// The languages are sorted in order specified by user or by lines of code if we got
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"autobuild.js","sourceRoot":"","sources":["../src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AAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAfD,oCAeC"}
|
|
@ -211,6 +211,7 @@ function setCodeQL(partialCodeql) {
|
|||
databaseInitCluster: resolveFunction(partialCodeql, "databaseInitCluster"),
|
||||
runAutobuild: resolveFunction(partialCodeql, "runAutobuild"),
|
||||
extractScannedLanguage: resolveFunction(partialCodeql, "extractScannedLanguage"),
|
||||
extractUsingBuildMode: resolveFunction(partialCodeql, "extractUsingBuildMode"),
|
||||
finalizeDatabase: resolveFunction(partialCodeql, "finalizeDatabase"),
|
||||
resolveLanguages: resolveFunction(partialCodeql, "resolveLanguages"),
|
||||
betterResolveLanguages: resolveFunction(partialCodeql, "betterResolveLanguages"),
|
||||
|
@ -364,6 +365,16 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||
util.getCodeQLDatabasePath(config, language),
|
||||
]);
|
||||
},
|
||||
async extractUsingBuildMode(config, language) {
|
||||
await runTool(cmd, [
|
||||
"database",
|
||||
"trace-command",
|
||||
"--use-build-mode",
|
||||
...(await getTrapCachingExtractorConfigArgsForLang(config, language)),
|
||||
...getExtraOptionsFromEnv(["database", "trace-command"]),
|
||||
util.getCodeQLDatabasePath(config, language),
|
||||
]);
|
||||
},
|
||||
async finalizeDatabase(databasePath, threadsFlag, memoryFlag) {
|
||||
const args = [
|
||||
"database",
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.wrapEnvironment = exports.generateRegistries = exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.validatePackSpecification = exports.parsePacksSpecification = exports.parsePacksFromInput = exports.calculateAugmentation = exports.getDefaultConfig = exports.getRawLanguages = exports.getLanguageAliases = exports.getLanguages = exports.getLanguagesInRepo = exports.getUnknownLanguagesError = exports.getNoLanguagesError = exports.getConfigFileDirectoryGivenMessage = exports.getConfigFileFormatInvalidMessage = exports.getConfigFileRepoFormatInvalidMessage = exports.getConfigFileDoesNotExistErrorMessage = exports.getConfigFileOutsideWorkspaceErrorMessage = exports.getPacksStrInvalid = exports.defaultAugmentationProperties = void 0;
|
||||
exports.wrapEnvironment = exports.generateRegistries = exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.validatePackSpecification = exports.parsePacksSpecification = exports.parsePacksFromInput = exports.calculateAugmentation = exports.getDefaultConfig = exports.getRawLanguages = exports.getLanguageAliases = exports.getLanguages = exports.getLanguagesInRepo = exports.getUnknownLanguagesError = exports.getNoLanguagesError = exports.getConfigFileDirectoryGivenMessage = exports.getConfigFileFormatInvalidMessage = exports.getConfigFileRepoFormatInvalidMessage = exports.getConfigFileDoesNotExistErrorMessage = exports.getConfigFileOutsideWorkspaceErrorMessage = exports.getPacksStrInvalid = exports.defaultAugmentationProperties = exports.BuildMode = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const perf_hooks_1 = require("perf_hooks");
|
||||
|
@ -36,6 +36,12 @@ const trap_caching_1 = require("./trap-caching");
|
|||
const util_1 = require("./util");
|
||||
// Property names from the user-supplied config file.
|
||||
const PACKS_PROPERTY = "packs";
|
||||
var BuildMode;
|
||||
(function (BuildMode) {
|
||||
BuildMode["None"] = "none";
|
||||
BuildMode["Autobuild"] = "autobuild";
|
||||
BuildMode["Manual"] = "manual";
|
||||
})(BuildMode || (exports.BuildMode = BuildMode = {}));
|
||||
/**
|
||||
* The default, empty augmentation properties. This is most useful
|
||||
* for tests.
|
||||
|
@ -218,7 +224,7 @@ async function getDefaultConfig({ languagesInput, queriesInput, packsInput, buil
|
|||
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeql, languages, logger);
|
||||
return {
|
||||
languages,
|
||||
buildMode: buildModeInput,
|
||||
buildMode: validateBuildModeInput(buildModeInput),
|
||||
originalUserInput: {},
|
||||
tempDir,
|
||||
codeQLCmd: codeql.getPath(),
|
||||
|
@ -261,7 +267,7 @@ async function loadConfig({ languagesInput, queriesInput, packsInput, buildModeI
|
|||
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeql, languages, logger);
|
||||
return {
|
||||
languages,
|
||||
buildMode: buildModeInput,
|
||||
buildMode: validateBuildModeInput(buildModeInput),
|
||||
originalUserInput: parsedYAML,
|
||||
tempDir,
|
||||
codeQLCmd: codeql.getPath(),
|
||||
|
@ -658,4 +664,13 @@ async function wrapEnvironment(env, operation) {
|
|||
}
|
||||
}
|
||||
exports.wrapEnvironment = wrapEnvironment;
|
||||
function validateBuildModeInput(buildModeInput) {
|
||||
if (buildModeInput === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (!Object.values(BuildMode).includes(buildModeInput)) {
|
||||
throw new util_1.UserError(`Invalid build mode: '${buildModeInput}'. Supported build modes are: ${Object.values(BuildMode).join(", ")}.`);
|
||||
}
|
||||
return buildModeInput;
|
||||
}
|
||||
//# sourceMappingURL=config-utils.js.map
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -35,6 +35,7 @@ const sinon = __importStar(require("sinon"));
|
|||
const api = __importStar(require("./api-client"));
|
||||
const codeql_1 = require("./codeql");
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
const config_utils_1 = require("./config-utils");
|
||||
const languages_1 = require("./languages");
|
||||
const logging_1 = require("./logging");
|
||||
const repository_1 = require("./repository");
|
||||
|
@ -266,7 +267,7 @@ function mockListLanguages(languages) {
|
|||
// And the config we expect it to parse to
|
||||
const expectedConfig = {
|
||||
languages: [languages_1.Language.javascript],
|
||||
buildMode: "none",
|
||||
buildMode: config_utils_1.BuildMode.None,
|
||||
originalUserInput: {
|
||||
name: "my config",
|
||||
"disable-default-queries": true,
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -11,6 +11,8 @@ var EnvVar;
|
|||
(function (EnvVar) {
|
||||
/** Whether the `analyze` Action completes successfully. */
|
||||
EnvVar["ANALYZE_DID_COMPLETE_SUCCESSFULLY"] = "CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY";
|
||||
/** Whether the `autobuild` Action completes successfully. */
|
||||
EnvVar["AUTOBUILD_DID_COMPLETE_SUCCESSFULLY"] = "CODEQL_ACTION_AUTOBUILD_DID_COMPLETE_SUCCESSFULLY";
|
||||
/** Whether the CodeQL Action has invoked the Go autobuilder. */
|
||||
EnvVar["DID_AUTOBUILD_GOLANG"] = "CODEQL_ACTION_DID_AUTOBUILD_GOLANG";
|
||||
/**
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,IAAY,MAyEX;AAzED,WAAY,MAAM;IAChB,2DAA2D;IAC3D,+FAAqF,CAAA;IAErF,gEAAgE;IAChE,qEAA2D,CAAA;IAE3D;;;OAGG;IACH,yFAA+E,CAAA;IAE/E;;;OAGG;IACH,yEAA+D,CAAA;IAE/D,gFAAgF;IAChF,6DAAmD,CAAA;IAEnD;;;OAGG;IACH,uEAA6D,CAAA;IAE7D,gEAAgE;IAChE,mEAAyD,CAAA;IAEzD,kFAAkF;IAClF,mFAAyE,CAAA;IAEzE,6CAA6C;IAC7C,uCAA6B,CAAA;IAE7B,+EAA+E;IAC/E,iDAAuC,CAAA;IAEvC,mEAAyD,CAAA;IAEzD;;;OAGG;IACH,2FAAiF,CAAA;IAEjF,mFAAmF;IACnF,6FAAmF,CAAA;IAEnF,qFAAqF;IACrF,+CAAqC,CAAA;IAErC,mEAAyD,CAAA;IAEzD,kEAAkE;IAClE,2CAAiC,CAAA;IAEjC;;;;;;OAMG;IACH,4DAAkD,CAAA;IAElD;;;OAGG;IACH,wDAA8C,CAAA;AAChD,CAAC,EAzEW,MAAM,sBAAN,MAAM,QAyEjB"}
|
||||
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,IAAY,MA4EX;AA5ED,WAAY,MAAM;IAChB,2DAA2D;IAC3D,+FAAqF,CAAA;IAErF,6DAA6D;IAC7D,mGAAyF,CAAA;IAEzF,gEAAgE;IAChE,qEAA2D,CAAA;IAE3D;;;OAGG;IACH,yFAA+E,CAAA;IAE/E;;;OAGG;IACH,yEAA+D,CAAA;IAE/D,gFAAgF;IAChF,6DAAmD,CAAA;IAEnD;;;OAGG;IACH,uEAA6D,CAAA;IAE7D,gEAAgE;IAChE,mEAAyD,CAAA;IAEzD,kFAAkF;IAClF,mFAAyE,CAAA;IAEzE,6CAA6C;IAC7C,uCAA6B,CAAA;IAE7B,+EAA+E;IAC/E,iDAAuC,CAAA;IAEvC,mEAAyD,CAAA;IAEzD;;;OAGG;IACH,2FAAiF,CAAA;IAEjF,mFAAmF;IACnF,6FAAmF,CAAA;IAEnF,qFAAqF;IACrF,+CAAqC,CAAA;IAErC,mEAAyD,CAAA;IAEzD,kEAAkE;IAClE,2CAAiC,CAAA;IAEjC;;;;;;OAMG;IACH,4DAAkD,CAAA;IAElD;;;OAGG;IACH,wDAA8C,CAAA;AAChD,CAAC,EA5EW,MAAM,sBAAN,MAAM,QA4EjB"}
|
|
@ -6,6 +6,7 @@ var ToolsFeature;
|
|||
ToolsFeature["BuildModeOption"] = "buildModeOption";
|
||||
ToolsFeature["IndirectTracingSupportsStaticBinaries"] = "indirectTracingSupportsStaticBinaries";
|
||||
ToolsFeature["SetsCodeqlRunnerEnvVar"] = "setsCodeqlRunnerEnvVar";
|
||||
ToolsFeature["TraceCommandUseBuildMode"] = "traceCommandUseBuildMode";
|
||||
})(ToolsFeature || (exports.ToolsFeature = ToolsFeature = {}));
|
||||
/**
|
||||
* Determines if the given feature is supported by the CLI.
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"tools-features.js","sourceRoot":"","sources":["../src/tools-features.ts"],"names":[],"mappings":";;;AAEA,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,mDAAmC,CAAA;IACnC,+FAA+E,CAAA;IAC/E,iEAAiD,CAAA;AACnD,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAED;;;;;;GAMG;AACH,SAAgB,uBAAuB,CACrC,WAAwB,EACxB,OAAqB;IAErB,OAAO,CAAC,CAAC,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AALD,0DAKC"}
|
||||
{"version":3,"file":"tools-features.js","sourceRoot":"","sources":["../src/tools-features.ts"],"names":[],"mappings":";;;AAEA,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,mDAAmC,CAAA;IACnC,+FAA+E,CAAA;IAC/E,iEAAiD,CAAA;IACjD,qEAAqD,CAAA;AACvD,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED;;;;;;GAMG;AACH,SAAgB,uBAAuB,CACrC,WAAwB,EACxB,OAAqB;IAErB,OAAO,CAAC,CAAC,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AALD,0DAKC"}
|
|
@ -0,0 +1,29 @@
|
|||
name: "Build mode autobuild"
|
||||
description: "An end-to-end integration test of a Java repository built using 'build-mode: autobuild'"
|
||||
operatingSystems: ["ubuntu"]
|
||||
versions: ["nightly-latest"]
|
||||
steps:
|
||||
- name: Set up Java test repo configuration
|
||||
run: |
|
||||
mv * .github ../action/tests/multi-language-repo/
|
||||
mv ../action/tests/multi-language-repo/.github/workflows .github
|
||||
mv ../action/tests/java-repo/* .
|
||||
|
||||
- uses: ./../action/init
|
||||
id: init
|
||||
with:
|
||||
build-mode: autobuild
|
||||
db-location: "${{ runner.temp }}/customDbLocation"
|
||||
languages: java
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
|
||||
- name: Validate database build mode
|
||||
run: |
|
||||
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
|
||||
build_mode=$(yq eval '.buildMode' "$metadata_path")
|
||||
if [[ "$build_mode" != "autobuild" ]]; then
|
||||
echo "Expected build mode to be 'autobuild' but was $build_mode"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- uses: ./../action/analyze
|
|
@ -0,0 +1,31 @@
|
|||
name: "Build mode manual"
|
||||
description: "An end-to-end integration test of a Java repository built using 'build-mode: manual'"
|
||||
operatingSystems: ["ubuntu"]
|
||||
versions: ["nightly-latest"]
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
id: init
|
||||
with:
|
||||
build-mode: manual
|
||||
db-location: "${{ runner.temp }}/customDbLocation"
|
||||
languages: java
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
|
||||
- name: Validate database build mode
|
||||
run: |
|
||||
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
|
||||
build_mode=$(yq eval '.buildMode' "$metadata_path")
|
||||
if [[ "$build_mode" != "manual" ]]; then
|
||||
echo "Expected build mode to be 'manual' but was $build_mode"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- uses: ./../action/.github/actions/setup-swift
|
||||
with:
|
||||
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
|
||||
- uses: ./../action/analyze
|
|
@ -20,5 +20,8 @@ steps:
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# The latest nightly supports omitting the autobuild Action when the build mode is specified.
|
||||
- uses: ./../action/autobuild
|
||||
if: matrix.version != 'nightly-latest'
|
||||
|
||||
- uses: ./../action/analyze
|
||||
|
|
|
@ -3,7 +3,6 @@ import path from "path";
|
|||
import { performance } from "perf_hooks";
|
||||
|
||||
import * as core from "@actions/core";
|
||||
import { safeWhich } from "@chrisgavin/safe-which";
|
||||
|
||||
import * as actionsUtil from "./actions-util";
|
||||
import {
|
||||
|
@ -13,13 +12,13 @@ import {
|
|||
runCleanup,
|
||||
runFinalize,
|
||||
runQueries,
|
||||
warnIfGoInstalledAfterInit,
|
||||
} from "./analyze";
|
||||
import { getApiDetails, getGitHubVersion } from "./api-client";
|
||||
import { runAutobuild } from "./autobuild";
|
||||
import { getCodeQL } from "./codeql";
|
||||
import { Config, getConfig } from "./config-utils";
|
||||
import { uploadDatabases } from "./database-upload";
|
||||
import { addDiagnostic, makeDiagnostic } from "./diagnostics";
|
||||
import { EnvVar } from "./environment";
|
||||
import { Features } from "./feature-flags";
|
||||
import { Language } from "./languages";
|
||||
|
@ -140,6 +139,12 @@ async function runAutobuildIfLegacyGoWorkflow(config: Config, logger: Logger) {
|
|||
if (!config.languages.includes(Language.go)) {
|
||||
return;
|
||||
}
|
||||
if (config.buildMode) {
|
||||
logger.debug(
|
||||
"Skipping legacy Go autobuild since a build mode has been specified.",
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (process.env[EnvVar.DID_AUTOBUILD_GOLANG] === "true") {
|
||||
logger.debug("Won't run Go autobuild since it has already been run.");
|
||||
return;
|
||||
|
@ -234,46 +239,7 @@ async function run() {
|
|||
logger,
|
||||
);
|
||||
|
||||
// Check that `which go` still points at the same path it did when the `init` Action ran to ensure that no steps
|
||||
// in-between performed any setup. We encourage users to perform all setup tasks before initializing CodeQL so that
|
||||
// the setup tasks do not interfere with our analysis.
|
||||
// Furthermore, if we installed a wrapper script in the `init` Action, we need to ensure that there isn't a step
|
||||
// in the workflow after the `init` step which installs a different version of Go and takes precedence in the PATH,
|
||||
// thus potentially circumventing our workaround that allows tracing to work.
|
||||
const goInitPath = process.env[EnvVar.GO_BINARY_LOCATION];
|
||||
|
||||
if (
|
||||
process.env[EnvVar.DID_AUTOBUILD_GOLANG] !== "true" &&
|
||||
goInitPath !== undefined
|
||||
) {
|
||||
const goBinaryPath = await safeWhich("go");
|
||||
|
||||
if (goInitPath !== goBinaryPath) {
|
||||
core.warning(
|
||||
`Expected \`which go\` to return ${goInitPath}, but got ${goBinaryPath}: please ensure that the correct version of Go is installed before the \`codeql-action/init\` Action is used.`,
|
||||
);
|
||||
|
||||
addDiagnostic(
|
||||
config,
|
||||
Language.go,
|
||||
makeDiagnostic(
|
||||
"go/workflow/go-installed-after-codeql-init",
|
||||
"Go was installed after the `codeql-action/init` Action was run",
|
||||
{
|
||||
markdownMessage:
|
||||
"To avoid interfering with the CodeQL analysis, perform all installation steps before calling the `github/codeql-action/init` Action.",
|
||||
visibility: {
|
||||
statusPage: true,
|
||||
telemetry: true,
|
||||
cliSummaryTable: true,
|
||||
},
|
||||
severity: "warning",
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
await warnIfGoInstalledAfterInit(config, logger);
|
||||
await runAutobuildIfLegacyGoWorkflow(config, logger);
|
||||
|
||||
dbCreationTimings = await runFinalize(
|
||||
|
@ -337,7 +303,7 @@ async function run() {
|
|||
|
||||
// We don't upload results in test mode, so don't wait for processing
|
||||
if (util.isInTestMode()) {
|
||||
core.debug("In test mode. Waiting for processing is disabled.");
|
||||
logger.debug("In test mode. Waiting for processing is disabled.");
|
||||
} else if (
|
||||
uploadResult !== undefined &&
|
||||
actionsUtil.getRequiredInput("wait-for-processing") === "true"
|
||||
|
|
|
@ -3,6 +3,7 @@ import * as path from "path";
|
|||
import { performance } from "perf_hooks";
|
||||
|
||||
import * as toolrunner from "@actions/exec/lib/toolrunner";
|
||||
import { safeWhich } from "@chrisgavin/safe-which";
|
||||
import del from "del";
|
||||
import * as yaml from "js-yaml";
|
||||
|
||||
|
@ -12,6 +13,9 @@ import {
|
|||
getCodeQL,
|
||||
} from "./codeql";
|
||||
import * as configUtils from "./config-utils";
|
||||
import { BuildMode } from "./config-utils";
|
||||
import { addDiagnostic, makeDiagnostic } from "./diagnostics";
|
||||
import { EnvVar } from "./environment";
|
||||
import {
|
||||
FeatureEnablement,
|
||||
Feature,
|
||||
|
@ -20,6 +24,7 @@ import {
|
|||
import { isScannedLanguage, Language } from "./languages";
|
||||
import { Logger } from "./logging";
|
||||
import { DatabaseCreationTimings, EventReport } from "./status-report";
|
||||
import { ToolsFeature } from "./tools-features";
|
||||
import { endTracingForCluster } from "./tracer-config";
|
||||
import { validateSarifFileSchema } from "./upload-lib";
|
||||
import * as util from "./util";
|
||||
|
@ -163,29 +168,50 @@ async function setupPythonExtractor(
|
|||
process.env["LGTM_PYTHON_SETUP_VERSION"] = output;
|
||||
}
|
||||
|
||||
export async function createdDBForScannedLanguages(
|
||||
export async function runExtraction(
|
||||
codeql: CodeQL,
|
||||
config: configUtils.Config,
|
||||
logger: Logger,
|
||||
features: FeatureEnablement,
|
||||
) {
|
||||
for (const language of config.languages) {
|
||||
if (
|
||||
isScannedLanguage(language) &&
|
||||
!dbIsFinalized(config, language, logger)
|
||||
) {
|
||||
logger.startGroup(`Extracting ${language}`);
|
||||
if (dbIsFinalized(config, language, logger)) {
|
||||
logger.debug(
|
||||
`Database for ${language} has already been finalized, skipping extraction.`,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (shouldExtractLanguage(config, language)) {
|
||||
logger.startGroup(`Extracting ${language}`);
|
||||
if (language === Language.python) {
|
||||
await setupPythonExtractor(logger, features, codeql);
|
||||
}
|
||||
|
||||
await codeql.extractScannedLanguage(config, language);
|
||||
if (
|
||||
config.buildMode &&
|
||||
(await codeql.supportsFeature(ToolsFeature.TraceCommandUseBuildMode))
|
||||
) {
|
||||
await codeql.extractUsingBuildMode(config, language);
|
||||
} else {
|
||||
await codeql.extractScannedLanguage(config, language);
|
||||
}
|
||||
logger.endGroup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function shouldExtractLanguage(
|
||||
config: configUtils.Config,
|
||||
language: Language,
|
||||
): boolean {
|
||||
return (
|
||||
config.buildMode === BuildMode.None ||
|
||||
(config.buildMode === BuildMode.Autobuild &&
|
||||
process.env[EnvVar.AUTOBUILD_DID_COMPLETE_SUCCESSFULLY] !== "true") ||
|
||||
(!config.buildMode && isScannedLanguage(language))
|
||||
);
|
||||
}
|
||||
|
||||
export function dbIsFinalized(
|
||||
config: configUtils.Config,
|
||||
language: Language,
|
||||
|
@ -215,7 +241,7 @@ async function finalizeDatabaseCreation(
|
|||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
|
||||
const extractionStart = performance.now();
|
||||
await createdDBForScannedLanguages(codeql, config, logger, features);
|
||||
await runExtraction(codeql, config, logger, features);
|
||||
const extractionTime = performance.now() - extractionStart;
|
||||
|
||||
const trapImportStart = performance.now();
|
||||
|
@ -419,6 +445,51 @@ export async function runFinalize(
|
|||
return timings;
|
||||
}
|
||||
|
||||
export async function warnIfGoInstalledAfterInit(
|
||||
config: configUtils.Config,
|
||||
logger: Logger,
|
||||
) {
|
||||
// Check that `which go` still points at the same path it did when the `init` Action ran to ensure that no steps
|
||||
// in-between performed any setup. We encourage users to perform all setup tasks before initializing CodeQL so that
|
||||
// the setup tasks do not interfere with our analysis.
|
||||
// Furthermore, if we installed a wrapper script in the `init` Action, we need to ensure that there isn't a step
|
||||
// in the workflow after the `init` step which installs a different version of Go and takes precedence in the PATH,
|
||||
// thus potentially circumventing our workaround that allows tracing to work.
|
||||
const goInitPath = process.env[EnvVar.GO_BINARY_LOCATION];
|
||||
|
||||
if (
|
||||
process.env[EnvVar.DID_AUTOBUILD_GOLANG] !== "true" &&
|
||||
goInitPath !== undefined
|
||||
) {
|
||||
const goBinaryPath = await safeWhich("go");
|
||||
|
||||
if (goInitPath !== goBinaryPath) {
|
||||
logger.warning(
|
||||
`Expected \`which go\` to return ${goInitPath}, but got ${goBinaryPath}: please ensure that the correct version of Go is installed before the \`codeql-action/init\` Action is used.`,
|
||||
);
|
||||
|
||||
addDiagnostic(
|
||||
config,
|
||||
Language.go,
|
||||
makeDiagnostic(
|
||||
"go/workflow/go-installed-after-codeql-init",
|
||||
"Go was installed after the `codeql-action/init` Action was run",
|
||||
{
|
||||
markdownMessage:
|
||||
"To avoid interfering with the CodeQL analysis, perform all installation steps before calling the `github/codeql-action/init` Action.",
|
||||
visibility: {
|
||||
statusPage: true,
|
||||
telemetry: true,
|
||||
cliSummaryTable: true,
|
||||
},
|
||||
severity: "warning",
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function runCleanup(
|
||||
config: configUtils.Config,
|
||||
cleanupLevel: string,
|
||||
|
|
|
@ -7,7 +7,9 @@ import {
|
|||
} from "./actions-util";
|
||||
import { getGitHubVersion } from "./api-client";
|
||||
import { determineAutobuildLanguages, runAutobuild } from "./autobuild";
|
||||
import { getCodeQL } from "./codeql";
|
||||
import * as configUtils from "./config-utils";
|
||||
import { EnvVar } from "./environment";
|
||||
import { Language } from "./languages";
|
||||
import { Logger, getActionsLogger } from "./logging";
|
||||
import {
|
||||
|
@ -87,7 +89,9 @@ async function run() {
|
|||
);
|
||||
}
|
||||
|
||||
languages = await determineAutobuildLanguages(config, logger);
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
|
||||
languages = await determineAutobuildLanguages(codeql, config, logger);
|
||||
if (languages !== undefined) {
|
||||
const workingDirectory = getOptionalInput("working-directory");
|
||||
if (workingDirectory) {
|
||||
|
@ -116,6 +120,8 @@ async function run() {
|
|||
return;
|
||||
}
|
||||
|
||||
core.exportVariable(EnvVar.AUTOBUILD_DID_COMPLETE_SUCCESSFULLY, "true");
|
||||
|
||||
await sendCompletedStatusReport(logger, startedAt, languages ?? []);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,17 +4,29 @@ import { getTemporaryDirectory, getWorkflowEventName } from "./actions-util";
|
|||
import { getGitHubVersion } from "./api-client";
|
||||
import { CodeQL, getCodeQL } from "./codeql";
|
||||
import * as configUtils from "./config-utils";
|
||||
import { BuildMode } from "./config-utils";
|
||||
import { EnvVar } from "./environment";
|
||||
import { Feature, featureConfig, Features } from "./feature-flags";
|
||||
import { isTracedLanguage, Language } from "./languages";
|
||||
import { Logger } from "./logging";
|
||||
import { parseRepositoryNwo } from "./repository";
|
||||
import { ToolsFeature } from "./tools-features";
|
||||
import { getRequiredEnvParam } from "./util";
|
||||
|
||||
export async function determineAutobuildLanguages(
|
||||
codeql: CodeQL,
|
||||
config: configUtils.Config,
|
||||
logger: Logger,
|
||||
): Promise<Language[] | undefined> {
|
||||
if (
|
||||
(config.buildMode === BuildMode.None &&
|
||||
(await codeql.supportsFeature(ToolsFeature.TraceCommandUseBuildMode))) ||
|
||||
config.buildMode === BuildMode.Manual
|
||||
) {
|
||||
logger.info(`Using ${config.buildMode} build mode, nothing to autobuild.`);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Attempt to find a language to autobuild
|
||||
// We want pick the dominant language in the repo from the ones we're able to build
|
||||
// The languages are sorted in order specified by user or by lines of code if we got
|
||||
|
|
|
@ -114,6 +114,11 @@ export interface CodeQL {
|
|||
* and running the language extractor.
|
||||
*/
|
||||
extractScannedLanguage(config: Config, language: Language): Promise<void>;
|
||||
/**
|
||||
* Extract code with 'codeql database trace-command --use-build-mode'. This can only be used when
|
||||
* the database specifies a build mode. This requires the `traceCommandUseBuildMode` tool feature.
|
||||
*/
|
||||
extractUsingBuildMode(config: Config, language: Language): Promise<void>;
|
||||
/**
|
||||
* Finalize a database using 'codeql database finalize'.
|
||||
*/
|
||||
|
@ -474,6 +479,10 @@ export function setCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
|
|||
partialCodeql,
|
||||
"extractScannedLanguage",
|
||||
),
|
||||
extractUsingBuildMode: resolveFunction(
|
||||
partialCodeql,
|
||||
"extractUsingBuildMode",
|
||||
),
|
||||
finalizeDatabase: resolveFunction(partialCodeql, "finalizeDatabase"),
|
||||
resolveLanguages: resolveFunction(partialCodeql, "resolveLanguages"),
|
||||
betterResolveLanguages: resolveFunction(
|
||||
|
@ -690,6 +699,16 @@ export async function getCodeQLForCmd(
|
|||
util.getCodeQLDatabasePath(config, language),
|
||||
]);
|
||||
},
|
||||
async extractUsingBuildMode(config: Config, language: Language) {
|
||||
await runTool(cmd, [
|
||||
"database",
|
||||
"trace-command",
|
||||
"--use-build-mode",
|
||||
...(await getTrapCachingExtractorConfigArgsForLang(config, language)),
|
||||
...getExtraOptionsFromEnv(["database", "trace-command"]),
|
||||
util.getCodeQLDatabasePath(config, language),
|
||||
]);
|
||||
},
|
||||
async finalizeDatabase(
|
||||
databasePath: string,
|
||||
threadsFlag: string,
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
setCodeQL,
|
||||
} from "./codeql";
|
||||
import * as configUtils from "./config-utils";
|
||||
import { BuildMode } from "./config-utils";
|
||||
import { Language } from "./languages";
|
||||
import { getRunnerLogger } from "./logging";
|
||||
import { parseRepositoryNwo } from "./repository";
|
||||
|
@ -323,7 +324,7 @@ test("load non-empty input", async (t) => {
|
|||
// And the config we expect it to parse to
|
||||
const expectedConfig: configUtils.Config = {
|
||||
languages: [Language.javascript],
|
||||
buildMode: "none",
|
||||
buildMode: BuildMode.None,
|
||||
originalUserInput: {
|
||||
name: "my config",
|
||||
"disable-default-queries": true,
|
||||
|
|
|
@ -72,6 +72,12 @@ interface IncludeQueryFilter {
|
|||
include: Record<string, string[] | string>;
|
||||
}
|
||||
|
||||
export enum BuildMode {
|
||||
None = "none",
|
||||
Autobuild = "autobuild",
|
||||
Manual = "manual",
|
||||
}
|
||||
|
||||
/**
|
||||
* Format of the parsed config file.
|
||||
*/
|
||||
|
@ -83,7 +89,7 @@ export interface Config {
|
|||
/**
|
||||
* Build mode, if set. Currently only a single build mode is supported per job.
|
||||
*/
|
||||
buildMode: string | undefined;
|
||||
buildMode: BuildMode | undefined;
|
||||
/**
|
||||
* A unaltered copy of the original user input.
|
||||
* Mainly intended to be used for status reporting.
|
||||
|
@ -466,7 +472,7 @@ export async function getDefaultConfig({
|
|||
|
||||
return {
|
||||
languages,
|
||||
buildMode: buildModeInput,
|
||||
buildMode: validateBuildModeInput(buildModeInput),
|
||||
originalUserInput: {},
|
||||
tempDir,
|
||||
codeQLCmd: codeql.getPath(),
|
||||
|
@ -554,7 +560,7 @@ async function loadConfig({
|
|||
|
||||
return {
|
||||
languages,
|
||||
buildMode: buildModeInput,
|
||||
buildMode: validateBuildModeInput(buildModeInput),
|
||||
originalUserInput: parsedYAML,
|
||||
tempDir,
|
||||
codeQLCmd: codeql.getPath(),
|
||||
|
@ -1056,3 +1062,20 @@ export async function wrapEnvironment(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function validateBuildModeInput(
|
||||
buildModeInput: string | undefined,
|
||||
): BuildMode | undefined {
|
||||
if (buildModeInput === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!Object.values(BuildMode).includes(buildModeInput as BuildMode)) {
|
||||
throw new UserError(
|
||||
`Invalid build mode: '${buildModeInput}'. Supported build modes are: ${Object.values(
|
||||
BuildMode,
|
||||
).join(", ")}.`,
|
||||
);
|
||||
}
|
||||
return buildModeInput as BuildMode;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,9 @@ export enum EnvVar {
|
|||
/** Whether the `analyze` Action completes successfully. */
|
||||
ANALYZE_DID_COMPLETE_SUCCESSFULLY = "CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY",
|
||||
|
||||
/** Whether the `autobuild` Action completes successfully. */
|
||||
AUTOBUILD_DID_COMPLETE_SUCCESSFULLY = "CODEQL_ACTION_AUTOBUILD_DID_COMPLETE_SUCCESSFULLY",
|
||||
|
||||
/** Whether the CodeQL Action has invoked the Go autobuilder. */
|
||||
DID_AUTOBUILD_GOLANG = "CODEQL_ACTION_DID_AUTOBUILD_GOLANG",
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ export enum ToolsFeature {
|
|||
BuildModeOption = "buildModeOption",
|
||||
IndirectTracingSupportsStaticBinaries = "indirectTracingSupportsStaticBinaries",
|
||||
SetsCodeqlRunnerEnvVar = "setsCodeqlRunnerEnvVar",
|
||||
TraceCommandUseBuildMode = "traceCommandUseBuildMode",
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Двоичный файл не отображается.
Двоичные данные
tests/java-repo/.gradle/8.1.1/dependencies-accessors/dependencies-accessors.lock
Normal file
Двоичные данные
tests/java-repo/.gradle/8.1.1/dependencies-accessors/dependencies-accessors.lock
Normal file
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -0,0 +1,2 @@
|
|||
#Thu Feb 08 15:11:31 GMT 2024
|
||||
gradle.version=8.1.1
|
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче