Merge branch 'main' into update-bundle/codeql-bundle-v2.20.0
This commit is contained in:
commit
b13515409a
21 changed files with 22 additions and 228 deletions
|
|
@ -3,7 +3,6 @@
|
||||||
name: PR Check - Debug artifacts after failure
|
name: PR Check - Debug artifacts after failure
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
CODEQL_ACTION_ARTIFACT_V4_UPGRADE: true
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
|
|
||||||
99
.github/workflows/debug-artifacts-legacy.yml
vendored
99
.github/workflows/debug-artifacts-legacy.yml
vendored
|
|
@ -1,99 +0,0 @@
|
||||||
# Checks logs, SARIF, and database bundle debug artifacts exist and are accessible
|
|
||||||
# with download-artifact@v3 when CODEQL_ACTION_ARTIFACT_V4_UPGRADE is set to false.
|
|
||||||
name: PR Check - Debug artifact upload using artifact@v2
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
CODEQL_ACTION_ARTIFACT_V4_UPGRADE: false
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- releases/v*
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- synchronize
|
|
||||||
- reopened
|
|
||||||
- ready_for_review
|
|
||||||
schedule:
|
|
||||||
- cron: '0 5 * * *'
|
|
||||||
workflow_dispatch: {}
|
|
||||||
jobs:
|
|
||||||
upload-artifacts:
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
version:
|
|
||||||
- stable-v2.14.6
|
|
||||||
- stable-v2.15.5
|
|
||||||
- stable-v2.16.6
|
|
||||||
- stable-v2.17.6
|
|
||||||
- stable-v2.18.4
|
|
||||||
- default
|
|
||||||
- linked
|
|
||||||
- nightly-latest
|
|
||||||
name: Upload debug artifacts
|
|
||||||
env:
|
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
|
||||||
timeout-minutes: 45
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Prepare test
|
|
||||||
id: prepare-test
|
|
||||||
uses: ./.github/actions/prepare-test
|
|
||||||
with:
|
|
||||||
version: ${{ matrix.version }}
|
|
||||||
- uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: ^1.13.1
|
|
||||||
- uses: ./../action/init
|
|
||||||
id: init
|
|
||||||
with:
|
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
|
||||||
debug: true
|
|
||||||
debug-artifact-name: my-debug-artifacts
|
|
||||||
debug-database-name: my-db
|
|
||||||
# We manually exclude Swift from the languages list here, as it is not supported on Ubuntu
|
|
||||||
languages: cpp,csharp,go,java,javascript,python,ruby
|
|
||||||
- name: Build code
|
|
||||||
shell: bash
|
|
||||||
run: ./build.sh
|
|
||||||
- uses: ./../action/analyze
|
|
||||||
id: analysis
|
|
||||||
download-and-check-artifacts:
|
|
||||||
name: Download and check debug artifacts
|
|
||||||
needs: upload-artifacts
|
|
||||||
timeout-minutes: 45
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Download all artifacts
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
- name: Check expected artifacts exist
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
VERSIONS="stable-v2.14.6 stable-v2.15.5 stable-v2.16.6 stable-v2.17.6 stable-v2.18.4 default linked nightly-latest"
|
|
||||||
LANGUAGES="cpp csharp go java javascript python"
|
|
||||||
for version in $VERSIONS; do
|
|
||||||
pushd "./my-debug-artifacts-${version//./}"
|
|
||||||
echo "Artifacts from version $version:"
|
|
||||||
for language in $LANGUAGES; do
|
|
||||||
echo "- Checking $language"
|
|
||||||
if [[ ! -f "$language.sarif" ]] ; then
|
|
||||||
echo "Missing a SARIF file for $language"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ ! -f "my-db-$language.zip" ]] ; then
|
|
||||||
echo "Missing a database bundle for $language"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ ! -d "$language/log" ]] ; then
|
|
||||||
echo "Missing logs for $language"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
popd
|
|
||||||
done
|
|
||||||
env:
|
|
||||||
GO111MODULE: auto
|
|
||||||
1
.github/workflows/debug-artifacts.yml
vendored
1
.github/workflows/debug-artifacts.yml
vendored
|
|
@ -2,7 +2,6 @@
|
||||||
name: PR Check - Debug artifact upload
|
name: PR Check - Debug artifact upload
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
CODEQL_ACTION_ARTIFACT_V4_UPGRADE: true
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
|
|
||||||
6
lib/analyze-action-post.js
generated
6
lib/analyze-action-post.js
generated
|
|
@ -44,9 +44,7 @@ const api_client_1 = require("./api-client");
|
||||||
const config_utils_1 = require("./config-utils");
|
const config_utils_1 = require("./config-utils");
|
||||||
const debugArtifacts = __importStar(require("./debug-artifacts"));
|
const debugArtifacts = __importStar(require("./debug-artifacts"));
|
||||||
const environment_1 = require("./environment");
|
const environment_1 = require("./environment");
|
||||||
const feature_flags_1 = require("./feature-flags");
|
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const repository_1 = require("./repository");
|
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
async function runWrapper() {
|
async function runWrapper() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -54,14 +52,12 @@ async function runWrapper() {
|
||||||
const logger = (0, logging_1.getActionsLogger)();
|
const logger = (0, logging_1.getActionsLogger)();
|
||||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
||||||
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger);
|
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger);
|
||||||
const repositoryNwo = (0, repository_1.parseRepositoryNwo)((0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY"));
|
|
||||||
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger);
|
|
||||||
// Upload SARIF artifacts if we determine that this is a first-party analysis run.
|
// Upload SARIF artifacts if we determine that this is a first-party analysis run.
|
||||||
// For third-party runs, this artifact will be uploaded in the `upload-sarif-post` step.
|
// For third-party runs, this artifact will be uploaded in the `upload-sarif-post` step.
|
||||||
if (process.env[environment_1.EnvVar.INIT_ACTION_HAS_RUN] === "true") {
|
if (process.env[environment_1.EnvVar.INIT_ACTION_HAS_RUN] === "true") {
|
||||||
const config = await (0, config_utils_1.getConfig)(actionsUtil.getTemporaryDirectory(), logger);
|
const config = await (0, config_utils_1.getConfig)(actionsUtil.getTemporaryDirectory(), logger);
|
||||||
if (config !== undefined) {
|
if (config !== undefined) {
|
||||||
await (0, logging_1.withGroup)("Uploading combined SARIF debug artifact", () => debugArtifacts.uploadCombinedSarifArtifacts(logger, config.gitHubVersion.type, features));
|
await (0, logging_1.withGroup)("Uploading combined SARIF debug artifact", () => debugArtifacts.uploadCombinedSarifArtifacts(logger, config.gitHubVersion.type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"analyze-action-post.js","sourceRoot":"","sources":["../src/analyze-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,4DAA8C;AAC9C,6CAAgD;AAChD,iDAA2C;AAC3C,kEAAoD;AACpD,+CAAuC;AACvC,mDAA2C;AAC3C,uCAAwD;AACxD,6CAAkD;AAClD,iCAIgB;AAEhB,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,WAAW,CAAC,aAAa,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;QAClC,MAAM,aAAa,GAAG,MAAM,IAAA,6BAAgB,GAAE,CAAC;QAC/C,IAAA,gCAAyB,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACjD,MAAM,aAAa,GAAG,IAAA,+BAAkB,EACtC,IAAA,0BAAmB,EAAC,mBAAmB,CAAC,CACzC,CAAC;QACF,MAAM,QAAQ,GAAG,IAAI,wBAAQ,CAC3B,aAAa,EACb,aAAa,EACb,WAAW,CAAC,qBAAqB,EAAE,EACnC,MAAM,CACP,CAAC;QAEF,kFAAkF;QAClF,wFAAwF;QACxF,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAM,CAAC,mBAAmB,CAAC,KAAK,MAAM,EAAE,CAAC;YACvD,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAS,EAC5B,WAAW,CAAC,qBAAqB,EAAE,EACnC,MAAM,CACP,CAAC;YACF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,MAAM,IAAA,mBAAS,EAAC,yCAAyC,EAAE,GAAG,EAAE,CAC9D,cAAc,CAAC,4BAA4B,CACzC,MAAM,EACN,MAAM,CAAC,aAAa,CAAC,IAAI,EACzB,QAAQ,CACT,CACF,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,oCAAoC,IAAA,sBAAe,EAAC,KAAK,CAAC,EAAE,CAC7D,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
{"version":3,"file":"analyze-action-post.js","sourceRoot":"","sources":["../src/analyze-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,4DAA8C;AAC9C,6CAAgD;AAChD,iDAA2C;AAC3C,kEAAoD;AACpD,+CAAuC;AACvC,uCAAwD;AACxD,iCAAoE;AAEpE,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,WAAW,CAAC,aAAa,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;QAClC,MAAM,aAAa,GAAG,MAAM,IAAA,6BAAgB,GAAE,CAAC;QAC/C,IAAA,gCAAyB,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAEjD,kFAAkF;QAClF,wFAAwF;QACxF,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAM,CAAC,mBAAmB,CAAC,KAAK,MAAM,EAAE,CAAC;YACvD,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAS,EAC5B,WAAW,CAAC,qBAAqB,EAAE,EACnC,MAAM,CACP,CAAC;YACF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,MAAM,IAAA,mBAAS,EAAC,yCAAyC,EAAE,GAAG,EAAE,CAC9D,cAAc,CAAC,4BAA4B,CACzC,MAAM,EACN,MAAM,CAAC,aAAa,CAAC,IAAI,CAC1B,CACF,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,oCAAoC,IAAA,sBAAe,EAAC,KAAK,CAAC,EAAE,CAC7D,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||||
19
lib/debug-artifacts.js
generated
19
lib/debug-artifacts.js
generated
|
|
@ -52,7 +52,6 @@ const actions_util_1 = require("./actions-util");
|
||||||
const analyze_1 = require("./analyze");
|
const analyze_1 = require("./analyze");
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
const environment_1 = require("./environment");
|
const environment_1 = require("./environment");
|
||||||
const feature_flags_1 = require("./feature-flags");
|
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
function sanitizeArtifactName(name) {
|
function sanitizeArtifactName(name) {
|
||||||
|
|
@ -62,7 +61,7 @@ function sanitizeArtifactName(name) {
|
||||||
* Upload Actions SARIF artifacts for debugging when CODEQL_ACTION_DEBUG_COMBINED_SARIF
|
* Upload Actions SARIF artifacts for debugging when CODEQL_ACTION_DEBUG_COMBINED_SARIF
|
||||||
* environment variable is set
|
* environment variable is set
|
||||||
*/
|
*/
|
||||||
async function uploadCombinedSarifArtifacts(logger, gitHubVariant, features) {
|
async function uploadCombinedSarifArtifacts(logger, gitHubVariant) {
|
||||||
const tempDir = (0, actions_util_1.getTemporaryDirectory)();
|
const tempDir = (0, actions_util_1.getTemporaryDirectory)();
|
||||||
// Upload Actions SARIF artifacts for debugging when environment variable is set
|
// Upload Actions SARIF artifacts for debugging when environment variable is set
|
||||||
if (process.env["CODEQL_ACTION_DEBUG_COMBINED_SARIF"] === "true") {
|
if (process.env["CODEQL_ACTION_DEBUG_COMBINED_SARIF"] === "true") {
|
||||||
|
|
@ -81,7 +80,7 @@ async function uploadCombinedSarifArtifacts(logger, gitHubVariant, features) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await uploadDebugArtifacts(logger, toUpload, baseTempDir, "combined-sarif-artifacts", gitHubVariant, features);
|
await uploadDebugArtifacts(logger, toUpload, baseTempDir, "combined-sarif-artifacts", gitHubVariant);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
logger.warning(`Failed to upload combined SARIF files as Actions debugging artifact. Reason: ${(0, util_1.getErrorMessage)(e)}`);
|
logger.warning(`Failed to upload combined SARIF files as Actions debugging artifact. Reason: ${(0, util_1.getErrorMessage)(e)}`);
|
||||||
|
|
@ -141,7 +140,7 @@ async function tryBundleDatabase(config, language, logger) {
|
||||||
*
|
*
|
||||||
* Logs and suppresses any errors that occur.
|
* Logs and suppresses any errors that occur.
|
||||||
*/
|
*/
|
||||||
async function tryUploadAllAvailableDebugArtifacts(config, logger, features) {
|
async function tryUploadAllAvailableDebugArtifacts(config, logger) {
|
||||||
const filesToUpload = [];
|
const filesToUpload = [];
|
||||||
try {
|
try {
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
|
|
@ -181,13 +180,13 @@ async function tryUploadAllAvailableDebugArtifacts(config, logger, features) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await (0, logging_1.withGroup)("Uploading debug artifacts", async () => uploadDebugArtifacts(logger, filesToUpload, config.dbLocation, config.debugArtifactName, config.gitHubVersion.type, features));
|
await (0, logging_1.withGroup)("Uploading debug artifacts", async () => uploadDebugArtifacts(logger, filesToUpload, config.dbLocation, config.debugArtifactName, config.gitHubVersion.type));
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
logger.warning(`Failed to upload debug artifacts. Reason: ${(0, util_1.getErrorMessage)(e)}`);
|
logger.warning(`Failed to upload debug artifacts. Reason: ${(0, util_1.getErrorMessage)(e)}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghVariant, features) {
|
async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghVariant) {
|
||||||
if (toUpload.length === 0) {
|
if (toUpload.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -202,7 +201,7 @@ async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghV
|
||||||
core.info("Could not parse user-specified `matrix` input into JSON. The debug artifact will not be named with the user's `matrix` input.");
|
core.info("Could not parse user-specified `matrix` input into JSON. The debug artifact will not be named with the user's `matrix` input.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const artifactUploader = await getArtifactUploaderClient(logger, ghVariant, features);
|
const artifactUploader = await getArtifactUploaderClient(logger, ghVariant);
|
||||||
try {
|
try {
|
||||||
await artifactUploader.uploadArtifact(sanitizeArtifactName(`${artifactName}${suffix}`), toUpload.map((file) => path.normalize(file)), path.normalize(rootDir), {
|
await artifactUploader.uploadArtifact(sanitizeArtifactName(`${artifactName}${suffix}`), toUpload.map((file) => path.normalize(file)), path.normalize(rootDir), {
|
||||||
// ensure we don't keep the debug artifacts around for too long since they can be large.
|
// ensure we don't keep the debug artifacts around for too long since they can be large.
|
||||||
|
|
@ -218,15 +217,11 @@ async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghV
|
||||||
// until it is supported. We also use the legacy version of the client if the feature flag is disabled.
|
// until it is supported. We also use the legacy version of the client if the feature flag is disabled.
|
||||||
// The feature flag is named `ArtifactV4Upgrade` to reduce customer confusion; customers are primarily affected by
|
// The feature flag is named `ArtifactV4Upgrade` to reduce customer confusion; customers are primarily affected by
|
||||||
// `actions/download-artifact`, whose upgrade to v4 must be accompanied by the `@actions/artifact@v2` upgrade.
|
// `actions/download-artifact`, whose upgrade to v4 must be accompanied by the `@actions/artifact@v2` upgrade.
|
||||||
async function getArtifactUploaderClient(logger, ghVariant, features) {
|
async function getArtifactUploaderClient(logger, ghVariant) {
|
||||||
if (ghVariant === util_1.GitHubVariant.GHES) {
|
if (ghVariant === util_1.GitHubVariant.GHES) {
|
||||||
logger.info("Debug artifacts can be consumed with `actions/download-artifact@v3` because the `v4` version is not yet compatible on GHES.");
|
logger.info("Debug artifacts can be consumed with `actions/download-artifact@v3` because the `v4` version is not yet compatible on GHES.");
|
||||||
return artifactLegacy.create();
|
return artifactLegacy.create();
|
||||||
}
|
}
|
||||||
else if (!(await features.getValue(feature_flags_1.Feature.ArtifactV4Upgrade))) {
|
|
||||||
logger.info("Debug artifacts can be consumed with `actions/download-artifact@v3`. To use the `actions/download-artifact@v4`, set the `CODEQL_ACTION_ARTIFACT_V4_UPGRADE` environment variable to true.");
|
|
||||||
return artifactLegacy.create();
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
logger.info("Debug artifacts can be consumed with `actions/download-artifact@v4`.");
|
logger.info("Debug artifacts can be consumed with `actions/download-artifact@v4`.");
|
||||||
return new artifact.DefaultArtifactClient();
|
return new artifact.DefaultArtifactClient();
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
5
lib/debug-artifacts.test.js
generated
5
lib/debug-artifacts.test.js
generated
|
|
@ -38,9 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const ava_1 = __importDefault(require("ava"));
|
const ava_1 = __importDefault(require("ava"));
|
||||||
const debugArtifacts = __importStar(require("./debug-artifacts"));
|
const debugArtifacts = __importStar(require("./debug-artifacts"));
|
||||||
const feature_flags_1 = require("./feature-flags");
|
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const testing_utils_1 = require("./testing-utils");
|
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
(0, ava_1.default)("sanitizeArtifactName", (t) => {
|
(0, ava_1.default)("sanitizeArtifactName", (t) => {
|
||||||
t.deepEqual(debugArtifacts.sanitizeArtifactName("hello-world_"), "hello-world_");
|
t.deepEqual(debugArtifacts.sanitizeArtifactName("hello-world_"), "hello-world_");
|
||||||
|
|
@ -51,7 +49,6 @@ const util_1 = require("./util");
|
||||||
(0, ava_1.default)("uploadDebugArtifacts", async (t) => {
|
(0, ava_1.default)("uploadDebugArtifacts", async (t) => {
|
||||||
// Test that no error is thrown if artifacts list is empty.
|
// Test that no error is thrown if artifacts list is empty.
|
||||||
const logger = (0, logging_1.getActionsLogger)();
|
const logger = (0, logging_1.getActionsLogger)();
|
||||||
const mockFeature = (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.ArtifactV4Upgrade]);
|
await t.notThrowsAsync(debugArtifacts.uploadDebugArtifacts(logger, [], "rootDir", "artifactName", util_1.GitHubVariant.DOTCOM));
|
||||||
await t.notThrowsAsync(debugArtifacts.uploadDebugArtifacts(logger, [], "rootDir", "artifactName", util_1.GitHubVariant.DOTCOM, mockFeature));
|
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=debug-artifacts.test.js.map
|
//# sourceMappingURL=debug-artifacts.test.js.map
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"debug-artifacts.test.js","sourceRoot":"","sources":["../src/debug-artifacts.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAuB;AAEvB,kEAAoD;AACpD,mDAA0C;AAC1C,uCAA6C;AAC7C,mDAAiD;AACjD,iCAAuC;AAEvC,IAAA,aAAI,EAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE,EAAE;IACjC,CAAC,CAAC,SAAS,CACT,cAAc,CAAC,oBAAoB,CAAC,cAAc,CAAC,EACnD,cAAc,CACf,CAAC;IACF,CAAC,CAAC,SAAS,CACT,cAAc,CAAC,oBAAoB,CAAC,cAAc,CAAC,EACnD,YAAY,CACb,CAAC;IACF,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,oBAAoB,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,CAAC;IAC5E,CAAC,CAAC,SAAS,CACT,cAAc,CAAC,oBAAoB,CAAC,yBAAyB,CAAC,EAC9D,aAAa,CACd,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAA,aAAI,EAAC,sBAAsB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACvC,2DAA2D;IAC3D,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAClC,MAAM,WAAW,GAAG,IAAA,8BAAc,EAAC,CAAC,uBAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAChE,MAAM,CAAC,CAAC,cAAc,CACpB,cAAc,CAAC,oBAAoB,CACjC,MAAM,EACN,EAAE,EACF,SAAS,EACT,cAAc,EACd,oBAAa,CAAC,MAAM,EACpB,WAAW,CACZ,CACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
{"version":3,"file":"debug-artifacts.test.js","sourceRoot":"","sources":["../src/debug-artifacts.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAuB;AAEvB,kEAAoD;AACpD,uCAA6C;AAC7C,iCAAuC;AAEvC,IAAA,aAAI,EAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE,EAAE;IACjC,CAAC,CAAC,SAAS,CACT,cAAc,CAAC,oBAAoB,CAAC,cAAc,CAAC,EACnD,cAAc,CACf,CAAC;IACF,CAAC,CAAC,SAAS,CACT,cAAc,CAAC,oBAAoB,CAAC,cAAc,CAAC,EACnD,YAAY,CACb,CAAC;IACF,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,oBAAoB,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,CAAC;IAC5E,CAAC,CAAC,SAAS,CACT,cAAc,CAAC,oBAAoB,CAAC,yBAAyB,CAAC,EAC9D,aAAa,CACd,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAA,aAAI,EAAC,sBAAsB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACvC,2DAA2D;IAC3D,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAClC,MAAM,CAAC,CAAC,cAAc,CACpB,cAAc,CAAC,oBAAoB,CACjC,MAAM,EACN,EAAE,EACF,SAAS,EACT,cAAc,EACd,oBAAa,CAAC,MAAM,CACrB,CACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
||||||
6
lib/feature-flags.js
generated
6
lib/feature-flags.js
generated
|
|
@ -62,7 +62,6 @@ exports.CODEQL_VERSION_ZSTD_BUNDLE = "2.19.0";
|
||||||
*/
|
*/
|
||||||
var Feature;
|
var Feature;
|
||||||
(function (Feature) {
|
(function (Feature) {
|
||||||
Feature["ArtifactV4Upgrade"] = "artifact_v4_upgrade";
|
|
||||||
Feature["CleanupTrapCaches"] = "cleanup_trap_caches";
|
Feature["CleanupTrapCaches"] = "cleanup_trap_caches";
|
||||||
Feature["CppBuildModeNone"] = "cpp_build_mode_none";
|
Feature["CppBuildModeNone"] = "cpp_build_mode_none";
|
||||||
Feature["CppDependencyInstallation"] = "cpp_dependency_installation_enabled";
|
Feature["CppDependencyInstallation"] = "cpp_dependency_installation_enabled";
|
||||||
|
|
@ -77,11 +76,6 @@ var Feature;
|
||||||
Feature["ZstdBundleStreamingExtraction"] = "zstd_bundle_streaming_extraction";
|
Feature["ZstdBundleStreamingExtraction"] = "zstd_bundle_streaming_extraction";
|
||||||
})(Feature || (exports.Feature = Feature = {}));
|
})(Feature || (exports.Feature = Feature = {}));
|
||||||
exports.featureConfig = {
|
exports.featureConfig = {
|
||||||
[Feature.ArtifactV4Upgrade]: {
|
|
||||||
defaultValue: true,
|
|
||||||
envVar: "CODEQL_ACTION_ARTIFACT_V4_UPGRADE",
|
|
||||||
minimumVersion: undefined,
|
|
||||||
},
|
|
||||||
[Feature.CleanupTrapCaches]: {
|
[Feature.CleanupTrapCaches]: {
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
envVar: "CODEQL_ACTION_CLEANUP_TRAP_CACHES",
|
envVar: "CODEQL_ACTION_CLEANUP_TRAP_CACHES",
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
6
lib/start-proxy-action-post.js
generated
6
lib/start-proxy-action-post.js
generated
|
|
@ -43,9 +43,7 @@ const actionsUtil = __importStar(require("./actions-util"));
|
||||||
const api_client_1 = require("./api-client");
|
const api_client_1 = require("./api-client");
|
||||||
const configUtils = __importStar(require("./config-utils"));
|
const configUtils = __importStar(require("./config-utils"));
|
||||||
const debug_artifacts_1 = require("./debug-artifacts");
|
const debug_artifacts_1 = require("./debug-artifacts");
|
||||||
const feature_flags_1 = require("./feature-flags");
|
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const repository_1 = require("./repository");
|
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
async function runWrapper() {
|
async function runWrapper() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -70,10 +68,8 @@ async function runWrapper() {
|
||||||
const logger = (0, logging_1.getActionsLogger)();
|
const logger = (0, logging_1.getActionsLogger)();
|
||||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
||||||
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger);
|
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger);
|
||||||
const repositoryNwo = (0, repository_1.parseRepositoryNwo)((0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY"));
|
|
||||||
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger);
|
|
||||||
try {
|
try {
|
||||||
const artifactUploader = await (0, debug_artifacts_1.getArtifactUploaderClient)(logger, gitHubVersion.type, features);
|
const artifactUploader = await (0, debug_artifacts_1.getArtifactUploaderClient)(logger, gitHubVersion.type);
|
||||||
await artifactUploader.uploadArtifact("proxy-log-file", [logFilePath], actionsUtil.getTemporaryDirectory(), {
|
await artifactUploader.uploadArtifact("proxy-log-file", [logFilePath], actionsUtil.getTemporaryDirectory(), {
|
||||||
// ensure we don't keep the debug artifacts around for too long since they can be large.
|
// ensure we don't keep the debug artifacts around for too long since they can be large.
|
||||||
retentionDays: 7,
|
retentionDays: 7,
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"start-proxy-action-post.js","sourceRoot":"","sources":["../src/start-proxy-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,4DAA8C;AAC9C,6CAAgD;AAChD,4DAA8C;AAC9C,uDAA8D;AAC9D,mDAA2C;AAC3C,uCAA6C;AAC7C,6CAAkD;AAClD,iCAIgB;AAEhB,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,4CAA4C;QAC5C,WAAW,CAAC,aAAa,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QAC/C,IAAI,GAAG,EAAE,CAAC;YACR,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,wCAAwC,IAAA,sBAAe,EAAC,KAAK,CAAC,EAAE,CACjE,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,SAAS,CACxC,WAAW,CAAC,qBAAqB,EAAE,EACnC,IAAI,CACL,CAAC;IAEF,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QACnD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,CACP,wEAAwE,CACzE,CAAC;QACF,IAAI,MAAM,EAAE,aAAa,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC7C,IAAI,CAAC,OAAO,CACV,qFAAqF,CACtF,CAAC;YACF,OAAO;QACT,CAAC;QAED,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;QAClC,MAAM,aAAa,GAAG,MAAM,IAAA,6BAAgB,GAAE,CAAC;QAC/C,IAAA,gCAAyB,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACjD,MAAM,aAAa,GAAG,IAAA,+BAAkB,EACtC,IAAA,0BAAmB,EAAC,mBAAmB,CAAC,CACzC,CAAC;QACF,MAAM,QAAQ,GAAG,IAAI,wBAAQ,CAC3B,aAAa,EACb,aAAa,EACb,WAAW,CAAC,qBAAqB,EAAE,EACnC,MAAM,CACP,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,gBAAgB,GAAG,MAAM,IAAA,2CAAyB,EACtD,MAAM,EACN,aAAa,CAAC,IAAI,EAClB,QAAQ,CACT,CAAC;YAEF,MAAM,gBAAgB,CAAC,cAAc,CACnC,gBAAgB,EAChB,CAAC,WAAW,CAAC,EACb,WAAW,CAAC,qBAAqB,EAAE,EACnC;gBACE,wFAAwF;gBACxF,aAAa,EAAE,CAAC;aACjB,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,yEAAyE;YACzE,IAAI,CAAC,OAAO,CAAC,qCAAqC,CAAC,EAAE,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
{"version":3,"file":"start-proxy-action-post.js","sourceRoot":"","sources":["../src/start-proxy-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,4DAA8C;AAC9C,6CAAgD;AAChD,4DAA8C;AAC9C,uDAA8D;AAC9D,uCAA6C;AAC7C,iCAAoE;AAEpE,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,4CAA4C;QAC5C,WAAW,CAAC,aAAa,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QAC/C,IAAI,GAAG,EAAE,CAAC;YACR,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,wCAAwC,IAAA,sBAAe,EAAC,KAAK,CAAC,EAAE,CACjE,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,SAAS,CACxC,WAAW,CAAC,qBAAqB,EAAE,EACnC,IAAI,CACL,CAAC;IAEF,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QACnD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,CACP,wEAAwE,CACzE,CAAC;QACF,IAAI,MAAM,EAAE,aAAa,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC7C,IAAI,CAAC,OAAO,CACV,qFAAqF,CACtF,CAAC;YACF,OAAO;QACT,CAAC;QAED,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;QAClC,MAAM,aAAa,GAAG,MAAM,IAAA,6BAAgB,GAAE,CAAC;QAC/C,IAAA,gCAAyB,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAEjD,IAAI,CAAC;YACH,MAAM,gBAAgB,GAAG,MAAM,IAAA,2CAAyB,EACtD,MAAM,EACN,aAAa,CAAC,IAAI,CACnB,CAAC;YAEF,MAAM,gBAAgB,CAAC,cAAc,CACnC,gBAAgB,EAChB,CAAC,WAAW,CAAC,EACb,WAAW,CAAC,qBAAqB,EAAE,EACnC;gBACE,wFAAwF;gBACxF,aAAa,EAAE,CAAC;aACjB,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,yEAAyE;YACzE,IAAI,CAAC,OAAO,CAAC,qCAAqC,CAAC,EAAE,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||||
7
lib/upload-sarif-action-post.js
generated
7
lib/upload-sarif-action-post.js
generated
|
|
@ -40,13 +40,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
*/
|
*/
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const actionsUtil = __importStar(require("./actions-util"));
|
const actionsUtil = __importStar(require("./actions-util"));
|
||||||
const actions_util_1 = require("./actions-util");
|
|
||||||
const api_client_1 = require("./api-client");
|
const api_client_1 = require("./api-client");
|
||||||
const debugArtifacts = __importStar(require("./debug-artifacts"));
|
const debugArtifacts = __importStar(require("./debug-artifacts"));
|
||||||
const environment_1 = require("./environment");
|
const environment_1 = require("./environment");
|
||||||
const feature_flags_1 = require("./feature-flags");
|
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const repository_1 = require("./repository");
|
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
async function runWrapper() {
|
async function runWrapper() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -55,8 +52,6 @@ async function runWrapper() {
|
||||||
const logger = (0, logging_1.getActionsLogger)();
|
const logger = (0, logging_1.getActionsLogger)();
|
||||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
||||||
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger);
|
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger);
|
||||||
const repositoryNwo = (0, repository_1.parseRepositoryNwo)((0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY"));
|
|
||||||
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), logger);
|
|
||||||
// Upload SARIF artifacts if we determine that this is a third-party analysis run.
|
// Upload SARIF artifacts if we determine that this is a third-party analysis run.
|
||||||
// For first-party runs, this artifact will be uploaded in the `analyze-post` step.
|
// For first-party runs, this artifact will be uploaded in the `analyze-post` step.
|
||||||
if (process.env[environment_1.EnvVar.INIT_ACTION_HAS_RUN] !== "true") {
|
if (process.env[environment_1.EnvVar.INIT_ACTION_HAS_RUN] !== "true") {
|
||||||
|
|
@ -64,7 +59,7 @@ async function runWrapper() {
|
||||||
core.warning(`Did not upload debug artifacts because cannot determine the GitHub variant running.`);
|
core.warning(`Did not upload debug artifacts because cannot determine the GitHub variant running.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await (0, logging_1.withGroup)("Uploading combined SARIF debug artifact", () => debugArtifacts.uploadCombinedSarifArtifacts(logger, gitHubVersion.type, features));
|
await (0, logging_1.withGroup)("Uploading combined SARIF debug artifact", () => debugArtifacts.uploadCombinedSarifArtifacts(logger, gitHubVersion.type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"upload-sarif-action-post.js","sourceRoot":"","sources":["../src/upload-sarif-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,4DAA8C;AAC9C,iDAAuD;AACvD,6CAAgD;AAChD,kEAAoD;AACpD,+CAAuC;AACvC,mDAA2C;AAC3C,uCAAwD;AACxD,6CAAkD;AAClD,iCAIgB;AAEhB,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,6CAA6C;QAC7C,WAAW,CAAC,aAAa,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;QAClC,MAAM,aAAa,GAAG,MAAM,IAAA,6BAAgB,GAAE,CAAC;QAC/C,IAAA,gCAAyB,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACjD,MAAM,aAAa,GAAG,IAAA,+BAAkB,EACtC,IAAA,0BAAmB,EAAC,mBAAmB,CAAC,CACzC,CAAC;QACF,MAAM,QAAQ,GAAG,IAAI,wBAAQ,CAC3B,aAAa,EACb,aAAa,EACb,IAAA,oCAAqB,GAAE,EACvB,MAAM,CACP,CAAC;QAEF,kFAAkF;QAClF,mFAAmF;QACnF,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAM,CAAC,mBAAmB,CAAC,KAAK,MAAM,EAAE,CAAC;YACvD,IAAI,aAAa,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBACrC,IAAI,CAAC,OAAO,CACV,qFAAqF,CACtF,CAAC;gBACF,OAAO;YACT,CAAC;YACD,MAAM,IAAA,mBAAS,EAAC,yCAAyC,EAAE,GAAG,EAAE,CAC9D,cAAc,CAAC,4BAA4B,CACzC,MAAM,EACN,aAAa,CAAC,IAAI,EAClB,QAAQ,CACT,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,yCAAyC,IAAA,sBAAe,EAAC,KAAK,CAAC,EAAE,CAClE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
{"version":3,"file":"upload-sarif-action-post.js","sourceRoot":"","sources":["../src/upload-sarif-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,4DAA8C;AAC9C,6CAAgD;AAChD,kEAAoD;AACpD,+CAAuC;AACvC,uCAAwD;AACxD,iCAAoE;AAEpE,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,6CAA6C;QAC7C,WAAW,CAAC,aAAa,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;QAClC,MAAM,aAAa,GAAG,MAAM,IAAA,6BAAgB,GAAE,CAAC;QAC/C,IAAA,gCAAyB,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAEjD,kFAAkF;QAClF,mFAAmF;QACnF,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAM,CAAC,mBAAmB,CAAC,KAAK,MAAM,EAAE,CAAC;YACvD,IAAI,aAAa,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBACrC,IAAI,CAAC,OAAO,CACV,qFAAqF,CACtF,CAAC;gBACF,OAAO;YACT,CAAC;YACD,MAAM,IAAA,mBAAS,EAAC,yCAAyC,EAAE,GAAG,EAAE,CAC9D,cAAc,CAAC,4BAA4B,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,CACxE,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,yCAAyC,IAAA,sBAAe,EAAC,KAAK,CAAC,EAAE,CAClE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||||
|
|
@ -10,14 +10,8 @@ import { getGitHubVersion } from "./api-client";
|
||||||
import { getConfig } from "./config-utils";
|
import { getConfig } from "./config-utils";
|
||||||
import * as debugArtifacts from "./debug-artifacts";
|
import * as debugArtifacts from "./debug-artifacts";
|
||||||
import { EnvVar } from "./environment";
|
import { EnvVar } from "./environment";
|
||||||
import { Features } from "./feature-flags";
|
|
||||||
import { getActionsLogger, withGroup } from "./logging";
|
import { getActionsLogger, withGroup } from "./logging";
|
||||||
import { parseRepositoryNwo } from "./repository";
|
import { checkGitHubVersionInRange, getErrorMessage } from "./util";
|
||||||
import {
|
|
||||||
checkGitHubVersionInRange,
|
|
||||||
getErrorMessage,
|
|
||||||
getRequiredEnvParam,
|
|
||||||
} from "./util";
|
|
||||||
|
|
||||||
async function runWrapper() {
|
async function runWrapper() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -25,15 +19,6 @@ async function runWrapper() {
|
||||||
const logger = getActionsLogger();
|
const logger = getActionsLogger();
|
||||||
const gitHubVersion = await getGitHubVersion();
|
const gitHubVersion = await getGitHubVersion();
|
||||||
checkGitHubVersionInRange(gitHubVersion, logger);
|
checkGitHubVersionInRange(gitHubVersion, logger);
|
||||||
const repositoryNwo = parseRepositoryNwo(
|
|
||||||
getRequiredEnvParam("GITHUB_REPOSITORY"),
|
|
||||||
);
|
|
||||||
const features = new Features(
|
|
||||||
gitHubVersion,
|
|
||||||
repositoryNwo,
|
|
||||||
actionsUtil.getTemporaryDirectory(),
|
|
||||||
logger,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Upload SARIF artifacts if we determine that this is a first-party analysis run.
|
// Upload SARIF artifacts if we determine that this is a first-party analysis run.
|
||||||
// For third-party runs, this artifact will be uploaded in the `upload-sarif-post` step.
|
// For third-party runs, this artifact will be uploaded in the `upload-sarif-post` step.
|
||||||
|
|
@ -47,7 +32,6 @@ async function runWrapper() {
|
||||||
debugArtifacts.uploadCombinedSarifArtifacts(
|
debugArtifacts.uploadCombinedSarifArtifacts(
|
||||||
logger,
|
logger,
|
||||||
config.gitHubVersion.type,
|
config.gitHubVersion.type,
|
||||||
features,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
import test from "ava";
|
import test from "ava";
|
||||||
|
|
||||||
import * as debugArtifacts from "./debug-artifacts";
|
import * as debugArtifacts from "./debug-artifacts";
|
||||||
import { Feature } from "./feature-flags";
|
|
||||||
import { getActionsLogger } from "./logging";
|
import { getActionsLogger } from "./logging";
|
||||||
import { createFeatures } from "./testing-utils";
|
|
||||||
import { GitHubVariant } from "./util";
|
import { GitHubVariant } from "./util";
|
||||||
|
|
||||||
test("sanitizeArtifactName", (t) => {
|
test("sanitizeArtifactName", (t) => {
|
||||||
|
|
@ -25,7 +23,6 @@ test("sanitizeArtifactName", (t) => {
|
||||||
test("uploadDebugArtifacts", async (t) => {
|
test("uploadDebugArtifacts", async (t) => {
|
||||||
// Test that no error is thrown if artifacts list is empty.
|
// Test that no error is thrown if artifacts list is empty.
|
||||||
const logger = getActionsLogger();
|
const logger = getActionsLogger();
|
||||||
const mockFeature = createFeatures([Feature.ArtifactV4Upgrade]);
|
|
||||||
await t.notThrowsAsync(
|
await t.notThrowsAsync(
|
||||||
debugArtifacts.uploadDebugArtifacts(
|
debugArtifacts.uploadDebugArtifacts(
|
||||||
logger,
|
logger,
|
||||||
|
|
@ -33,7 +30,6 @@ test("uploadDebugArtifacts", async (t) => {
|
||||||
"rootDir",
|
"rootDir",
|
||||||
"artifactName",
|
"artifactName",
|
||||||
GitHubVariant.DOTCOM,
|
GitHubVariant.DOTCOM,
|
||||||
mockFeature,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import { dbIsFinalized } from "./analyze";
|
||||||
import { getCodeQL } from "./codeql";
|
import { getCodeQL } from "./codeql";
|
||||||
import { Config } from "./config-utils";
|
import { Config } from "./config-utils";
|
||||||
import { EnvVar } from "./environment";
|
import { EnvVar } from "./environment";
|
||||||
import { Feature, FeatureEnablement } from "./feature-flags";
|
|
||||||
import { Language } from "./languages";
|
import { Language } from "./languages";
|
||||||
import { Logger, withGroup } from "./logging";
|
import { Logger, withGroup } from "./logging";
|
||||||
import {
|
import {
|
||||||
|
|
@ -35,7 +34,6 @@ export function sanitizeArtifactName(name: string): string {
|
||||||
export async function uploadCombinedSarifArtifacts(
|
export async function uploadCombinedSarifArtifacts(
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
gitHubVariant: GitHubVariant,
|
gitHubVariant: GitHubVariant,
|
||||||
features: FeatureEnablement,
|
|
||||||
) {
|
) {
|
||||||
const tempDir = getTemporaryDirectory();
|
const tempDir = getTemporaryDirectory();
|
||||||
|
|
||||||
|
|
@ -70,7 +68,6 @@ export async function uploadCombinedSarifArtifacts(
|
||||||
baseTempDir,
|
baseTempDir,
|
||||||
"combined-sarif-artifacts",
|
"combined-sarif-artifacts",
|
||||||
gitHubVariant,
|
gitHubVariant,
|
||||||
features,
|
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warning(
|
logger.warning(
|
||||||
|
|
@ -163,7 +160,6 @@ async function tryBundleDatabase(
|
||||||
export async function tryUploadAllAvailableDebugArtifacts(
|
export async function tryUploadAllAvailableDebugArtifacts(
|
||||||
config: Config,
|
config: Config,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
features: FeatureEnablement,
|
|
||||||
) {
|
) {
|
||||||
const filesToUpload: string[] = [];
|
const filesToUpload: string[] = [];
|
||||||
try {
|
try {
|
||||||
|
|
@ -227,7 +223,6 @@ export async function tryUploadAllAvailableDebugArtifacts(
|
||||||
config.dbLocation,
|
config.dbLocation,
|
||||||
config.debugArtifactName,
|
config.debugArtifactName,
|
||||||
config.gitHubVersion.type,
|
config.gitHubVersion.type,
|
||||||
features,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
@ -243,7 +238,6 @@ export async function uploadDebugArtifacts(
|
||||||
rootDir: string,
|
rootDir: string,
|
||||||
artifactName: string,
|
artifactName: string,
|
||||||
ghVariant: GitHubVariant,
|
ghVariant: GitHubVariant,
|
||||||
features: FeatureEnablement,
|
|
||||||
) {
|
) {
|
||||||
if (toUpload.length === 0) {
|
if (toUpload.length === 0) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -263,11 +257,7 @@ export async function uploadDebugArtifacts(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const artifactUploader = await getArtifactUploaderClient(
|
const artifactUploader = await getArtifactUploaderClient(logger, ghVariant);
|
||||||
logger,
|
|
||||||
ghVariant,
|
|
||||||
features,
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await artifactUploader.uploadArtifact(
|
await artifactUploader.uploadArtifact(
|
||||||
|
|
@ -292,18 +282,12 @@ export async function uploadDebugArtifacts(
|
||||||
export async function getArtifactUploaderClient(
|
export async function getArtifactUploaderClient(
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
ghVariant: GitHubVariant,
|
ghVariant: GitHubVariant,
|
||||||
features: FeatureEnablement,
|
|
||||||
): Promise<artifact.ArtifactClient | artifactLegacy.ArtifactClient> {
|
): Promise<artifact.ArtifactClient | artifactLegacy.ArtifactClient> {
|
||||||
if (ghVariant === GitHubVariant.GHES) {
|
if (ghVariant === GitHubVariant.GHES) {
|
||||||
logger.info(
|
logger.info(
|
||||||
"Debug artifacts can be consumed with `actions/download-artifact@v3` because the `v4` version is not yet compatible on GHES.",
|
"Debug artifacts can be consumed with `actions/download-artifact@v3` because the `v4` version is not yet compatible on GHES.",
|
||||||
);
|
);
|
||||||
return artifactLegacy.create();
|
return artifactLegacy.create();
|
||||||
} else if (!(await features.getValue(Feature.ArtifactV4Upgrade))) {
|
|
||||||
logger.info(
|
|
||||||
"Debug artifacts can be consumed with `actions/download-artifact@v3`. To use the `actions/download-artifact@v4`, set the `CODEQL_ACTION_ARTIFACT_V4_UPGRADE` environment variable to true.",
|
|
||||||
);
|
|
||||||
return artifactLegacy.create();
|
|
||||||
} else {
|
} else {
|
||||||
logger.info(
|
logger.info(
|
||||||
"Debug artifacts can be consumed with `actions/download-artifact@v4`.",
|
"Debug artifacts can be consumed with `actions/download-artifact@v4`.",
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,6 @@ export interface FeatureEnablement {
|
||||||
* Legacy features should end with `_enabled`.
|
* Legacy features should end with `_enabled`.
|
||||||
*/
|
*/
|
||||||
export enum Feature {
|
export enum Feature {
|
||||||
ArtifactV4Upgrade = "artifact_v4_upgrade",
|
|
||||||
CleanupTrapCaches = "cleanup_trap_caches",
|
CleanupTrapCaches = "cleanup_trap_caches",
|
||||||
CppBuildModeNone = "cpp_build_mode_none",
|
CppBuildModeNone = "cpp_build_mode_none",
|
||||||
CppDependencyInstallation = "cpp_dependency_installation_enabled",
|
CppDependencyInstallation = "cpp_dependency_installation_enabled",
|
||||||
|
|
@ -94,11 +93,6 @@ export const featureConfig: Record<
|
||||||
toolsFeature?: ToolsFeature;
|
toolsFeature?: ToolsFeature;
|
||||||
}
|
}
|
||||||
> = {
|
> = {
|
||||||
[Feature.ArtifactV4Upgrade]: {
|
|
||||||
defaultValue: true,
|
|
||||||
envVar: "CODEQL_ACTION_ARTIFACT_V4_UPGRADE",
|
|
||||||
minimumVersion: undefined,
|
|
||||||
},
|
|
||||||
[Feature.CleanupTrapCaches]: {
|
[Feature.CleanupTrapCaches]: {
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
envVar: "CODEQL_ACTION_CLEANUP_TRAP_CACHES",
|
envVar: "CODEQL_ACTION_CLEANUP_TRAP_CACHES",
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,8 @@ import * as actionsUtil from "./actions-util";
|
||||||
import { getGitHubVersion } from "./api-client";
|
import { getGitHubVersion } from "./api-client";
|
||||||
import * as configUtils from "./config-utils";
|
import * as configUtils from "./config-utils";
|
||||||
import { getArtifactUploaderClient } from "./debug-artifacts";
|
import { getArtifactUploaderClient } from "./debug-artifacts";
|
||||||
import { Features } from "./feature-flags";
|
|
||||||
import { getActionsLogger } from "./logging";
|
import { getActionsLogger } from "./logging";
|
||||||
import { parseRepositoryNwo } from "./repository";
|
import { checkGitHubVersionInRange, getErrorMessage } from "./util";
|
||||||
import {
|
|
||||||
checkGitHubVersionInRange,
|
|
||||||
getErrorMessage,
|
|
||||||
getRequiredEnvParam,
|
|
||||||
} from "./util";
|
|
||||||
|
|
||||||
async function runWrapper() {
|
async function runWrapper() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -51,21 +45,11 @@ async function runWrapper() {
|
||||||
const logger = getActionsLogger();
|
const logger = getActionsLogger();
|
||||||
const gitHubVersion = await getGitHubVersion();
|
const gitHubVersion = await getGitHubVersion();
|
||||||
checkGitHubVersionInRange(gitHubVersion, logger);
|
checkGitHubVersionInRange(gitHubVersion, logger);
|
||||||
const repositoryNwo = parseRepositoryNwo(
|
|
||||||
getRequiredEnvParam("GITHUB_REPOSITORY"),
|
|
||||||
);
|
|
||||||
const features = new Features(
|
|
||||||
gitHubVersion,
|
|
||||||
repositoryNwo,
|
|
||||||
actionsUtil.getTemporaryDirectory(),
|
|
||||||
logger,
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const artifactUploader = await getArtifactUploaderClient(
|
const artifactUploader = await getArtifactUploaderClient(
|
||||||
logger,
|
logger,
|
||||||
gitHubVersion.type,
|
gitHubVersion.type,
|
||||||
features,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
await artifactUploader.uploadArtifact(
|
await artifactUploader.uploadArtifact(
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,11 @@
|
||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
|
|
||||||
import * as actionsUtil from "./actions-util";
|
import * as actionsUtil from "./actions-util";
|
||||||
import { getTemporaryDirectory } from "./actions-util";
|
|
||||||
import { getGitHubVersion } from "./api-client";
|
import { getGitHubVersion } from "./api-client";
|
||||||
import * as debugArtifacts from "./debug-artifacts";
|
import * as debugArtifacts from "./debug-artifacts";
|
||||||
import { EnvVar } from "./environment";
|
import { EnvVar } from "./environment";
|
||||||
import { Features } from "./feature-flags";
|
|
||||||
import { getActionsLogger, withGroup } from "./logging";
|
import { getActionsLogger, withGroup } from "./logging";
|
||||||
import { parseRepositoryNwo } from "./repository";
|
import { checkGitHubVersionInRange, getErrorMessage } from "./util";
|
||||||
import {
|
|
||||||
checkGitHubVersionInRange,
|
|
||||||
getErrorMessage,
|
|
||||||
getRequiredEnvParam,
|
|
||||||
} from "./util";
|
|
||||||
|
|
||||||
async function runWrapper() {
|
async function runWrapper() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -26,15 +19,6 @@ async function runWrapper() {
|
||||||
const logger = getActionsLogger();
|
const logger = getActionsLogger();
|
||||||
const gitHubVersion = await getGitHubVersion();
|
const gitHubVersion = await getGitHubVersion();
|
||||||
checkGitHubVersionInRange(gitHubVersion, logger);
|
checkGitHubVersionInRange(gitHubVersion, logger);
|
||||||
const repositoryNwo = parseRepositoryNwo(
|
|
||||||
getRequiredEnvParam("GITHUB_REPOSITORY"),
|
|
||||||
);
|
|
||||||
const features = new Features(
|
|
||||||
gitHubVersion,
|
|
||||||
repositoryNwo,
|
|
||||||
getTemporaryDirectory(),
|
|
||||||
logger,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Upload SARIF artifacts if we determine that this is a third-party analysis run.
|
// Upload SARIF artifacts if we determine that this is a third-party analysis run.
|
||||||
// For first-party runs, this artifact will be uploaded in the `analyze-post` step.
|
// For first-party runs, this artifact will be uploaded in the `analyze-post` step.
|
||||||
|
|
@ -46,11 +30,7 @@ async function runWrapper() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await withGroup("Uploading combined SARIF debug artifact", () =>
|
await withGroup("Uploading combined SARIF debug artifact", () =>
|
||||||
debugArtifacts.uploadCombinedSarifArtifacts(
|
debugArtifacts.uploadCombinedSarifArtifacts(logger, gitHubVersion.type),
|
||||||
logger,
|
|
||||||
gitHubVersion.type,
|
|
||||||
features,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue