mirror of
https://github.com/github/codeql-action.git
synced 2025-12-27 01:30:10 +08:00
Compare commits
208 Commits
codeql-bun
...
codeql-bun
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1245696032 | ||
|
|
317cd34a7a | ||
|
|
6cfb483131 | ||
|
|
a5f4123fb0 | ||
|
|
50931b43dd | ||
|
|
f54f0731d1 | ||
|
|
ca6b925548 | ||
|
|
d439786b65 | ||
|
|
f5159143cd | ||
|
|
a1be09ed8a | ||
|
|
2bf10dc4b9 | ||
|
|
e422b64793 | ||
|
|
5489416722 | ||
|
|
dc0f6da426 | ||
|
|
e1cca2565c | ||
|
|
cf58ef4480 | ||
|
|
fce87bbc67 | ||
|
|
cc641561b7 | ||
|
|
c237da1a2f | ||
|
|
cbc79bf64b | ||
|
|
b8f39fe0f5 | ||
|
|
130884e4e1 | ||
|
|
a0755a79b6 | ||
|
|
903cb278c5 | ||
|
|
e5fdcd4a8f | ||
|
|
eb8a70647a | ||
|
|
0ccdbf8cd5 | ||
|
|
c26fc558ba | ||
|
|
f8707c9939 | ||
|
|
699855c048 | ||
|
|
edb138ff88 | ||
|
|
95cfca769b | ||
|
|
9c51a58355 | ||
|
|
deb312c60b | ||
|
|
9824588133 | ||
|
|
11fba50273 | ||
|
|
684c4b5c77 | ||
|
|
1e1aca8165 | ||
|
|
898fba281b | ||
|
|
913b8b11ad | ||
|
|
29b1f65c5e | ||
|
|
140500d80a | ||
|
|
318bcc7f84 | ||
|
|
f72bf5dfb3 | ||
|
|
33461954a5 | ||
|
|
3df80238a3 | ||
|
|
ef88842204 | ||
|
|
ece3cbc8ec | ||
|
|
febbadf751 | ||
|
|
8ca5570701 | ||
|
|
b1b3d00b62 | ||
|
|
d2f6dfd52d | ||
|
|
cba5616040 | ||
|
|
40c95932fe | ||
|
|
234badad23 | ||
|
|
824d18c689 | ||
|
|
f31a31c052 | ||
|
|
e3395de200 | ||
|
|
1cccbfcedc | ||
|
|
f3feb00acb | ||
|
|
1c9e206df3 | ||
|
|
8b12d99ee5 | ||
|
|
dcf71cf79b | ||
|
|
194450bdd6 | ||
|
|
e78ef455a8 | ||
|
|
8662eabe0e | ||
|
|
1f2f707d99 | ||
|
|
da583b07a7 | ||
|
|
a9648ea7c6 | ||
|
|
c5f3f016ae | ||
|
|
90f053271e | ||
|
|
0f085f964c | ||
|
|
b2c19fb9a2 | ||
|
|
b203f98343 | ||
|
|
a8affb0639 | ||
|
|
b8cc643a23 | ||
|
|
7019a9c6fd | ||
|
|
66f62df188 | ||
|
|
afdf30f311 | ||
|
|
55a2e70992 | ||
|
|
1c2f282107 | ||
|
|
47cec7ab01 | ||
|
|
7b876ae4f4 | ||
|
|
f398a65921 | ||
|
|
9a866ed452 | ||
|
|
7867d03591 | ||
|
|
be2b53b5c7 | ||
|
|
ae24b75fca | ||
|
|
dc046388f3 | ||
|
|
b4fa971e40 | ||
|
|
7879209bb2 | ||
|
|
7df0ce3489 | ||
|
|
fbedecac34 | ||
|
|
d944b3423d | ||
|
|
e3210d8ce3 | ||
|
|
599f4927f2 | ||
|
|
ed6c4995fc | ||
|
|
c2b5d643fd | ||
|
|
8a093aa1a5 | ||
|
|
9c13316a15 | ||
|
|
98f7bbd610 | ||
|
|
d7b9dcdb85 | ||
|
|
fc374f5e9a | ||
|
|
b4e6f81a72 | ||
|
|
0b75f471b1 | ||
|
|
c9f360d9af | ||
|
|
d2950c11f0 | ||
|
|
a9fb7d923c | ||
|
|
696504dcab | ||
|
|
18f13455eb | ||
|
|
988e1bc941 | ||
|
|
e12fed6a79 | ||
|
|
ca89579b06 | ||
|
|
d186a2a36c | ||
|
|
748f83eaab | ||
|
|
518b24fea4 | ||
|
|
69371ffa95 | ||
|
|
e5c2f32a9f | ||
|
|
c28edf06a1 | ||
|
|
555b602b2f | ||
|
|
7193623f40 | ||
|
|
2058418de9 | ||
|
|
5da64f56c0 | ||
|
|
322cea6439 | ||
|
|
f7a67e4341 | ||
|
|
f32426ba96 | ||
|
|
173a94ca3f | ||
|
|
8efbd5b301 | ||
|
|
8c8d71dde4 | ||
|
|
d53297ef61 | ||
|
|
66aeadb4c9 | ||
|
|
fa7cce4d4b | ||
|
|
2754e10472 | ||
|
|
3bba073180 | ||
|
|
ae0109a777 | ||
|
|
9c869ebf0d | ||
|
|
f0a422fa27 | ||
|
|
98173be3f0 | ||
|
|
f6091a09eb | ||
|
|
a86046f817 | ||
|
|
33f30874a7 | ||
|
|
1c0a788663 | ||
|
|
e85546ccca | ||
|
|
fe4a785361 | ||
|
|
bb28e7e59e | ||
|
|
69aec345f1 | ||
|
|
29a4713933 | ||
|
|
d838bacfbe | ||
|
|
dc81ae3368 | ||
|
|
72d018e267 | ||
|
|
9975b733f4 | ||
|
|
6cd5121600 | ||
|
|
f6e4cff38a | ||
|
|
fff3a80b5b | ||
|
|
ff39eb8d6a | ||
|
|
6ef37003ca | ||
|
|
d13d683355 | ||
|
|
d8fe76e161 | ||
|
|
4772c1d99f | ||
|
|
f9c159f4fd | ||
|
|
0af0653ef4 | ||
|
|
bc0ed6a6c3 | ||
|
|
b0e191ecbc | ||
|
|
57eca7cbb2 | ||
|
|
1e7a38893c | ||
|
|
2deae45400 | ||
|
|
32daed70e7 | ||
|
|
04df1262e6 | ||
|
|
f0988cbd79 | ||
|
|
fef20d6c35 | ||
|
|
fb32c3fefd | ||
|
|
329c022f48 | ||
|
|
c8935d5a9d | ||
|
|
ade432fd68 | ||
|
|
6f852eeb38 | ||
|
|
097ab4665f | ||
|
|
befd804b8b | ||
|
|
a21bb7f968 | ||
|
|
0214d1d378 | ||
|
|
94cc1dea00 | ||
|
|
04f256d7e2 | ||
|
|
0b08c9f2ff | ||
|
|
1196b1ac0c | ||
|
|
67a35a0858 | ||
|
|
57571ab0cd | ||
|
|
066b6343ef | ||
|
|
aefd9896b1 | ||
|
|
3ca2260643 | ||
|
|
5f20b2c372 | ||
|
|
760583e70d | ||
|
|
0ef7eda548 | ||
|
|
86128131fa | ||
|
|
ebbe965b43 | ||
|
|
3cbd063679 | ||
|
|
b4fba292aa | ||
|
|
b55762b0a6 | ||
|
|
91fb7b5c11 | ||
|
|
34231cfd52 | ||
|
|
f1fb80a041 | ||
|
|
f81f52702f | ||
|
|
2f141340f0 | ||
|
|
94786b354b | ||
|
|
ee44252240 | ||
|
|
978bc50f9b | ||
|
|
fb75ebd750 | ||
|
|
a2527628e8 | ||
|
|
16b3d998b4 | ||
|
|
98a90dcce7 |
@@ -40,11 +40,11 @@ runs:
|
|||||||
with:
|
with:
|
||||||
output: ${{ runner.temp }}/results
|
output: ${{ runner.temp }}/results
|
||||||
upload-database: false
|
upload-database: false
|
||||||
upload: false
|
upload: never
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: "true"
|
CODEQL_ACTION_TEST_MODE: "true"
|
||||||
- name: Check SARIF
|
- name: Check SARIF
|
||||||
uses: ./../action/.github/check-sarif
|
uses: ./../action/.github/actions/check-sarif
|
||||||
with:
|
with:
|
||||||
sarif-file: ${{ inputs.sarif-file }}
|
sarif-file: ${{ inputs.sarif-file }}
|
||||||
queries-run: ${{ inputs.queries-run}}
|
queries-run: ${{ inputs.queries-run}}
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
name: "Set up Swift"
|
name: "Set up Swift"
|
||||||
description: Performs necessary steps to set up appropriate Swift version.
|
description: Sets up an appropriate Swift version if Swift is enabled via CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT.
|
||||||
inputs:
|
inputs:
|
||||||
codeql-path:
|
codeql-path:
|
||||||
|
description: Path to the CodeQL CLI executable.
|
||||||
required: true
|
required: true
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Get Swift version
|
- name: Get Swift version
|
||||||
id: get_swift_version
|
id: get_swift_version
|
||||||
# We don't support Swift on Windows or prior versions of CLI.
|
if: env.CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT == 'true'
|
||||||
if: "(runner.os != 'Windows') && (matrix.version == 'cached' || matrix.version == 'latest' || matrix.version == 'nightly-latest')"
|
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
CODEQL_PATH: ${{inputs.codeql-path}}
|
CODEQL_PATH: ${{ inputs.codeql-path }}
|
||||||
run: |
|
run: |
|
||||||
if [ $RUNNER_OS = "macOS" ]; then
|
if [ $RUNNER_OS = "macOS" ]; then
|
||||||
PLATFORM="osx64"
|
PLATFORM="osx64"
|
||||||
@@ -26,7 +26,7 @@ runs:
|
|||||||
VERSION="5.7.0"
|
VERSION="5.7.0"
|
||||||
fi
|
fi
|
||||||
echo "version=$VERSION" | tee -a $GITHUB_OUTPUT
|
echo "version=$VERSION" | tee -a $GITHUB_OUTPUT
|
||||||
- uses: swift-actions/setup-swift@da0e3e04b5e3e15dbc3861bd835ad9f0afe56296 # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test.
|
- uses: swift-actions/setup-swift@65540b95f51493d65f5e59e97dcef9629ddf11bf # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test.
|
||||||
if: "(runner.os != 'Windows') && (matrix.version == 'cached' || matrix.version == 'latest' || matrix.version == 'nightly-latest')"
|
if: env.CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT == 'true'
|
||||||
with:
|
with:
|
||||||
swift-version: "${{steps.get_swift_version.outputs.version}}"
|
swift-version: "${{ steps.get_swift_version.outputs.version }}"
|
||||||
14
.github/actions/update-bundle/action.yml
vendored
Normal file
14
.github/actions/update-bundle/action.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
name: Update default CodeQL bundle
|
||||||
|
description: Updates 'src/defaults.json' to point to a new CodeQL bundle release.
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Install ts-node
|
||||||
|
shell: bash
|
||||||
|
run: npm install -g ts-node
|
||||||
|
|
||||||
|
- name: Run update script
|
||||||
|
working-directory: ${{ github.action_path }}
|
||||||
|
shell: bash
|
||||||
|
run: ts-node ./index.ts
|
||||||
67
.github/actions/update-bundle/index.ts
vendored
Normal file
67
.github/actions/update-bundle/index.ts
vendored
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import * as fs from 'fs';
|
||||||
|
import * as github from '@actions/github';
|
||||||
|
|
||||||
|
interface BundleInfo {
|
||||||
|
bundleVersion: string;
|
||||||
|
cliVersion: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Defaults {
|
||||||
|
bundleVersion: string;
|
||||||
|
cliVersion: string;
|
||||||
|
priorBundleVersion: string;
|
||||||
|
priorCliVersion: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCodeQLCliVersionForRelease(release): string {
|
||||||
|
// We do not currently tag CodeQL bundles based on the CLI version they contain.
|
||||||
|
// Instead, we use a marker file `cli-version-<version>.txt` to record the CLI version.
|
||||||
|
// This marker file is uploaded as a release asset for all new CodeQL bundles.
|
||||||
|
const cliVersionsFromMarkerFiles = release.assets
|
||||||
|
.map((asset) => asset.name.match(/cli-version-(.*)\.txt/)?.[1])
|
||||||
|
.filter((v) => v)
|
||||||
|
.map((v) => v as string);
|
||||||
|
if (cliVersionsFromMarkerFiles.length > 1) {
|
||||||
|
throw new Error(
|
||||||
|
`Release ${release.tag_name} has multiple CLI version marker files.`
|
||||||
|
);
|
||||||
|
} else if (cliVersionsFromMarkerFiles.length === 0) {
|
||||||
|
throw new Error(
|
||||||
|
`Failed to find the CodeQL CLI version for release ${release.tag_name}.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return cliVersionsFromMarkerFiles[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getBundleInfoFromRelease(release): Promise<BundleInfo> {
|
||||||
|
return {
|
||||||
|
bundleVersion: release.tag_name,
|
||||||
|
cliVersion: getCodeQLCliVersionForRelease(release)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getNewDefaults(currentDefaults: Defaults): Promise<Defaults> {
|
||||||
|
const release = github.context.payload.release;
|
||||||
|
console.log('Updating default bundle as a result of the following release: ' +
|
||||||
|
`${JSON.stringify(release)}.`)
|
||||||
|
|
||||||
|
const bundleInfo = await getBundleInfoFromRelease(release);
|
||||||
|
return {
|
||||||
|
bundleVersion: bundleInfo.bundleVersion,
|
||||||
|
cliVersion: bundleInfo.cliVersion,
|
||||||
|
priorBundleVersion: currentDefaults.bundleVersion,
|
||||||
|
priorCliVersion: currentDefaults.cliVersion
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const previousDefaults: Defaults = JSON.parse(fs.readFileSync('../../../src/defaults.json', 'utf8'));
|
||||||
|
const newDefaults = await getNewDefaults(previousDefaults);
|
||||||
|
// Update the source file in the repository. Calling workflows should subsequently rebuild
|
||||||
|
// the Action to update `lib/defaults.json`.
|
||||||
|
fs.writeFileSync('../../../src/defaults.json', JSON.stringify(newDefaults, null, 2) + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ideally, we'd await main() here, but that doesn't work well with `ts-node`.
|
||||||
|
// So instead we rely on the fact that Node won't exit until the event loop is empty.
|
||||||
|
main();
|
||||||
2
.github/dependabot.yml
vendored
2
.github/dependabot.yml
vendored
@@ -16,6 +16,6 @@ updates:
|
|||||||
schedule:
|
schedule:
|
||||||
interval: weekly
|
interval: weekly
|
||||||
- package-ecosystem: github-actions
|
- package-ecosystem: github-actions
|
||||||
directory: "/.github/setup-swift/" # All subdirectories outside of "/.github/workflows" must be explicitly included.
|
directory: "/.github/actions/setup-swift/" # All subdirectories outside of "/.github/workflows" must be explicitly included.
|
||||||
schedule:
|
schedule:
|
||||||
interval: weekly
|
interval: weekly
|
||||||
|
|||||||
48
.github/workflows/__analyze-ref-input.yml
generated
vendored
48
.github/workflows/__analyze-ref-input.yml
generated
vendored
@@ -25,24 +25,30 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20211005
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20211005
|
|
||||||
- os: windows-2019
|
|
||||||
version: stable-20211005
|
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20220120
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220120
|
|
||||||
- os: windows-2019
|
|
||||||
version: stable-20220120
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20221211
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -69,14 +75,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
- name: Set environment variable for Swift enablement
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
if: >-
|
||||||
uses: actions/setup-go@v3
|
runner.os != 'Windows' && (
|
||||||
with:
|
matrix.version == '20220908' ||
|
||||||
go-version: ^1.13.1
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
|||||||
13
.github/workflows/__autobuild-action.yml
generated
vendored
13
.github/workflows/__autobuild-action.yml
generated
vendored
@@ -39,9 +39,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: csharp
|
languages: csharp
|
||||||
|
|||||||
20
.github/workflows/__config-export.yml
generated
vendored
20
.github/workflows/__config-export.yml
generated
vendored
@@ -31,6 +31,12 @@ jobs:
|
|||||||
version: latest
|
version: latest
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: latest
|
version: latest
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: nightly-latest
|
||||||
|
- os: macos-latest
|
||||||
|
version: nightly-latest
|
||||||
|
- os: windows-latest
|
||||||
|
version: nightly-latest
|
||||||
name: Config export
|
name: Config export
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
@@ -39,9 +45,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: javascript
|
languages: javascript
|
||||||
@@ -64,7 +81,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
|
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
|
||||||
const run = sarif.runs[0];
|
const run = sarif.runs[0];
|
||||||
|
|||||||
151
.github/workflows/__diagnostics-export.yml
generated
vendored
Normal file
151
.github/workflows/__diagnostics-export.yml
generated
vendored
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
# Warning: This file is generated automatically, and should not be modified.
|
||||||
|
# Instead, please modify the template in the pr-checks directory and run:
|
||||||
|
# pip install ruamel.yaml && python3 sync.py
|
||||||
|
# to regenerate this file.
|
||||||
|
|
||||||
|
name: PR Check - Diagnostic export
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GO111MODULE: auto
|
||||||
|
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- releases/v2
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- ready_for_review
|
||||||
|
workflow_dispatch: {}
|
||||||
|
jobs:
|
||||||
|
diagnostics-export:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20230317
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20230317
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20230317
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: latest
|
||||||
|
- os: macos-latest
|
||||||
|
version: latest
|
||||||
|
- os: windows-latest
|
||||||
|
version: latest
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: nightly-latest
|
||||||
|
- os: macos-latest
|
||||||
|
version: nightly-latest
|
||||||
|
- os: windows-latest
|
||||||
|
version: nightly-latest
|
||||||
|
name: Diagnostic export
|
||||||
|
timeout-minutes: 45
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Prepare test
|
||||||
|
id: prepare-test
|
||||||
|
uses: ./.github/actions/prepare-test
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
|
- uses: ./../action/init
|
||||||
|
id: init
|
||||||
|
with:
|
||||||
|
languages: javascript
|
||||||
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
- name: Add test diagnostics
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
CODEQL_PATH: ${{ steps.init.outputs.codeql-path }}
|
||||||
|
run: |
|
||||||
|
for i in {1..2}; do
|
||||||
|
# Use the same location twice to test the workaround for the bug in CodeQL CLI 2.12.5 that
|
||||||
|
# produces an invalid diagnostic with multiple identical location objects.
|
||||||
|
"$CODEQL_PATH" database add-diagnostic \
|
||||||
|
"$RUNNER_TEMP/codeql_databases/javascript" \
|
||||||
|
--file-path /path/to/file \
|
||||||
|
--plaintext-message "Plaintext message $i" \
|
||||||
|
--source-id "lang/diagnostics/example" \
|
||||||
|
--source-name "Diagnostic name" \
|
||||||
|
--ready-for-status-page
|
||||||
|
done
|
||||||
|
- uses: ./../action/analyze
|
||||||
|
with:
|
||||||
|
output: ${{ runner.temp }}/results
|
||||||
|
upload-database: false
|
||||||
|
- name: Upload SARIF
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: diagnostics-export-${{ matrix.os }}-${{ matrix.version }}.sarif.json
|
||||||
|
path: ${{ runner.temp }}/results/javascript.sarif
|
||||||
|
retention-days: 7
|
||||||
|
- name: Check diagnostics appear in SARIF
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
env:
|
||||||
|
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
function checkStatusPageNotification(n) {
|
||||||
|
const expectedMessage = 'Plaintext message 1\n\nCodeQL also found 1 other diagnostic like this. See the workflow log for details.';
|
||||||
|
if (n.message.text !== expectedMessage) {
|
||||||
|
core.setFailed(`Expected the status page diagnostic to have the message '${expectedMessage}', but found '${n.message.text}'.`);
|
||||||
|
}
|
||||||
|
if (n.locations.length !== 1) {
|
||||||
|
core.setFailed(`Expected the status page diagnostic to have exactly 1 location, but found ${n.locations.length}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
|
||||||
|
const run = sarif.runs[0];
|
||||||
|
|
||||||
|
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
|
||||||
|
const statusPageNotifications = toolExecutionNotifications.filter(n =>
|
||||||
|
n.descriptor.id === 'lang/diagnostics/example' && n.properties?.visibility?.statusPage
|
||||||
|
);
|
||||||
|
if (statusPageNotifications.length !== 1) {
|
||||||
|
core.setFailed(
|
||||||
|
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
|
||||||
|
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
|
||||||
|
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
|
||||||
|
`${JSON.stringify(toolExecutionNotifications)}.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
checkStatusPageNotification(statusPageNotifications[0]);
|
||||||
|
|
||||||
|
const notifications = run.tool.driver.notifications;
|
||||||
|
const diagnosticNotification = notifications.filter(n =>
|
||||||
|
n.id === 'lang/diagnostics/example' && n.name === 'lang/diagnostics/example' &&
|
||||||
|
n.fullDescription.text === 'Diagnostic name'
|
||||||
|
);
|
||||||
|
if (diagnosticNotification.length !== 1) {
|
||||||
|
core.setFailed(
|
||||||
|
'Expected exactly one notification for this diagnostic in the ' +
|
||||||
|
`'runs[].tool.driver.notifications[]' SARIF property, but found ` +
|
||||||
|
`${diagnosticNotification.length}. All notifications: ` +
|
||||||
|
`${JSON.stringify(notifications)}.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
core.info('Finished diagnostic export test');
|
||||||
|
env:
|
||||||
|
CODEQL_ACTION_EXPORT_DIAGNOSTICS: true
|
||||||
|
CODEQL_ACTION_TEST_MODE: true
|
||||||
21
.github/workflows/__export-file-baseline-information.yml
generated
vendored
21
.github/workflows/__export-file-baseline-information.yml
generated
vendored
@@ -39,9 +39,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
id: init
|
id: init
|
||||||
with:
|
with:
|
||||||
@@ -49,7 +60,7 @@ jobs:
|
|||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
env:
|
env:
|
||||||
CODEQL_FILE_BASELINE_INFORMATION: true
|
CODEQL_FILE_BASELINE_INFORMATION: true
|
||||||
- uses: ./../action/.github/setup-swift
|
- uses: ./../action/.github/actions/setup-swift
|
||||||
with:
|
with:
|
||||||
codeql-path: ${{steps.init.outputs.codeql-path}}
|
codeql-path: ${{steps.init.outputs.codeql-path}}
|
||||||
- name: Build code
|
- name: Build code
|
||||||
@@ -70,7 +81,10 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd "$RUNNER_TEMP/results"
|
cd "$RUNNER_TEMP/results"
|
||||||
expected_baseline_languages="cpp cs go java js py rb swift"
|
expected_baseline_languages="cpp cs go java js py rb"
|
||||||
|
if [[ $RUNNER_OS != "Windows" ]]; then
|
||||||
|
expected_baseline_languages+=" swift"
|
||||||
|
fi
|
||||||
|
|
||||||
for lang in ${expected_baseline_languages}; do
|
for lang in ${expected_baseline_languages}; do
|
||||||
rule_name="${lang}/baseline/expected-extracted-files"
|
rule_name="${lang}/baseline/expected-extracted-files"
|
||||||
@@ -84,5 +98,4 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
env:
|
env:
|
||||||
CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true # Remove when Swift is GA.
|
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
CODEQL_ACTION_TEST_MODE: true
|
||||||
|
|||||||
13
.github/workflows/__extractor-ram-threads.yml
generated
vendored
13
.github/workflows/__extractor-ram-threads.yml
generated
vendored
@@ -35,9 +35,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: java
|
languages: java
|
||||||
|
|||||||
48
.github/workflows/__go-custom-queries.yml
generated
vendored
48
.github/workflows/__go-custom-queries.yml
generated
vendored
@@ -25,24 +25,30 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20211005
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20211005
|
|
||||||
- os: windows-2019
|
|
||||||
version: stable-20211005
|
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20220120
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220120
|
|
||||||
- os: windows-2019
|
|
||||||
version: stable-20220120
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20221211
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -69,14 +75,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
- name: Set environment variable for Swift enablement
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
if: >-
|
||||||
uses: actions/setup-go@v3
|
runner.os != 'Windows' && (
|
||||||
with:
|
matrix.version == '20220908' ||
|
||||||
go-version: ^1.13.1
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: go
|
languages: go
|
||||||
|
|||||||
38
.github/workflows/__go-tracing-autobuilder.yml
generated
vendored
38
.github/workflows/__go-tracing-autobuilder.yml
generated
vendored
@@ -25,18 +25,22 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20211005
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20211005
|
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20220120
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220120
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20221211
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -57,14 +61,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
- name: Set environment variable for Swift enablement
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
if: >-
|
||||||
uses: actions/setup-go@v3
|
runner.os != 'Windows' && (
|
||||||
with:
|
matrix.version == '20220908' ||
|
||||||
go-version: ^1.13.1
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: go
|
languages: go
|
||||||
|
|||||||
38
.github/workflows/__go-tracing-custom-build-steps.yml
generated
vendored
38
.github/workflows/__go-tracing-custom-build-steps.yml
generated
vendored
@@ -25,18 +25,22 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20211005
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20211005
|
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20220120
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220120
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20221211
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -57,14 +61,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
- name: Set environment variable for Swift enablement
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
if: >-
|
||||||
uses: actions/setup-go@v3
|
runner.os != 'Windows' && (
|
||||||
with:
|
matrix.version == '20220908' ||
|
||||||
go-version: ^1.13.1
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: go
|
languages: go
|
||||||
|
|||||||
38
.github/workflows/__go-tracing-legacy-workflow.yml
generated
vendored
38
.github/workflows/__go-tracing-legacy-workflow.yml
generated
vendored
@@ -25,18 +25,22 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20211005
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20211005
|
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20220120
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220120
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20221211
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -57,14 +61,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
- name: Set environment variable for Swift enablement
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
if: >-
|
||||||
uses: actions/setup-go@v3
|
runner.os != 'Windows' && (
|
||||||
with:
|
matrix.version == '20220908' ||
|
||||||
go-version: ^1.13.1
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: go
|
languages: go
|
||||||
|
|||||||
21
.github/workflows/__init-with-registries.yml
generated
vendored
21
.github/workflows/__init-with-registries.yml
generated
vendored
@@ -51,9 +51,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- name: Init with registries
|
- name: Init with registries
|
||||||
uses: ./../action/init
|
uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
@@ -69,8 +80,8 @@ jobs:
|
|||||||
- name: Verify packages installed
|
- name: Verify packages installed
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
PRIVATE_PACK="$HOME/.codeql/packages/dsp-testing/private-pack"
|
PRIVATE_PACK="$HOME/.codeql/packages/codeql-testing/private-pack"
|
||||||
CODEQL_PACK1="$HOME/.codeql/packages/dsp-testing/codeql-pack1"
|
CODEQL_PACK1="$HOME/.codeql/packages/codeql-testing/codeql-pack1"
|
||||||
|
|
||||||
if [[ -d $PRIVATE_PACK ]]
|
if [[ -d $PRIVATE_PACK ]]
|
||||||
then
|
then
|
||||||
@@ -117,5 +128,9 @@ jobs:
|
|||||||
cat $QLCONFIG_PATH
|
cat $QLCONFIG_PATH
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: read
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
CODEQL_ACTION_TEST_MODE: true
|
||||||
|
|||||||
15
.github/workflows/__javascript-source-root.yml
generated
vendored
15
.github/workflows/__javascript-source-root.yml
generated
vendored
@@ -39,9 +39,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- name: Move codeql-action
|
- name: Move codeql-action
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -56,7 +67,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
upload-database: false
|
upload-database: false
|
||||||
skip-queries: true
|
skip-queries: true
|
||||||
upload: false
|
upload: never
|
||||||
- name: Assert database exists
|
- name: Assert database exists
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
55
.github/workflows/__ml-powered-queries.yml
generated
vendored
55
.github/workflows/__ml-powered-queries.yml
generated
vendored
@@ -25,12 +25,30 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-latest
|
||||||
version: stable-20220120
|
version: stable-20220401
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220120
|
version: stable-20220401
|
||||||
- os: windows-2019
|
- os: windows-latest
|
||||||
version: stable-20220120
|
version: stable-20220401
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20221211
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -57,14 +75,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
- name: Set environment variable for Swift enablement
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
if: >-
|
||||||
uses: actions/setup-go@v3
|
runner.os != 'Windows' && (
|
||||||
with:
|
matrix.version == '20220908' ||
|
||||||
go-version: ^1.13.1
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: javascript
|
languages: javascript
|
||||||
@@ -85,18 +109,19 @@ jobs:
|
|||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
- name: Check sarif
|
- name: Check sarif
|
||||||
uses: ./../action/.github/check-sarif
|
uses: ./../action/.github/actions/check-sarif
|
||||||
# Running on Windows requires CodeQL CLI 2.9.0+.
|
# Running on Windows requires CodeQL CLI 2.9.0+.
|
||||||
if: "!(matrix.version == 'stable-20220120' && runner.os == 'Windows')"
|
if: "!(matrix.version == 'stable-20220401' && runner.os == 'Windows')"
|
||||||
with:
|
with:
|
||||||
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||||
queries-run: js/ml-powered/nosql-injection,js/ml-powered/path-injection,js/ml-powered/sql-injection,js/ml-powered/xss
|
queries-run:
|
||||||
|
js/ml-powered/nosql-injection,js/ml-powered/path-injection,js/ml-powered/sql-injection,js/ml-powered/xss
|
||||||
queries-not-run: foo,bar
|
queries-not-run: foo,bar
|
||||||
|
|
||||||
- name: Check results
|
- name: Check results
|
||||||
env:
|
env:
|
||||||
# Running on Windows requires CodeQL CLI 2.9.0+.
|
# Running on Windows requires CodeQL CLI 2.9.0+.
|
||||||
SHOULD_RUN_ML_POWERED_QUERIES: ${{ !(matrix.version == 'stable-20220120' &&
|
SHOULD_RUN_ML_POWERED_QUERIES: ${{ !(matrix.version == 'stable-20220401' &&
|
||||||
runner.os == 'Windows') }}
|
runner.os == 'Windows') }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
49
.github/workflows/__multi-language-autodetect.yml
generated
vendored
49
.github/workflows/__multi-language-autodetect.yml
generated
vendored
@@ -25,18 +25,22 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20211005
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20211005
|
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20220120
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220120
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20221211
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -57,23 +61,29 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
- name: Set environment variable for Swift enablement
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
if: >-
|
||||||
uses: actions/setup-go@v3
|
runner.os != 'Windows' && (
|
||||||
with:
|
matrix.version == '20220908' ||
|
||||||
go-version: ^1.13.1
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
id: init
|
id: init
|
||||||
with:
|
with:
|
||||||
db-location: ${{ runner.temp }}/customDbLocation
|
db-location: ${{ runner.temp }}/customDbLocation
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
|
||||||
- uses: ./../action/.github/setup-swift
|
- uses: ./../action/.github/actions/setup-swift
|
||||||
with:
|
with:
|
||||||
codeql-path: ${{steps.init.outputs.codeql-path}}
|
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||||
|
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -119,8 +129,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Check language autodetect for Ruby
|
- name: Check language autodetect for Ruby
|
||||||
if: (matrix.version == 'cached' || matrix.version == 'latest' || matrix.version
|
if: env.CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT == 'true'
|
||||||
== 'nightly-latest')
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
RUBY_DB=${{ fromJson(steps.analysis.outputs.db-locations).ruby }}
|
RUBY_DB=${{ fromJson(steps.analysis.outputs.db-locations).ruby }}
|
||||||
@@ -130,8 +139,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Check language autodetect for Swift
|
- name: Check language autodetect for Swift
|
||||||
if: (matrix.version == 'cached' || matrix.version == 'latest' || matrix.version
|
if: env.CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT == 'true'
|
||||||
== 'nightly-latest')
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }}
|
SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }}
|
||||||
@@ -140,5 +148,4 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true' # Remove when Swift is GA.
|
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
CODEQL_ACTION_TEST_MODE: true
|
||||||
|
|||||||
20
.github/workflows/__packaging-codescanning-config-inputs-js.yml
generated
vendored
20
.github/workflows/__packaging-codescanning-config-inputs-js.yml
generated
vendored
@@ -51,13 +51,24 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
config-file: .github/codeql/codeql-config-packaging3.yml
|
config-file: .github/codeql/codeql-config-packaging3.yml
|
||||||
packs: +dsp-testing/codeql-pack1@1.0.0
|
packs: +codeql-testing/codeql-pack1@1.0.0
|
||||||
languages: javascript
|
languages: javascript
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
- name: Build code
|
- name: Build code
|
||||||
@@ -69,10 +80,11 @@ jobs:
|
|||||||
upload-database: false
|
upload-database: false
|
||||||
|
|
||||||
- name: Check results
|
- name: Check results
|
||||||
uses: ./../action/.github/check-sarif
|
uses: ./../action/.github/actions/check-sarif
|
||||||
with:
|
with:
|
||||||
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||||
queries-run: javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
|
queries-run:
|
||||||
|
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
|
||||||
queries-not-run: foo,bar
|
queries-not-run: foo,bar
|
||||||
|
|
||||||
- name: Assert Results
|
- name: Assert Results
|
||||||
|
|||||||
20
.github/workflows/__packaging-config-inputs-js.yml
generated
vendored
20
.github/workflows/__packaging-config-inputs-js.yml
generated
vendored
@@ -51,13 +51,24 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
config-file: .github/codeql/codeql-config-packaging3.yml
|
config-file: .github/codeql/codeql-config-packaging3.yml
|
||||||
packs: +dsp-testing/codeql-pack1@1.0.0
|
packs: +codeql-testing/codeql-pack1@1.0.0
|
||||||
languages: javascript
|
languages: javascript
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
- name: Build code
|
- name: Build code
|
||||||
@@ -69,10 +80,11 @@ jobs:
|
|||||||
upload-database: false
|
upload-database: false
|
||||||
|
|
||||||
- name: Check results
|
- name: Check results
|
||||||
uses: ./../action/.github/check-sarif
|
uses: ./../action/.github/actions/check-sarif
|
||||||
with:
|
with:
|
||||||
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||||
queries-run: javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
|
queries-run:
|
||||||
|
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
|
||||||
queries-not-run: foo,bar
|
queries-not-run: foo,bar
|
||||||
|
|
||||||
- name: Assert Results
|
- name: Assert Results
|
||||||
|
|||||||
18
.github/workflows/__packaging-config-js.yml
generated
vendored
18
.github/workflows/__packaging-config-js.yml
generated
vendored
@@ -51,9 +51,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
config-file: .github/codeql/codeql-config-packaging.yml
|
config-file: .github/codeql/codeql-config-packaging.yml
|
||||||
@@ -68,10 +79,11 @@ jobs:
|
|||||||
upload-database: false
|
upload-database: false
|
||||||
|
|
||||||
- name: Check results
|
- name: Check results
|
||||||
uses: ./../action/.github/check-sarif
|
uses: ./../action/.github/actions/check-sarif
|
||||||
with:
|
with:
|
||||||
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||||
queries-run: javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
|
queries-run:
|
||||||
|
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
|
||||||
queries-not-run: foo,bar
|
queries-not-run: foo,bar
|
||||||
|
|
||||||
- name: Assert Results
|
- name: Assert Results
|
||||||
|
|||||||
20
.github/workflows/__packaging-inputs-js.yml
generated
vendored
20
.github/workflows/__packaging-inputs-js.yml
generated
vendored
@@ -51,14 +51,25 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
config-file: .github/codeql/codeql-config-packaging2.yml
|
config-file: .github/codeql/codeql-config-packaging2.yml
|
||||||
languages: javascript
|
languages: javascript
|
||||||
packs: dsp-testing/codeql-pack1@1.0.0, dsp-testing/codeql-pack2, dsp-testing/codeql-pack3:other-query.ql
|
packs: codeql-testing/codeql-pack1@1.0.0, codeql-testing/codeql-pack2, codeql-testing/codeql-pack3:other-query.ql
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -68,10 +79,11 @@ jobs:
|
|||||||
output: ${{ runner.temp }}/results
|
output: ${{ runner.temp }}/results
|
||||||
|
|
||||||
- name: Check results
|
- name: Check results
|
||||||
uses: ./../action/.github/check-sarif
|
uses: ./../action/.github/actions/check-sarif
|
||||||
with:
|
with:
|
||||||
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||||
queries-run: javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
|
queries-run:
|
||||||
|
javascript/example/empty-or-one-block,javascript/example/empty-or-one-block,javascript/example/other-query-block,javascript/example/two-block
|
||||||
queries-not-run: foo,bar
|
queries-not-run: foo,bar
|
||||||
|
|
||||||
- name: Assert Results
|
- name: Assert Results
|
||||||
|
|||||||
48
.github/workflows/__remote-config.yml
generated
vendored
48
.github/workflows/__remote-config.yml
generated
vendored
@@ -25,24 +25,30 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20211005
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20211005
|
|
||||||
- os: windows-2019
|
|
||||||
version: stable-20211005
|
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20220120
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220120
|
|
||||||
- os: windows-2019
|
|
||||||
version: stable-20220120
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20221211
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -69,14 +75,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
- name: Set environment variable for Swift enablement
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
if: >-
|
||||||
uses: actions/setup-go@v3
|
runner.os != 'Windows' && (
|
||||||
with:
|
matrix.version == '20220908' ||
|
||||||
go-version: ^1.13.1
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
|||||||
13
.github/workflows/__rubocop-multi-language.yml
generated
vendored
13
.github/workflows/__rubocop-multi-language.yml
generated
vendored
@@ -35,9 +35,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- name: Set up Ruby
|
- name: Set up Ruby
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
13
.github/workflows/__ruby.yml
generated
vendored
13
.github/workflows/__ruby.yml
generated
vendored
@@ -45,9 +45,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: ruby
|
languages: ruby
|
||||||
|
|||||||
15
.github/workflows/__split-workflow.yml
generated
vendored
15
.github/workflows/__split-workflow.yml
generated
vendored
@@ -45,13 +45,24 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
config-file: .github/codeql/codeql-config-packaging3.yml
|
config-file: .github/codeql/codeql-config-packaging3.yml
|
||||||
packs: +dsp-testing/codeql-pack1@1.0.0
|
packs: +codeql-testing/codeql-pack1@1.0.0
|
||||||
languages: javascript
|
languages: javascript
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
- name: Build code
|
- name: Build code
|
||||||
|
|||||||
13
.github/workflows/__submit-sarif-failure.yml
generated
vendored
13
.github/workflows/__submit-sarif-failure.yml
generated
vendored
@@ -39,9 +39,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: ./init
|
- uses: ./init
|
||||||
with:
|
with:
|
||||||
|
|||||||
72
.github/workflows/__swift-autobuild.yml
generated
vendored
72
.github/workflows/__swift-autobuild.yml
generated
vendored
@@ -1,72 +0,0 @@
|
|||||||
# Warning: This file is generated automatically, and should not be modified.
|
|
||||||
# Instead, please modify the template in the pr-checks directory and run:
|
|
||||||
# pip install ruamel.yaml && python3 sync.py
|
|
||||||
# to regenerate this file.
|
|
||||||
|
|
||||||
name: PR Check - Swift analysis using autobuild
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GO111MODULE: auto
|
|
||||||
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- releases/v2
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- synchronize
|
|
||||||
- reopened
|
|
||||||
- ready_for_review
|
|
||||||
workflow_dispatch: {}
|
|
||||||
jobs:
|
|
||||||
swift-autobuild:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: macos-latest
|
|
||||||
version: latest
|
|
||||||
- os: macos-latest
|
|
||||||
version: cached
|
|
||||||
- os: macos-latest
|
|
||||||
version: nightly-latest
|
|
||||||
name: Swift analysis using autobuild
|
|
||||||
timeout-minutes: 45
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Check out repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Prepare test
|
|
||||||
id: prepare-test
|
|
||||||
uses: ./.github/prepare-test
|
|
||||||
with:
|
|
||||||
version: ${{ matrix.version }}
|
|
||||||
- uses: ./../action/init
|
|
||||||
id: init
|
|
||||||
with:
|
|
||||||
languages: swift
|
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
|
||||||
- uses: ./../action/.github/setup-swift
|
|
||||||
with:
|
|
||||||
codeql-path: ${{steps.init.outputs.codeql-path}}
|
|
||||||
- name: Check working directory
|
|
||||||
shell: bash
|
|
||||||
run: pwd
|
|
||||||
- uses: ./../action/autobuild
|
|
||||||
timeout-minutes: 10
|
|
||||||
- uses: ./../action/analyze
|
|
||||||
id: analysis
|
|
||||||
with:
|
|
||||||
upload-database: false
|
|
||||||
- name: Check database
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}"
|
|
||||||
if [[ ! -d "$SWIFT_DB" ]]; then
|
|
||||||
echo "Did not create a database for Swift."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
env:
|
|
||||||
CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true' # Remove when Swift is GA.
|
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
|
||||||
16
.github/workflows/__swift-custom-build.yml
generated
vendored
16
.github/workflows/__swift-custom-build.yml
generated
vendored
@@ -45,15 +45,26 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
id: init
|
id: init
|
||||||
with:
|
with:
|
||||||
languages: swift
|
languages: swift
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
- uses: ./../action/.github/setup-swift
|
- uses: ./../action/.github/actions/setup-swift
|
||||||
with:
|
with:
|
||||||
codeql-path: ${{steps.init.outputs.codeql-path}}
|
codeql-path: ${{steps.init.outputs.codeql-path}}
|
||||||
- name: Check working directory
|
- name: Check working directory
|
||||||
@@ -75,6 +86,5 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true' # Remove when Swift is GA.
|
|
||||||
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
|
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
CODEQL_ACTION_TEST_MODE: true
|
||||||
|
|||||||
13
.github/workflows/__test-autobuild-working-dir.yml
generated
vendored
13
.github/workflows/__test-autobuild-working-dir.yml
generated
vendored
@@ -35,9 +35,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- name: Test setup
|
- name: Test setup
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
19
.github/workflows/__test-local-codeql.yml
generated
vendored
19
.github/workflows/__test-local-codeql.yml
generated
vendored
@@ -35,18 +35,33 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- name: Fetch a CodeQL bundle
|
- name: Fetch a CodeQL bundle
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
CODEQL_URL: ${{ steps.prepare-test.outputs.tools-url }}
|
CODEQL_URL: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
run: |
|
run: |
|
||||||
wget "$CODEQL_URL"
|
wget "$CODEQL_URL"
|
||||||
- uses: ./../action/init
|
- id: init
|
||||||
|
uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
tools: ./codeql-bundle.tar.gz
|
tools: ./codeql-bundle.tar.gz
|
||||||
|
- uses: ./../action/.github/actions/setup-swift
|
||||||
|
with:
|
||||||
|
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
|
|||||||
13
.github/workflows/__test-proxy.yml
generated
vendored
13
.github/workflows/__test-proxy.yml
generated
vendored
@@ -35,9 +35,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: >-
|
||||||
|
runner.os != 'Windows' && (
|
||||||
|
matrix.version == '20220908' ||
|
||||||
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: javascript
|
languages: javascript
|
||||||
|
|||||||
32
.github/workflows/__unset-environment.yml
generated
vendored
32
.github/workflows/__unset-environment.yml
generated
vendored
@@ -25,12 +25,14 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20211005
|
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20220120
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20221211
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
@@ -45,18 +47,28 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
- name: Set environment variable for Swift enablement
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
if: >-
|
||||||
uses: actions/setup-go@v3
|
runner.os != 'Windows' && (
|
||||||
with:
|
matrix.version == '20220908' ||
|
||||||
go-version: ^1.13.1
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
|
id: init
|
||||||
with:
|
with:
|
||||||
db-location: ${{ runner.temp }}/customDbLocation
|
db-location: ${{ runner.temp }}/customDbLocation
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
- uses: ./../action/.github/actions/setup-swift
|
||||||
|
with:
|
||||||
|
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
# Disable Kotlin analysis while it's incompatible with Kotlin 1.8, until we find a
|
# Disable Kotlin analysis while it's incompatible with Kotlin 1.8, until we find a
|
||||||
|
|||||||
50
.github/workflows/__upload-ref-sha-input.yml
generated
vendored
50
.github/workflows/__upload-ref-sha-input.yml
generated
vendored
@@ -25,24 +25,30 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20211005
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20211005
|
|
||||||
- os: windows-2019
|
|
||||||
version: stable-20211005
|
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20220120
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220120
|
|
||||||
- os: windows-2019
|
|
||||||
version: stable-20220120
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20221211
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -69,14 +75,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
- name: Set environment variable for Swift enablement
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
if: >-
|
||||||
uses: actions/setup-go@v3
|
runner.os != 'Windows' && (
|
||||||
with:
|
matrix.version == '20220908' ||
|
||||||
go-version: ^1.13.1
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
@@ -91,7 +103,7 @@ jobs:
|
|||||||
upload-database: false
|
upload-database: false
|
||||||
ref: refs/heads/main
|
ref: refs/heads/main
|
||||||
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
|
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
|
||||||
upload: false
|
upload: never
|
||||||
- uses: ./../action/upload-sarif
|
- uses: ./../action/upload-sarif
|
||||||
with:
|
with:
|
||||||
ref: refs/heads/main
|
ref: refs/heads/main
|
||||||
|
|||||||
50
.github/workflows/__with-checkout-path.yml
generated
vendored
50
.github/workflows/__with-checkout-path.yml
generated
vendored
@@ -25,24 +25,30 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20211005
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20211005
|
|
||||||
- os: windows-2019
|
|
||||||
version: stable-20211005
|
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20220120
|
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220120
|
|
||||||
- os: windows-2019
|
|
||||||
version: stable-20220120
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
version: stable-20220401
|
version: stable-20220401
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20220615
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20220908
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20221211
|
||||||
|
- os: windows-latest
|
||||||
|
version: stable-20221211
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -69,14 +75,20 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
- name: Set environment variable for Swift enablement
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
if: >-
|
||||||
uses: actions/setup-go@v3
|
runner.os != 'Windows' && (
|
||||||
with:
|
matrix.version == '20220908' ||
|
||||||
go-version: ^1.13.1
|
matrix.version == '20221211' ||
|
||||||
|
matrix.version == 'cached' ||
|
||||||
|
matrix.version == 'latest' ||
|
||||||
|
matrix.version == 'nightly-latest'
|
||||||
|
)
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
|
ref: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
|
||||||
@@ -103,7 +115,7 @@ jobs:
|
|||||||
checkout_path: x/y/z/some-path/tests/multi-language-repo
|
checkout_path: x/y/z/some-path/tests/multi-language-repo
|
||||||
ref: v1.1.0
|
ref: v1.1.0
|
||||||
sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
|
sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
|
||||||
upload: false
|
upload: never
|
||||||
upload-database: false
|
upload-database: false
|
||||||
|
|
||||||
- uses: ./../action/upload-sarif
|
- uses: ./../action/upload-sarif
|
||||||
|
|||||||
44
.github/workflows/codescanning-config-cli.yml
vendored
44
.github/workflows/codescanning-config-cli.yml
vendored
@@ -47,12 +47,12 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
|
||||||
- name: Empty file
|
- name: Empty file
|
||||||
uses: ./../action/.github/check-codescanning-config
|
uses: ./../action/.github/actions/check-codescanning-config
|
||||||
with:
|
with:
|
||||||
expected-config-file-contents: "{}"
|
expected-config-file-contents: "{}"
|
||||||
languages: javascript
|
languages: javascript
|
||||||
@@ -60,31 +60,31 @@ jobs:
|
|||||||
|
|
||||||
- name: Packs from input
|
- name: Packs from input
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
uses: ./../action/.github/check-codescanning-config
|
uses: ./../action/.github/actions/check-codescanning-config
|
||||||
with:
|
with:
|
||||||
expected-config-file-contents: |
|
expected-config-file-contents: |
|
||||||
{
|
{
|
||||||
"packs": ["dsp-testing/codeql-pack1@1.0.0", "dsp-testing/codeql-pack2" ]
|
"packs": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2" ]
|
||||||
}
|
}
|
||||||
languages: javascript
|
languages: javascript
|
||||||
packs: dsp-testing/codeql-pack1@1.0.0, dsp-testing/codeql-pack2
|
packs: codeql-testing/codeql-pack1@1.0.0, codeql-testing/codeql-pack2
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
|
||||||
- name: Packs from input with +
|
- name: Packs from input with +
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
uses: ./../action/.github/check-codescanning-config
|
uses: ./../action/.github/actions/check-codescanning-config
|
||||||
with:
|
with:
|
||||||
expected-config-file-contents: |
|
expected-config-file-contents: |
|
||||||
{
|
{
|
||||||
"packs": ["dsp-testing/codeql-pack1@1.0.0", "dsp-testing/codeql-pack2" ]
|
"packs": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2" ]
|
||||||
}
|
}
|
||||||
languages: javascript
|
languages: javascript
|
||||||
packs: + dsp-testing/codeql-pack1@1.0.0, dsp-testing/codeql-pack2
|
packs: + codeql-testing/codeql-pack1@1.0.0, codeql-testing/codeql-pack2
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
|
||||||
- name: Queries from input
|
- name: Queries from input
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
uses: ./../action/.github/check-codescanning-config
|
uses: ./../action/.github/actions/check-codescanning-config
|
||||||
with:
|
with:
|
||||||
expected-config-file-contents: |
|
expected-config-file-contents: |
|
||||||
{
|
{
|
||||||
@@ -96,7 +96,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Queries from input with +
|
- name: Queries from input with +
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
uses: ./../action/.github/check-codescanning-config
|
uses: ./../action/.github/actions/check-codescanning-config
|
||||||
with:
|
with:
|
||||||
expected-config-file-contents: |
|
expected-config-file-contents: |
|
||||||
{
|
{
|
||||||
@@ -108,27 +108,27 @@ jobs:
|
|||||||
|
|
||||||
- name: Queries and packs from input with +
|
- name: Queries and packs from input with +
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
uses: ./../action/.github/check-codescanning-config
|
uses: ./../action/.github/actions/check-codescanning-config
|
||||||
with:
|
with:
|
||||||
expected-config-file-contents: |
|
expected-config-file-contents: |
|
||||||
{
|
{
|
||||||
"queries": [{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" }],
|
"queries": [{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" }],
|
||||||
"packs": ["dsp-testing/codeql-pack1@1.0.0", "dsp-testing/codeql-pack2" ]
|
"packs": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2" ]
|
||||||
}
|
}
|
||||||
languages: javascript
|
languages: javascript
|
||||||
queries: + ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql
|
queries: + ./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql
|
||||||
packs: + dsp-testing/codeql-pack1@1.0.0, dsp-testing/codeql-pack2
|
packs: + codeql-testing/codeql-pack1@1.0.0, codeql-testing/codeql-pack2
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
|
||||||
- name: Queries and packs from config
|
- name: Queries and packs from config
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
uses: ./../action/.github/check-codescanning-config
|
uses: ./../action/.github/actions/check-codescanning-config
|
||||||
with:
|
with:
|
||||||
expected-config-file-contents: |
|
expected-config-file-contents: |
|
||||||
{
|
{
|
||||||
"queries": [{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/foo2/show_ifs.ql" }],
|
"queries": [{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/foo2/show_ifs.ql" }],
|
||||||
"packs": {
|
"packs": {
|
||||||
"javascript": ["dsp-testing/codeql-pack1@1.0.0", "dsp-testing/codeql-pack2" ]
|
"javascript": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
languages: javascript
|
languages: javascript
|
||||||
@@ -137,7 +137,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Queries and packs from config overriden by input
|
- name: Queries and packs from config overriden by input
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
uses: ./../action/.github/check-codescanning-config
|
uses: ./../action/.github/actions/check-codescanning-config
|
||||||
with:
|
with:
|
||||||
expected-config-file-contents: |
|
expected-config-file-contents: |
|
||||||
{
|
{
|
||||||
@@ -152,7 +152,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Queries and packs from config merging with input
|
- name: Queries and packs from config merging with input
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
uses: ./../action/.github/check-codescanning-config
|
uses: ./../action/.github/actions/check-codescanning-config
|
||||||
with:
|
with:
|
||||||
expected-config-file-contents: |
|
expected-config-file-contents: |
|
||||||
{
|
{
|
||||||
@@ -161,7 +161,7 @@ jobs:
|
|||||||
{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" }
|
{ "uses": "./codeql-qlpacks/complex-javascript-qlpack/show_ifs.ql" }
|
||||||
],
|
],
|
||||||
"packs": {
|
"packs": {
|
||||||
"javascript": ["dsp-testing/codeql-pack1@1.0.0", "dsp-testing/codeql-pack2", "codeql/javascript-queries" ]
|
"javascript": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2", "codeql/javascript-queries" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
languages: javascript
|
languages: javascript
|
||||||
@@ -172,12 +172,12 @@ jobs:
|
|||||||
|
|
||||||
- name: Multi-language packs from config
|
- name: Multi-language packs from config
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
uses: ./../action/.github/check-codescanning-config
|
uses: ./../action/.github/actions/check-codescanning-config
|
||||||
with:
|
with:
|
||||||
expected-config-file-contents: |
|
expected-config-file-contents: |
|
||||||
{
|
{
|
||||||
"packs": {
|
"packs": {
|
||||||
"javascript": ["dsp-testing/codeql-pack1@1.0.0", "dsp-testing/codeql-pack2" ],
|
"javascript": ["codeql-testing/codeql-pack1@1.0.0", "codeql-testing/codeql-pack2" ],
|
||||||
"ruby": ["codeql/ruby-queries"]
|
"ruby": ["codeql/ruby-queries"]
|
||||||
},
|
},
|
||||||
"queries": [
|
"queries": [
|
||||||
@@ -190,7 +190,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Other config properties
|
- name: Other config properties
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
uses: ./../action/.github/check-codescanning-config
|
uses: ./../action/.github/actions/check-codescanning-config
|
||||||
with:
|
with:
|
||||||
expected-config-file-contents: |
|
expected-config-file-contents: |
|
||||||
{
|
{
|
||||||
@@ -209,7 +209,7 @@ jobs:
|
|||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
env:
|
env:
|
||||||
CODEQL_PASS_CONFIG_TO_CLI: false
|
CODEQL_PASS_CONFIG_TO_CLI: false
|
||||||
uses: ./../action/.github/check-codescanning-config
|
uses: ./../action/.github/actions/check-codescanning-config
|
||||||
with:
|
with:
|
||||||
expected-config-file-contents: ""
|
expected-config-file-contents: ""
|
||||||
languages: javascript
|
languages: javascript
|
||||||
|
|||||||
@@ -36,10 +36,10 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: ^1.13.1
|
go-version: ^1.13.1
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
|
|||||||
51
.github/workflows/debug-artifacts.yml
vendored
51
.github/workflows/debug-artifacts.yml
vendored
@@ -21,31 +21,17 @@ jobs:
|
|||||||
upload-artifacts:
|
upload-artifacts:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
os:
|
||||||
- os: ubuntu-20.04
|
- ubuntu-latest
|
||||||
version: stable-20211005
|
- macos-latest
|
||||||
- os: macos-latest
|
version:
|
||||||
version: stable-20211005
|
- stable-20220401
|
||||||
- os: ubuntu-20.04
|
- stable-20220615
|
||||||
version: stable-20220120
|
- stable-20220908
|
||||||
- os: macos-latest
|
- stable-20221211
|
||||||
version: stable-20220120
|
- cached
|
||||||
- os: ubuntu-latest
|
- latest
|
||||||
version: stable-20220401
|
- nightly-latest
|
||||||
- os: macos-latest
|
|
||||||
version: stable-20220401
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: cached
|
|
||||||
- os: macos-latest
|
|
||||||
version: cached
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: latest
|
|
||||||
- os: macos-latest
|
|
||||||
version: latest
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: nightly-latest
|
|
||||||
- os: macos-latest
|
|
||||||
version: nightly-latest
|
|
||||||
name: Upload debug artifacts
|
name: Upload debug artifacts
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
CODEQL_ACTION_TEST_MODE: true
|
||||||
@@ -56,10 +42,10 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: ^1.13.1
|
go-version: ^1.13.1
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
@@ -84,17 +70,10 @@ jobs:
|
|||||||
- name: Check expected artifacts exist
|
- name: Check expected artifacts exist
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
VERSIONS="stable-20211005 stable-20220120 stable-20220401 cached latest nightly-latest"
|
VERSIONS="stable-20220401 stable-20220615 stable-20220908 stable-20221211 cached latest nightly-latest"
|
||||||
LANGUAGES="cpp csharp go java javascript python"
|
LANGUAGES="cpp csharp go java javascript python"
|
||||||
for version in $VERSIONS; do
|
for version in $VERSIONS; do
|
||||||
if [[ "$version" =~ stable-(20211005|20220120|20210809) ]]; then
|
for os in ubuntu-latest macos-latest; do
|
||||||
# Note the absence of the period in "ubuntu-2004": this is present in the image name
|
|
||||||
# but not the artifact name
|
|
||||||
OPERATING_SYSTEMS="ubuntu-2004 macos-latest"
|
|
||||||
else
|
|
||||||
OPERATING_SYSTEMS="ubuntu-latest macos-latest"
|
|
||||||
fi
|
|
||||||
for os in $OPERATING_SYSTEMS; do
|
|
||||||
pushd "./my-debug-artifacts-$os-$version"
|
pushd "./my-debug-artifacts-$os-$version"
|
||||||
echo "Artifacts from version $version on $os:"
|
echo "Artifacts from version $version on $os:"
|
||||||
for language in $LANGUAGES; do
|
for language in $LANGUAGES; do
|
||||||
|
|||||||
6
.github/workflows/expected-queries-runs.yml
vendored
6
.github/workflows/expected-queries-runs.yml
vendored
@@ -25,7 +25,7 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
@@ -36,10 +36,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
output: ${{ runner.temp }}/results
|
output: ${{ runner.temp }}/results
|
||||||
upload-database: false
|
upload-database: false
|
||||||
upload: false
|
upload: never
|
||||||
|
|
||||||
- name: Check Sarif
|
- name: Check Sarif
|
||||||
uses: ./../action/.github/check-sarif
|
uses: ./../action/.github/actions/check-sarif
|
||||||
with:
|
with:
|
||||||
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||||
queries-run: js/incomplete-hostname-regexp,js/path-injection
|
queries-run: js/incomplete-hostname-regexp,js/path-injection
|
||||||
|
|||||||
8
.github/workflows/query-filters.yml
vendored
8
.github/workflows/query-filters.yml
vendored
@@ -23,12 +23,12 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare test
|
- name: Prepare test
|
||||||
id: prepare-test
|
id: prepare-test
|
||||||
uses: ./.github/prepare-test
|
uses: ./.github/actions/prepare-test
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
|
|
||||||
- name: Check SARIF for default queries with Single include, Single exclude
|
- name: Check SARIF for default queries with Single include, Single exclude
|
||||||
uses: ./../action/.github/query-filter-test
|
uses: ./../action/.github/actions/query-filter-test
|
||||||
with:
|
with:
|
||||||
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||||
queries-run: js/zipslip
|
queries-run: js/zipslip
|
||||||
@@ -37,7 +37,7 @@ jobs:
|
|||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
|
||||||
- name: Check SARIF for query packs with Single include, Single exclude
|
- name: Check SARIF for query packs with Single include, Single exclude
|
||||||
uses: ./../action/.github/query-filter-test
|
uses: ./../action/.github/actions/query-filter-test
|
||||||
with:
|
with:
|
||||||
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||||
queries-run: js/zipslip,javascript/example/empty-or-one-block
|
queries-run: js/zipslip,javascript/example/empty-or-one-block
|
||||||
@@ -46,7 +46,7 @@ jobs:
|
|||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
|
||||||
- name: Check SARIF for query packs and local queries with Single include, Single exclude
|
- name: Check SARIF for query packs and local queries with Single include, Single exclude
|
||||||
uses: ./../action/.github/query-filter-test
|
uses: ./../action/.github/actions/query-filter-test
|
||||||
with:
|
with:
|
||||||
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
sarif-file: ${{ runner.temp }}/results/javascript.sarif
|
||||||
queries-run: js/zipslip,javascript/example/empty-or-one-block,inrepo-javascript-querypack/show-ifs
|
queries-run: js/zipslip,javascript/example/empty-or-one-block,inrepo-javascript-querypack/show-ifs
|
||||||
|
|||||||
91
.github/workflows/update-bundle.yml
vendored
Normal file
91
.github/workflows/update-bundle.yml
vendored
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
name: Update default CodeQL bundle
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
# From https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
|
||||||
|
# Note: The prereleased type will not trigger for pre-releases published
|
||||||
|
# from draft releases, but the published type will trigger. If you want a
|
||||||
|
# workflow to run when stable and pre-releases publish, subscribe to
|
||||||
|
# published instead of released and prereleased.
|
||||||
|
#
|
||||||
|
# From https://github.com/orgs/community/discussions/26281
|
||||||
|
# As a work around, in published type workflow, you could add if condition
|
||||||
|
# to filter pre-release attribute.
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-bundle:
|
||||||
|
if: github.event.release.prerelease && startsWith(github.event.release.tag_name, 'codeql-bundle-')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Dump environment
|
||||||
|
run: env
|
||||||
|
|
||||||
|
- name: Dump GitHub context
|
||||||
|
env:
|
||||||
|
GITHUB_CONTEXT: '${{ toJson(github) }}'
|
||||||
|
run: echo "$GITHUB_CONTEXT"
|
||||||
|
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Update git config
|
||||||
|
run: |
|
||||||
|
git config --global user.email "github-actions@github.com"
|
||||||
|
git config --global user.name "github-actions[bot]"
|
||||||
|
|
||||||
|
- name: Update bundle
|
||||||
|
uses: ./.github/actions/update-bundle
|
||||||
|
|
||||||
|
- name: Rebuild Action
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
env:
|
||||||
|
RELEASE_TAG: "${{ github.event.release.tag_name }}"
|
||||||
|
run: |
|
||||||
|
git checkout -b "update-bundle/$RELEASE_TAG"
|
||||||
|
git commit -am "Update default bundle to $RELEASE_TAG"
|
||||||
|
git push --set-upstream origin "update-bundle/$RELEASE_TAG"
|
||||||
|
|
||||||
|
- name: Open pull request
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
cli_version=$(jq -r '.cliVersion' src/defaults.json)
|
||||||
|
pr_url=$(gh pr create \
|
||||||
|
--title "Update default bundle to $cli_version" \
|
||||||
|
--body "This pull request updates the default CodeQL bundle, as used with \`tools: latest\` and on GHES, to $cli_version." \
|
||||||
|
--assignee "$GITHUB_ACTOR" \
|
||||||
|
--draft \
|
||||||
|
)
|
||||||
|
echo "CLI_VERSION=$cli_version" | tee -a "$GITHUB_ENV"
|
||||||
|
echo "PR_URL=$pr_url" | tee -a "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Create changelog note
|
||||||
|
shell: python
|
||||||
|
run: |
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
# Get the PR number from the PR URL.
|
||||||
|
pr_number = os.environ['PR_URL'].split('/')[-1]
|
||||||
|
changelog_note = f"- Update default CodeQL bundle version to {os.environ['CLI_VERSION']}. [#{pr_number}]({os.environ['PR_URL']})"
|
||||||
|
|
||||||
|
# If the "[UNRELEASED]" section starts with "no user facing changes", remove that line.
|
||||||
|
# Use perl to avoid having to escape the newline character.
|
||||||
|
|
||||||
|
with open('CHANGELOG.md', 'r') as f:
|
||||||
|
changelog = f.read()
|
||||||
|
|
||||||
|
changelog = changelog.replace('## [UNRELEASED]\n\nNo user facing changes.', '## [UNRELEASED]\n')
|
||||||
|
|
||||||
|
# Add the changelog note to the bottom of the "[UNRELEASED]" section.
|
||||||
|
changelog = re.sub(r'\n## (\d+\.\d+\.\d+)', f'{changelog_note}\n\n## \\1', changelog, count=1)
|
||||||
|
|
||||||
|
with open('CHANGELOG.md', 'w') as f:
|
||||||
|
f.write(changelog)
|
||||||
|
|
||||||
|
- name: Push changelog note
|
||||||
|
run: |
|
||||||
|
git commit -am "Add changelog note"
|
||||||
|
git push
|
||||||
@@ -3,6 +3,7 @@ name: Update Supported Enterprise Server Versions
|
|||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *"
|
- cron: "0 0 * * *"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-supported-enterprise-server-versions:
|
update-supported-enterprise-server-versions:
|
||||||
@@ -35,7 +36,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
ENTERPRISE_RELEASES_PATH: ${{ github.workspace }}/enterprise-releases/
|
ENTERPRISE_RELEASES_PATH: ${{ github.workspace }}/enterprise-releases/
|
||||||
- name: Commit Changes
|
- name: Commit Changes
|
||||||
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04 # v4.2.3
|
uses: peter-evans/create-pull-request@284f54f989303d2699d373481a0cfa13ad5a6666 # v5.0.1
|
||||||
with:
|
with:
|
||||||
commit-message: Update supported GitHub Enterprise Server versions.
|
commit-message: Update supported GitHub Enterprise Server versions.
|
||||||
title: Update supported GitHub Enterprise Server versions.
|
title: Update supported GitHub Enterprise Server versions.
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ def main():
|
|||||||
api_compatibility_data = json.loads(_API_COMPATIBILITY_PATH.read_text())
|
api_compatibility_data = json.loads(_API_COMPATIBILITY_PATH.read_text())
|
||||||
|
|
||||||
releases = json.loads(_RELEASE_FILE_PATH.read_text())
|
releases = json.loads(_RELEASE_FILE_PATH.read_text())
|
||||||
|
|
||||||
|
# Remove GHES version using a previous version numbering scheme.
|
||||||
|
if "11.10.340" in releases:
|
||||||
|
del releases["11.10.340"]
|
||||||
|
|
||||||
oldest_supported_release = None
|
oldest_supported_release = None
|
||||||
newest_supported_release = semver.VersionInfo.parse(api_compatibility_data["maximumVersion"] + ".0")
|
newest_supported_release = semver.VersionInfo.parse(api_compatibility_data["maximumVersion"] + ".0")
|
||||||
|
|
||||||
|
|||||||
53
CHANGELOG.md
53
CHANGELOG.md
@@ -2,15 +2,66 @@
|
|||||||
|
|
||||||
## [UNRELEASED]
|
## [UNRELEASED]
|
||||||
|
|
||||||
|
- We are rolling out a feature in May 2023 that will disable Python dependency installation for new users of the CodeQL Action. This improves the speed of analysis while having only a very minor impact on results. [#1676](https://github.com/github/codeql-action/pull/1676)
|
||||||
|
- We are improving the way that [CodeQL bundles](https://github.com/github/codeql-action/releases) are tagged to make it possible to easily identify bundles by their CodeQL semantic version.
|
||||||
|
- As of CodeQL CLI 2.13.4, CodeQL bundles will be tagged using semantic versions, for example `codeql-bundle-v2.13.4`, instead of timestamps, like `codeql-bundle-20230615`.
|
||||||
|
- This change does not affect the majority of workflows, and we will not be changing tags for existing bundle releases.
|
||||||
|
- Some workflows with custom logic that depends on the specific format of the CodeQL bundle tag may need to be updated. For example, if your workflow matches CodeQL bundle tag names against a `codeql-bundle-yyyymmdd` pattern, you should update it to also recognize `codeql-bundle-vx.y.z` tags.
|
||||||
|
- Remove the requirement for `on.push` and `on.pull_request` to trigger on the same branches. [#1675](https://github.com/github/codeql-action/pull/1675)
|
||||||
|
|
||||||
|
## 2.3.3 - 04 May 2023
|
||||||
|
|
||||||
|
- Update default CodeQL bundle version to 2.13.1. [#1664](https://github.com/github/codeql-action/pull/1664)
|
||||||
|
- You can now configure CodeQL within your code scanning workflow by passing a `config` input to the `init` Action. See [Using a custom configuration file](https://aka.ms/code-scanning-docs/config-file) for more information about configuring code scanning. [#1590](https://github.com/github/codeql-action/pull/1590)
|
||||||
|
- Updated the SARIF 2.1.0 JSON schema file to the latest from [oasis-tcs/sarif-spec](https://github.com/oasis-tcs/sarif-spec/blob/123e95847b13fbdd4cbe2120fa5e33355d4a042b/Schemata/sarif-schema-2.1.0.json). [#1668](https://github.com/github/codeql-action/pull/1668)
|
||||||
|
|
||||||
|
## 2.3.2 - 27 Apr 2023
|
||||||
|
|
||||||
No user facing changes.
|
No user facing changes.
|
||||||
|
|
||||||
|
## 2.3.1 - 26 Apr 2023
|
||||||
|
|
||||||
|
No user facing changes.
|
||||||
|
|
||||||
|
## 2.3.0 - 21 Apr 2023
|
||||||
|
|
||||||
|
- Update default CodeQL bundle version to 2.13.0. [#1649](https://github.com/github/codeql-action/pull/1649)
|
||||||
|
- Bump the minimum CodeQL bundle version to 2.8.5. [#1618](https://github.com/github/codeql-action/pull/1618)
|
||||||
|
|
||||||
|
## 2.2.12 - 13 Apr 2023
|
||||||
|
|
||||||
|
- Include the value of the `GITHUB_RUN_ATTEMPT` environment variable in the telemetry sent to GitHub. [#1640](https://github.com/github/codeql-action/pull/1640)
|
||||||
|
- Improve the ease of debugging failed runs configured using [default setup](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning-for-a-repository#configuring-code-scanning-automatically). The CodeQL Action will now upload diagnostic information to Code Scanning from failed runs configured using default setup. You can view this diagnostic information on the [tool status page](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-the-tool-status-page). [#1619](https://github.com/github/codeql-action/pull/1619)
|
||||||
|
|
||||||
|
## 2.2.11 - 06 Apr 2023
|
||||||
|
|
||||||
|
No user facing changes.
|
||||||
|
|
||||||
|
## 2.2.10 - 05 Apr 2023
|
||||||
|
|
||||||
|
- Update default CodeQL bundle version to 2.12.6. [#1629](https://github.com/github/codeql-action/pull/1629)
|
||||||
|
|
||||||
|
## 2.2.9 - 27 Mar 2023
|
||||||
|
|
||||||
|
- Customers post-processing the SARIF output of the `analyze` Action before uploading it to Code Scanning will benefit from an improved debugging experience. [#1598](https://github.com/github/codeql-action/pull/1598)
|
||||||
|
- The CodeQL Action will now upload a SARIF file with debugging information to Code Scanning on failed runs for customers using `upload: false`. Previously, this was only available for customers using the default value of the `upload` input.
|
||||||
|
- The `upload` input to the `analyze` Action now accepts the following values:
|
||||||
|
- `always` is the default value, which uploads the SARIF file to Code Scanning for successful and failed runs.
|
||||||
|
- `failure-only` is recommended for customers post-processing the SARIF file before uploading it to Code Scanning. This option uploads debugging information to Code Scanning for failed runs to improve the debugging experience.
|
||||||
|
- `never` avoids uploading the SARIF file to Code Scanning even if the code scanning run fails. This is not recommended for external users since it complicates debugging.
|
||||||
|
- The legacy `true` and `false` options will be interpreted as `always` and `failure-only` respectively.
|
||||||
|
|
||||||
|
## 2.2.8 - 22 Mar 2023
|
||||||
|
|
||||||
|
- Update default CodeQL bundle version to 2.12.5. [#1585](https://github.com/github/codeql-action/pull/1585)
|
||||||
|
|
||||||
## 2.2.7 - 15 Mar 2023
|
## 2.2.7 - 15 Mar 2023
|
||||||
|
|
||||||
No user facing changes.
|
No user facing changes.
|
||||||
|
|
||||||
## 2.2.6 - 10 Mar 2023
|
## 2.2.6 - 10 Mar 2023
|
||||||
|
|
||||||
- Update default CodeQL bundle version to 2.12.4.
|
- Update default CodeQL bundle version to 2.12.4. [#1561](https://github.com/github/codeql-action/pull/1561)
|
||||||
|
|
||||||
## 2.2.5 - 24 Feb 2023
|
## 2.2.5 - 24 Feb 2023
|
||||||
|
|
||||||
|
|||||||
33
README.md
33
README.md
@@ -135,7 +135,38 @@ By default, this will override any queries specified in a config file. If you wi
|
|||||||
queries: +<local-or-remote-query>,<another-query>
|
queries: +<local-or-remote-query>,<another-query>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Configuration via `config` input
|
||||||
|
|
||||||
|
You can alternatively configure CodeQL using the `config` input to the `init` Action. The value of this input must be a YAML string that follows the configuration file format documented at "[Using a custom configuration file](https://aka.ms/code-scanning-docs/config-file)."
|
||||||
|
|
||||||
|
#### Example configuration
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: github/codeql-action/init@v2
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
config: |
|
||||||
|
disable-default-queries: true
|
||||||
|
queries:
|
||||||
|
- uses: security-extended
|
||||||
|
- uses: security-and-quality
|
||||||
|
query-filters:
|
||||||
|
- include:
|
||||||
|
tags: /cwe-020/
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Sharing configuration across multiple repositories
|
||||||
|
|
||||||
|
You can use Actions or environment variables to share configuration across multiple repositories and to modify configuration without needing to edit the workflow file. In the following example, `vars.CODEQL_CONF` is an [Actions configuration variable](https://docs.github.com/en/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: github/codeql-action/init@v2
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
config: ${{ vars.CODEQL_CONF }}
|
||||||
|
```
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
Read about [troubleshooting code scanning](https://help.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-code-scanning).
|
Read about [troubleshooting code scanning](https://help.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-code-scanning).
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,14 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: "../results"
|
default: "../results"
|
||||||
upload:
|
upload:
|
||||||
description: Upload the SARIF file to Code Scanning
|
description: >-
|
||||||
|
Upload the SARIF file to Code Scanning.
|
||||||
|
Defaults to 'always' which uploads the SARIF file to Code Scanning for successful and failed runs.
|
||||||
|
'failure-only' only uploads debugging information to Code Scanning if the workflow run fails, for users post-processing the SARIF file before uploading it to Code Scanning.
|
||||||
|
'never' avoids uploading the SARIF file to Code Scanning, even if the code scanning run fails. This is not recommended for external users since it complicates debugging.
|
||||||
required: false
|
required: false
|
||||||
# If changing this, make sure to update workflow.ts accordingly.
|
# If changing this, make sure to update workflow.ts accordingly.
|
||||||
default: "true"
|
default: "always"
|
||||||
cleanup-level:
|
cleanup-level:
|
||||||
description: "Level of cleanup to perform on CodeQL databases at the end of the analyze step. This should either be 'none' to skip cleanup, or be a valid argument for the --mode flag of the CodeQL CLI command 'codeql database cleanup' as documented at https://codeql.github.com/docs/codeql-cli/manual/database-cleanup"
|
description: "Level of cleanup to perform on CodeQL databases at the end of the analyze step. This should either be 'none' to skip cleanup, or be a valid argument for the --mode flag of the CodeQL CLI command 'codeql database cleanup' as documented at https://codeql.github.com/docs/codeql-cli/manual/database-cleanup"
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ inputs:
|
|||||||
db-location:
|
db-location:
|
||||||
description: Path where CodeQL databases should be created. If not specified, a temporary directory will be used.
|
description: Path where CodeQL databases should be created. If not specified, a temporary directory will be used.
|
||||||
required: false
|
required: false
|
||||||
|
config:
|
||||||
|
description: Configuration passed as a YAML string in the same format as the config-file input. This takes precedence over the config-file input.
|
||||||
|
required: false
|
||||||
queries:
|
queries:
|
||||||
description: Comma-separated list of additional queries to run. By default, this overrides the same setting in a configuration file; prefix with "+" to use both sets of queries.
|
description: Comma-separated list of additional queries to run. By default, this overrides the same setting in a configuration file; prefix with "+" to use both sets of queries.
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
39
lib/actions-util.js
generated
39
lib/actions-util.js
generated
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.printDebugLogs = exports.isAnalyzingDefaultBranch = exports.getRelativeScriptPath = exports.isRunningLocalAction = exports.workflowEventName = exports.sendStatusReport = exports.createStatusReportBase = exports.getActionVersion = exports.getActionsStatus = exports.getRef = exports.computeAutomationID = exports.getAutomationID = exports.getAnalysisKey = exports.determineMergeBaseCommitOid = exports.getCommitOid = exports.getTemporaryDirectory = exports.getOptionalInput = exports.getRequiredInput = void 0;
|
exports.getUploadValue = exports.printDebugLogs = exports.isAnalyzingDefaultBranch = exports.getRelativeScriptPath = exports.isRunningLocalAction = exports.workflowEventName = exports.sendStatusReport = exports.createStatusReportBase = exports.getActionVersion = exports.getActionsStatus = exports.getRef = exports.computeAutomationID = exports.getAutomationID = exports.getAnalysisKey = exports.determineMergeBaseCommitOid = exports.getCommitOid = exports.getTemporaryDirectory = exports.getOptionalInput = exports.getRequiredInput = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const os = __importStar(require("os"));
|
const os = __importStar(require("os"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
@@ -163,7 +163,7 @@ async function getAnalysisKey() {
|
|||||||
if (analysisKey !== undefined) {
|
if (analysisKey !== undefined) {
|
||||||
return analysisKey;
|
return analysisKey;
|
||||||
}
|
}
|
||||||
const workflowPath = await (0, workflow_1.getWorkflowPath)();
|
const workflowPath = await (0, workflow_1.getWorkflowRelativePath)();
|
||||||
const jobName = (0, util_1.getRequiredEnvParam)("GITHUB_JOB");
|
const jobName = (0, util_1.getRequiredEnvParam)("GITHUB_JOB");
|
||||||
analysisKey = `${workflowPath}:${jobName}`;
|
analysisKey = `${workflowPath}:${jobName}`;
|
||||||
core.exportVariable(analysisKeyEnvVar, analysisKey);
|
core.exportVariable(analysisKeyEnvVar, analysisKey);
|
||||||
@@ -290,11 +290,8 @@ exports.getActionVersion = getActionVersion;
|
|||||||
async function createStatusReportBase(actionName, status, actionStartedAt, cause, exception) {
|
async function createStatusReportBase(actionName, status, actionStartedAt, cause, exception) {
|
||||||
const commitOid = (0, exports.getOptionalInput)("sha") || process.env["GITHUB_SHA"] || "";
|
const commitOid = (0, exports.getOptionalInput)("sha") || process.env["GITHUB_SHA"] || "";
|
||||||
const ref = await getRef();
|
const ref = await getRef();
|
||||||
const workflowRunIDStr = process.env["GITHUB_RUN_ID"];
|
const workflowRunID = (0, workflow_1.getWorkflowRunID)();
|
||||||
let workflowRunID = -1;
|
const workflowRunAttempt = (0, workflow_1.getWorkflowRunAttempt)();
|
||||||
if (workflowRunIDStr) {
|
|
||||||
workflowRunID = parseInt(workflowRunIDStr, 10);
|
|
||||||
}
|
|
||||||
const workflowName = process.env["GITHUB_WORKFLOW"] || "";
|
const workflowName = process.env["GITHUB_WORKFLOW"] || "";
|
||||||
const jobName = process.env["GITHUB_JOB"] || "";
|
const jobName = process.env["GITHUB_JOB"] || "";
|
||||||
const analysis_key = await getAnalysisKey();
|
const analysis_key = await getAnalysisKey();
|
||||||
@@ -314,6 +311,7 @@ async function createStatusReportBase(actionName, status, actionStartedAt, cause
|
|||||||
}
|
}
|
||||||
const statusReport = {
|
const statusReport = {
|
||||||
workflow_run_id: workflowRunID,
|
workflow_run_id: workflowRunID,
|
||||||
|
workflow_run_attempt: workflowRunAttempt,
|
||||||
workflow_name: workflowName,
|
workflow_name: workflowName,
|
||||||
job_name: jobName,
|
job_name: jobName,
|
||||||
analysis_key,
|
analysis_key,
|
||||||
@@ -478,9 +476,14 @@ function getWorkflowEvent() {
|
|||||||
function removeRefsHeadsPrefix(ref) {
|
function removeRefsHeadsPrefix(ref) {
|
||||||
return ref.startsWith("refs/heads/") ? ref.slice("refs/heads/".length) : ref;
|
return ref.startsWith("refs/heads/") ? ref.slice("refs/heads/".length) : ref;
|
||||||
}
|
}
|
||||||
// Is the version of the repository we are currently analyzing from the default branch,
|
// Returns whether we are analyzing the default branch for the repository.
|
||||||
// or alternatively from another branch or a pull request.
|
// For cases where the repository information might not be available (e.g.,
|
||||||
|
// dynamic workflows), this can be forced by the environment variable
|
||||||
|
// CODE_SCANNING_IS_ANALYZING_DEFAULT_BRANCH.
|
||||||
async function isAnalyzingDefaultBranch() {
|
async function isAnalyzingDefaultBranch() {
|
||||||
|
if (process.env.CODE_SCANNING_IS_ANALYZING_DEFAULT_BRANCH === "true") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// Get the current ref and trim and refs/heads/ prefix
|
// Get the current ref and trim and refs/heads/ prefix
|
||||||
let currentRef = await getRef();
|
let currentRef = await getRef();
|
||||||
currentRef = removeRefsHeadsPrefix(currentRef);
|
currentRef = removeRefsHeadsPrefix(currentRef);
|
||||||
@@ -521,4 +524,22 @@ async function printDebugLogs(config) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.printDebugLogs = printDebugLogs;
|
exports.printDebugLogs = printDebugLogs;
|
||||||
|
// Parses the `upload` input into an `UploadKind`, converting unspecified and deprecated upload inputs appropriately.
|
||||||
|
function getUploadValue(input) {
|
||||||
|
switch (input) {
|
||||||
|
case undefined:
|
||||||
|
case "true":
|
||||||
|
case "always":
|
||||||
|
return "always";
|
||||||
|
case "false":
|
||||||
|
case "failure-only":
|
||||||
|
return "failure-only";
|
||||||
|
case "never":
|
||||||
|
return "never";
|
||||||
|
default:
|
||||||
|
core.warning(`Unrecognized 'upload' input to 'analyze' Action: ${input}. Defaulting to 'always'.`);
|
||||||
|
return "always";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.getUploadValue = getUploadValue;
|
||||||
//# sourceMappingURL=actions-util.js.map
|
//# sourceMappingURL=actions-util.js.map
|
||||||
File diff suppressed because one or more lines are too long
3
lib/actions-util.test.js
generated
3
lib/actions-util.test.js
generated
@@ -172,6 +172,9 @@ const util_1 = require("./util");
|
|||||||
t.deepEqual(process.env.CODEQL_ACTION_VERSION, "1.2.3");
|
t.deepEqual(process.env.CODEQL_ACTION_VERSION, "1.2.3");
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("isAnalyzingDefaultBranch()", async (t) => {
|
(0, ava_1.default)("isAnalyzingDefaultBranch()", async (t) => {
|
||||||
|
process.env["CODE_SCANNING_IS_ANALYZING_DEFAULT_BRANCH"] = "true";
|
||||||
|
t.deepEqual(await actionsutil.isAnalyzingDefaultBranch(), true);
|
||||||
|
process.env["CODE_SCANNING_IS_ANALYZING_DEFAULT_BRANCH"] = "false";
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
||||||
const envFile = path.join(tmpDir, "event.json");
|
const envFile = path.join(tmpDir, "event.json");
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
4
lib/analyze-action-post.js
generated
4
lib/analyze-action-post.js
generated
@@ -31,13 +31,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const analyzeActionPostHelper = __importStar(require("./analyze-action-post-helper"));
|
const analyzeActionPostHelper = __importStar(require("./analyze-action-post-helper"));
|
||||||
const debugArtifacts = __importStar(require("./debug-artifacts"));
|
const debugArtifacts = __importStar(require("./debug-artifacts"));
|
||||||
|
const util_1 = require("./util");
|
||||||
async function runWrapper() {
|
async function runWrapper() {
|
||||||
try {
|
try {
|
||||||
await analyzeActionPostHelper.run(debugArtifacts.uploadSarifDebugArtifact);
|
await analyzeActionPostHelper.run(debugArtifacts.uploadSarifDebugArtifact);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(`analyze post-action step failed: ${error}`);
|
core.setFailed(`analyze post-action step failed: ${(0, util_1.wrapError)(error).message}`);
|
||||||
console.log(error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void runWrapper();
|
void runWrapper();
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"analyze-action-post.js","sourceRoot":"","sources":["../src/analyze-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,sFAAwE;AACxE,kEAAoD;AAEpD,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,uBAAuB,CAAC,GAAG,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC;KAC5E;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,oCAAoC,KAAK,EAAE,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACpB;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,sFAAwE;AACxE,kEAAoD;AACpD,iCAAmC;AAEnC,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,uBAAuB,CAAC,GAAG,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC;KAC5E;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CACZ,oCAAoC,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAC/D,CAAC;KACH;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||||
16
lib/analyze-action.js
generated
16
lib/analyze-action.js
generated
@@ -103,7 +103,7 @@ function doesGoExtractionOutputExist(config) {
|
|||||||
* an autobuild step or manual build steps.
|
* an autobuild step or manual build steps.
|
||||||
*
|
*
|
||||||
* - We detect whether an autobuild step is present by checking the
|
* - We detect whether an autobuild step is present by checking the
|
||||||
* `util.DID_AUTOBUILD_GO_ENV_VAR_NAME` environment variable, which is set
|
* `CODEQL_ACTION_DID_AUTOBUILD_GOLANG` environment variable, which is set
|
||||||
* when the autobuilder is invoked.
|
* when the autobuilder is invoked.
|
||||||
* - We detect whether the Go database has already been finalized in case it
|
* - We detect whether the Go database has already been finalized in case it
|
||||||
* has been manually set in a prior Action step.
|
* has been manually set in a prior Action step.
|
||||||
@@ -114,7 +114,7 @@ async function runAutobuildIfLegacyGoWorkflow(config, logger) {
|
|||||||
if (!config.languages.includes(languages_1.Language.go)) {
|
if (!config.languages.includes(languages_1.Language.go)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (process.env[util.DID_AUTOBUILD_GO_ENV_VAR_NAME] === "true") {
|
if (process.env[shared_environment_1.CODEQL_ACTION_DID_AUTOBUILD_GOLANG] === "true") {
|
||||||
logger.debug("Won't run Go autobuild since it has already been run.");
|
logger.debug("Won't run Go autobuild since it has already been run.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,6 @@ async function run() {
|
|||||||
if (hasBadExpectErrorInput()) {
|
if (hasBadExpectErrorInput()) {
|
||||||
throw new Error("`expect-error` input parameter is for internal use only. It should only be set by codeql-action or a fork.");
|
throw new Error("`expect-error` input parameter is for internal use only. It should only be set by codeql-action or a fork.");
|
||||||
}
|
}
|
||||||
await util.enrichEnvironment(await (0, codeql_1.getCodeQL)(config.codeQLCmd));
|
|
||||||
const apiDetails = (0, api_client_1.getApiDetails)();
|
const apiDetails = (0, api_client_1.getApiDetails)();
|
||||||
const outputDir = actionsUtil.getRequiredInput("output");
|
const outputDir = actionsUtil.getRequiredInput("output");
|
||||||
const threads = util.getThreadsFlag(actionsUtil.getOptionalInput("threads") || process.env["CODEQL_THREADS"], logger);
|
const threads = util.getThreadsFlag(actionsUtil.getOptionalInput("threads") || process.env["CODEQL_THREADS"], logger);
|
||||||
@@ -164,7 +163,7 @@ async function run() {
|
|||||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
||||||
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger);
|
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger);
|
||||||
await runAutobuildIfLegacyGoWorkflow(config, logger);
|
await runAutobuildIfLegacyGoWorkflow(config, logger);
|
||||||
dbCreationTimings = await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger);
|
dbCreationTimings = await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger, features);
|
||||||
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
|
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
|
||||||
runStats = await (0, analyze_1.runQueries)(outputDir, memory, util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")), threads, actionsUtil.getOptionalInput("category"), config, logger, features);
|
runStats = await (0, analyze_1.runQueries)(outputDir, memory, util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")), threads, actionsUtil.getOptionalInput("category"), config, logger, features);
|
||||||
}
|
}
|
||||||
@@ -176,7 +175,8 @@ async function run() {
|
|||||||
dbLocations[language] = util.getCodeQLDatabasePath(config, language);
|
dbLocations[language] = util.getCodeQLDatabasePath(config, language);
|
||||||
}
|
}
|
||||||
core.setOutput("db-locations", dbLocations);
|
core.setOutput("db-locations", dbLocations);
|
||||||
if (runStats && actionsUtil.getRequiredInput("upload") === "true") {
|
const uploadInput = actionsUtil.getOptionalInput("upload");
|
||||||
|
if (runStats && actionsUtil.getUploadValue(uploadInput) === "always") {
|
||||||
uploadResult = await upload_lib.uploadFromActions(outputDir, actionsUtil.getRequiredInput("checkout_path"), actionsUtil.getOptionalInput("category"), logger);
|
uploadResult = await upload_lib.uploadFromActions(outputDir, actionsUtil.getRequiredInput("checkout_path"), actionsUtil.getOptionalInput("category"), logger);
|
||||||
core.setOutput("sarif-id", uploadResult.sarifID);
|
core.setOutput("sarif-id", uploadResult.sarifID);
|
||||||
}
|
}
|
||||||
@@ -204,8 +204,8 @@ async function run() {
|
|||||||
}
|
}
|
||||||
core.exportVariable(shared_environment_1.CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY, "true");
|
core.exportVariable(shared_environment_1.CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY, "true");
|
||||||
}
|
}
|
||||||
catch (origError) {
|
catch (unwrappedError) {
|
||||||
const error = origError instanceof Error ? origError : new Error(String(origError));
|
const error = (0, util_1.wrapError)(unwrappedError);
|
||||||
if (actionsUtil.getOptionalInput("expect-error") !== "true" ||
|
if (actionsUtil.getOptionalInput("expect-error") !== "true" ||
|
||||||
hasBadExpectErrorInput()) {
|
hasBadExpectErrorInput()) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
@@ -238,7 +238,7 @@ async function runWrapper() {
|
|||||||
await exports.runPromise;
|
await exports.runPromise;
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(`analyze action failed: ${error}`);
|
core.setFailed(`analyze action failed: ${(0, util_1.wrapError)(error).message}`);
|
||||||
}
|
}
|
||||||
await (0, util_1.checkForTimeout)();
|
await (0, util_1.checkForTimeout)();
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
34
lib/analyze.js
generated
34
lib/analyze.js
generated
@@ -36,8 +36,8 @@ const yaml = __importStar(require("js-yaml"));
|
|||||||
const analysisPaths = __importStar(require("./analysis-paths"));
|
const analysisPaths = __importStar(require("./analysis-paths"));
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
const configUtils = __importStar(require("./config-utils"));
|
const configUtils = __importStar(require("./config-utils"));
|
||||||
|
const feature_flags_1 = require("./feature-flags");
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const sharedEnv = __importStar(require("./shared-environment"));
|
|
||||||
const tracer_config_1 = require("./tracer-config");
|
const tracer_config_1 = require("./tracer-config");
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
class CodeQLAnalysisError extends Error {
|
class CodeQLAnalysisError extends Error {
|
||||||
@@ -48,12 +48,17 @@ class CodeQLAnalysisError extends Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.CodeQLAnalysisError = CodeQLAnalysisError;
|
exports.CodeQLAnalysisError = CodeQLAnalysisError;
|
||||||
async function setupPythonExtractor(logger) {
|
async function setupPythonExtractor(logger, features, codeql) {
|
||||||
const codeqlPython = process.env["CODEQL_PYTHON"];
|
const codeqlPython = process.env["CODEQL_PYTHON"];
|
||||||
if (codeqlPython === undefined || codeqlPython.length === 0) {
|
if (codeqlPython === undefined || codeqlPython.length === 0) {
|
||||||
// If CODEQL_PYTHON is not set, no dependencies were installed, so we don't need to do anything
|
// If CODEQL_PYTHON is not set, no dependencies were installed, so we don't need to do anything
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (await features.getValue(feature_flags_1.Feature.DisablePythonDependencyInstallation, codeql)) {
|
||||||
|
logger.warning("We recommend that you remove the CODEQL_PYTHON environment variable from your workflow. This environment variable was originally used to specify a Python executable that included the dependencies of your Python code, however Python analysis no longer uses these dependencies." +
|
||||||
|
"\nIf you used CODEQL_PYTHON to force the version of Python to analyze as, please use CODEQL_EXTRACTOR_PYTHON_ANALYSIS_VERSION instead, such as 'CODEQL_EXTRACTOR_PYTHON_ANALYSIS_VERSION=2.7' or 'CODEQL_EXTRACTOR_PYTHON_ANALYSIS_VERSION=3.11'.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
const scriptsFolder = path.resolve(__dirname, "../python-setup");
|
const scriptsFolder = path.resolve(__dirname, "../python-setup");
|
||||||
let output = "";
|
let output = "";
|
||||||
const options = {
|
const options = {
|
||||||
@@ -71,7 +76,7 @@ async function setupPythonExtractor(logger) {
|
|||||||
logger.info(`Setting LGTM_PYTHON_SETUP_VERSION=${output}`);
|
logger.info(`Setting LGTM_PYTHON_SETUP_VERSION=${output}`);
|
||||||
process.env["LGTM_PYTHON_SETUP_VERSION"] = output;
|
process.env["LGTM_PYTHON_SETUP_VERSION"] = output;
|
||||||
}
|
}
|
||||||
async function createdDBForScannedLanguages(codeql, config, logger) {
|
async function createdDBForScannedLanguages(codeql, config, logger, features) {
|
||||||
// Insert the LGTM_INDEX_X env vars at this point so they are set when
|
// Insert the LGTM_INDEX_X env vars at this point so they are set when
|
||||||
// we extract any scanned languages.
|
// we extract any scanned languages.
|
||||||
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
||||||
@@ -80,7 +85,7 @@ async function createdDBForScannedLanguages(codeql, config, logger) {
|
|||||||
!dbIsFinalized(config, language, logger)) {
|
!dbIsFinalized(config, language, logger)) {
|
||||||
logger.startGroup(`Extracting ${language}`);
|
logger.startGroup(`Extracting ${language}`);
|
||||||
if (language === languages_1.Language.python) {
|
if (language === languages_1.Language.python) {
|
||||||
await setupPythonExtractor(logger);
|
await setupPythonExtractor(logger, features, codeql);
|
||||||
}
|
}
|
||||||
await codeql.extractScannedLanguage(config, language);
|
await codeql.extractScannedLanguage(config, language);
|
||||||
logger.endGroup();
|
logger.endGroup();
|
||||||
@@ -100,10 +105,10 @@ function dbIsFinalized(config, language, logger) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.dbIsFinalized = dbIsFinalized;
|
exports.dbIsFinalized = dbIsFinalized;
|
||||||
async function finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger) {
|
async function finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger, features) {
|
||||||
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
||||||
const extractionStart = perf_hooks_1.performance.now();
|
const extractionStart = perf_hooks_1.performance.now();
|
||||||
await createdDBForScannedLanguages(codeql, config, logger);
|
await createdDBForScannedLanguages(codeql, config, logger, features);
|
||||||
const extractionTime = perf_hooks_1.performance.now() - extractionStart;
|
const extractionTime = perf_hooks_1.performance.now() - extractionStart;
|
||||||
const trapImportStart = perf_hooks_1.performance.now();
|
const trapImportStart = perf_hooks_1.performance.now();
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
@@ -218,7 +223,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
|||||||
return statusReport;
|
return statusReport;
|
||||||
async function runInterpretResults(language, queries, sarifFile, enableDebugLogging) {
|
async function runInterpretResults(language, queries, sarifFile, enableDebugLogging) {
|
||||||
const databasePath = util.getCodeQLDatabasePath(config, language);
|
const databasePath = util.getCodeQLDatabasePath(config, language);
|
||||||
return await codeql.databaseInterpretResults(databasePath, queries, sarifFile, addSnippetsFlag, threadsFlag, enableDebugLogging ? "-vv" : "-v", automationDetailsId, config, features);
|
return await codeql.databaseInterpretResults(databasePath, queries, sarifFile, addSnippetsFlag, threadsFlag, enableDebugLogging ? "-vv" : "-v", automationDetailsId, config, features, logger);
|
||||||
}
|
}
|
||||||
async function runPrintLinesOfCode(language) {
|
async function runPrintLinesOfCode(language) {
|
||||||
const databasePath = util.getCodeQLDatabasePath(config, language);
|
const databasePath = util.getCodeQLDatabasePath(config, language);
|
||||||
@@ -272,7 +277,7 @@ function createQuerySuiteContents(queries, queryFilters) {
|
|||||||
return yaml.dump(queries.map((q) => ({ query: q })).concat(queryFilters));
|
return yaml.dump(queries.map((q) => ({ query: q })).concat(queryFilters));
|
||||||
}
|
}
|
||||||
exports.createQuerySuiteContents = createQuerySuiteContents;
|
exports.createQuerySuiteContents = createQuerySuiteContents;
|
||||||
async function runFinalize(outputDir, threadsFlag, memoryFlag, config, logger) {
|
async function runFinalize(outputDir, threadsFlag, memoryFlag, config, logger, features) {
|
||||||
try {
|
try {
|
||||||
await (0, del_1.default)(outputDir, { force: true });
|
await (0, del_1.default)(outputDir, { force: true });
|
||||||
}
|
}
|
||||||
@@ -282,21 +287,14 @@ async function runFinalize(outputDir, threadsFlag, memoryFlag, config, logger) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await fs.promises.mkdir(outputDir, { recursive: true });
|
await fs.promises.mkdir(outputDir, { recursive: true });
|
||||||
const timings = await finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger);
|
const timings = await finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger, features);
|
||||||
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
|
||||||
// WARNING: This does not _really_ end tracing, as the tracer will restore its
|
// WARNING: This does not _really_ end tracing, as the tracer will restore its
|
||||||
// critical environment variables and it'll still be active for all processes
|
// critical environment variables and it'll still be active for all processes
|
||||||
// launched from this build step.
|
// launched from this build step.
|
||||||
// However, it will stop tracing for all steps past the codeql-action/analyze
|
// However, it will stop tracing for all steps past the codeql-action/analyze
|
||||||
// step.
|
// step.
|
||||||
if (await util.codeQlVersionAbove(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING)) {
|
// Delete variables as specified by the end-tracing script
|
||||||
// Delete variables as specified by the end-tracing script
|
await (0, tracer_config_1.endTracingForCluster)(config);
|
||||||
await (0, tracer_config_1.endTracingForCluster)(config);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Delete the tracer config env var to avoid tracing ourselves
|
|
||||||
delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION];
|
|
||||||
}
|
|
||||||
return timings;
|
return timings;
|
||||||
}
|
}
|
||||||
exports.runFinalize = runFinalize;
|
exports.runFinalize = runFinalize;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
|||||||
{ "maximumVersion": "3.8", "minimumVersion": "3.4" }
|
{ "maximumVersion": "3.9", "minimumVersion": "3.5" }
|
||||||
|
|||||||
14
lib/autobuild-action.js
generated
14
lib/autobuild-action.js
generated
@@ -30,6 +30,7 @@ const autobuild_1 = require("./autobuild");
|
|||||||
const configUtils = __importStar(require("./config-utils"));
|
const configUtils = __importStar(require("./config-utils"));
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
|
const shared_environment_1 = require("./shared-environment");
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
async function sendCompletedStatusReport(startedAt, allLanguages, failingLanguage, cause) {
|
async function sendCompletedStatusReport(startedAt, allLanguages, failingLanguage, cause) {
|
||||||
(0, util_1.initializeEnvironment)((0, actions_util_1.getActionVersion)());
|
(0, util_1.initializeEnvironment)((0, actions_util_1.getActionVersion)());
|
||||||
@@ -68,15 +69,15 @@ async function run() {
|
|||||||
currentLanguage = language;
|
currentLanguage = language;
|
||||||
await (0, autobuild_1.runAutobuild)(language, config, logger);
|
await (0, autobuild_1.runAutobuild)(language, config, logger);
|
||||||
if (language === languages_1.Language.go) {
|
if (language === languages_1.Language.go) {
|
||||||
core.exportVariable(util_1.DID_AUTOBUILD_GO_ENV_VAR_NAME, "true");
|
core.exportVariable(shared_environment_1.CODEQL_ACTION_DID_AUTOBUILD_GOLANG, "true");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (unwrappedError) {
|
||||||
core.setFailed(`We were unable to automatically build your code. Please replace the call to the autobuild action with your custom build steps. ${error instanceof Error ? error.message : String(error)}`);
|
const error = (0, util_1.wrapError)(unwrappedError);
|
||||||
console.log(error);
|
core.setFailed(`We were unable to automatically build your code. Please replace the call to the autobuild action with your custom build steps. ${error.message}`);
|
||||||
await sendCompletedStatusReport(startedAt, languages ?? [], currentLanguage, error instanceof Error ? error : new Error(String(error)));
|
await sendCompletedStatusReport(startedAt, languages ?? [], currentLanguage, error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await sendCompletedStatusReport(startedAt, languages ?? []);
|
await sendCompletedStatusReport(startedAt, languages ?? []);
|
||||||
@@ -86,8 +87,7 @@ async function runWrapper() {
|
|||||||
await run();
|
await run();
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(`autobuild action failed. ${error}`);
|
core.setFailed(`autobuild action failed. ${(0, util_1.wrapError)(error).message}`);
|
||||||
console.log(error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void runWrapper();
|
void runWrapper();
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAQwB;AACxB,6CAAgD;AAChD,2CAAwE;AACxE,4DAA8C;AAC9C,2CAAuC;AACvC,uCAA6C;AAC7C,iCAIgB;AAShB,KAAK,UAAU,yBAAyB,CACtC,SAAe,EACf,YAAsB,EACtB,eAAwB,EACxB,KAAa;IAEb,IAAA,4BAAqB,EAAC,IAAA,+BAAgB,GAAE,CAAC,CAAC;IAE1C,MAAM,MAAM,GAAG,IAAA,+BAAgB,EAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACxD,MAAM,gBAAgB,GAAG,MAAM,IAAA,qCAAsB,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CAAC;KACxE;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||||
195
lib/codeql.js
generated
195
lib/codeql.js
generated
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = exports.CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS = exports.CODEQL_VERSION_TRACING_GLIBC_2_34 = exports.CODEQL_VERSION_NEW_TRACING = exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = exports.CommandInvocationError = void 0;
|
exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = exports.CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS = exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = exports.CommandInvocationError = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||||
@@ -37,6 +37,7 @@ const setupCodeql = __importStar(require("./setup-codeql"));
|
|||||||
const toolrunner_error_catcher_1 = require("./toolrunner-error-catcher");
|
const toolrunner_error_catcher_1 = require("./toolrunner-error-catcher");
|
||||||
const trap_caching_1 = require("./trap-caching");
|
const trap_caching_1 = require("./trap-caching");
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
|
const util_1 = require("./util");
|
||||||
class CommandInvocationError extends Error {
|
class CommandInvocationError extends Error {
|
||||||
constructor(cmd, args, exitCode, error, output) {
|
constructor(cmd, args, exitCode, error, output) {
|
||||||
super(`Failure invoking ${cmd} with arguments ${args}.\n
|
super(`Failure invoking ${cmd} with arguments ${args}.\n
|
||||||
@@ -59,32 +60,16 @@ let cachedCodeQL = undefined;
|
|||||||
* The version flags below can be used to conditionally enable certain features
|
* The version flags below can be used to conditionally enable certain features
|
||||||
* on versions newer than this.
|
* on versions newer than this.
|
||||||
*/
|
*/
|
||||||
const CODEQL_MINIMUM_VERSION = "2.6.3";
|
const CODEQL_MINIMUM_VERSION = "2.8.5";
|
||||||
/**
|
/**
|
||||||
* Versions of CodeQL that version-flag certain functionality in the Action.
|
* Versions of CodeQL that version-flag certain functionality in the Action.
|
||||||
* For convenience, please keep these in descending order. Once a version
|
* For convenience, please keep these in descending order. Once a version
|
||||||
* flag is older than the oldest supported version above, it may be removed.
|
* flag is older than the oldest supported version above, it may be removed.
|
||||||
*/
|
*/
|
||||||
const CODEQL_VERSION_CUSTOM_QUERY_HELP = "2.7.1";
|
|
||||||
const CODEQL_VERSION_LUA_TRACER_CONFIG = "2.10.0";
|
const CODEQL_VERSION_LUA_TRACER_CONFIG = "2.10.0";
|
||||||
const CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED = "2.10.4";
|
const CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED = "2.10.4";
|
||||||
exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = "2.10.4";
|
exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = "2.10.4";
|
||||||
const CODEQL_VERSION_FILE_BASELINE_INFORMATION = "2.11.3";
|
const CODEQL_VERSION_FILE_BASELINE_INFORMATION = "2.11.3";
|
||||||
/**
|
|
||||||
* This variable controls using the new style of tracing from the CodeQL
|
|
||||||
* CLI. In particular, with versions above this we will use both indirect
|
|
||||||
* tracing, and multi-language tracing together with database clusters.
|
|
||||||
*
|
|
||||||
* Note that there were bugs in both of these features that were fixed in
|
|
||||||
* release 2.7.0 of the CodeQL CLI, therefore this flag is only enabled for
|
|
||||||
* versions above that.
|
|
||||||
*/
|
|
||||||
exports.CODEQL_VERSION_NEW_TRACING = "2.7.0";
|
|
||||||
/**
|
|
||||||
* Versions 2.7.3+ of the CodeQL CLI support build tracing with glibc 2.34 on Linux. Versions before
|
|
||||||
* this cannot perform build tracing when running on the Actions `ubuntu-22.04` runner image.
|
|
||||||
*/
|
|
||||||
exports.CODEQL_VERSION_TRACING_GLIBC_2_34 = "2.7.3";
|
|
||||||
/**
|
/**
|
||||||
* Versions 2.9.0+ of the CodeQL CLI run machine learning models from a temporary directory, which
|
* Versions 2.9.0+ of the CodeQL CLI run machine learning models from a temporary directory, which
|
||||||
* resolves an issue on Windows where TensorFlow models are not correctly loaded due to the path of
|
* resolves an issue on Windows where TensorFlow models are not correctly loaded due to the path of
|
||||||
@@ -136,8 +121,7 @@ async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliV
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
logger.error(e instanceof Error ? e : new Error(String(e)));
|
throw new Error(`Unable to download and extract CodeQL CLI: ${(0, util_1.wrapError)(e).message}`);
|
||||||
throw new Error("Unable to download and extract CodeQL CLI");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.setupCodeQL = setupCodeQL;
|
exports.setupCodeQL = setupCodeQL;
|
||||||
@@ -174,8 +158,6 @@ function setCodeQL(partialCodeql) {
|
|||||||
getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"),
|
getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"),
|
||||||
getVersion: resolveFunction(partialCodeql, "getVersion", () => new Promise((resolve) => resolve("1.0.0"))),
|
getVersion: resolveFunction(partialCodeql, "getVersion", () => new Promise((resolve) => resolve("1.0.0"))),
|
||||||
printVersion: resolveFunction(partialCodeql, "printVersion"),
|
printVersion: resolveFunction(partialCodeql, "printVersion"),
|
||||||
getTracerEnv: resolveFunction(partialCodeql, "getTracerEnv"),
|
|
||||||
databaseInit: resolveFunction(partialCodeql, "databaseInit"),
|
|
||||||
databaseInitCluster: resolveFunction(partialCodeql, "databaseInitCluster"),
|
databaseInitCluster: resolveFunction(partialCodeql, "databaseInitCluster"),
|
||||||
runAutobuild: resolveFunction(partialCodeql, "runAutobuild"),
|
runAutobuild: resolveFunction(partialCodeql, "runAutobuild"),
|
||||||
extractScannedLanguage: resolveFunction(partialCodeql, "extractScannedLanguage"),
|
extractScannedLanguage: resolveFunction(partialCodeql, "extractScannedLanguage"),
|
||||||
@@ -189,7 +171,9 @@ function setCodeQL(partialCodeql) {
|
|||||||
databaseRunQueries: resolveFunction(partialCodeql, "databaseRunQueries"),
|
databaseRunQueries: resolveFunction(partialCodeql, "databaseRunQueries"),
|
||||||
databaseInterpretResults: resolveFunction(partialCodeql, "databaseInterpretResults"),
|
databaseInterpretResults: resolveFunction(partialCodeql, "databaseInterpretResults"),
|
||||||
databasePrintBaseline: resolveFunction(partialCodeql, "databasePrintBaseline"),
|
databasePrintBaseline: resolveFunction(partialCodeql, "databasePrintBaseline"),
|
||||||
|
databaseExportDiagnostics: resolveFunction(partialCodeql, "databaseExportDiagnostics"),
|
||||||
diagnosticsExport: resolveFunction(partialCodeql, "diagnosticsExport"),
|
diagnosticsExport: resolveFunction(partialCodeql, "diagnosticsExport"),
|
||||||
|
resolveExtractor: resolveFunction(partialCodeql, "resolveExtractor"),
|
||||||
};
|
};
|
||||||
return cachedCodeQL;
|
return cachedCodeQL;
|
||||||
}
|
}
|
||||||
@@ -241,73 +225,6 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
async printVersion() {
|
async printVersion() {
|
||||||
await runTool(cmd, ["version", "--format=json"]);
|
await runTool(cmd, ["version", "--format=json"]);
|
||||||
},
|
},
|
||||||
async getTracerEnv(databasePath) {
|
|
||||||
// Write tracer-env.js to a temp location.
|
|
||||||
// BEWARE: The name and location of this file is recognized by `codeql database
|
|
||||||
// trace-command` in order to enable special support for concatenable tracer
|
|
||||||
// configurations. Consequently the name must not be changed.
|
|
||||||
// (This warning can be removed once a different way to recognize the
|
|
||||||
// action/runner has been implemented in `codeql database trace-command`
|
|
||||||
// _and_ is present in the latest supported CLI release.)
|
|
||||||
const tracerEnvJs = path.resolve(databasePath, "working", "tracer-env.js");
|
|
||||||
fs.mkdirSync(path.dirname(tracerEnvJs), { recursive: true });
|
|
||||||
fs.writeFileSync(tracerEnvJs, `
|
|
||||||
const fs = require('fs');
|
|
||||||
const env = {};
|
|
||||||
for (let entry of Object.entries(process.env)) {
|
|
||||||
const key = entry[0];
|
|
||||||
const value = entry[1];
|
|
||||||
if (typeof value !== 'undefined' && key !== '_' && !key.startsWith('JAVA_MAIN_CLASS_')) {
|
|
||||||
env[key] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
process.stdout.write(process.argv[2]);
|
|
||||||
fs.writeFileSync(process.argv[2], JSON.stringify(env), 'utf-8');`);
|
|
||||||
// BEWARE: The name and location of this file is recognized by `codeql database
|
|
||||||
// trace-command` in order to enable special support for concatenable tracer
|
|
||||||
// configurations. Consequently the name must not be changed.
|
|
||||||
// (This warning can be removed once a different way to recognize the
|
|
||||||
// action/runner has been implemented in `codeql database trace-command`
|
|
||||||
// _and_ is present in the latest supported CLI release.)
|
|
||||||
const envFile = path.resolve(databasePath, "working", "env.tmp");
|
|
||||||
try {
|
|
||||||
await runTool(cmd, [
|
|
||||||
"database",
|
|
||||||
"trace-command",
|
|
||||||
databasePath,
|
|
||||||
...getExtraOptionsFromEnv(["database", "trace-command"]),
|
|
||||||
process.execPath,
|
|
||||||
tracerEnvJs,
|
|
||||||
envFile,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
if (e instanceof CommandInvocationError &&
|
|
||||||
e.output.includes("undefined symbol: __libc_dlopen_mode, version GLIBC_PRIVATE") &&
|
|
||||||
process.platform === "linux" &&
|
|
||||||
!(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_TRACING_GLIBC_2_34))) {
|
|
||||||
throw new util.UserError("The CodeQL CLI is incompatible with the version of glibc on your system. " +
|
|
||||||
`Please upgrade to CodeQL CLI version ${exports.CODEQL_VERSION_TRACING_GLIBC_2_34} or ` +
|
|
||||||
"later. If you cannot upgrade to a newer version of the CodeQL CLI, you can " +
|
|
||||||
`alternatively run your workflow on another runner image such as "ubuntu-20.04" ` +
|
|
||||||
"that has glibc 2.33 or earlier installed.");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return JSON.parse(fs.readFileSync(envFile, "utf-8"));
|
|
||||||
},
|
|
||||||
async databaseInit(databasePath, language, sourceRoot) {
|
|
||||||
await runTool(cmd, [
|
|
||||||
"database",
|
|
||||||
"init",
|
|
||||||
databasePath,
|
|
||||||
`--language=${language}`,
|
|
||||||
`--source-root=${sourceRoot}`,
|
|
||||||
...getExtraOptionsFromEnv(["database", "init"]),
|
|
||||||
]);
|
|
||||||
},
|
|
||||||
async databaseInitCluster(config, sourceRoot, processName, features, qlconfigFile, logger) {
|
async databaseInitCluster(config, sourceRoot, processName, features, qlconfigFile, logger) {
|
||||||
const extraArgs = config.languages.map((language) => `--language=${language}`);
|
const extraArgs = config.languages.map((language) => `--language=${language}`);
|
||||||
if (config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l)).length > 0) {
|
if (config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l)).length > 0) {
|
||||||
@@ -352,10 +269,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
], { stdin: externalRepositoryToken });
|
], { stdin: externalRepositoryToken });
|
||||||
},
|
},
|
||||||
async runAutobuild(language) {
|
async runAutobuild(language) {
|
||||||
const cmdName = process.platform === "win32" ? "autobuild.cmd" : "autobuild.sh";
|
const autobuildCmd = path.join(await this.resolveExtractor(language), "tools", process.platform === "win32" ? "autobuild.cmd" : "autobuild.sh");
|
||||||
// The autobuilder for Swift is located in the experimental/ directory.
|
|
||||||
const possibleExperimentalDir = language === languages_1.Language.swift ? "experimental" : "";
|
|
||||||
const autobuildCmd = path.join(path.dirname(cmd), possibleExperimentalDir, language, "tools", cmdName);
|
|
||||||
// Update JAVA_TOOL_OPTIONS to contain '-Dhttp.keepAlive=false'
|
// Update JAVA_TOOL_OPTIONS to contain '-Dhttp.keepAlive=false'
|
||||||
// This is because of an issue with Azure pipelines timing out connections after 4 minutes
|
// This is because of an issue with Azure pipelines timing out connections after 4 minutes
|
||||||
// and Maven not properly handling closed connections
|
// and Maven not properly handling closed connections
|
||||||
@@ -384,31 +298,9 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
},
|
},
|
||||||
async extractScannedLanguage(config, language) {
|
async extractScannedLanguage(config, language) {
|
||||||
const databasePath = util.getCodeQLDatabasePath(config, language);
|
const databasePath = util.getCodeQLDatabasePath(config, language);
|
||||||
// Get extractor location
|
|
||||||
//
|
|
||||||
// Request it using `format=json` so we don't need to strip the trailing new line generated by
|
|
||||||
// the CLI.
|
|
||||||
let extractorPath = "";
|
|
||||||
await new toolrunner.ToolRunner(cmd, [
|
|
||||||
"resolve",
|
|
||||||
"extractor",
|
|
||||||
"--format=json",
|
|
||||||
`--language=${language}`,
|
|
||||||
...getExtraOptionsFromEnv(["resolve", "extractor"]),
|
|
||||||
], {
|
|
||||||
silent: true,
|
|
||||||
listeners: {
|
|
||||||
stdout: (data) => {
|
|
||||||
extractorPath += data.toString();
|
|
||||||
},
|
|
||||||
stderr: (data) => {
|
|
||||||
process.stderr.write(data);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}).exec();
|
|
||||||
// Set trace command
|
// Set trace command
|
||||||
const ext = process.platform === "win32" ? ".cmd" : ".sh";
|
const ext = process.platform === "win32" ? ".cmd" : ".sh";
|
||||||
const traceCommand = path.resolve(JSON.parse(extractorPath), "tools", `autobuild${ext}`);
|
const traceCommand = path.resolve(await this.resolveExtractor(language), "tools", `autobuild${ext}`);
|
||||||
// Run trace command
|
// Run trace command
|
||||||
await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, [
|
await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, [
|
||||||
"database",
|
"database",
|
||||||
@@ -504,35 +396,49 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
}
|
}
|
||||||
await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, codeqlArgs, error_matcher_1.errorMatchers);
|
await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, codeqlArgs, error_matcher_1.errorMatchers);
|
||||||
},
|
},
|
||||||
async databaseInterpretResults(databasePath, querySuitePaths, sarifFile, addSnippetsFlag, threadsFlag, verbosityFlag, automationDetailsId, config, features) {
|
async databaseInterpretResults(databasePath, querySuitePaths, sarifFile, addSnippetsFlag, threadsFlag, verbosityFlag, automationDetailsId, config, features, logger) {
|
||||||
|
const shouldExportDiagnostics = await features.getValue(feature_flags_1.Feature.ExportDiagnosticsEnabled, this);
|
||||||
|
// Update this to take into account the CodeQL version when we have a version with the fix.
|
||||||
|
const shouldWorkaroundInvalidNotifications = shouldExportDiagnostics;
|
||||||
|
const codeqlOutputFile = shouldWorkaroundInvalidNotifications
|
||||||
|
? path.join(config.tempDir, "codeql-intermediate-results.sarif")
|
||||||
|
: sarifFile;
|
||||||
const codeqlArgs = [
|
const codeqlArgs = [
|
||||||
"database",
|
"database",
|
||||||
"interpret-results",
|
"interpret-results",
|
||||||
threadsFlag,
|
threadsFlag,
|
||||||
"--format=sarif-latest",
|
"--format=sarif-latest",
|
||||||
verbosityFlag,
|
verbosityFlag,
|
||||||
`--output=${sarifFile}`,
|
`--output=${codeqlOutputFile}`,
|
||||||
addSnippetsFlag,
|
addSnippetsFlag,
|
||||||
"--print-diagnostics-summary",
|
"--print-diagnostics-summary",
|
||||||
"--print-metrics-summary",
|
"--print-metrics-summary",
|
||||||
|
"--sarif-add-query-help",
|
||||||
"--sarif-group-rules-by-pack",
|
"--sarif-group-rules-by-pack",
|
||||||
...(await getCodeScanningConfigExportArguments(config, this, features)),
|
...(await getCodeScanningConfigExportArguments(config, this, features)),
|
||||||
...getExtraOptionsFromEnv(["database", "interpret-results"]),
|
...getExtraOptionsFromEnv(["database", "interpret-results"]),
|
||||||
];
|
];
|
||||||
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_CUSTOM_QUERY_HELP))
|
|
||||||
codeqlArgs.push("--sarif-add-query-help");
|
|
||||||
if (automationDetailsId !== undefined) {
|
if (automationDetailsId !== undefined) {
|
||||||
codeqlArgs.push("--sarif-category", automationDetailsId);
|
codeqlArgs.push("--sarif-category", automationDetailsId);
|
||||||
}
|
}
|
||||||
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_FILE_BASELINE_INFORMATION)) {
|
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_FILE_BASELINE_INFORMATION)) {
|
||||||
codeqlArgs.push("--sarif-add-baseline-file-info");
|
codeqlArgs.push("--sarif-add-baseline-file-info");
|
||||||
}
|
}
|
||||||
|
if (shouldExportDiagnostics) {
|
||||||
|
codeqlArgs.push("--sarif-include-diagnostics");
|
||||||
|
}
|
||||||
|
else if (await util.codeQlVersionAbove(this, "2.12.4")) {
|
||||||
|
codeqlArgs.push("--no-sarif-include-diagnostics");
|
||||||
|
}
|
||||||
codeqlArgs.push(databasePath);
|
codeqlArgs.push(databasePath);
|
||||||
if (querySuitePaths) {
|
if (querySuitePaths) {
|
||||||
codeqlArgs.push(...querySuitePaths);
|
codeqlArgs.push(...querySuitePaths);
|
||||||
}
|
}
|
||||||
// capture stdout, which contains analysis summaries
|
// capture stdout, which contains analysis summaries
|
||||||
const returnState = await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, codeqlArgs, error_matcher_1.errorMatchers);
|
const returnState = await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, codeqlArgs, error_matcher_1.errorMatchers);
|
||||||
|
if (shouldWorkaroundInvalidNotifications) {
|
||||||
|
util.fixInvalidNotificationsInFile(codeqlOutputFile, sarifFile, logger);
|
||||||
|
}
|
||||||
return returnState.stdout;
|
return returnState.stdout;
|
||||||
},
|
},
|
||||||
async databasePrintBaseline(databasePath) {
|
async databasePrintBaseline(databasePath) {
|
||||||
@@ -609,6 +515,32 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
];
|
];
|
||||||
await new toolrunner.ToolRunner(cmd, args).exec();
|
await new toolrunner.ToolRunner(cmd, args).exec();
|
||||||
},
|
},
|
||||||
|
async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId, tempDir, logger) {
|
||||||
|
// Update this to take into account the CodeQL version when we have a version with the fix.
|
||||||
|
const shouldWorkaroundInvalidNotifications = true;
|
||||||
|
const codeqlOutputFile = shouldWorkaroundInvalidNotifications
|
||||||
|
? path.join(tempDir, "codeql-intermediate-results.sarif")
|
||||||
|
: sarifFile;
|
||||||
|
const args = [
|
||||||
|
"database",
|
||||||
|
"export-diagnostics",
|
||||||
|
`${databasePath}`,
|
||||||
|
"--db-cluster",
|
||||||
|
"--format=sarif-latest",
|
||||||
|
`--output=${codeqlOutputFile}`,
|
||||||
|
"--sarif-include-diagnostics",
|
||||||
|
"-vvv",
|
||||||
|
...getExtraOptionsFromEnv(["diagnostics", "export"]),
|
||||||
|
];
|
||||||
|
if (automationDetailsId !== undefined) {
|
||||||
|
args.push("--sarif-category", automationDetailsId);
|
||||||
|
}
|
||||||
|
await new toolrunner.ToolRunner(cmd, args).exec();
|
||||||
|
if (shouldWorkaroundInvalidNotifications) {
|
||||||
|
// Fix invalid notifications in the SARIF file output by CodeQL.
|
||||||
|
util.fixInvalidNotificationsInFile(codeqlOutputFile, sarifFile, logger);
|
||||||
|
}
|
||||||
|
},
|
||||||
async diagnosticsExport(sarifFile, automationDetailsId, config, features) {
|
async diagnosticsExport(sarifFile, automationDetailsId, config, features) {
|
||||||
const args = [
|
const args = [
|
||||||
"diagnostics",
|
"diagnostics",
|
||||||
@@ -623,6 +555,29 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
}
|
}
|
||||||
await new toolrunner.ToolRunner(cmd, args).exec();
|
await new toolrunner.ToolRunner(cmd, args).exec();
|
||||||
},
|
},
|
||||||
|
async resolveExtractor(language) {
|
||||||
|
// Request it using `format=json` so we don't need to strip the trailing new line generated by
|
||||||
|
// the CLI.
|
||||||
|
let extractorPath = "";
|
||||||
|
await new toolrunner.ToolRunner(cmd, [
|
||||||
|
"resolve",
|
||||||
|
"extractor",
|
||||||
|
"--format=json",
|
||||||
|
`--language=${language}`,
|
||||||
|
...getExtraOptionsFromEnv(["resolve", "extractor"]),
|
||||||
|
], {
|
||||||
|
silent: true,
|
||||||
|
listeners: {
|
||||||
|
stdout: (data) => {
|
||||||
|
extractorPath += data.toString();
|
||||||
|
},
|
||||||
|
stderr: (data) => {
|
||||||
|
process.stderr.write(data);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}).exec();
|
||||||
|
return JSON.parse(extractorPath);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
// To ensure that status reports include the CodeQL CLI version wherever
|
// To ensure that status reports include the CodeQL CLI version wherever
|
||||||
// possible, we want to call getVersion(), which populates the version value
|
// possible, we want to call getVersion(), which populates the version value
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
104
lib/codeql.test.js
generated
104
lib/codeql.test.js
generated
@@ -49,20 +49,11 @@ const testing_utils_1 = require("./testing-utils");
|
|||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
(0, testing_utils_1.setupTests)(ava_1.default);
|
(0, testing_utils_1.setupTests)(ava_1.default);
|
||||||
const sampleApiDetails = {
|
|
||||||
auth: "token",
|
|
||||||
url: "https://github.com",
|
|
||||||
apiURL: "https://api.github.com",
|
|
||||||
};
|
|
||||||
const sampleGHAEApiDetails = {
|
const sampleGHAEApiDetails = {
|
||||||
auth: "token",
|
auth: "token",
|
||||||
url: "https://example.githubenterprise.com",
|
url: "https://example.githubenterprise.com",
|
||||||
apiURL: "https://example.githubenterprise.com/api/v3",
|
apiURL: "https://example.githubenterprise.com/api/v3",
|
||||||
};
|
};
|
||||||
const SAMPLE_DEFAULT_CLI_VERSION = {
|
|
||||||
cliVersion: "2.0.0",
|
|
||||||
variant: util.GitHubVariant.DOTCOM,
|
|
||||||
};
|
|
||||||
let stubConfig;
|
let stubConfig;
|
||||||
ava_1.default.beforeEach(() => {
|
ava_1.default.beforeEach(() => {
|
||||||
(0, util_1.initializeEnvironment)("1.2.3");
|
(0, util_1.initializeEnvironment)("1.2.3");
|
||||||
@@ -91,34 +82,13 @@ ava_1.default.beforeEach(() => {
|
|||||||
trapCacheDownloadTime: 0,
|
trapCacheDownloadTime: 0,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
/**
|
async function installIntoToolcache({ apiDetails = testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, cliVersion, isPinned, tagName, tmpDir, }) {
|
||||||
* Mocks the API for downloading the bundle tagged `tagName`.
|
const url = (0, testing_utils_1.mockBundleDownloadApi)({ apiDetails, isPinned, tagName });
|
||||||
*
|
|
||||||
* @returns the download URL for the bundle. This can be passed to the tools parameter of
|
|
||||||
* `codeql.setupCodeQL`.
|
|
||||||
*/
|
|
||||||
function mockDownloadApi({ apiDetails = sampleApiDetails, isPinned, repo = "github/codeql-action", platformSpecific = true, tagName, }) {
|
|
||||||
const platform = process.platform === "win32"
|
|
||||||
? "win64"
|
|
||||||
: process.platform === "linux"
|
|
||||||
? "linux64"
|
|
||||||
: "osx64";
|
|
||||||
const baseUrl = apiDetails?.url ?? "https://example.com";
|
|
||||||
const relativeUrl = apiDetails
|
|
||||||
? `/${repo}/releases/download/${tagName}/codeql-bundle${platformSpecific ? `-${platform}` : ""}.tar.gz`
|
|
||||||
: `/download/${tagName}/codeql-bundle.tar.gz`;
|
|
||||||
(0, nock_1.default)(baseUrl)
|
|
||||||
.get(relativeUrl)
|
|
||||||
.replyWithFile(200, path_1.default.join(__dirname, `/../src/testdata/codeql-bundle${isPinned ? "-pinned" : ""}.tar.gz`));
|
|
||||||
return `${baseUrl}${relativeUrl}`;
|
|
||||||
}
|
|
||||||
async function installIntoToolcache({ apiDetails = sampleApiDetails, cliVersion, isPinned, tagName, tmpDir, }) {
|
|
||||||
const url = mockDownloadApi({ apiDetails, isPinned, tagName });
|
|
||||||
await codeql.setupCodeQL(cliVersion !== undefined ? undefined : url, apiDetails, tmpDir, util.GitHubVariant.GHES, cliVersion !== undefined
|
await codeql.setupCodeQL(cliVersion !== undefined ? undefined : url, apiDetails, tmpDir, util.GitHubVariant.GHES, cliVersion !== undefined
|
||||||
? { cliVersion, tagName, variant: util.GitHubVariant.GHES }
|
? { cliVersion, tagName, variant: util.GitHubVariant.GHES }
|
||||||
: SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
: testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
||||||
}
|
}
|
||||||
function mockReleaseApi({ apiDetails = sampleApiDetails, assetNames, tagName, }) {
|
function mockReleaseApi({ apiDetails = testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, assetNames, tagName, }) {
|
||||||
return (0, nock_1.default)(apiDetails.apiURL)
|
return (0, nock_1.default)(apiDetails.apiURL)
|
||||||
.get(`/repos/github/codeql-action/releases/tags/${tagName}`)
|
.get(`/repos/github/codeql-action/releases/tags/${tagName}`)
|
||||||
.reply(200, {
|
.reply(200, {
|
||||||
@@ -149,11 +119,11 @@ function mockApiDetails(apiDetails) {
|
|||||||
const versions = ["20200601", "20200610"];
|
const versions = ["20200601", "20200610"];
|
||||||
for (let i = 0; i < versions.length; i++) {
|
for (let i = 0; i < versions.length; i++) {
|
||||||
const version = versions[i];
|
const version = versions[i];
|
||||||
const url = mockDownloadApi({
|
const url = (0, testing_utils_1.mockBundleDownloadApi)({
|
||||||
tagName: `codeql-bundle-${version}`,
|
tagName: `codeql-bundle-${version}`,
|
||||||
isPinned: false,
|
isPinned: false,
|
||||||
});
|
});
|
||||||
const result = await codeql.setupCodeQL(url, sampleApiDetails, tmpDir, util.GitHubVariant.DOTCOM, SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
||||||
t.assert(toolcache.find("CodeQL", `0.0.0-${version}`));
|
t.assert(toolcache.find("CodeQL", `0.0.0-${version}`));
|
||||||
t.is(result.toolsVersion, `0.0.0-${version}`);
|
t.is(result.toolsVersion, `0.0.0-${version}`);
|
||||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
||||||
@@ -170,10 +140,10 @@ function mockApiDetails(apiDetails) {
|
|||||||
isPinned: true,
|
isPinned: true,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
});
|
});
|
||||||
const url = mockDownloadApi({
|
const url = (0, testing_utils_1.mockBundleDownloadApi)({
|
||||||
tagName: "codeql-bundle-20200610",
|
tagName: "codeql-bundle-20200610",
|
||||||
});
|
});
|
||||||
const result = await codeql.setupCodeQL(url, sampleApiDetails, tmpDir, util.GitHubVariant.DOTCOM, SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
||||||
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
|
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
|
||||||
t.deepEqual(result.toolsVersion, "0.0.0-20200610");
|
t.deepEqual(result.toolsVersion, "0.0.0-20200610");
|
||||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
||||||
@@ -198,16 +168,16 @@ for (const { cliVersion, expectedToolcacheVersion, } of EXPLICITLY_REQUESTED_BUN
|
|||||||
(0, ava_1.default)(`caches an explicitly requested bundle containing CLI ${cliVersion} as ${expectedToolcacheVersion}`, async (t) => {
|
(0, ava_1.default)(`caches an explicitly requested bundle containing CLI ${cliVersion} as ${expectedToolcacheVersion}`, async (t) => {
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
||||||
mockApiDetails(sampleApiDetails);
|
mockApiDetails(testing_utils_1.SAMPLE_DOTCOM_API_DETAILS);
|
||||||
sinon.stub(actionsUtil, "isRunningLocalAction").returns(true);
|
sinon.stub(actionsUtil, "isRunningLocalAction").returns(true);
|
||||||
const releaseApiMock = mockReleaseApi({
|
const releaseApiMock = mockReleaseApi({
|
||||||
assetNames: [`cli-version-${cliVersion}.txt`],
|
assetNames: [`cli-version-${cliVersion}.txt`],
|
||||||
tagName: "codeql-bundle-20200610",
|
tagName: "codeql-bundle-20200610",
|
||||||
});
|
});
|
||||||
const url = mockDownloadApi({
|
const url = (0, testing_utils_1.mockBundleDownloadApi)({
|
||||||
tagName: "codeql-bundle-20200610",
|
tagName: "codeql-bundle-20200610",
|
||||||
});
|
});
|
||||||
const result = await codeql.setupCodeQL(url, sampleApiDetails, tmpDir, util.GitHubVariant.DOTCOM, SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
||||||
t.assert(releaseApiMock.isDone(), "Releases API should have been called");
|
t.assert(releaseApiMock.isDone(), "Releases API should have been called");
|
||||||
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
|
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
|
||||||
t.deepEqual(result.toolsVersion, cliVersion);
|
t.deepEqual(result.toolsVersion, cliVersion);
|
||||||
@@ -220,19 +190,19 @@ for (const { githubReleases, toolcacheVersion } of [
|
|||||||
// Test that we use the tools from the toolcache when `SAMPLE_DEFAULT_CLI_VERSION` is requested
|
// Test that we use the tools from the toolcache when `SAMPLE_DEFAULT_CLI_VERSION` is requested
|
||||||
// and `SAMPLE_DEFAULT_CLI_VERSION-` is in the toolcache.
|
// and `SAMPLE_DEFAULT_CLI_VERSION-` is in the toolcache.
|
||||||
{
|
{
|
||||||
toolcacheVersion: SAMPLE_DEFAULT_CLI_VERSION.cliVersion,
|
toolcacheVersion: testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION.cliVersion,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
githubReleases: {
|
githubReleases: {
|
||||||
"codeql-bundle-20230101": `cli-version-${SAMPLE_DEFAULT_CLI_VERSION.cliVersion}.txt`,
|
"codeql-bundle-20230101": `cli-version-${testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION.cliVersion}.txt`,
|
||||||
},
|
},
|
||||||
toolcacheVersion: "0.0.0-20230101",
|
toolcacheVersion: "0.0.0-20230101",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
toolcacheVersion: `${SAMPLE_DEFAULT_CLI_VERSION.cliVersion}-20230101`,
|
toolcacheVersion: `${testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION.cliVersion}-20230101`,
|
||||||
},
|
},
|
||||||
]) {
|
]) {
|
||||||
(0, ava_1.default)(`uses tools from toolcache when ${SAMPLE_DEFAULT_CLI_VERSION.cliVersion} is requested and ` +
|
(0, ava_1.default)(`uses tools from toolcache when ${testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION.cliVersion} is requested and ` +
|
||||||
`${toolcacheVersion} is installed`, async (t) => {
|
`${toolcacheVersion} is installed`, async (t) => {
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
||||||
@@ -256,8 +226,8 @@ for (const { githubReleases, toolcacheVersion } of [
|
|||||||
}))),
|
}))),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
const result = await codeql.setupCodeQL(undefined, sampleApiDetails, tmpDir, util.GitHubVariant.DOTCOM, SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
||||||
t.is(result.toolsVersion, SAMPLE_DEFAULT_CLI_VERSION.cliVersion);
|
t.is(result.toolsVersion, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION.cliVersion);
|
||||||
t.is(result.toolsSource, init_1.ToolsSource.Toolcache);
|
t.is(result.toolsSource, init_1.ToolsSource.Toolcache);
|
||||||
t.is(result.toolsDownloadDurationMs, undefined);
|
t.is(result.toolsDownloadDurationMs, undefined);
|
||||||
});
|
});
|
||||||
@@ -272,7 +242,7 @@ for (const variant of [util.GitHubVariant.GHAE, util.GitHubVariant.GHES]) {
|
|||||||
isPinned: true,
|
isPinned: true,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
});
|
});
|
||||||
const result = await codeql.setupCodeQL(undefined, sampleApiDetails, tmpDir, variant, {
|
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, variant, {
|
||||||
cliVersion: defaults.cliVersion,
|
cliVersion: defaults.cliVersion,
|
||||||
tagName: defaults.bundleVersion,
|
tagName: defaults.bundleVersion,
|
||||||
variant,
|
variant,
|
||||||
@@ -292,10 +262,10 @@ for (const variant of [util.GitHubVariant.GHAE, util.GitHubVariant.GHES]) {
|
|||||||
isPinned: false,
|
isPinned: false,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
});
|
});
|
||||||
mockDownloadApi({
|
(0, testing_utils_1.mockBundleDownloadApi)({
|
||||||
tagName: defaults.bundleVersion,
|
tagName: defaults.bundleVersion,
|
||||||
});
|
});
|
||||||
const result = await codeql.setupCodeQL(undefined, sampleApiDetails, tmpDir, variant, {
|
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, variant, {
|
||||||
cliVersion: defaults.cliVersion,
|
cliVersion: defaults.cliVersion,
|
||||||
tagName: defaults.bundleVersion,
|
tagName: defaults.bundleVersion,
|
||||||
variant,
|
variant,
|
||||||
@@ -316,10 +286,10 @@ for (const variant of [util.GitHubVariant.GHAE, util.GitHubVariant.GHES]) {
|
|||||||
isPinned: true,
|
isPinned: true,
|
||||||
tmpDir,
|
tmpDir,
|
||||||
});
|
});
|
||||||
mockDownloadApi({
|
(0, testing_utils_1.mockBundleDownloadApi)({
|
||||||
tagName: defaults.bundleVersion,
|
tagName: defaults.bundleVersion,
|
||||||
});
|
});
|
||||||
const result = await codeql.setupCodeQL("latest", sampleApiDetails, tmpDir, util.GitHubVariant.DOTCOM, SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL("latest", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
||||||
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
||||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
||||||
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
|
||||||
@@ -375,18 +345,18 @@ for (const isBundleVersionInUrl of [true, false]) {
|
|||||||
(0, ava_1.default)("bundle URL from another repo is cached as 0.0.0-bundleVersion", async (t) => {
|
(0, ava_1.default)("bundle URL from another repo is cached as 0.0.0-bundleVersion", async (t) => {
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
||||||
mockApiDetails(sampleApiDetails);
|
mockApiDetails(testing_utils_1.SAMPLE_DOTCOM_API_DETAILS);
|
||||||
sinon.stub(actionsUtil, "isRunningLocalAction").returns(true);
|
sinon.stub(actionsUtil, "isRunningLocalAction").returns(true);
|
||||||
const releasesApiMock = mockReleaseApi({
|
const releasesApiMock = mockReleaseApi({
|
||||||
assetNames: ["cli-version-2.12.2.txt"],
|
assetNames: ["cli-version-2.12.2.txt"],
|
||||||
tagName: "codeql-bundle-20230203",
|
tagName: "codeql-bundle-20230203",
|
||||||
});
|
});
|
||||||
mockDownloadApi({
|
(0, testing_utils_1.mockBundleDownloadApi)({
|
||||||
repo: "dsp-testing/codeql-cli-nightlies",
|
repo: "codeql-testing/codeql-cli-nightlies",
|
||||||
platformSpecific: false,
|
platformSpecific: false,
|
||||||
tagName: "codeql-bundle-20230203",
|
tagName: "codeql-bundle-20230203",
|
||||||
});
|
});
|
||||||
const result = await codeql.setupCodeQL("https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20230203/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, util.GitHubVariant.DOTCOM, SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL("https://github.com/codeql-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20230203/codeql-bundle.tar.gz", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
||||||
t.is(result.toolsVersion, "0.0.0-20230203");
|
t.is(result.toolsVersion, "0.0.0-20230203");
|
||||||
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
t.is(result.toolsSource, init_1.ToolsSource.Download);
|
||||||
t.true(Number.isInteger(result.toolsDownloadDurationMs));
|
t.true(Number.isInteger(result.toolsDownloadDurationMs));
|
||||||
@@ -418,24 +388,6 @@ for (const isBundleVersionInUrl of [true, false]) {
|
|||||||
t.throws(() => codeql.getExtraOptions({ foo: 87 }, ["foo"], []));
|
t.throws(() => codeql.getExtraOptions({ foo: 87 }, ["foo"], []));
|
||||||
t.throws(() => codeql.getExtraOptions({ "*": [42], foo: { "*": 87, bar: [99] } }, ["foo", "bar"], []));
|
t.throws(() => codeql.getExtraOptions({ "*": [42], foo: { "*": 87, bar: [99] } }, ["foo", "bar"], []));
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("databaseInterpretResults() does not set --sarif-add-query-help for 2.7.0", async (t) => {
|
|
||||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
|
||||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
|
||||||
sinon.stub(codeqlObject, "getVersion").resolves("2.7.0");
|
|
||||||
// safeWhich throws because of the test CodeQL object.
|
|
||||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
|
||||||
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]));
|
|
||||||
t.false(runnerConstructorStub.firstCall.args[1].includes("--sarif-add-query-help"), "--sarif-add-query-help should be absent, but it is present");
|
|
||||||
});
|
|
||||||
(0, ava_1.default)("databaseInterpretResults() sets --sarif-add-query-help for 2.7.1", async (t) => {
|
|
||||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
|
||||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
|
||||||
sinon.stub(codeqlObject, "getVersion").resolves("2.7.1");
|
|
||||||
// safeWhich throws because of the test CodeQL object.
|
|
||||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
|
||||||
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]));
|
|
||||||
t.true(runnerConstructorStub.firstCall.args[1].includes("--sarif-add-query-help"), "--sarif-add-query-help should be present, but it is absent");
|
|
||||||
});
|
|
||||||
(0, ava_1.default)("databaseInitCluster() without injected codescanning config", async (t) => {
|
(0, ava_1.default)("databaseInitCluster() without injected codescanning config", async (t) => {
|
||||||
await util.withTmpDir(async (tempDir) => {
|
await util.withTmpDir(async (tempDir) => {
|
||||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||||
@@ -733,7 +685,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
sinon.stub(codeqlObject, "getVersion").resolves("2.11.3");
|
sinon.stub(codeqlObject, "getVersion").resolves("2.11.3");
|
||||||
// safeWhich throws because of the test CodeQL object.
|
// safeWhich throws because of the test CodeQL object.
|
||||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]));
|
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
t.true(runnerConstructorStub.firstCall.args[1].includes("--sarif-add-baseline-file-info"), "--sarif-add-baseline-file-info should be present, but it is absent");
|
t.true(runnerConstructorStub.firstCall.args[1].includes("--sarif-add-baseline-file-info"), "--sarif-add-baseline-file-info should be present, but it is absent");
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("databaseInterpretResults() does not set --sarif-add-baseline-file-info for 2.11.2", async (t) => {
|
(0, ava_1.default)("databaseInterpretResults() does not set --sarif-add-baseline-file-info for 2.11.2", async (t) => {
|
||||||
@@ -742,7 +694,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
sinon.stub(codeqlObject, "getVersion").resolves("2.11.2");
|
sinon.stub(codeqlObject, "getVersion").resolves("2.11.2");
|
||||||
// safeWhich throws because of the test CodeQL object.
|
// safeWhich throws because of the test CodeQL object.
|
||||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||||
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]));
|
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
t.false(runnerConstructorStub.firstCall.args[1].includes("--sarif-add-baseline-file-info"), "--sarif-add-baseline-file-info must be absent, but it is present");
|
t.false(runnerConstructorStub.firstCall.args[1].includes("--sarif-add-baseline-file-info"), "--sarif-add-baseline-file-info must be absent, but it is present");
|
||||||
});
|
});
|
||||||
function stubToolRunnerConstructor() {
|
function stubToolRunnerConstructor() {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
11
lib/config-utils.js
generated
11
lib/config-utils.js
generated
@@ -932,8 +932,17 @@ function dbLocationOrDefault(dbLocation, tempDir) {
|
|||||||
* This will parse the config from the user input if present, or generate
|
* This will parse the config from the user input if present, or generate
|
||||||
* a default config. The parsed config is then stored to a known location.
|
* a default config. The parsed config is then stored to a known location.
|
||||||
*/
|
*/
|
||||||
async function initConfig(languagesInput, queriesInput, packsInput, registriesInput, configFile, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, features, logger) {
|
async function initConfig(languagesInput, queriesInput, packsInput, registriesInput, configFile, dbLocation, configInput, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, features, logger) {
|
||||||
let config;
|
let config;
|
||||||
|
// if configInput is set, it takes precedence over configFile
|
||||||
|
if (configInput) {
|
||||||
|
if (configFile) {
|
||||||
|
logger.warning(`Both a config file and config input were provided. Ignoring config file.`);
|
||||||
|
}
|
||||||
|
configFile = path.resolve(workspacePath, "user-config-from-action.yml");
|
||||||
|
fs.writeFileSync(configFile, configInput);
|
||||||
|
logger.debug(`Using config from action input: ${configFile}`);
|
||||||
|
}
|
||||||
// If no config file was provided create an empty one
|
// If no config file was provided create an empty one
|
||||||
if (!configFile) {
|
if (!configFile) {
|
||||||
logger.debug("No configuration file was provided");
|
logger.debug("No configuration file was provided");
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
147
lib/config-utils.test.js
generated
147
lib/config-utils.test.js
generated
@@ -102,8 +102,8 @@ function mockListLanguages(languages) {
|
|||||||
return { packs: [] };
|
return { packs: [] };
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const config = await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), logger);
|
const config = await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), logger);
|
||||||
t.deepEqual(config, await configUtils.getDefaultConfig(languages, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), logger));
|
t.deepEqual(config, await configUtils.getDefaultConfig(languages, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), logger));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("loading config saves config", async (t) => {
|
(0, ava_1.default)("loading config saves config", async (t) => {
|
||||||
@@ -128,7 +128,7 @@ function mockListLanguages(languages) {
|
|||||||
t.false(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
t.false(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
||||||
// Sanity check that getConfig returns undefined before we have called initConfig
|
// Sanity check that getConfig returns undefined before we have called initConfig
|
||||||
t.deepEqual(await configUtils.getConfig(tmpDir, logger), undefined);
|
t.deepEqual(await configUtils.getConfig(tmpDir, logger), undefined);
|
||||||
const config1 = await configUtils.initConfig("javascript,python", undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), logger);
|
const config1 = await configUtils.initConfig("javascript,python", undefined, undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), logger);
|
||||||
// The saved config file should now exist
|
// The saved config file should now exist
|
||||||
t.true(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
t.true(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
||||||
// And that same newly-initialised config should now be returned by getConfig
|
// And that same newly-initialised config should now be returned by getConfig
|
||||||
@@ -144,7 +144,7 @@ function mockListLanguages(languages) {
|
|||||||
(0, ava_1.default)("load input outside of workspace", async (t) => {
|
(0, ava_1.default)("load input outside of workspace", async (t) => {
|
||||||
return await util.withTmpDir(async (tmpDir) => {
|
return await util.withTmpDir(async (tmpDir) => {
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(undefined, undefined, undefined, undefined, "../input", undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(undefined, undefined, undefined, undefined, "../input", undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -157,7 +157,7 @@ function mockListLanguages(languages) {
|
|||||||
// no filename given, just a repo
|
// no filename given, just a repo
|
||||||
const configFile = "octo-org/codeql-config@main";
|
const configFile = "octo-org/codeql-config@main";
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(undefined, undefined, undefined, undefined, configFile, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(undefined, undefined, undefined, undefined, configFile, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -171,7 +171,7 @@ function mockListLanguages(languages) {
|
|||||||
const configFile = "input";
|
const configFile = "input";
|
||||||
t.false(fs.existsSync(path.join(tmpDir, configFile)));
|
t.false(fs.existsSync(path.join(tmpDir, configFile)));
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(languages, undefined, undefined, undefined, configFile, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(languages, undefined, undefined, undefined, configFile, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -247,7 +247,7 @@ function mockListLanguages(languages) {
|
|||||||
};
|
};
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
const actualConfig = await configUtils.initConfig(languages, undefined, undefined, undefined, configFilePath, undefined, false, false, "my-artifact", "my-db", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
const actualConfig = await configUtils.initConfig(languages, undefined, undefined, undefined, configFilePath, undefined, undefined, false, false, "my-artifact", "my-db", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
// Should exactly equal the object we constructed earlier
|
// Should exactly equal the object we constructed earlier
|
||||||
t.deepEqual(actualConfig, expectedConfig);
|
t.deepEqual(actualConfig, expectedConfig);
|
||||||
});
|
});
|
||||||
@@ -286,7 +286,7 @@ function mockListLanguages(languages) {
|
|||||||
fs.mkdirSync(path.join(tmpDir, "foo"));
|
fs.mkdirSync(path.join(tmpDir, "foo"));
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
await configUtils.initConfig(languages, undefined, undefined, undefined, configFilePath, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(languages, undefined, undefined, undefined, configFilePath, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
// Check resolve queries was called correctly
|
// Check resolve queries was called correctly
|
||||||
t.deepEqual(resolveQueriesArgs.length, 1);
|
t.deepEqual(resolveQueriesArgs.length, 1);
|
||||||
t.deepEqual(resolveQueriesArgs[0].queries, [
|
t.deepEqual(resolveQueriesArgs[0].queries, [
|
||||||
@@ -332,7 +332,7 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const config = await configUtils.initConfig(languages, undefined, undefined, undefined, configFilePath, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
const config = await configUtils.initConfig(languages, undefined, undefined, undefined, configFilePath, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
// Check resolveQueries was called correctly
|
// Check resolveQueries was called correctly
|
||||||
// It'll be called once for the default queries
|
// It'll be called once for the default queries
|
||||||
// and once for `./foo` from the config file.
|
// and once for `./foo` from the config file.
|
||||||
@@ -368,7 +368,7 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const config = await configUtils.initConfig(languages, testQueries, undefined, undefined, configFilePath, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
const config = await configUtils.initConfig(languages, testQueries, undefined, undefined, configFilePath, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
// Check resolveQueries was called correctly
|
// Check resolveQueries was called correctly
|
||||||
// It'll be called once for the default queries and once for `./override`,
|
// It'll be called once for the default queries and once for `./override`,
|
||||||
// but won't be called for './foo' from the config file.
|
// but won't be called for './foo' from the config file.
|
||||||
@@ -403,7 +403,7 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const config = await configUtils.initConfig(languages, testQueries, undefined, undefined, configFilePath, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
const config = await configUtils.initConfig(languages, testQueries, undefined, undefined, configFilePath, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
// Check resolveQueries was called correctly
|
// Check resolveQueries was called correctly
|
||||||
// It'll be called once for `./workflow-query`,
|
// It'll be called once for `./workflow-query`,
|
||||||
// but won't be called for the default one since that was disabled
|
// but won't be called for the default one since that was disabled
|
||||||
@@ -432,7 +432,7 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const config = await configUtils.initConfig(languages, testQueries, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
const config = await configUtils.initConfig(languages, testQueries, undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
// Check resolveQueries was called correctly:
|
// Check resolveQueries was called correctly:
|
||||||
// It'll be called once for the default queries,
|
// It'll be called once for the default queries,
|
||||||
// and then once for each of the two queries from the workflow
|
// and then once for each of the two queries from the workflow
|
||||||
@@ -474,7 +474,7 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const config = await configUtils.initConfig(languages, testQueries, undefined, undefined, configFilePath, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
const config = await configUtils.initConfig(languages, testQueries, undefined, undefined, configFilePath, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
// Check resolveQueries was called correctly
|
// Check resolveQueries was called correctly
|
||||||
// It'll be called once for the default queries,
|
// It'll be called once for the default queries,
|
||||||
// once for each of additional1 and additional2,
|
// once for each of additional1 and additional2,
|
||||||
@@ -495,6 +495,97 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
t.true(config.queries["javascript"].custom[2].queries[0].endsWith(`${path.sep}foo`));
|
t.true(config.queries["javascript"].custom[2].queries[0].endsWith(`${path.sep}foo`));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
(0, ava_1.default)("Queries can be specified using config input", async (t) => {
|
||||||
|
return await util.withTmpDir(async (tmpDir) => {
|
||||||
|
const configInput = `
|
||||||
|
name: my config
|
||||||
|
queries:
|
||||||
|
- uses: ./foo
|
||||||
|
packs:
|
||||||
|
javascript:
|
||||||
|
- a/b@1.2.3
|
||||||
|
python:
|
||||||
|
- c/d@1.2.3
|
||||||
|
`;
|
||||||
|
fs.mkdirSync(path.join(tmpDir, "foo"));
|
||||||
|
const resolveQueriesArgs = [];
|
||||||
|
const codeQL = (0, codeql_1.setCodeQL)({
|
||||||
|
async resolveQueries(queries, extraSearchPath) {
|
||||||
|
resolveQueriesArgs.push({ queries, extraSearchPath });
|
||||||
|
return queriesToResolvedQueryForm(queries);
|
||||||
|
},
|
||||||
|
async packDownload() {
|
||||||
|
return { packs: [] };
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// Only JS, python packs will be ignored
|
||||||
|
const languages = "javascript";
|
||||||
|
const config = await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, undefined, configInput, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
|
// Check resolveQueries was called correctly
|
||||||
|
// It'll be called once for the default queries
|
||||||
|
// and once for `./foo` from the config file.
|
||||||
|
t.deepEqual(resolveQueriesArgs.length, 2);
|
||||||
|
t.deepEqual(resolveQueriesArgs[1].queries.length, 1);
|
||||||
|
t.true(resolveQueriesArgs[1].queries[0].endsWith(`${path.sep}foo`));
|
||||||
|
t.deepEqual(config.packs, {
|
||||||
|
[languages_1.Language.javascript]: ["a/b@1.2.3"],
|
||||||
|
});
|
||||||
|
// Now check that the end result contains the default queries and the query from config
|
||||||
|
t.deepEqual(config.queries["javascript"].builtin.length, 1);
|
||||||
|
t.deepEqual(config.queries["javascript"].custom.length, 1);
|
||||||
|
t.true(config.queries["javascript"].builtin[0].endsWith("javascript-code-scanning.qls"));
|
||||||
|
t.true(config.queries["javascript"].custom[0].queries[0].endsWith(`${path.sep}foo`));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("Using config input and file together, config input should be used.", async (t) => {
|
||||||
|
return await util.withTmpDir(async (tmpDir) => {
|
||||||
|
process.env["RUNNER_TEMP"] = tmpDir;
|
||||||
|
process.env["GITHUB_WORKSPACE"] = tmpDir;
|
||||||
|
const inputFileContents = `
|
||||||
|
name: my config
|
||||||
|
queries:
|
||||||
|
- uses: ./foo_file`;
|
||||||
|
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||||
|
const configInput = `
|
||||||
|
name: my config
|
||||||
|
queries:
|
||||||
|
- uses: ./foo
|
||||||
|
packs:
|
||||||
|
javascript:
|
||||||
|
- a/b@1.2.3
|
||||||
|
python:
|
||||||
|
- c/d@1.2.3
|
||||||
|
`;
|
||||||
|
fs.mkdirSync(path.join(tmpDir, "foo"));
|
||||||
|
const resolveQueriesArgs = [];
|
||||||
|
const codeQL = (0, codeql_1.setCodeQL)({
|
||||||
|
async resolveQueries(queries, extraSearchPath) {
|
||||||
|
resolveQueriesArgs.push({ queries, extraSearchPath });
|
||||||
|
return queriesToResolvedQueryForm(queries);
|
||||||
|
},
|
||||||
|
async packDownload() {
|
||||||
|
return { packs: [] };
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// Only JS, python packs will be ignored
|
||||||
|
const languages = "javascript";
|
||||||
|
const config = await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, configFilePath, configInput, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
|
// Check resolveQueries was called correctly
|
||||||
|
// It'll be called once for the default queries
|
||||||
|
// and once for `./foo` from the config file.
|
||||||
|
t.deepEqual(resolveQueriesArgs.length, 2);
|
||||||
|
t.deepEqual(resolveQueriesArgs[1].queries.length, 1);
|
||||||
|
t.true(resolveQueriesArgs[1].queries[0].endsWith(`${path.sep}foo`));
|
||||||
|
t.deepEqual(config.packs, {
|
||||||
|
[languages_1.Language.javascript]: ["a/b@1.2.3"],
|
||||||
|
});
|
||||||
|
// Now check that the end result contains the default queries and the query from config
|
||||||
|
t.deepEqual(config.queries["javascript"].builtin.length, 1);
|
||||||
|
t.deepEqual(config.queries["javascript"].custom.length, 1);
|
||||||
|
t.true(config.queries["javascript"].builtin[0].endsWith("javascript-code-scanning.qls"));
|
||||||
|
t.true(config.queries["javascript"].custom[0].queries[0].endsWith(`${path.sep}foo`));
|
||||||
|
});
|
||||||
|
});
|
||||||
(0, ava_1.default)("Invalid queries in workflow file handled correctly", async (t) => {
|
(0, ava_1.default)("Invalid queries in workflow file handled correctly", async (t) => {
|
||||||
return await util.withTmpDir(async (tmpDir) => {
|
return await util.withTmpDir(async (tmpDir) => {
|
||||||
const queries = "foo/bar@v1@v3";
|
const queries = "foo/bar@v1@v3";
|
||||||
@@ -516,7 +607,7 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(languages, queries, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(languages, queries, undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
t.fail("initConfig did not throw error");
|
t.fail("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -562,7 +653,7 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
fs.mkdirSync(path.join(tmpDir, "foo/bar/dev"), { recursive: true });
|
fs.mkdirSync(path.join(tmpDir, "foo/bar/dev"), { recursive: true });
|
||||||
const configFile = "octo-org/codeql-config/config.yaml@main";
|
const configFile = "octo-org/codeql-config/config.yaml@main";
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
await configUtils.initConfig(languages, undefined, undefined, undefined, configFile, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(languages, undefined, undefined, undefined, configFile, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
t.assert(spyGetContents.called);
|
t.assert(spyGetContents.called);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -572,7 +663,7 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
mockGetContents(dummyResponse);
|
mockGetContents(dummyResponse);
|
||||||
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(undefined, undefined, undefined, undefined, repoReference, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(undefined, undefined, undefined, undefined, repoReference, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -588,7 +679,7 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
mockGetContents(dummyResponse);
|
mockGetContents(dummyResponse);
|
||||||
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(undefined, undefined, undefined, undefined, repoReference, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(undefined, undefined, undefined, undefined, repoReference, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -608,7 +699,7 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(undefined, undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(undefined, undefined, undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -620,7 +711,7 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
return await util.withTmpDir(async (tmpDir) => {
|
return await util.withTmpDir(async (tmpDir) => {
|
||||||
const languages = "rubbish,english";
|
const languages = "rubbish,english";
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -651,7 +742,7 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
const configFile = path.join(tmpDir, "codeql-config.yaml");
|
const configFile = path.join(tmpDir, "codeql-config.yaml");
|
||||||
fs.writeFileSync(configFile, inputFileContents);
|
fs.writeFileSync(configFile, inputFileContents);
|
||||||
const languages = "javascript";
|
const languages = "javascript";
|
||||||
const { packs } = await configUtils.initConfig(languages, undefined, undefined, undefined, configFile, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
const { packs } = await configUtils.initConfig(languages, undefined, undefined, undefined, configFile, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
t.deepEqual(packs, {
|
t.deepEqual(packs, {
|
||||||
[languages_1.Language.javascript]: ["a/b@1.2.3"],
|
[languages_1.Language.javascript]: ["a/b@1.2.3"],
|
||||||
});
|
});
|
||||||
@@ -688,7 +779,7 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
fs.writeFileSync(configFile, inputFileContents);
|
fs.writeFileSync(configFile, inputFileContents);
|
||||||
fs.mkdirSync(path.join(tmpDir, "foo"));
|
fs.mkdirSync(path.join(tmpDir, "foo"));
|
||||||
const languages = "javascript,python,cpp";
|
const languages = "javascript,python,cpp";
|
||||||
const { packs, queries } = await configUtils.initConfig(languages, undefined, undefined, undefined, configFile, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
const { packs, queries } = await configUtils.initConfig(languages, undefined, undefined, undefined, configFile, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
t.deepEqual(packs, {
|
t.deepEqual(packs, {
|
||||||
[languages_1.Language.javascript]: ["a/b@1.2.3"],
|
[languages_1.Language.javascript]: ["a/b@1.2.3"],
|
||||||
[languages_1.Language.python]: ["c/d@1.2.3"],
|
[languages_1.Language.python]: ["c/d@1.2.3"],
|
||||||
@@ -734,7 +825,7 @@ function doInvalidInputTest(testName, inputFileContents, expectedErrorMessageGen
|
|||||||
const inputFile = path.join(tmpDir, configFile);
|
const inputFile = path.join(tmpDir, configFile);
|
||||||
fs.writeFileSync(inputFile, inputFileContents, "utf8");
|
fs.writeFileSync(inputFile, inputFileContents, "utf8");
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(languages, undefined, undefined, undefined, configFile, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(languages, undefined, undefined, undefined, configFile, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -991,7 +1082,7 @@ const mlPoweredQueriesMacro = ava_1.default.macro({
|
|||||||
return { packs: [] };
|
return { packs: [] };
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const { packs } = await configUtils.initConfig("javascript", queriesInput, packsInput, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example " }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)(isMlPoweredQueriesEnabled ? [feature_flags_1.Feature.MlPoweredQueriesEnabled] : []), (0, logging_1.getRunnerLogger)(true));
|
const { packs } = await configUtils.initConfig("javascript", queriesInput, packsInput, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)(isMlPoweredQueriesEnabled ? [feature_flags_1.Feature.MlPoweredQueriesEnabled] : []), (0, logging_1.getRunnerLogger)(true));
|
||||||
if (expectedVersionString !== undefined) {
|
if (expectedVersionString !== undefined) {
|
||||||
t.deepEqual(packs, {
|
t.deepEqual(packs, {
|
||||||
[languages_1.Language.javascript]: [
|
[languages_1.Language.javascript]: [
|
||||||
@@ -1134,7 +1225,7 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
|
|||||||
{
|
{
|
||||||
// no slash
|
// no slash
|
||||||
url: "http://ghcr.io",
|
url: "http://ghcr.io",
|
||||||
packages: ["codeql/*", "dsp-testing/*"],
|
packages: ["codeql/*", "codeql-testing/*"],
|
||||||
token: "not-a-token",
|
token: "not-a-token",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1200,7 +1291,7 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
|
|||||||
const registriesInput = yaml.dump([
|
const registriesInput = yaml.dump([
|
||||||
{
|
{
|
||||||
url: "http://ghcr.io",
|
url: "http://ghcr.io",
|
||||||
packages: ["codeql/*", "dsp-testing/*"],
|
packages: ["codeql/*", "codeql-testing/*"],
|
||||||
token: "not-a-token",
|
token: "not-a-token",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1227,7 +1318,7 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
|
|||||||
const registriesInput = yaml.dump([
|
const registriesInput = yaml.dump([
|
||||||
{
|
{
|
||||||
// missing url property
|
// missing url property
|
||||||
packages: ["codeql/*", "dsp-testing/*"],
|
packages: ["codeql/*", "codeql-testing/*"],
|
||||||
token: "not-a-token",
|
token: "not-a-token",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1252,7 +1343,7 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
|
|||||||
{
|
{
|
||||||
// no slash
|
// no slash
|
||||||
url: "http://ghcr.io",
|
url: "http://ghcr.io",
|
||||||
packages: ["codeql/*", "dsp-testing/*"],
|
packages: ["codeql/*", "codeql-testing/*"],
|
||||||
token: "not-a-token",
|
token: "not-a-token",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
@@ -1283,7 +1374,7 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
|
|||||||
const registriesInput = yaml.dump([
|
const registriesInput = yaml.dump([
|
||||||
{
|
{
|
||||||
url: "http://ghcr.io",
|
url: "http://ghcr.io",
|
||||||
packages: ["codeql/*", "dsp-testing/*"],
|
packages: ["codeql/*", "codeql-testing/*"],
|
||||||
token: "not-a-token",
|
token: "not-a-token",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
18
lib/debug-artifacts.js
generated
18
lib/debug-artifacts.js
generated
@@ -74,7 +74,6 @@ async function uploadSarifDebugArtifact(config, outputDir) {
|
|||||||
}
|
}
|
||||||
exports.uploadSarifDebugArtifact = uploadSarifDebugArtifact;
|
exports.uploadSarifDebugArtifact = uploadSarifDebugArtifact;
|
||||||
async function uploadLogsDebugArtifact(config) {
|
async function uploadLogsDebugArtifact(config) {
|
||||||
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
|
||||||
let toUpload = [];
|
let toUpload = [];
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
const databaseDirectory = (0, util_1.getCodeQLDatabasePath)(config, language);
|
const databaseDirectory = (0, util_1.getCodeQLDatabasePath)(config, language);
|
||||||
@@ -83,21 +82,12 @@ async function uploadLogsDebugArtifact(config) {
|
|||||||
toUpload = toUpload.concat((0, util_1.listFolder)(logsDirectory));
|
toUpload = toUpload.concat((0, util_1.listFolder)(logsDirectory));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING)) {
|
// Multilanguage tracing: there are additional logs in the root of the cluster
|
||||||
// Multilanguage tracing: there are additional logs in the root of the cluster
|
const multiLanguageTracingLogsDirectory = path.resolve(config.dbLocation, "log");
|
||||||
const multiLanguageTracingLogsDirectory = path.resolve(config.dbLocation, "log");
|
if ((0, util_1.doesDirectoryExist)(multiLanguageTracingLogsDirectory)) {
|
||||||
if ((0, util_1.doesDirectoryExist)(multiLanguageTracingLogsDirectory)) {
|
toUpload = toUpload.concat((0, util_1.listFolder)(multiLanguageTracingLogsDirectory));
|
||||||
toUpload = toUpload.concat((0, util_1.listFolder)(multiLanguageTracingLogsDirectory));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
await uploadDebugArtifacts(toUpload, config.dbLocation, config.debugArtifactName);
|
await uploadDebugArtifacts(toUpload, config.dbLocation, config.debugArtifactName);
|
||||||
// Before multi-language tracing, we wrote a compound-build-tracer.log in the temp dir
|
|
||||||
if (!(await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING))) {
|
|
||||||
const compoundBuildTracerLogDirectory = path.resolve(config.tempDir, "compound-build-tracer.log");
|
|
||||||
if ((0, util_1.doesDirectoryExist)(compoundBuildTracerLogDirectory)) {
|
|
||||||
await uploadDebugArtifacts([compoundBuildTracerLogDirectory], config.tempDir, config.debugArtifactName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exports.uploadLogsDebugArtifact = uploadLogsDebugArtifact;
|
exports.uploadLogsDebugArtifact = uploadLogsDebugArtifact;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"debug-artifacts.js","sourceRoot":"","sources":["../src/debug-artifacts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,4DAA8C;AAC9C,oDAAsC;AACtC,sDAA6B;AAC7B,8CAAsB;AAEtB,iDAAkD;AAClD,uCAA0C;AAC1C,qCAAiE;AAIjE,iCAMgB;AAEhB,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;AAChD,CAAC;AAFD,kDAEC;AAEM,KAAK,UAAU,oBAAoB,CACxC,QAAkB,EAClB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D,8EA0BC"}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"bundleVersion": "codeql-bundle-20230304",
|
"bundleVersion": "codeql-bundle-20230428",
|
||||||
"cliVersion": "2.12.4",
|
"cliVersion": "2.13.1",
|
||||||
"priorBundleVersion": "codeql-bundle-20230217",
|
"priorBundleVersion": "codeql-bundle-20230414",
|
||||||
"priorCliVersion": "2.12.3"
|
"priorCliVersion": "2.13.0"
|
||||||
}
|
}
|
||||||
|
|||||||
19
lib/feature-flags.js
generated
19
lib/feature-flags.js
generated
@@ -37,8 +37,10 @@ var Feature;
|
|||||||
Feature["CliConfigFileEnabled"] = "cli_config_file_enabled";
|
Feature["CliConfigFileEnabled"] = "cli_config_file_enabled";
|
||||||
Feature["DisableKotlinAnalysisEnabled"] = "disable_kotlin_analysis_enabled";
|
Feature["DisableKotlinAnalysisEnabled"] = "disable_kotlin_analysis_enabled";
|
||||||
Feature["ExportCodeScanningConfigEnabled"] = "export_code_scanning_config_enabled";
|
Feature["ExportCodeScanningConfigEnabled"] = "export_code_scanning_config_enabled";
|
||||||
|
Feature["ExportDiagnosticsEnabled"] = "export_diagnostics_enabled";
|
||||||
Feature["MlPoweredQueriesEnabled"] = "ml_powered_queries_enabled";
|
Feature["MlPoweredQueriesEnabled"] = "ml_powered_queries_enabled";
|
||||||
Feature["UploadFailedSarifEnabled"] = "upload_failed_sarif_enabled";
|
Feature["UploadFailedSarifEnabled"] = "upload_failed_sarif_enabled";
|
||||||
|
Feature["DisablePythonDependencyInstallation"] = "disable_python_dependency_installation";
|
||||||
})(Feature = exports.Feature || (exports.Feature = {}));
|
})(Feature = exports.Feature || (exports.Feature = {}));
|
||||||
exports.featureConfig = {
|
exports.featureConfig = {
|
||||||
[Feature.DisableKotlinAnalysisEnabled]: {
|
[Feature.DisableKotlinAnalysisEnabled]: {
|
||||||
@@ -54,7 +56,12 @@ exports.featureConfig = {
|
|||||||
[Feature.ExportCodeScanningConfigEnabled]: {
|
[Feature.ExportCodeScanningConfigEnabled]: {
|
||||||
envVar: "CODEQL_ACTION_EXPORT_CODE_SCANNING_CONFIG",
|
envVar: "CODEQL_ACTION_EXPORT_CODE_SCANNING_CONFIG",
|
||||||
minimumVersion: "2.12.3",
|
minimumVersion: "2.12.3",
|
||||||
defaultValue: false,
|
defaultValue: true,
|
||||||
|
},
|
||||||
|
[Feature.ExportDiagnosticsEnabled]: {
|
||||||
|
envVar: "CODEQL_ACTION_EXPORT_DIAGNOSTICS",
|
||||||
|
minimumVersion: "2.12.4",
|
||||||
|
defaultValue: true,
|
||||||
},
|
},
|
||||||
[Feature.MlPoweredQueriesEnabled]: {
|
[Feature.MlPoweredQueriesEnabled]: {
|
||||||
envVar: "CODEQL_ML_POWERED_QUERIES",
|
envVar: "CODEQL_ML_POWERED_QUERIES",
|
||||||
@@ -64,6 +71,16 @@ exports.featureConfig = {
|
|||||||
[Feature.UploadFailedSarifEnabled]: {
|
[Feature.UploadFailedSarifEnabled]: {
|
||||||
envVar: "CODEQL_ACTION_UPLOAD_FAILED_SARIF",
|
envVar: "CODEQL_ACTION_UPLOAD_FAILED_SARIF",
|
||||||
minimumVersion: "2.11.3",
|
minimumVersion: "2.11.3",
|
||||||
|
defaultValue: true,
|
||||||
|
},
|
||||||
|
[Feature.DisablePythonDependencyInstallation]: {
|
||||||
|
envVar: "CODEQL_ACTION_DISABLE_PYTHON_DEPENDENCY_INSTALLATION",
|
||||||
|
// Although the python extractor only started supporting not extracting installed
|
||||||
|
// dependencies in 2.13.1, the init-action can still benefit from not installing
|
||||||
|
// dependencies no matter what codeql version we are using, so therefore the
|
||||||
|
// minimumVersion is set to 'undefined'. This means that with an old CodeQL version,
|
||||||
|
// packages available with current python3 installation might get extracted.
|
||||||
|
minimumVersion: undefined,
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
21
lib/init-action-post-helper.js
generated
21
lib/init-action-post-helper.js
generated
@@ -34,9 +34,10 @@ const uploadLib = __importStar(require("./upload-lib"));
|
|||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
const workflow_1 = require("./workflow");
|
const workflow_1 = require("./workflow");
|
||||||
function createFailedUploadFailedSarifResult(error) {
|
function createFailedUploadFailedSarifResult(error) {
|
||||||
|
const wrappedError = (0, util_1.wrapError)(error);
|
||||||
return {
|
return {
|
||||||
upload_failed_run_error: error instanceof Error ? error.message : String(error),
|
upload_failed_run_error: wrappedError.message,
|
||||||
upload_failed_run_stack_trace: error instanceof Error ? error.stack : undefined,
|
upload_failed_run_stack_trace: wrappedError.stack,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -51,17 +52,27 @@ async function maybeUploadFailedSarif(config, repositoryNwo, features, logger) {
|
|||||||
if (!(await features.getValue(feature_flags_1.Feature.UploadFailedSarifEnabled, codeql))) {
|
if (!(await features.getValue(feature_flags_1.Feature.UploadFailedSarifEnabled, codeql))) {
|
||||||
return { upload_failed_run_skipped_because: "Feature disabled" };
|
return { upload_failed_run_skipped_because: "Feature disabled" };
|
||||||
}
|
}
|
||||||
const workflow = await (0, workflow_1.getWorkflow)();
|
const workflow = await (0, workflow_1.getWorkflow)(logger);
|
||||||
const jobName = (0, util_1.getRequiredEnvParam)("GITHUB_JOB");
|
const jobName = (0, util_1.getRequiredEnvParam)("GITHUB_JOB");
|
||||||
const matrix = (0, util_1.parseMatrixInput)(actionsUtil.getRequiredInput("matrix"));
|
const matrix = (0, util_1.parseMatrixInput)(actionsUtil.getRequiredInput("matrix"));
|
||||||
if ((0, workflow_1.getUploadInputOrThrow)(workflow, jobName, matrix) !== "true" ||
|
const shouldUpload = (0, workflow_1.getUploadInputOrThrow)(workflow, jobName, matrix);
|
||||||
|
if (!["always", "failure-only"].includes(actionsUtil.getUploadValue(shouldUpload)) ||
|
||||||
(0, util_1.isInTestMode)()) {
|
(0, util_1.isInTestMode)()) {
|
||||||
return { upload_failed_run_skipped_because: "SARIF upload is disabled" };
|
return { upload_failed_run_skipped_because: "SARIF upload is disabled" };
|
||||||
}
|
}
|
||||||
const category = (0, workflow_1.getCategoryInputOrThrow)(workflow, jobName, matrix);
|
const category = (0, workflow_1.getCategoryInputOrThrow)(workflow, jobName, matrix);
|
||||||
const checkoutPath = (0, workflow_1.getCheckoutPathInputOrThrow)(workflow, jobName, matrix);
|
const checkoutPath = (0, workflow_1.getCheckoutPathInputOrThrow)(workflow, jobName, matrix);
|
||||||
|
const databasePath = config.dbLocation;
|
||||||
const sarifFile = "../codeql-failed-run.sarif";
|
const sarifFile = "../codeql-failed-run.sarif";
|
||||||
await codeql.diagnosticsExport(sarifFile, category, config, features);
|
// If there is no database or the feature flag is off, we run 'export diagnostics'
|
||||||
|
if (databasePath === undefined ||
|
||||||
|
!(await features.getValue(feature_flags_1.Feature.ExportDiagnosticsEnabled, codeql))) {
|
||||||
|
await codeql.diagnosticsExport(sarifFile, category, config, features);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// We call 'database export-diagnostics' to find any per-database diagnostics.
|
||||||
|
await codeql.databaseExportDiagnostics(databasePath, sarifFile, category, config.tempDir, logger);
|
||||||
|
}
|
||||||
core.info(`Uploading failed SARIF file ${sarifFile}`);
|
core.info(`Uploading failed SARIF file ${sarifFile}`);
|
||||||
const uploadResult = await uploadLib.uploadFromActions(sarifFile, checkoutPath, category, logger);
|
const uploadResult = await uploadLib.uploadFromActions(sarifFile, checkoutPath, category, logger);
|
||||||
await uploadLib.waitForProcessing(repositoryNwo, uploadResult.sarifID, logger, { isUnsuccessfulExecution: true });
|
await uploadLib.waitForProcessing(repositoryNwo, uploadResult.sarifID, logger, { isUnsuccessfulExecution: true });
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"init-action-post-helper.js","sourceRoot":"","sources":["../src/init-action-post-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,4DAA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,EAC3B,MAAc;IAEd,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAS,EAAC,WAAW,CAAC,qBAAqB,EAAE,EAAE,MAAM,CAAC,CAAC;IAC5E,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,MAAM,CAAC,OAAO,CACZ,iGAAiG,CAClG,CAAC;QACF,OAAO;KACR;IAED,MAAM,uBAAuB,GAAG,MAAM,yBAAyB,CAC7D,MAAM,EACN,aAAa,EACb,QAAQ,EACR,MAAM,CACP,CAAC;IACF,IAAI,uBAAuB,CAAC,iCAAiC,EAAE;QAC7D,MAAM,CAAC,KAAK,CACV,8EAA8E;YAC5E,GAAG,uBAAuB,CAAC,iCAAiC,GAAG,CAClE,CAAC;KACH;IACD,8FAA8F;IAC9F,iCAAiC;IACjC,IACE,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,KAAK,MAAM;QAClE,CAAC,uBAAuB,CAAC,qBAAqB,EAC9C;QACA,MAAM,IAAI,KAAK,CACb,4EAA4E;YAC1E,8BAA8B,uBAAuB,GAAG,CAC3D,CAAC;KACH;IAED,qDAAqD;IACrD,IAAI,MAAM,CAAC,SAAS,EAAE;QACpB,IAAI,CAAC,IAAI,CACP,mGAAmG,CACpG,CAAC;QACF,MAAM,iCAAiC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACxD,MAAM,uBAAuB,CAAC,MAAM,CAAC,CAAC;QAEtC,MAAM,cAAc,CAAC,MAAM,CAAC,CAAC;KAC9B;IAED,OAAO,uBAAuB,CAAC;AACjC,CAAC;AApDD,kBAoDC"}
|
{"version":3,"file":"init-action-post-helper.js","sourceRoot":"","sources":["../src/init-action-post-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,4DAA8C;AAC9C,qCAAqC;AACrC,iDAAmD;AACnD,mDAA6D;AAG7D,6DAAuF;AACvF,wDAA0C;AAC1C,iCAKgB;AAChB,yCAKoB;AAWpB,SAAS,mCAAm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|
||||||
116
lib/init-action-post-helper.test.js
generated
116
lib/init-action-post-helper.test.js
generated
@@ -84,7 +84,7 @@ const workflow = __importStar(require("./workflow"));
|
|||||||
t.assert(printDebugLogsSpy.called);
|
t.assert(printDebugLogsSpy.called);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("uploads failed SARIF run for typical workflow", async (t) => {
|
(0, ava_1.default)("uploads failed SARIF run with `diagnostics export` if feature flag is off", async (t) => {
|
||||||
const actionsWorkflow = createTestWorkflow([
|
const actionsWorkflow = createTestWorkflow([
|
||||||
{
|
{
|
||||||
name: "Checkout repository",
|
name: "Checkout repository",
|
||||||
@@ -107,7 +107,7 @@ const workflow = __importStar(require("./workflow"));
|
|||||||
]);
|
]);
|
||||||
await testFailedSarifUpload(t, actionsWorkflow, { category: "my-category" });
|
await testFailedSarifUpload(t, actionsWorkflow, { category: "my-category" });
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("doesn't upload failed SARIF for workflow with upload: false", async (t) => {
|
(0, ava_1.default)("uploads failed SARIF run with `diagnostics export` if the database doesn't exist", async (t) => {
|
||||||
const actionsWorkflow = createTestWorkflow([
|
const actionsWorkflow = createTestWorkflow([
|
||||||
{
|
{
|
||||||
name: "Checkout repository",
|
name: "Checkout repository",
|
||||||
@@ -125,15 +125,98 @@ const workflow = __importStar(require("./workflow"));
|
|||||||
uses: "github/codeql-action/analyze@v2",
|
uses: "github/codeql-action/analyze@v2",
|
||||||
with: {
|
with: {
|
||||||
category: "my-category",
|
category: "my-category",
|
||||||
upload: false,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const result = await testFailedSarifUpload(t, actionsWorkflow, {
|
await testFailedSarifUpload(t, actionsWorkflow, {
|
||||||
expectUpload: false,
|
category: "my-category",
|
||||||
|
databaseExists: false,
|
||||||
});
|
});
|
||||||
t.is(result.upload_failed_run_skipped_because, "SARIF upload is disabled");
|
|
||||||
});
|
});
|
||||||
|
(0, ava_1.default)("uploads failed SARIF run with database export-diagnostics if the database exists and feature flag is on", async (t) => {
|
||||||
|
const actionsWorkflow = createTestWorkflow([
|
||||||
|
{
|
||||||
|
name: "Checkout repository",
|
||||||
|
uses: "actions/checkout@v3",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Initialize CodeQL",
|
||||||
|
uses: "github/codeql-action/init@v2",
|
||||||
|
with: {
|
||||||
|
languages: "javascript",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Perform CodeQL Analysis",
|
||||||
|
uses: "github/codeql-action/analyze@v2",
|
||||||
|
with: {
|
||||||
|
category: "my-category",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
await testFailedSarifUpload(t, actionsWorkflow, {
|
||||||
|
category: "my-category",
|
||||||
|
exportDiagnosticsEnabled: true,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
const UPLOAD_INPUT_TEST_CASES = [
|
||||||
|
{
|
||||||
|
uploadInput: "true",
|
||||||
|
shouldUpload: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
uploadInput: "false",
|
||||||
|
shouldUpload: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
uploadInput: "always",
|
||||||
|
shouldUpload: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
uploadInput: "failure-only",
|
||||||
|
shouldUpload: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
uploadInput: "never",
|
||||||
|
shouldUpload: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
uploadInput: "unrecognized-value",
|
||||||
|
shouldUpload: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
for (const { uploadInput, shouldUpload } of UPLOAD_INPUT_TEST_CASES) {
|
||||||
|
(0, ava_1.default)(`does ${shouldUpload ? "" : "not "}upload failed SARIF run for workflow with upload: ${uploadInput}`, async (t) => {
|
||||||
|
const actionsWorkflow = createTestWorkflow([
|
||||||
|
{
|
||||||
|
name: "Checkout repository",
|
||||||
|
uses: "actions/checkout@v3",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Initialize CodeQL",
|
||||||
|
uses: "github/codeql-action/init@v2",
|
||||||
|
with: {
|
||||||
|
languages: "javascript",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Perform CodeQL Analysis",
|
||||||
|
uses: "github/codeql-action/analyze@v2",
|
||||||
|
with: {
|
||||||
|
category: "my-category",
|
||||||
|
upload: uploadInput,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const result = await testFailedSarifUpload(t, actionsWorkflow, {
|
||||||
|
category: "my-category",
|
||||||
|
expectUpload: shouldUpload,
|
||||||
|
});
|
||||||
|
if (!shouldUpload) {
|
||||||
|
t.is(result.upload_failed_run_skipped_because, "SARIF upload is disabled");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
(0, ava_1.default)("uploading failed SARIF run succeeds when workflow uses an input with a matrix var", async (t) => {
|
(0, ava_1.default)("uploading failed SARIF run succeeds when workflow uses an input with a matrix var", async (t) => {
|
||||||
const actionsWorkflow = createTestWorkflow([
|
const actionsWorkflow = createTestWorkflow([
|
||||||
{
|
{
|
||||||
@@ -221,13 +304,16 @@ function createTestWorkflow(steps) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
async function testFailedSarifUpload(t, actionsWorkflow, { category, expectUpload = true, matrix = {}, } = {}) {
|
async function testFailedSarifUpload(t, actionsWorkflow, { category, databaseExists = true, expectUpload = true, exportDiagnosticsEnabled = false, matrix = {}, } = {}) {
|
||||||
const config = {
|
const config = {
|
||||||
codeQLCmd: "codeql",
|
codeQLCmd: "codeql",
|
||||||
debugMode: true,
|
debugMode: true,
|
||||||
languages: [],
|
languages: [],
|
||||||
packs: [],
|
packs: [],
|
||||||
};
|
};
|
||||||
|
if (databaseExists) {
|
||||||
|
config.dbLocation = "path/to/database";
|
||||||
|
}
|
||||||
process.env["GITHUB_JOB"] = "analyze";
|
process.env["GITHUB_JOB"] = "analyze";
|
||||||
process.env["GITHUB_REPOSITORY"] = "github/codeql-action-fake-repository";
|
process.env["GITHUB_REPOSITORY"] = "github/codeql-action-fake-repository";
|
||||||
process.env["GITHUB_WORKSPACE"] =
|
process.env["GITHUB_WORKSPACE"] =
|
||||||
@@ -238,6 +324,7 @@ async function testFailedSarifUpload(t, actionsWorkflow, { category, expectUploa
|
|||||||
.returns(JSON.stringify(matrix));
|
.returns(JSON.stringify(matrix));
|
||||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||||
sinon.stub(codeql, "getCodeQL").resolves(codeqlObject);
|
sinon.stub(codeql, "getCodeQL").resolves(codeqlObject);
|
||||||
|
const databaseExportDiagnosticsStub = sinon.stub(codeqlObject, "databaseExportDiagnostics");
|
||||||
const diagnosticsExportStub = sinon.stub(codeqlObject, "diagnosticsExport");
|
const diagnosticsExportStub = sinon.stub(codeqlObject, "diagnosticsExport");
|
||||||
sinon.stub(workflow, "getWorkflow").resolves(actionsWorkflow);
|
sinon.stub(workflow, "getWorkflow").resolves(actionsWorkflow);
|
||||||
const uploadFromActions = sinon.stub(uploadLib, "uploadFromActions");
|
const uploadFromActions = sinon.stub(uploadLib, "uploadFromActions");
|
||||||
@@ -246,15 +333,22 @@ async function testFailedSarifUpload(t, actionsWorkflow, { category, expectUploa
|
|||||||
statusReport: { raw_upload_size_bytes: 20, zipped_upload_size_bytes: 10 },
|
statusReport: { raw_upload_size_bytes: 20, zipped_upload_size_bytes: 10 },
|
||||||
});
|
});
|
||||||
const waitForProcessing = sinon.stub(uploadLib, "waitForProcessing");
|
const waitForProcessing = sinon.stub(uploadLib, "waitForProcessing");
|
||||||
const result = await initActionPostHelper.tryUploadSarifIfRunFailed(config, (0, repository_1.parseRepositoryNwo)("github/codeql-action"), (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.UploadFailedSarifEnabled]), (0, logging_1.getRunnerLogger)(true));
|
const features = [feature_flags_1.Feature.UploadFailedSarifEnabled];
|
||||||
|
if (exportDiagnosticsEnabled) {
|
||||||
|
features.push(feature_flags_1.Feature.ExportDiagnosticsEnabled);
|
||||||
|
}
|
||||||
|
const result = await initActionPostHelper.tryUploadSarifIfRunFailed(config, (0, repository_1.parseRepositoryNwo)("github/codeql-action"), (0, testing_utils_1.createFeatures)(features), (0, logging_1.getRunnerLogger)(true));
|
||||||
if (expectUpload) {
|
if (expectUpload) {
|
||||||
t.deepEqual(result, {
|
t.deepEqual(result, {
|
||||||
raw_upload_size_bytes: 20,
|
raw_upload_size_bytes: 20,
|
||||||
zipped_upload_size_bytes: 10,
|
zipped_upload_size_bytes: 10,
|
||||||
});
|
});
|
||||||
}
|
if (databaseExists && exportDiagnosticsEnabled) {
|
||||||
if (expectUpload) {
|
t.true(databaseExportDiagnosticsStub.calledOnceWith(config.dbLocation, sinon.match.string, category, sinon.match.any, sinon.match.any), `Actual args were: ${databaseExportDiagnosticsStub.args}`);
|
||||||
t.true(diagnosticsExportStub.calledOnceWith(sinon.match.string, category, sinon.match.any, sinon.match.any), `Actual args were: ${diagnosticsExportStub.args}`);
|
}
|
||||||
|
else {
|
||||||
|
t.true(diagnosticsExportStub.calledOnceWith(sinon.match.string, category, config, sinon.match.any), `Actual args were: ${diagnosticsExportStub.args}`);
|
||||||
|
}
|
||||||
t.true(uploadFromActions.calledOnceWith(sinon.match.string, sinon.match.string, category, sinon.match.any), `Actual args were: ${uploadFromActions.args}`);
|
t.true(uploadFromActions.calledOnceWith(sinon.match.string, sinon.match.string, category, sinon.match.any), `Actual args were: ${uploadFromActions.args}`);
|
||||||
t.true(waitForProcessing.calledOnceWith(sinon.match.any, "42", sinon.match.any, {
|
t.true(waitForProcessing.calledOnceWith(sinon.match.any, "42", sinon.match.any, {
|
||||||
isUnsuccessfulExecution: true,
|
isUnsuccessfulExecution: true,
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
8
lib/init-action-post.js
generated
8
lib/init-action-post.js
generated
@@ -48,10 +48,10 @@ async function runWrapper() {
|
|||||||
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), logger);
|
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), logger);
|
||||||
uploadFailedSarifResult = await initActionPostHelper.run(debugArtifacts.uploadDatabaseBundleDebugArtifact, debugArtifacts.uploadLogsDebugArtifact, actions_util_1.printDebugLogs, repositoryNwo, features, logger);
|
uploadFailedSarifResult = await initActionPostHelper.run(debugArtifacts.uploadDatabaseBundleDebugArtifact, debugArtifacts.uploadLogsDebugArtifact, actions_util_1.printDebugLogs, repositoryNwo, features, logger);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (unwrappedError) {
|
||||||
core.setFailed(e instanceof Error ? e.message : String(e));
|
const error = (0, util_1.wrapError)(unwrappedError);
|
||||||
console.log(e);
|
core.setFailed(error.message);
|
||||||
await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("init-post", (0, actions_util_1.getActionsStatus)(e), startedAt, String(e), e instanceof Error ? e.stack : undefined));
|
await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("init-post", (0, actions_util_1.getActionsStatus)(error), startedAt, error.message, error.stack));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const statusReportBase = await (0, actions_util_1.createStatusReportBase)("init-post", "success", startedAt);
|
const statusReportBase = await (0, actions_util_1.createStatusReportBase)("init-post", "success", startedAt);
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"init-action-post.js","sourceRoot":"","sources":["../src/init-action-post.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsC;AAEtC,iDAOwB;AACxB,6CAAgD;AAChD,kEAAoD;AACpD,mDAA2C;AAC3C,gFAAkE;AAClE,uCAA6C;AAC7C,6CAAkD;AAClD,iCAAwE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AAW,EACX,IAAA,+BAAgB,EAAC,KAAK,CAAC,EACvB,SAAS,EACT,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,KAAK,CACZ,CACF,CAAC;QACF,OAAO;KACR;IACD,MAAM,gBAAgB,GAAG,MAAM,IAAA,qCAAsB,EACnD,WAAW,EACX,SAAS,EACT,SAAS,CACV,CAAC;IACF,MAAM,YAAY,GAAyB;QACzC,GAAG,gBAAgB;QACnB,GAAG,uBAAuB;KAC3B,CAAC;IACF,MAAM,IAAA,+BAAgB,EAAC,YAAY,CAAC,CAAC;AACvC,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||||
55
lib/init-action.js
generated
55
lib/init-action.js
generated
@@ -27,7 +27,6 @@ const path = __importStar(require("path"));
|
|||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const actions_util_1 = 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 codeql_1 = require("./codeql");
|
|
||||||
const feature_flags_1 = require("./feature-flags");
|
const feature_flags_1 = require("./feature-flags");
|
||||||
const init_1 = require("./init");
|
const init_1 = require("./init");
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
@@ -36,8 +35,8 @@ const repository_1 = require("./repository");
|
|||||||
const trap_caching_1 = require("./trap-caching");
|
const trap_caching_1 = require("./trap-caching");
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
const workflow_1 = require("./workflow");
|
const workflow_1 = require("./workflow");
|
||||||
async function sendInitStatusReport(actionStatus, startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger) {
|
async function sendCompletedStatusReport(startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger, error) {
|
||||||
const statusReportBase = await (0, actions_util_1.createStatusReportBase)("init", actionStatus, startedAt);
|
const statusReportBase = await (0, actions_util_1.createStatusReportBase)("init", (0, actions_util_1.getActionsStatus)(error), startedAt, error?.message, error?.stack);
|
||||||
const workflowLanguages = (0, actions_util_1.getOptionalInput)("languages");
|
const workflowLanguages = (0, actions_util_1.getOptionalInput)("languages");
|
||||||
const initStatusReport = {
|
const initStatusReport = {
|
||||||
...statusReportBase,
|
...statusReportBase,
|
||||||
@@ -116,7 +115,7 @@ async function run() {
|
|||||||
const registriesInput = (0, actions_util_1.getOptionalInput)("registries");
|
const registriesInput = (0, actions_util_1.getOptionalInput)("registries");
|
||||||
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), logger);
|
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), logger);
|
||||||
try {
|
try {
|
||||||
const workflowErrors = await (0, workflow_1.validateWorkflow)();
|
const workflowErrors = await (0, workflow_1.validateWorkflow)(logger);
|
||||||
if (!(await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("init", "starting", startedAt, workflowErrors)))) {
|
if (!(await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("init", "starting", startedAt, workflowErrors)))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -129,8 +128,7 @@ async function run() {
|
|||||||
toolsDownloadDurationMs = initCodeQLResult.toolsDownloadDurationMs;
|
toolsDownloadDurationMs = initCodeQLResult.toolsDownloadDurationMs;
|
||||||
toolsVersion = initCodeQLResult.toolsVersion;
|
toolsVersion = initCodeQLResult.toolsVersion;
|
||||||
toolsSource = initCodeQLResult.toolsSource;
|
toolsSource = initCodeQLResult.toolsSource;
|
||||||
await (0, util_1.enrichEnvironment)(codeql);
|
config = await (0, init_1.initConfig)((0, actions_util_1.getOptionalInput)("languages"), (0, actions_util_1.getOptionalInput)("queries"), (0, actions_util_1.getOptionalInput)("packs"), registriesInput, (0, actions_util_1.getOptionalInput)("config-file"), (0, actions_util_1.getOptionalInput)("db-location"), (0, actions_util_1.getOptionalInput)("config"), getTrapCachingEnabled(),
|
||||||
config = await (0, init_1.initConfig)((0, actions_util_1.getOptionalInput)("languages"), (0, actions_util_1.getOptionalInput)("queries"), (0, actions_util_1.getOptionalInput)("packs"), registriesInput, (0, actions_util_1.getOptionalInput)("config-file"), (0, actions_util_1.getOptionalInput)("db-location"), getTrapCachingEnabled(),
|
|
||||||
// Debug mode is enabled if:
|
// Debug mode is enabled if:
|
||||||
// - The `init` Action is passed `debug: true`.
|
// - The `init` Action is passed `debug: true`.
|
||||||
// - Actions step debugging is enabled (e.g. by [enabling debug logging for a rerun](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#re-running-all-the-jobs-in-a-workflow),
|
// - Actions step debugging is enabled (e.g. by [enabling debug logging for a rerun](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#re-running-all-the-jobs-in-a-workflow),
|
||||||
@@ -138,20 +136,24 @@ async function run() {
|
|||||||
(0, actions_util_1.getOptionalInput)("debug") === "true" || core.isDebug(), (0, actions_util_1.getOptionalInput)("debug-artifact-name") || util_1.DEFAULT_DEBUG_ARTIFACT_NAME, (0, actions_util_1.getOptionalInput)("debug-database-name") || util_1.DEFAULT_DEBUG_DATABASE_NAME, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), codeql, (0, util_1.getRequiredEnvParam)("GITHUB_WORKSPACE"), gitHubVersion, apiDetails, features, logger);
|
(0, actions_util_1.getOptionalInput)("debug") === "true" || core.isDebug(), (0, actions_util_1.getOptionalInput)("debug-artifact-name") || util_1.DEFAULT_DEBUG_ARTIFACT_NAME, (0, actions_util_1.getOptionalInput)("debug-database-name") || util_1.DEFAULT_DEBUG_DATABASE_NAME, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), codeql, (0, util_1.getRequiredEnvParam)("GITHUB_WORKSPACE"), gitHubVersion, apiDetails, features, logger);
|
||||||
if (config.languages.includes(languages_1.Language.python) &&
|
if (config.languages.includes(languages_1.Language.python) &&
|
||||||
(0, actions_util_1.getRequiredInput)("setup-python-dependencies") === "true") {
|
(0, actions_util_1.getRequiredInput)("setup-python-dependencies") === "true") {
|
||||||
try {
|
if (await features.getValue(feature_flags_1.Feature.DisablePythonDependencyInstallation, codeql)) {
|
||||||
await (0, init_1.installPythonDeps)(codeql, logger);
|
logger.info("Skipping python dependency installation");
|
||||||
}
|
}
|
||||||
catch (err) {
|
else {
|
||||||
const message = err instanceof Error ? err.message : String(err);
|
try {
|
||||||
logger.warning(`${message} You can call this action with 'setup-python-dependencies: false' to disable this process`);
|
await (0, init_1.installPythonDeps)(codeql, logger);
|
||||||
|
}
|
||||||
|
catch (unwrappedError) {
|
||||||
|
const error = (0, util_1.wrapError)(unwrappedError);
|
||||||
|
logger.warning(`${error.message} You can call this action with 'setup-python-dependencies: false' to disable this process`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (unwrappedError) {
|
||||||
const message = e instanceof Error ? e.message : String(e);
|
const error = (0, util_1.wrapError)(unwrappedError);
|
||||||
core.setFailed(message);
|
core.setFailed(error.message);
|
||||||
console.log(e);
|
await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("init", "aborted", startedAt, error.message, error.stack));
|
||||||
await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("init", "aborted", startedAt, message));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -173,26 +175,26 @@ async function run() {
|
|||||||
if (await features.getValue(feature_flags_1.Feature.DisableKotlinAnalysisEnabled)) {
|
if (await features.getValue(feature_flags_1.Feature.DisableKotlinAnalysisEnabled)) {
|
||||||
core.exportVariable("CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN", "true");
|
core.exportVariable("CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN", "true");
|
||||||
}
|
}
|
||||||
|
// Disable Python dependency extraction if feature flag set
|
||||||
|
if (await features.getValue(feature_flags_1.Feature.DisablePythonDependencyInstallation, codeql)) {
|
||||||
|
core.exportVariable("CODEQL_EXTRACTOR_PYTHON_DISABLE_LIBRARY_EXTRACTION", "true");
|
||||||
|
}
|
||||||
const sourceRoot = path.resolve((0, util_1.getRequiredEnvParam)("GITHUB_WORKSPACE"), (0, actions_util_1.getOptionalInput)("source-root") || "");
|
const sourceRoot = path.resolve((0, util_1.getRequiredEnvParam)("GITHUB_WORKSPACE"), (0, actions_util_1.getOptionalInput)("source-root") || "");
|
||||||
const tracerConfig = await (0, init_1.runInit)(codeql, config, sourceRoot, "Runner.Worker.exe", registriesInput, features, apiDetails, logger);
|
const tracerConfig = await (0, init_1.runInit)(codeql, config, sourceRoot, "Runner.Worker.exe", registriesInput, features, apiDetails, logger);
|
||||||
if (tracerConfig !== undefined) {
|
if (tracerConfig !== undefined) {
|
||||||
for (const [key, value] of Object.entries(tracerConfig.env)) {
|
for (const [key, value] of Object.entries(tracerConfig.env)) {
|
||||||
core.exportVariable(key, value);
|
core.exportVariable(key, value);
|
||||||
}
|
}
|
||||||
if (process.platform === "win32" &&
|
|
||||||
!(await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING))) {
|
|
||||||
await (0, init_1.injectWindowsTracer)("Runner.Worker.exe", undefined, config, codeql, tracerConfig);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
core.setOutput("codeql-path", config.codeQLCmd);
|
core.setOutput("codeql-path", config.codeQLCmd);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (unwrappedError) {
|
||||||
core.setFailed(String(error));
|
const error = (0, util_1.wrapError)(unwrappedError);
|
||||||
console.log(error);
|
core.setFailed(error.message);
|
||||||
await sendInitStatusReport((0, actions_util_1.getActionsStatus)(error), startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger);
|
await sendCompletedStatusReport(startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger, error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await sendInitStatusReport("success", startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger);
|
await sendCompletedStatusReport(startedAt, config, toolsDownloadDurationMs, toolsFeatureFlagsValid, toolsSource, toolsVersion, logger);
|
||||||
}
|
}
|
||||||
function getTrapCachingEnabled() {
|
function getTrapCachingEnabled() {
|
||||||
// If the workflow specified something always respect that
|
// If the workflow specified something always respect that
|
||||||
@@ -210,8 +212,7 @@ async function runWrapper() {
|
|||||||
await run();
|
await run();
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(`init action failed: ${error}`);
|
core.setFailed(`init action failed: ${(0, util_1.wrapError)(error).message}`);
|
||||||
console.log(error);
|
|
||||||
}
|
}
|
||||||
await (0, util_1.checkForTimeout)();
|
await (0, util_1.checkForTimeout)();
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
130
lib/init.js
generated
130
lib/init.js
generated
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.installPythonDeps = exports.injectWindowsTracer = exports.runInit = exports.initConfig = exports.initCodeQL = exports.ToolsSource = void 0;
|
exports.installPythonDeps = exports.runInit = exports.initConfig = exports.initCodeQL = exports.ToolsSource = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||||
@@ -33,7 +33,6 @@ const codeql_1 = require("./codeql");
|
|||||||
const configUtils = __importStar(require("./config-utils"));
|
const configUtils = __importStar(require("./config-utils"));
|
||||||
const tracer_config_1 = require("./tracer-config");
|
const tracer_config_1 = require("./tracer-config");
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
const util_1 = require("./util");
|
|
||||||
var ToolsSource;
|
var ToolsSource;
|
||||||
(function (ToolsSource) {
|
(function (ToolsSource) {
|
||||||
ToolsSource["Unknown"] = "UNKNOWN";
|
ToolsSource["Unknown"] = "UNKNOWN";
|
||||||
@@ -49,9 +48,9 @@ async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVe
|
|||||||
return { codeql, toolsDownloadDurationMs, toolsSource, toolsVersion };
|
return { codeql, toolsDownloadDurationMs, toolsSource, toolsVersion };
|
||||||
}
|
}
|
||||||
exports.initCodeQL = initCodeQL;
|
exports.initCodeQL = initCodeQL;
|
||||||
async function initConfig(languagesInput, queriesInput, packsInput, registriesInput, configFile, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, features, logger) {
|
async function initConfig(languagesInput, queriesInput, packsInput, registriesInput, configFile, dbLocation, configInput, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, features, logger) {
|
||||||
logger.startGroup("Load language configuration");
|
logger.startGroup("Load language configuration");
|
||||||
const config = await configUtils.initConfig(languagesInput, queriesInput, packsInput, registriesInput, configFile, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, features, logger);
|
const config = await configUtils.initConfig(languagesInput, queriesInput, packsInput, registriesInput, configFile, dbLocation, configInput, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, features, logger);
|
||||||
analysisPaths.printPathFiltersWarning(config, logger);
|
analysisPaths.printPathFiltersWarning(config, logger);
|
||||||
logger.endGroup();
|
logger.endGroup();
|
||||||
return config;
|
return config;
|
||||||
@@ -60,35 +59,27 @@ exports.initConfig = initConfig;
|
|||||||
async function runInit(codeql, config, sourceRoot, processName, registriesInput, features, apiDetails, logger) {
|
async function runInit(codeql, config, sourceRoot, processName, registriesInput, features, apiDetails, logger) {
|
||||||
fs.mkdirSync(config.dbLocation, { recursive: true });
|
fs.mkdirSync(config.dbLocation, { recursive: true });
|
||||||
try {
|
try {
|
||||||
if (await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING)) {
|
// When parsing the codeql config in the CLI, we have not yet created the qlconfig file.
|
||||||
// When parsing the codeql config in the CLI, we have not yet created the qlconfig file.
|
// So, create it now.
|
||||||
// So, create it now.
|
// If we are parsing the config file in the Action, then the qlconfig file was already created
|
||||||
// If we are parsing the config file in the Action, then the qlconfig file was already created
|
// before the `pack download` command was invoked. It is not required for the init command.
|
||||||
// before the `pack download` command was invoked. It is not required for the init command.
|
let registriesAuthTokens;
|
||||||
let registriesAuthTokens;
|
let qlconfigFile;
|
||||||
let qlconfigFile;
|
if (await util.useCodeScanningConfigInCli(codeql, features)) {
|
||||||
if (await util.useCodeScanningConfigInCli(codeql, features)) {
|
({ registriesAuthTokens, qlconfigFile } =
|
||||||
({ registriesAuthTokens, qlconfigFile } =
|
await configUtils.generateRegistries(registriesInput, codeql, config.tempDir, logger));
|
||||||
await configUtils.generateRegistries(registriesInput, codeql, config.tempDir, logger));
|
|
||||||
}
|
|
||||||
await configUtils.wrapEnvironment({
|
|
||||||
GITHUB_TOKEN: apiDetails.auth,
|
|
||||||
CODEQL_REGISTRIES_AUTH: registriesAuthTokens,
|
|
||||||
},
|
|
||||||
// Init a database cluster
|
|
||||||
async () => await codeql.databaseInitCluster(config, sourceRoot, processName, features, qlconfigFile, logger));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (const language of config.languages) {
|
|
||||||
// Init language database
|
|
||||||
await codeql.databaseInit(util.getCodeQLDatabasePath(config, language), language, sourceRoot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
await configUtils.wrapEnvironment({
|
||||||
|
GITHUB_TOKEN: apiDetails.auth,
|
||||||
|
CODEQL_REGISTRIES_AUTH: registriesAuthTokens,
|
||||||
|
},
|
||||||
|
// Init a database cluster
|
||||||
|
async () => await codeql.databaseInitCluster(config, sourceRoot, processName, features, qlconfigFile, logger));
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
throw processError(e);
|
throw processError(e);
|
||||||
}
|
}
|
||||||
return await (0, tracer_config_1.getCombinedTracerConfig)(config, codeql);
|
return await (0, tracer_config_1.getCombinedTracerConfig)(config);
|
||||||
}
|
}
|
||||||
exports.runInit = runInit;
|
exports.runInit = runInit;
|
||||||
/**
|
/**
|
||||||
@@ -119,89 +110,6 @@ function processError(e) {
|
|||||||
}
|
}
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
// Runs a powershell script to inject the tracer into a parent process
|
|
||||||
// so it can tracer future processes, hopefully including the build process.
|
|
||||||
// If processName is given then injects into the nearest parent process with
|
|
||||||
// this name, otherwise uses the processLevel-th parent if defined, otherwise
|
|
||||||
// defaults to the 3rd parent as a rough guess.
|
|
||||||
async function injectWindowsTracer(processName, processLevel, config, codeql, tracerConfig) {
|
|
||||||
let script;
|
|
||||||
if (processName !== undefined) {
|
|
||||||
script = `
|
|
||||||
Param(
|
|
||||||
[Parameter(Position=0)]
|
|
||||||
[String]
|
|
||||||
$tracer
|
|
||||||
)
|
|
||||||
|
|
||||||
$id = $PID
|
|
||||||
while ($true) {
|
|
||||||
$p = Get-CimInstance -Class Win32_Process -Filter "ProcessId = $id"
|
|
||||||
Write-Host "Found process: $p"
|
|
||||||
if ($p -eq $null) {
|
|
||||||
throw "Could not determine ${processName} process"
|
|
||||||
}
|
|
||||||
if ($p[0].Name -eq "${processName}") {
|
|
||||||
Break
|
|
||||||
} else {
|
|
||||||
$id = $p[0].ParentProcessId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Write-Host "Final process: $p"
|
|
||||||
|
|
||||||
Invoke-Expression "&$tracer --inject=$id"`;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// If the level is not defined then guess at the 3rd parent process.
|
|
||||||
// This won't be correct in every setting but it should be enough in most settings,
|
|
||||||
// and overestimating is likely better in this situation so we definitely trace
|
|
||||||
// what we want, though this does run the risk of interfering with future CI jobs.
|
|
||||||
// Note that the default of 3 doesn't work on github actions, so we include a
|
|
||||||
// special case in the script that checks for Runner.Worker.exe so we can still work
|
|
||||||
// on actions if the runner is invoked there.
|
|
||||||
processLevel = processLevel || 3;
|
|
||||||
script = `
|
|
||||||
Param(
|
|
||||||
[Parameter(Position=0)]
|
|
||||||
[String]
|
|
||||||
$tracer
|
|
||||||
)
|
|
||||||
|
|
||||||
$id = $PID
|
|
||||||
for ($i = 0; $i -le ${processLevel}; $i++) {
|
|
||||||
$p = Get-CimInstance -Class Win32_Process -Filter "ProcessId = $id"
|
|
||||||
Write-Host "Parent process \${i}: $p"
|
|
||||||
if ($p -eq $null) {
|
|
||||||
throw "Process tree ended before reaching required level"
|
|
||||||
}
|
|
||||||
# Special case just in case the runner is used on actions
|
|
||||||
if ($p[0].Name -eq "Runner.Worker.exe") {
|
|
||||||
Write-Host "Found Runner.Worker.exe process which means we are running on GitHub Actions"
|
|
||||||
Write-Host "Aborting search early and using process: $p"
|
|
||||||
Break
|
|
||||||
} elseif ($p[0].Name -eq "Agent.Worker.exe") {
|
|
||||||
Write-Host "Found Agent.Worker.exe process which means we are running on Azure Pipelines"
|
|
||||||
Write-Host "Aborting search early and using process: $p"
|
|
||||||
Break
|
|
||||||
} else {
|
|
||||||
$id = $p[0].ParentProcessId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Write-Host "Final process: $p"
|
|
||||||
|
|
||||||
Invoke-Expression "&$tracer --inject=$id"`;
|
|
||||||
}
|
|
||||||
const injectTracerPath = path.join(config.tempDir, "inject-tracer.ps1");
|
|
||||||
fs.writeFileSync(injectTracerPath, script);
|
|
||||||
await new toolrunner.ToolRunner(await safeWhich.safeWhich("powershell"), [
|
|
||||||
"-ExecutionPolicy",
|
|
||||||
"Bypass",
|
|
||||||
"-file",
|
|
||||||
injectTracerPath,
|
|
||||||
path.resolve(path.dirname(codeql.getPath()), "tools", "win64", "tracer.exe"),
|
|
||||||
], { env: { ODASA_TRACER_CONFIGURATION: tracerConfig.spec } }).exec();
|
|
||||||
}
|
|
||||||
exports.injectWindowsTracer = injectWindowsTracer;
|
|
||||||
async function installPythonDeps(codeql, logger) {
|
async function installPythonDeps(codeql, logger) {
|
||||||
logger.startGroup("Setup Python dependencies");
|
logger.startGroup("Setup Python dependencies");
|
||||||
const scriptsFolder = path.resolve(__dirname, "../python-setup");
|
const scriptsFolder = path.resolve(__dirname, "../python-setup");
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
9
lib/setup-codeql.js
generated
9
lib/setup-codeql.js
generated
@@ -139,7 +139,7 @@ async function tryFindCliVersionDotcomOnly(tagName, logger) {
|
|||||||
return tryGetCodeQLCliVersionForRelease(release.data, logger);
|
return tryGetCodeQLCliVersionForRelease(release.data, logger);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
logger.debug(`Failed to find the CLI version for the CodeQL bundle tagged ${tagName}. ${e instanceof Error ? e.message : e}`);
|
logger.debug(`Failed to find the CLI version for the CodeQL bundle tagged ${tagName}. ${(0, util_1.wrapError)(e).message}`);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -315,6 +315,13 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||||||
// If a tools URL was provided, then use that.
|
// If a tools URL was provided, then use that.
|
||||||
tagName = tryGetTagNameFromUrl(toolsInput, logger);
|
tagName = tryGetTagNameFromUrl(toolsInput, logger);
|
||||||
url = toolsInput;
|
url = toolsInput;
|
||||||
|
if (tagName) {
|
||||||
|
const bundleVersion = tryGetBundleVersionFromTagName(tagName, logger);
|
||||||
|
// If the bundle version is a semantic version, it is a CLI version number.
|
||||||
|
if (bundleVersion && semver.valid(bundleVersion)) {
|
||||||
|
cliVersion = convertToSemVer(bundleVersion, logger);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Otherwise, use the default CLI version passed in.
|
// Otherwise, use the default CLI version passed in.
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
12
lib/setup-codeql.test.js
generated
12
lib/setup-codeql.test.js
generated
@@ -57,7 +57,7 @@ ava_1.default.beforeEach(() => {
|
|||||||
t.deepEqual(parsedVersion, expectedVersion);
|
t.deepEqual(parsedVersion, expectedVersion);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
t.fail(e instanceof Error ? e.message : String(e));
|
t.fail((0, util_1.wrapError)(e).message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -117,4 +117,14 @@ ava_1.default.beforeEach(() => {
|
|||||||
message: "Failed to find a release of the CodeQL tools that contains CodeQL CLI 2.12.1.",
|
message: "Failed to find a release of the CodeQL tools that contains CodeQL CLI 2.12.1.",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
(0, ava_1.default)("getCodeQLSource sets CLI version for a semver tagged bundle", async (t) => {
|
||||||
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
|
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
||||||
|
const tagName = "codeql-bundle-v1.2.3";
|
||||||
|
(0, testing_utils_1.mockBundleDownloadApi)({ tagName });
|
||||||
|
const source = await setupCodeql.getCodeQLSource(`https://github.com/github/codeql-action/releases/download/${tagName}/codeql-bundle-linux64.tar.gz`, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, util_1.GitHubVariant.DOTCOM, (0, logging_1.getRunnerLogger)(true));
|
||||||
|
t.is(source.sourceType, "download");
|
||||||
|
t.is(source["cliVersion"], "1.2.3");
|
||||||
|
});
|
||||||
|
});
|
||||||
//# sourceMappingURL=setup-codeql.test.js.map
|
//# sourceMappingURL=setup-codeql.test.js.map
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"setup-codeql.test.js","sourceRoot":"","sources":["../src/setup-codeql.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAE7B,8CAAuB;AACvB,6CAA+B;AAE/B,4DAA8C;AAC9C,kDAAoC;AACpC,uCAA4C;AAC5C,4DAA8C;AAC9C,mDAA6C;AAC7C,iCAA+C;AAE/C,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,aAAI,CAAC,UAAU,CAAC,GAAG,EAAE;IACnB,IAAA,4BAAqB,EAAC,OAAO,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEH,IAAA,aAAI,EAAC,iCAAiC,EAAE,CAAC,CAAC,EAAE,EAAE;IAC5C,CAAC,CAAC,SAAS,CACT,WAAW,CAAC,mBAAmB,CAC7B,mDAAmD,CACpD,EACD,UAAU,CACX,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAA,aAAI,EAAC,mBAAmB,EAAE,CAAC,CAAC,EAAE,EAAE;IAC9B,MAAM,KAAK,GAAG;QACZ,UAAU,EAAE,gBAAgB;QAC5B,YAAY,EAAE,kBAAkB;QAChC,cAAc,EAAE,cAAc;QAC9B,OAAO,EAAE,OAAO;QAChB,aAAa,EAAE,aAAa;QAC5B,cAAc,EAAE,cAAc;KAC/B,CAAC;IAEF,KAAK,MAAM,CAAC,OAAO,EAAE,eAAe,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QAC9D,IAAI;YACF,MAAM,aAAa,GAAG,WAAW,CAAC,eAAe,CAC/C,OAAO,EACP,IAAA,yBAAe,EAAC,IAAI,CAAC,CACtB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AAI,EAAC,6DAA6D,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC9E,MAAM,IAAA,iBAAU,EAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAChC,IAAA,gCAAgB,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,MAAM,OAAO,GAAG,sBAAsB,CAAC;QACvC,IAAA,qCAAqB,EAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QACnC,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,eAAe,CAC9C,6DAA6D,OAAO,+BAA+B,EACnG,0CAA0B,EAC1B,yCAAyB,EACzB,oBAAa,CAAC,MAAM,EACpB,IAAA,yBAAe,EAAC,IAAI,CAAC,CACtB,CAAC;QAEF,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QACpC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||||
44
lib/shared-environment.js
generated
44
lib/shared-environment.js
generated
@@ -1,6 +1,43 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.ODASA_TRACER_CONFIGURATION = exports.CODEQL_WORKFLOW_STARTED_AT = exports.CODEQL_ACTION_TEST_MODE = exports.CODEQL_ACTION_TESTING_ENVIRONMENT = exports.CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY = void 0;
|
exports.ODASA_TRACER_CONFIGURATION = exports.CODEQL_WORKFLOW_STARTED_AT = exports.CODEQL_ACTION_DISABLE_DUPLICATE_LOCATION_FIX = exports.CODEQL_ACTION_TEST_MODE = exports.CODEQL_ACTION_TESTING_ENVIRONMENT = exports.CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY = exports.CODEQL_ACTION_DID_AUTOBUILD_GOLANG = exports.EnvVar = void 0;
|
||||||
|
/**
|
||||||
|
* Environment variables to be set by codeql-action and used by the
|
||||||
|
* CLI.
|
||||||
|
*/
|
||||||
|
var EnvVar;
|
||||||
|
(function (EnvVar) {
|
||||||
|
/**
|
||||||
|
* Semver of the codeql-action as specified in package.json.
|
||||||
|
*/
|
||||||
|
EnvVar["VERSION"] = "CODEQL_ACTION_VERSION";
|
||||||
|
/**
|
||||||
|
* If set to a truthy value, then the codeql-action might combine SARIF
|
||||||
|
* output from several `interpret-results` runs for the same Language.
|
||||||
|
*/
|
||||||
|
EnvVar["FEATURE_SARIF_COMBINE"] = "CODEQL_ACTION_FEATURE_SARIF_COMBINE";
|
||||||
|
/**
|
||||||
|
* If set to the "true" string, then the codeql-action will upload SARIF,
|
||||||
|
* not the cli.
|
||||||
|
*/
|
||||||
|
EnvVar["FEATURE_WILL_UPLOAD"] = "CODEQL_ACTION_FEATURE_WILL_UPLOAD";
|
||||||
|
/**
|
||||||
|
* If set to the "true" string, then the codeql-action is using its
|
||||||
|
* own deprecated and non-standard way of scanning for multiple
|
||||||
|
* languages.
|
||||||
|
*/
|
||||||
|
EnvVar["FEATURE_MULTI_LANGUAGE"] = "CODEQL_ACTION_FEATURE_MULTI_LANGUAGE";
|
||||||
|
/**
|
||||||
|
* If set to the "true" string, then the codeql-action is using its
|
||||||
|
* own sandwiched workflow mechanism
|
||||||
|
*/
|
||||||
|
EnvVar["FEATURE_SANDWICH"] = "CODEQL_ACTION_FEATURE_SANDWICH";
|
||||||
|
})(EnvVar = exports.EnvVar || (exports.EnvVar = {}));
|
||||||
|
/**
|
||||||
|
* Environment variable that is set to true when the CodeQL Action has invoked
|
||||||
|
* the Go autobuilder.
|
||||||
|
*/
|
||||||
|
exports.CODEQL_ACTION_DID_AUTOBUILD_GOLANG = "CODEQL_ACTION_DID_AUTOBUILD_GOLANG";
|
||||||
/**
|
/**
|
||||||
* This environment variable is set to true when the `analyze` Action
|
* This environment variable is set to true when the `analyze` Action
|
||||||
* completes successfully.
|
* completes successfully.
|
||||||
@@ -9,6 +46,11 @@ exports.CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY = "CODEQL_ACTION_ANALYZE
|
|||||||
exports.CODEQL_ACTION_TESTING_ENVIRONMENT = "CODEQL_ACTION_TESTING_ENVIRONMENT";
|
exports.CODEQL_ACTION_TESTING_ENVIRONMENT = "CODEQL_ACTION_TESTING_ENVIRONMENT";
|
||||||
/** Used to disable uploading SARIF results or status reports to the GitHub API */
|
/** Used to disable uploading SARIF results or status reports to the GitHub API */
|
||||||
exports.CODEQL_ACTION_TEST_MODE = "CODEQL_ACTION_TEST_MODE";
|
exports.CODEQL_ACTION_TEST_MODE = "CODEQL_ACTION_TEST_MODE";
|
||||||
|
/**
|
||||||
|
* Used to disable the SARIF post-processing in the Action that removes duplicate locations from
|
||||||
|
* notifications in the `run[].invocations[].toolExecutionNotifications` SARIF property.
|
||||||
|
*/
|
||||||
|
exports.CODEQL_ACTION_DISABLE_DUPLICATE_LOCATION_FIX = "CODEQL_ACTION_DISABLE_DUPLICATE_LOCATION_FIX";
|
||||||
/**
|
/**
|
||||||
* The time at which the first action (normally init) started executing.
|
* The time at which the first action (normally init) started executing.
|
||||||
* If a workflow invokes a different action without first invoking the init
|
* If a workflow invokes a different action without first invoking the init
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"shared-environment.js","sourceRoot":"","sources":["../src/shared-environment.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,+CAA+C,GAC1D,iDAAiD,CAAC;AAEvC,QAAA,iCAAiC,GAC5C,mCAAmC,CAAC;AAEtC,kFAAkF;AACrE,QAAA,uBAAuB,GAAG,yBAAyB,CAAC;AAEjE;;;;;;GAMG;AACU,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AAE1D,QAAA,0BAA0B,GAAG,4BAA4B,CAAC"}
|
{"version":3,"file":"shared-environment.js","sourceRoot":"","sources":["../src/shared-environment.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,IAAY,MA8BX;AA9BD,WAAY,MAAM;IAChB;;OAEG;IACH,2CAAiC,CAAA;IAEjC;;;OAGG;IACH,uEAA6D,CAAA;IAE7D;;;OAGG;IACH,mEAAyD,CAAA;IAEzD;;;;OAIG;IACH,yEAA+D,CAAA;IAE/D;;;OAGG;IACH,6DAAmD,CAAA;AACrD,CAAC,EA9BW,MAAM,GAAN,cAAM,KAAN,cAAM,QA8BjB;AAED;;;GAGG;AACU,QAAA,kCAAkC,GAC7C,oCAAoC,CAAC;AAEvC;;;GAGG;AACU,QAAA,+CAA+C,GAC1D,iDAAiD,CAAC;AAEvC,QAAA,iCAAiC,GAC5C,mCAAmC,CAAC;AAEtC,kFAAkF;AACrE,QAAA,uBAAuB,GAAG,yBAAyB,CAAC;AAEjE;;;GAGG;AACU,QAAA,4CAA4C,GACvD,8CAA8C,CAAC;AAEjD;;;;;;GAMG;AACU,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AAE1D,QAAA,0BAA0B,GAAG,4BAA4B,CAAC"}
|
||||||
41
lib/testing-utils.js
generated
41
lib/testing-utils.js
generated
@@ -22,15 +22,28 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.createFeatures = exports.mockCodeQLVersion = exports.mockLanguagesInRepo = exports.mockFeatureFlagApiEndpoint = exports.getRecordingLogger = exports.setupActionsVars = exports.setupTests = void 0;
|
exports.mockBundleDownloadApi = exports.createFeatures = exports.mockCodeQLVersion = exports.mockLanguagesInRepo = exports.mockFeatureFlagApiEndpoint = exports.getRecordingLogger = exports.setupActionsVars = exports.setupTests = exports.SAMPLE_DEFAULT_CLI_VERSION = exports.SAMPLE_DOTCOM_API_DETAILS = void 0;
|
||||||
const node_util_1 = require("node:util");
|
const node_util_1 = require("node:util");
|
||||||
|
const path_1 = __importDefault(require("path"));
|
||||||
const github = __importStar(require("@actions/github"));
|
const github = __importStar(require("@actions/github"));
|
||||||
const nock = __importStar(require("nock"));
|
const nock_1 = __importDefault(require("nock"));
|
||||||
const sinon = __importStar(require("sinon"));
|
const sinon = __importStar(require("sinon"));
|
||||||
const apiClient = __importStar(require("./api-client"));
|
const apiClient = __importStar(require("./api-client"));
|
||||||
const CodeQL = __importStar(require("./codeql"));
|
const CodeQL = __importStar(require("./codeql"));
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
|
exports.SAMPLE_DOTCOM_API_DETAILS = {
|
||||||
|
auth: "token",
|
||||||
|
url: "https://github.com",
|
||||||
|
apiURL: "https://api.github.com",
|
||||||
|
};
|
||||||
|
exports.SAMPLE_DEFAULT_CLI_VERSION = {
|
||||||
|
cliVersion: "2.0.0",
|
||||||
|
variant: util_1.GitHubVariant.DOTCOM,
|
||||||
|
};
|
||||||
function wrapOutput(context) {
|
function wrapOutput(context) {
|
||||||
// Function signature taken from Socket.write.
|
// Function signature taken from Socket.write.
|
||||||
// Note there are two overloads:
|
// Note there are two overloads:
|
||||||
@@ -92,7 +105,7 @@ function setupTests(test) {
|
|||||||
process.stdout.write(t.context.testOutput);
|
process.stdout.write(t.context.testOutput);
|
||||||
}
|
}
|
||||||
// Undo any modifications made by nock
|
// Undo any modifications made by nock
|
||||||
nock.cleanAll();
|
nock_1.default.cleanAll();
|
||||||
// Undo any modifications made by sinon
|
// Undo any modifications made by sinon
|
||||||
sinon.restore();
|
sinon.restore();
|
||||||
// Undo any modifications to the env
|
// Undo any modifications to the env
|
||||||
@@ -196,4 +209,26 @@ function createFeatures(enabledFeatures) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.createFeatures = createFeatures;
|
exports.createFeatures = createFeatures;
|
||||||
|
/**
|
||||||
|
* Mocks the API for downloading the bundle tagged `tagName`.
|
||||||
|
*
|
||||||
|
* @returns the download URL for the bundle. This can be passed to the tools parameter of
|
||||||
|
* `codeql.setupCodeQL`.
|
||||||
|
*/
|
||||||
|
function mockBundleDownloadApi({ apiDetails = exports.SAMPLE_DOTCOM_API_DETAILS, isPinned, repo = "github/codeql-action", platformSpecific = true, tagName, }) {
|
||||||
|
const platform = process.platform === "win32"
|
||||||
|
? "win64"
|
||||||
|
: process.platform === "linux"
|
||||||
|
? "linux64"
|
||||||
|
: "osx64";
|
||||||
|
const baseUrl = apiDetails?.url ?? "https://example.com";
|
||||||
|
const relativeUrl = apiDetails
|
||||||
|
? `/${repo}/releases/download/${tagName}/codeql-bundle${platformSpecific ? `-${platform}` : ""}.tar.gz`
|
||||||
|
: `/download/${tagName}/codeql-bundle.tar.gz`;
|
||||||
|
(0, nock_1.default)(baseUrl)
|
||||||
|
.get(relativeUrl)
|
||||||
|
.replyWithFile(200, path_1.default.join(__dirname, `/../src/testdata/codeql-bundle${isPinned ? "-pinned" : ""}.tar.gz`));
|
||||||
|
return `${baseUrl}${relativeUrl}`;
|
||||||
|
}
|
||||||
|
exports.mockBundleDownloadApi = mockBundleDownloadApi;
|
||||||
//# sourceMappingURL=testing-utils.js.map
|
//# sourceMappingURL=testing-utils.js.map
|
||||||
File diff suppressed because one or more lines are too long
4
lib/toolrunner-error-catcher.js
generated
4
lib/toolrunner-error-catcher.js
generated
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
exports.toolrunnerErrorCatcher = void 0;
|
exports.toolrunnerErrorCatcher = void 0;
|
||||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||||
const safeWhich = __importStar(require("@chrisgavin/safe-which"));
|
const safeWhich = __importStar(require("@chrisgavin/safe-which"));
|
||||||
|
const util_1 = require("./util");
|
||||||
/**
|
/**
|
||||||
* Wrapper for toolrunner.Toolrunner which checks for specific return code and/or regex matches in console output.
|
* Wrapper for toolrunner.Toolrunner which checks for specific return code and/or regex matches in console output.
|
||||||
* Output will be streamed to the live console as well as captured for subsequent processing.
|
* Output will be streamed to the live console as well as captured for subsequent processing.
|
||||||
@@ -83,8 +84,7 @@ async function toolrunnerErrorCatcher(commandLine, args, matchers, options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
const error = e instanceof Error ? e : new Error(String(e));
|
throw (0, util_1.wrapError)(e);
|
||||||
throw error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.toolrunnerErrorCatcher = toolrunnerErrorCatcher;
|
exports.toolrunnerErrorCatcher = toolrunnerErrorCatcher;
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"toolrunner-error-catcher.js","sourceRoot":"","sources":["../src/toolrunner-error-catcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yEAA2D;AAC3D,kEAAoD;AASpD;;;;;;;;;;GAUG;AACI,KAAK,UAAU,sBAAsB,CAC1C,WAAmB,EACnB,IAAe,EACf,QAAyB,EACzB,OAAwB;IAExB,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,MAAM,SAAS,GAAG;QAChB,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;YACvB,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC1B,IAAI,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,SAAS,EAAE;gBAC5C,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;aAChC;QACH,CAAC;QACD,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;YACvB,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC1B,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KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;gBAC9B,IACE,OAAO,CAAC,QAAQ,KAAK,QAAQ;oBAC7B,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC;oBACjC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,EACjC;oBACA,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;iBAClC;aACF;SACF;QAED,qFAAqF;QACrF,IAAI,OAAO,EAAE,gBAAgB,EAAE;YAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;SAC7B;aAAM;YACL,MAAM,IAAI,KAAK,CACb,gBAAgB,WAAW,2BAA2B,QAAQ,EAAE,CACjE,CAAC;SACH;KACF;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,IAAA,gBAAS,EAAC,CAAC,CAAC,CAAC;KACpB;AACH,CAAC;AA/DD,wDA+DC"}
|
||||||
161
lib/tracer-config.js
generated
161
lib/tracer-config.js
generated
@@ -23,20 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getCombinedTracerConfig = exports.concatTracerConfigs = exports.getTracerConfigForLanguage = exports.getTracerConfigForCluster = exports.endTracingForCluster = void 0;
|
exports.getCombinedTracerConfig = exports.getTracerConfigForCluster = exports.endTracingForCluster = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const codeql_1 = require("./codeql");
|
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const util = __importStar(require("./util"));
|
|
||||||
const util_1 = require("./util");
|
|
||||||
const CRITICAL_TRACER_VARS = new Set([
|
|
||||||
"SEMMLE_PRELOAD_libtrace",
|
|
||||||
"SEMMLE_RUNNER",
|
|
||||||
"SEMMLE_COPY_EXECUTABLES_ROOT",
|
|
||||||
"SEMMLE_DEPTRACE_SOCKET",
|
|
||||||
"SEMMLE_JAVA_TOOL_OPTIONS",
|
|
||||||
]);
|
|
||||||
async function endTracingForCluster(config) {
|
async function endTracingForCluster(config) {
|
||||||
// If there are no traced languages, we don't need to do anything.
|
// If there are no traced languages, we don't need to do anything.
|
||||||
if (!config.languages.some((l) => (0, languages_1.isTracedLanguage)(l)))
|
if (!config.languages.some((l) => (0, languages_1.isTracedLanguage)(l)))
|
||||||
@@ -64,162 +54,17 @@ exports.endTracingForCluster = endTracingForCluster;
|
|||||||
async function getTracerConfigForCluster(config) {
|
async function getTracerConfigForCluster(config) {
|
||||||
const tracingEnvVariables = JSON.parse(fs.readFileSync(path.resolve(config.dbLocation, "temp/tracingEnvironment/start-tracing.json"), "utf8"));
|
const tracingEnvVariables = JSON.parse(fs.readFileSync(path.resolve(config.dbLocation, "temp/tracingEnvironment/start-tracing.json"), "utf8"));
|
||||||
return {
|
return {
|
||||||
spec: tracingEnvVariables["ODASA_TRACER_CONFIGURATION"],
|
|
||||||
env: tracingEnvVariables,
|
env: tracingEnvVariables,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.getTracerConfigForCluster = getTracerConfigForCluster;
|
exports.getTracerConfigForCluster = getTracerConfigForCluster;
|
||||||
async function getTracerConfigForLanguage(codeql, config, language) {
|
async function getCombinedTracerConfig(config) {
|
||||||
const env = await codeql.getTracerEnv(util.getCodeQLDatabasePath(config, language));
|
|
||||||
const spec = env["ODASA_TRACER_CONFIGURATION"];
|
|
||||||
const info = { spec, env: {} };
|
|
||||||
// Extract critical tracer variables from the environment
|
|
||||||
for (const entry of Object.entries(env)) {
|
|
||||||
const key = entry[0];
|
|
||||||
const value = entry[1];
|
|
||||||
// skip ODASA_TRACER_CONFIGURATION as it is handled separately
|
|
||||||
if (key === "ODASA_TRACER_CONFIGURATION") {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// skip undefined values
|
|
||||||
if (typeof value === "undefined") {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// Keep variables that do not exist in current environment. In addition always keep
|
|
||||||
// critical and CODEQL_ variables
|
|
||||||
if (typeof process.env[key] === "undefined" ||
|
|
||||||
CRITICAL_TRACER_VARS.has(key) ||
|
|
||||||
key.startsWith("CODEQL_")) {
|
|
||||||
info.env[key] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
exports.getTracerConfigForLanguage = getTracerConfigForLanguage;
|
|
||||||
function concatTracerConfigs(tracerConfigs, config, writeBothEnvironments = false) {
|
|
||||||
// A tracer config is a map containing additional environment variables and a tracer 'spec' file.
|
|
||||||
// A tracer 'spec' file has the following format [log_file, number_of_blocks, blocks_text]
|
|
||||||
// Merge the environments
|
|
||||||
const env = {};
|
|
||||||
let copyExecutables = false;
|
|
||||||
let envSize = 0;
|
|
||||||
for (const v of Object.values(tracerConfigs)) {
|
|
||||||
for (const e of Object.entries(v.env)) {
|
|
||||||
const name = e[0];
|
|
||||||
const value = e[1];
|
|
||||||
// skip SEMMLE_COPY_EXECUTABLES_ROOT as it is handled separately
|
|
||||||
if (name === "SEMMLE_COPY_EXECUTABLES_ROOT") {
|
|
||||||
copyExecutables = true;
|
|
||||||
}
|
|
||||||
else if (name in env) {
|
|
||||||
if (env[name] !== value) {
|
|
||||||
throw Error(`Incompatible values in environment parameter ${name}: ${env[name]} and ${value}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
env[name] = value;
|
|
||||||
envSize += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Concatenate spec files into a new spec file
|
|
||||||
const languages = Object.keys(tracerConfigs);
|
|
||||||
const cppIndex = languages.indexOf("cpp");
|
|
||||||
// Make sure cpp is the last language, if it's present since it must be concatenated last
|
|
||||||
if (cppIndex !== -1) {
|
|
||||||
const lastLang = languages[languages.length - 1];
|
|
||||||
languages[languages.length - 1] = languages[cppIndex];
|
|
||||||
languages[cppIndex] = lastLang;
|
|
||||||
}
|
|
||||||
const totalLines = [];
|
|
||||||
let totalCount = 0;
|
|
||||||
for (const lang of languages) {
|
|
||||||
const lines = fs
|
|
||||||
.readFileSync(tracerConfigs[lang].spec, "utf8")
|
|
||||||
.split(/\r?\n/);
|
|
||||||
const count = parseInt(lines[1], 10);
|
|
||||||
totalCount += count;
|
|
||||||
totalLines.push(...lines.slice(2));
|
|
||||||
}
|
|
||||||
const newLogFilePath = path.resolve(config.tempDir, "compound-build-tracer.log");
|
|
||||||
const spec = path.resolve(config.tempDir, "compound-spec");
|
|
||||||
const compoundTempFolder = path.resolve(config.tempDir, "compound-temp");
|
|
||||||
const newSpecContent = [
|
|
||||||
newLogFilePath,
|
|
||||||
totalCount.toString(10),
|
|
||||||
...totalLines,
|
|
||||||
];
|
|
||||||
if (copyExecutables) {
|
|
||||||
env["SEMMLE_COPY_EXECUTABLES_ROOT"] = compoundTempFolder;
|
|
||||||
envSize += 1;
|
|
||||||
}
|
|
||||||
fs.writeFileSync(spec, newSpecContent.join("\n"));
|
|
||||||
if (writeBothEnvironments || process.platform !== "win32") {
|
|
||||||
// Prepare the content of the compound environment file on Unix
|
|
||||||
let buffer = Buffer.alloc(4);
|
|
||||||
buffer.writeInt32LE(envSize, 0);
|
|
||||||
for (const e of Object.entries(env)) {
|
|
||||||
const key = e[0];
|
|
||||||
const value = e[1];
|
|
||||||
const lineBuffer = Buffer.from(`${key}=${value}\0`, "utf8");
|
|
||||||
const sizeBuffer = Buffer.alloc(4);
|
|
||||||
sizeBuffer.writeInt32LE(lineBuffer.length, 0);
|
|
||||||
buffer = Buffer.concat([buffer, sizeBuffer, lineBuffer]);
|
|
||||||
}
|
|
||||||
// Write the compound environment for Unix
|
|
||||||
const envPath = `${spec}.environment`;
|
|
||||||
fs.writeFileSync(envPath, buffer);
|
|
||||||
}
|
|
||||||
if (writeBothEnvironments || process.platform === "win32") {
|
|
||||||
// Prepare the content of the compound environment file on Windows
|
|
||||||
let bufferWindows = Buffer.alloc(0);
|
|
||||||
let length = 0;
|
|
||||||
for (const e of Object.entries(env)) {
|
|
||||||
const key = e[0];
|
|
||||||
const value = e[1];
|
|
||||||
const string = `${key}=${value}\0`;
|
|
||||||
length += string.length;
|
|
||||||
const lineBuffer = Buffer.from(string, "utf16le");
|
|
||||||
bufferWindows = Buffer.concat([bufferWindows, lineBuffer]);
|
|
||||||
}
|
|
||||||
const sizeBuffer = Buffer.alloc(4);
|
|
||||||
sizeBuffer.writeInt32LE(length + 1, 0); // Add one for trailing null character marking end
|
|
||||||
const trailingNull = Buffer.from(`\0`, "utf16le");
|
|
||||||
bufferWindows = Buffer.concat([sizeBuffer, bufferWindows, trailingNull]);
|
|
||||||
// Write the compound environment for Windows
|
|
||||||
const envPathWindows = `${spec}.win32env`;
|
|
||||||
fs.writeFileSync(envPathWindows, bufferWindows);
|
|
||||||
}
|
|
||||||
return { env, spec };
|
|
||||||
}
|
|
||||||
exports.concatTracerConfigs = concatTracerConfigs;
|
|
||||||
async function getCombinedTracerConfig(config, codeql) {
|
|
||||||
// Abort if there are no traced languages as there's nothing to do
|
// Abort if there are no traced languages as there's nothing to do
|
||||||
const tracedLanguages = config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l));
|
const tracedLanguages = config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l));
|
||||||
if (tracedLanguages.length === 0) {
|
if (tracedLanguages.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
let mainTracerConfig;
|
const mainTracerConfig = await getTracerConfigForCluster(config);
|
||||||
if (await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING)) {
|
|
||||||
mainTracerConfig = await getTracerConfigForCluster(config);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Get all the tracer configs and combine them together
|
|
||||||
const tracedLanguageConfigs = {};
|
|
||||||
for (const language of tracedLanguages) {
|
|
||||||
tracedLanguageConfigs[language] = await getTracerConfigForLanguage(codeql, config, language);
|
|
||||||
}
|
|
||||||
mainTracerConfig = concatTracerConfigs(tracedLanguageConfigs, config);
|
|
||||||
// Add a couple more variables
|
|
||||||
mainTracerConfig.env["ODASA_TRACER_CONFIGURATION"] = mainTracerConfig.spec;
|
|
||||||
const codeQLDir = path.dirname(codeql.getPath());
|
|
||||||
if (process.platform === "darwin") {
|
|
||||||
mainTracerConfig.env["DYLD_INSERT_LIBRARIES"] = path.join(codeQLDir, "tools", "osx64", "libtrace.dylib");
|
|
||||||
}
|
|
||||||
else if (process.platform !== "win32") {
|
|
||||||
mainTracerConfig.env["LD_PRELOAD"] = path.join(codeQLDir, "tools", "linux64", "${LIB}trace.so");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// On macos it's necessary to prefix the build command with the runner executable
|
// On macos it's necessary to prefix the build command with the runner executable
|
||||||
// on order to trace when System Integrity Protection is enabled.
|
// on order to trace when System Integrity Protection is enabled.
|
||||||
// The executable also exists and works for other platforms so we output this env
|
// The executable also exists and works for other platforms so we output this env
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user