mirror of
https://github.com/github/codeql-action.git
synced 2026-06-02 11:55:22 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b5b1699bc0 | |||
| e977f57489 | |||
| e42f82ead7 | |||
| 259a837405 | |||
| 9a2a2da304 | |||
| d39a4f6fac | |||
| 0eee1e99c7 |
@@ -1,4 +1,5 @@
|
|||||||
**/webpack.config.js
|
**/webpack.config.js
|
||||||
lib/**
|
lib/**
|
||||||
|
runner/dist/**
|
||||||
src/testdata/**
|
src/testdata/**
|
||||||
tests/**
|
tests/**
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ runs:
|
|||||||
packs: ${{ inputs.packs }}
|
packs: ${{ inputs.packs }}
|
||||||
tools: ${{ inputs.tools }}
|
tools: ${{ inputs.tools }}
|
||||||
db-location: ${{ runner.temp }}/codescanning-config-cli-test
|
db-location: ${{ runner.temp }}/codescanning-config-cli-test
|
||||||
env:
|
|
||||||
CODEQL_ACTION_TEST_MODE: 'true'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
@@ -35,14 +35,14 @@ runs:
|
|||||||
tools: ${{ inputs.tools }}
|
tools: ${{ inputs.tools }}
|
||||||
db-location: ${{ runner.temp }}/query-filter-test
|
db-location: ${{ runner.temp }}/query-filter-test
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: "true"
|
TEST_MODE: "true"
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
with:
|
with:
|
||||||
output: ${{ runner.temp }}/results
|
output: ${{ runner.temp }}/results
|
||||||
upload-database: false
|
upload-database: false
|
||||||
upload: false
|
upload: false
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: "true"
|
TEST_MODE: "true"
|
||||||
- name: Check SARIF
|
- name: Check SARIF
|
||||||
uses: ./../action/.github/check-sarif
|
uses: ./../action/.github/check-sarif
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import json
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
EMPTY_CHANGELOG = """# CodeQL Action Changelog
|
EMPTY_CHANGELOG = """# CodeQL Action and CodeQL Runner Changelog
|
||||||
|
|
||||||
## [UNRELEASED]
|
## [UNRELEASED]
|
||||||
|
|
||||||
|
|||||||
+16
-17
@@ -26,23 +26,23 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: windows-2019
|
- os: windows-2019
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: windows-2019
|
- os: windows-2019
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-20.04
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: windows-latest
|
- os: windows-2019
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -72,17 +72,14 @@ jobs:
|
|||||||
uses: ./.github/prepare-test
|
uses: ./.github/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ^1.13.1
|
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
languages: cpp,csharp,java,javascript,python
|
languages: cpp,csharp,java,javascript,python
|
||||||
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
|
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
|
||||||
github.sha }}
|
github.sha }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
@@ -91,4 +88,6 @@ jobs:
|
|||||||
ref: refs/heads/main
|
ref: refs/heads/main
|
||||||
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
|
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
TEST_MODE: true
|
||||||
|
env:
|
||||||
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
Generated
+5
-1
@@ -46,6 +46,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
languages: csharp
|
languages: csharp
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- uses: ./../action/autobuild
|
- uses: ./../action/autobuild
|
||||||
env:
|
env:
|
||||||
# Explicitly disable the CLR tracer.
|
# Explicitly disable the CLR tracer.
|
||||||
@@ -56,6 +58,8 @@ jobs:
|
|||||||
CORECLR_PROFILER: ''
|
CORECLR_PROFILER: ''
|
||||||
CORECLR_PROFILER_PATH_64: ''
|
CORECLR_PROFILER_PATH_64: ''
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Check database
|
- name: Check database
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -65,4 +69,4 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
+4
-8
@@ -42,17 +42,13 @@ jobs:
|
|||||||
uses: ./.github/prepare-test
|
uses: ./.github/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- uses: swift-actions/setup-swift@5cdaa9161ad1f55ae39a5ea1784ef96de72f95d9
|
|
||||||
if: runner.os != 'Windows'
|
|
||||||
with:
|
|
||||||
swift-version: '5.7'
|
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: javascript
|
languages: javascript
|
||||||
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
|
||||||
CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
@@ -61,7 +57,7 @@ jobs:
|
|||||||
output: ${{ runner.temp }}/results
|
output: ${{ runner.temp }}/results
|
||||||
env:
|
env:
|
||||||
CODEQL_FILE_BASELINE_INFORMATION: true
|
CODEQL_FILE_BASELINE_INFORMATION: true
|
||||||
CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: true
|
TEST_MODE: true
|
||||||
- name: Upload SARIF
|
- name: Upload SARIF
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
@@ -72,7 +68,7 @@ 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 csharp go java js python ruby"
|
||||||
|
|
||||||
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"
|
||||||
@@ -86,4 +82,4 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
+3
-1
@@ -43,6 +43,8 @@ jobs:
|
|||||||
languages: java
|
languages: java
|
||||||
ram: 230
|
ram: 230
|
||||||
threads: 1
|
threads: 1
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Assert Results
|
- name: Assert Results
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -63,4 +65,4 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
+17
-15
@@ -26,23 +26,23 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: windows-2019
|
- os: windows-2019
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: windows-2019
|
- os: windows-2019
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-20.04
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: windows-latest
|
- os: windows-2019
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -72,9 +72,7 @@ jobs:
|
|||||||
uses: ./.github/prepare-test
|
uses: ./.github/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
- uses: actions/setup-go@v3
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
with:
|
||||||
go-version: ^1.13.1
|
go-version: ^1.13.1
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
@@ -82,10 +80,14 @@ jobs:
|
|||||||
languages: go
|
languages: go
|
||||||
config-file: ./.github/codeql/custom-queries.yml
|
config-file: ./.github/codeql/custom-queries.yml
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
env:
|
env:
|
||||||
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
|
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
+18
-14
@@ -3,7 +3,7 @@
|
|||||||
# pip install ruamel.yaml && python3 sync.py
|
# pip install ruamel.yaml && python3 sync.py
|
||||||
# to regenerate this file.
|
# to regenerate this file.
|
||||||
|
|
||||||
name: 'PR Check - Go: tracing with legacy workflow'
|
name: 'PR Check - Go: Autobuild custom tracing'
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
GO111MODULE: auto
|
GO111MODULE: auto
|
||||||
@@ -21,22 +21,22 @@ on:
|
|||||||
- ready_for_review
|
- ready_for_review
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
jobs:
|
jobs:
|
||||||
go-tracing-legacy-workflow:
|
go-custom-tracing-autobuild:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-20.04
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -49,7 +49,7 @@ jobs:
|
|||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
name: 'Go: tracing with legacy workflow'
|
name: 'Go: Autobuild custom tracing'
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
@@ -60,16 +60,19 @@ jobs:
|
|||||||
uses: ./.github/prepare-test
|
uses: ./.github/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
- uses: actions/setup-go@v3
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
with:
|
||||||
go-version: ^1.13.1
|
go-version: ^1.13.1
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: go
|
languages: go
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
- uses: ./../action/autobuild
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- shell: bash
|
- shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd "$RUNNER_TEMP/codeql_databases"
|
cd "$RUNNER_TEMP/codeql_databases"
|
||||||
@@ -78,5 +81,6 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
|
CODEQL_EXTRACTOR_GO_BUILD_TRACING: on
|
||||||
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
|
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
+92
@@ -0,0 +1,92 @@
|
|||||||
|
# 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 - Go: Custom tracing'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GO111MODULE: auto
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- releases/v1
|
||||||
|
- releases/v2
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- ready_for_review
|
||||||
|
workflow_dispatch: {}
|
||||||
|
jobs:
|
||||||
|
go-custom-tracing:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
version: stable-20210308
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20210308
|
||||||
|
- os: windows-2019
|
||||||
|
version: stable-20210308
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
version: stable-20210319
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20210319
|
||||||
|
- os: windows-2019
|
||||||
|
version: stable-20210319
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
version: stable-20210809
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20210809
|
||||||
|
- os: windows-2019
|
||||||
|
version: stable-20210809
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: cached
|
||||||
|
- os: macos-latest
|
||||||
|
version: cached
|
||||||
|
- os: windows-latest
|
||||||
|
version: cached
|
||||||
|
- 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: 'Go: Custom tracing'
|
||||||
|
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: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: ^1.13.1
|
||||||
|
- uses: ./../action/init
|
||||||
|
with:
|
||||||
|
languages: go
|
||||||
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
- name: Build code
|
||||||
|
shell: bash
|
||||||
|
run: go build main.go
|
||||||
|
- uses: ./../action/analyze
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
env:
|
||||||
|
CODEQL_EXTRACTOR_GO_BUILD_TRACING: on
|
||||||
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
+17
-14
@@ -3,7 +3,7 @@
|
|||||||
# pip install ruamel.yaml && python3 sync.py
|
# pip install ruamel.yaml && python3 sync.py
|
||||||
# to regenerate this file.
|
# to regenerate this file.
|
||||||
|
|
||||||
name: 'PR Check - Go: tracing with autobuilder step'
|
name: 'PR Check - Go: Reconciled tracing with autobuilder'
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
GO111MODULE: auto
|
GO111MODULE: auto
|
||||||
@@ -21,22 +21,22 @@ on:
|
|||||||
- ready_for_review
|
- ready_for_review
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
jobs:
|
jobs:
|
||||||
go-tracing-autobuilder:
|
go-reconciled-tracing-autobuilder:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-20.04
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -49,7 +49,7 @@ jobs:
|
|||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
name: 'Go: tracing with autobuilder step'
|
name: 'Go: Reconciled tracing with autobuilder'
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
@@ -60,17 +60,19 @@ jobs:
|
|||||||
uses: ./.github/prepare-test
|
uses: ./.github/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
- uses: actions/setup-go@v3
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
with:
|
||||||
go-version: ^1.13.1
|
go-version: ^1.13.1
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: go
|
languages: go
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- uses: ./../action/autobuild
|
- uses: ./../action/autobuild
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- shell: bash
|
- shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then
|
if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then
|
||||||
@@ -84,5 +86,6 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
|
CODEQL_ACTION_RECONCILE_GO_EXTRACTION: 'true'
|
||||||
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
|
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
+30
-14
@@ -3,7 +3,7 @@
|
|||||||
# pip install ruamel.yaml && python3 sync.py
|
# pip install ruamel.yaml && python3 sync.py
|
||||||
# to regenerate this file.
|
# to regenerate this file.
|
||||||
|
|
||||||
name: 'PR Check - Go: tracing with custom build steps'
|
name: 'PR Check - Go: Reconciled tracing with custom build steps'
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
GO111MODULE: auto
|
GO111MODULE: auto
|
||||||
@@ -21,35 +21,47 @@ on:
|
|||||||
- ready_for_review
|
- ready_for_review
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
jobs:
|
jobs:
|
||||||
go-tracing-custom-build-steps:
|
go-reconciled-tracing-custom-build-steps:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
|
- os: windows-2019
|
||||||
|
version: stable-20210308
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: ubuntu-latest
|
- os: windows-2019
|
||||||
version: stable-20220401
|
version: stable-20210319
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
version: stable-20210809
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
|
- os: windows-2019
|
||||||
|
version: stable-20210809
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: cached
|
||||||
|
- os: windows-latest
|
||||||
|
version: cached
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: latest
|
version: latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: latest
|
version: latest
|
||||||
|
- os: windows-latest
|
||||||
|
version: latest
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
name: 'Go: tracing with custom build steps'
|
- os: windows-latest
|
||||||
|
version: nightly-latest
|
||||||
|
name: 'Go: Reconciled tracing with custom build steps'
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
@@ -60,19 +72,21 @@ jobs:
|
|||||||
uses: ./.github/prepare-test
|
uses: ./.github/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
- uses: actions/setup-go@v3
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
with:
|
||||||
go-version: ^1.13.1
|
go-version: ^1.13.1
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: go
|
languages: go
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: go build main.go
|
run: go build main.go
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- shell: bash
|
- shell: bash
|
||||||
run: |
|
run: |
|
||||||
# Once we start running Bash 4.2 in all environments, we can replace the
|
# Once we start running Bash 4.2 in all environments, we can replace the
|
||||||
@@ -89,4 +103,6 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
# Enable reconciled Go tracing beta functionality
|
||||||
|
CODEQL_ACTION_RECONCILE_GO_EXTRACTION: 'true'
|
||||||
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
+32
-20
@@ -3,7 +3,7 @@
|
|||||||
# pip install ruamel.yaml && python3 sync.py
|
# pip install ruamel.yaml && python3 sync.py
|
||||||
# to regenerate this file.
|
# to regenerate this file.
|
||||||
|
|
||||||
name: PR Check - Swift analysis using a custom build command
|
name: 'PR Check - Go: Reconciled tracing with legacy workflow'
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
GO111MODULE: auto
|
GO111MODULE: auto
|
||||||
@@ -21,23 +21,35 @@ on:
|
|||||||
- ready_for_review
|
- ready_for_review
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
jobs:
|
jobs:
|
||||||
swift-custom-build:
|
go-reconciled-tracing-legacy-workflow:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-20.04
|
||||||
version: latest
|
version: stable-20210308
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: latest
|
version: stable-20210308
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
version: stable-20210319
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20210319
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
version: stable-20210809
|
||||||
|
- os: macos-latest
|
||||||
|
version: stable-20210809
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: cached
|
version: cached
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: latest
|
||||||
|
- os: macos-latest
|
||||||
|
version: latest
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
name: Swift analysis using a custom build command
|
name: 'Go: Reconciled tracing with legacy workflow'
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
@@ -48,27 +60,27 @@ jobs:
|
|||||||
uses: ./.github/prepare-test
|
uses: ./.github/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- uses: swift-actions/setup-swift@5cdaa9161ad1f55ae39a5ea1784ef96de72f95d9
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
swift-version: '5.7'
|
go-version: ^1.13.1
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: swift
|
languages: go
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
- name: Build code
|
env:
|
||||||
shell: bash
|
TEST_MODE: true
|
||||||
run: ./build.sh
|
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
id: analysis
|
env:
|
||||||
- name: Check database
|
TEST_MODE: true
|
||||||
shell: bash
|
- shell: bash
|
||||||
run: |
|
run: |
|
||||||
SWIFT_DB="${{ fromJson(steps.analysis.outputs.db-locations).swift }}"
|
cd "$RUNNER_TEMP/codeql_databases"
|
||||||
if [[ ! -d "$SWIFT_DB" ]]; then
|
if [[ ! -d go ]]; then
|
||||||
echo "Did not create a database for Swift."
|
echo "Did not find a Go database"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true'
|
# Enable reconciled Go tracing beta functionality
|
||||||
|
CODEQL_ACTION_RECONCILE_GO_EXTRACTION: 'true'
|
||||||
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
|
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
+3
-1
@@ -54,6 +54,8 @@ jobs:
|
|||||||
packages: "*/*"
|
packages: "*/*"
|
||||||
token: "${{ secrets.GITHUB_TOKEN }}"
|
token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Verify packages installed
|
- name: Verify packages installed
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -76,4 +78,4 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
+3
-1
@@ -52,6 +52,8 @@ jobs:
|
|||||||
languages: javascript
|
languages: javascript
|
||||||
source-root: ../new-source-root
|
source-root: ../new-source-root
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
with:
|
with:
|
||||||
skip-queries: true
|
skip-queries: true
|
||||||
@@ -65,4 +67,4 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
+18
-13
@@ -25,11 +25,11 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-latest
|
||||||
version: stable-20220120
|
version: stable-20220120
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220120
|
version: stable-20220120
|
||||||
- os: windows-2019
|
- os: windows-latest
|
||||||
version: stable-20220120
|
version: stable-20220120
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
@@ -60,22 +60,21 @@ jobs:
|
|||||||
uses: ./.github/prepare-test
|
uses: ./.github/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ^1.13.1
|
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
languages: javascript
|
languages: javascript
|
||||||
queries: security-extended
|
queries: security-extended
|
||||||
source-root: ./../action/tests/ml-powered-queries-repo
|
source-root: ./../action/tests/ml-powered-queries-repo
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
with:
|
with:
|
||||||
output: ${{ runner.temp }}/results
|
output: ${{ runner.temp }}/results
|
||||||
upload-database: false
|
upload-database: false
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
- name: Upload SARIF
|
- name: Upload SARIF
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
@@ -86,18 +85,24 @@ jobs:
|
|||||||
|
|
||||||
- name: Check sarif
|
- name: Check sarif
|
||||||
uses: ./../action/.github/check-sarif
|
uses: ./../action/.github/check-sarif
|
||||||
# Running on Windows requires CodeQL CLI 2.9.0+.
|
if: matrix.os != 'windows-latest' || matrix.version == 'latest' || matrix.version
|
||||||
if: "!(matrix.version == 'stable-20220120' && runner.os == 'Windows')"
|
== 'nightly-latest'
|
||||||
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
|
||||||
|
# Running ML-powered queries on Windows requires CodeQL CLI 2.9.0+. We don't run these checks
|
||||||
|
# against Windows and `cached` while CodeQL CLI 2.9.0 makes its way into `cached` to avoid the
|
||||||
|
# test starting to fail when the cached CodeQL Bundle gets updated. Once the CodeQL Bundle
|
||||||
|
# containing CodeQL CLI 2.9.0 has been fully released, we can drop this line and start running
|
||||||
|
# these checks on Windows and `cached`.
|
||||||
|
if: matrix.os != 'windows-latest' || matrix.version != 'cached'
|
||||||
env:
|
env:
|
||||||
# Running on Windows requires CodeQL CLI 2.9.0+.
|
# Running on Windows requires CodeQL CLI 2.9.0+, which has so far only made it to 'latest'.
|
||||||
SHOULD_RUN_ML_POWERED_QUERIES: ${{ !(matrix.version == 'stable-20220120' &&
|
SHOULD_RUN_ML_POWERED_QUERIES: ${{ matrix.os != 'windows-latest' || matrix.version
|
||||||
runner.os == 'Windows') }}
|
== 'latest' || matrix.version == 'nightly-latest' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "Expecting ML-powered queries to be run: ${SHOULD_RUN_ML_POWERED_QUERIES}"
|
echo "Expecting ML-powered queries to be run: ${SHOULD_RUN_ML_POWERED_QUERIES}"
|
||||||
@@ -132,4 +137,4 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
+13
-46
@@ -26,17 +26,17 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-20.04
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -60,30 +60,20 @@ jobs:
|
|||||||
uses: ./.github/prepare-test
|
uses: ./.github/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ^1.13.1
|
|
||||||
- uses: swift-actions/setup-swift@5cdaa9161ad1f55ae39a5ea1784ef96de72f95d9
|
|
||||||
if: runner.os != 'Windows'
|
|
||||||
with:
|
|
||||||
swift-version: '5.7'
|
|
||||||
|
|
||||||
- uses: ./../action/init
|
- uses: ./../action/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 }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
|
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
id: analysis
|
id: analysis
|
||||||
|
env:
|
||||||
- name: Check language autodetect for all languages excluding Ruby, Swift
|
TEST_MODE: true
|
||||||
shell: bash
|
- shell: bash
|
||||||
run: |
|
run: |
|
||||||
CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }}
|
CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }}
|
||||||
if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
||||||
@@ -115,28 +105,5 @@ jobs:
|
|||||||
echo "Did not create a database for Python, or created it in the wrong location."
|
echo "Did not create a database for Python, or created it in the wrong location."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Check language autodetect for Ruby
|
|
||||||
if: (matrix.version == 'cached' || matrix.version == 'latest' || matrix.version
|
|
||||||
== 'nightly-latest')
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
RUBY_DB=${{ fromJson(steps.analysis.outputs.db-locations).ruby }}
|
|
||||||
if [[ ! -d $RUBY_DB ]] || [[ ! $RUBY_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
|
||||||
echo "Did not create a database for Ruby, or created it in the wrong location."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Check language autodetect for Swift
|
|
||||||
if: "!startsWith(matrix.os, 'windows') && (matrix.version == 'cached' || matrix.version\
|
|
||||||
\ == 'latest' || matrix.version == 'nightly-latest')"
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }}
|
|
||||||
if [[ ! -d $SWIFT_DB ]] || [[ ! $SWIFT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
|
||||||
echo "Did not create a database for Swift, or created it in the wrong location."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
env:
|
env:
|
||||||
CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT: 'true' # Remove when Swift is GA.
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
|
||||||
|
|||||||
@@ -60,12 +60,16 @@ jobs:
|
|||||||
packs: +dsp-testing/codeql-pack1@1.0.0
|
packs: +dsp-testing/codeql-pack1@1.0.0
|
||||||
languages: javascript
|
languages: javascript
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
with:
|
with:
|
||||||
output: ${{ runner.temp }}/results
|
output: ${{ runner.temp }}/results
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
- name: Check results
|
- name: Check results
|
||||||
uses: ./../action/.github/check-sarif
|
uses: ./../action/.github/check-sarif
|
||||||
@@ -91,4 +95,4 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
CODEQL_PASS_CONFIG_TO_CLI: true
|
CODEQL_PASS_CONFIG_TO_CLI: true
|
||||||
|
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
+5
-1
@@ -60,12 +60,16 @@ jobs:
|
|||||||
packs: +dsp-testing/codeql-pack1@1.0.0
|
packs: +dsp-testing/codeql-pack1@1.0.0
|
||||||
languages: javascript
|
languages: javascript
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
with:
|
with:
|
||||||
output: ${{ runner.temp }}/results
|
output: ${{ runner.temp }}/results
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
- name: Check results
|
- name: Check results
|
||||||
uses: ./../action/.github/check-sarif
|
uses: ./../action/.github/check-sarif
|
||||||
@@ -89,4 +93,4 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
+5
-1
@@ -59,12 +59,16 @@ jobs:
|
|||||||
config-file: .github/codeql/codeql-config-packaging.yml
|
config-file: .github/codeql/codeql-config-packaging.yml
|
||||||
languages: javascript
|
languages: javascript
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
with:
|
with:
|
||||||
output: ${{ runner.temp }}/results
|
output: ${{ runner.temp }}/results
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
- name: Check results
|
- name: Check results
|
||||||
uses: ./../action/.github/check-sarif
|
uses: ./../action/.github/check-sarif
|
||||||
@@ -88,4 +92,4 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
+5
-1
@@ -60,12 +60,16 @@ jobs:
|
|||||||
languages: javascript
|
languages: javascript
|
||||||
packs: dsp-testing/codeql-pack1@1.0.0, dsp-testing/codeql-pack2, dsp-testing/codeql-pack3:other-query.ql
|
packs: dsp-testing/codeql-pack1@1.0.0, dsp-testing/codeql-pack2, dsp-testing/codeql-pack3:other-query.ql
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
with:
|
with:
|
||||||
output: ${{ runner.temp }}/results
|
output: ${{ runner.temp }}/results
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
- name: Check results
|
- name: Check results
|
||||||
uses: ./../action/.github/check-sarif
|
uses: ./../action/.github/check-sarif
|
||||||
@@ -89,4 +93,4 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
Generated
+16
-17
@@ -26,23 +26,23 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: windows-2019
|
- os: windows-2019
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: windows-2019
|
- os: windows-2019
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-20.04
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: windows-latest
|
- os: windows-2019
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -72,20 +72,19 @@ jobs:
|
|||||||
uses: ./.github/prepare-test
|
uses: ./.github/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ^1.13.1
|
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
languages: cpp,csharp,java,javascript,python
|
languages: cpp,csharp,java,javascript,python
|
||||||
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
|
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
|
||||||
github.sha }}
|
github.sha }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
TEST_MODE: true
|
||||||
|
env:
|
||||||
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
+3
-1
@@ -59,4 +59,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
sarif_file: rubocop.sarif
|
sarif_file: rubocop.sarif
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
TEST_MODE: true
|
||||||
|
env:
|
||||||
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
Generated
+7
-1
@@ -54,6 +54,8 @@ jobs:
|
|||||||
packs: +dsp-testing/codeql-pack1@1.0.0
|
packs: +dsp-testing/codeql-pack1@1.0.0
|
||||||
languages: javascript
|
languages: javascript
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
@@ -61,6 +63,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
skip-queries: true
|
skip-queries: true
|
||||||
output: ${{ runner.temp }}/results
|
output: ${{ runner.temp }}/results
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
- name: Assert No Results
|
- name: Assert No Results
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -73,6 +77,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
output: ${{ runner.temp }}/results
|
output: ${{ runner.temp }}/results
|
||||||
upload-database: false
|
upload-database: false
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Assert Results
|
- name: Assert Results
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -88,4 +94,4 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
Generated
-65
@@ -1,65 +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
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- releases/v1
|
|
||||||
- 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: swift-actions/setup-swift@5cdaa9161ad1f55ae39a5ea1784ef96de72f95d9
|
|
||||||
with:
|
|
||||||
swift-version: '5.7'
|
|
||||||
- uses: ./../action/init
|
|
||||||
with:
|
|
||||||
languages: swift
|
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
|
||||||
- uses: ./../action/autobuild
|
|
||||||
- uses: ./../action/analyze
|
|
||||||
id: analysis
|
|
||||||
- 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'
|
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
|
||||||
+5
-1
@@ -49,10 +49,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
languages: java
|
languages: java
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- uses: ./../action/autobuild
|
- uses: ./../action/autobuild
|
||||||
with:
|
with:
|
||||||
working-directory: autobuild-dir
|
working-directory: autobuild-dir
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Check database
|
- name: Check database
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -62,4 +66,4 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
+5
-1
@@ -47,9 +47,13 @@ jobs:
|
|||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
tools: ./codeql-bundle.tar.gz
|
tools: ./codeql-bundle.tar.gz
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
TEST_MODE: true
|
||||||
|
env:
|
||||||
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
Generated
+5
-1
@@ -42,10 +42,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
languages: javascript
|
languages: javascript
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
env:
|
env:
|
||||||
https_proxy: http://squid-proxy:3128
|
https_proxy: http://squid-proxy:3128
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
container:
|
container:
|
||||||
image: ubuntu:22.04
|
image: ubuntu:22.04
|
||||||
options: --dns 127.0.0.1
|
options: --dns 127.0.0.1
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ on:
|
|||||||
- ready_for_review
|
- ready_for_review
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
jobs:
|
jobs:
|
||||||
ruby:
|
test-ruby:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
@@ -52,8 +52,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
languages: ruby
|
languages: ruby
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
id: analysis
|
id: analysis
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Check database
|
- name: Check database
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -63,4 +67,5 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
CODEQL_ENABLE_EXPERIMENTAL_FEATURES: 'true'
|
||||||
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
+18
-17
@@ -26,23 +26,23 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: windows-2019
|
- os: windows-2019
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: windows-2019
|
- os: windows-2019
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-20.04
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: windows-latest
|
- os: windows-2019
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -72,17 +72,14 @@ jobs:
|
|||||||
uses: ./.github/prepare-test
|
uses: ./.github/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ^1.13.1
|
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
languages: cpp,csharp,java,javascript,python
|
languages: cpp,csharp,java,javascript,python
|
||||||
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
|
config-file: ${{ github.repository }}/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
|
||||||
github.sha }}
|
github.sha }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
@@ -91,9 +88,13 @@ jobs:
|
|||||||
ref: refs/heads/main
|
ref: refs/heads/main
|
||||||
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
|
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
|
||||||
upload: false
|
upload: false
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- uses: ./../action/upload-sarif
|
- uses: ./../action/upload-sarif
|
||||||
with:
|
with:
|
||||||
ref: refs/heads/main
|
ref: refs/heads/main
|
||||||
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
|
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
TEST_MODE: true
|
||||||
|
env:
|
||||||
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
+18
-17
@@ -26,23 +26,23 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: windows-2019
|
- os: windows-2019
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: windows-2019
|
- os: windows-2019
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-20.04
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: windows-latest
|
- os: windows-2019
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -72,11 +72,6 @@ jobs:
|
|||||||
uses: ./.github/prepare-test
|
uses: ./.github/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ^1.13.1
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
|
ref: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
|
||||||
@@ -88,6 +83,8 @@ jobs:
|
|||||||
languages: csharp,javascript
|
languages: csharp,javascript
|
||||||
source-path: x/y/z/some-path/tests/multi-language-repo
|
source-path: x/y/z/some-path/tests/multi-language-repo
|
||||||
debug: true
|
debug: true
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code (non-windows)
|
- name: Build code (non-windows)
|
||||||
shell: bash
|
shell: bash
|
||||||
if: ${{ runner.os != 'Windows' }}
|
if: ${{ runner.os != 'Windows' }}
|
||||||
@@ -104,12 +101,16 @@ jobs:
|
|||||||
ref: v1.1.0
|
ref: v1.1.0
|
||||||
sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
|
sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
|
||||||
upload: false
|
upload: false
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
- uses: ./../action/upload-sarif
|
- uses: ./../action/upload-sarif
|
||||||
with:
|
with:
|
||||||
ref: v1.1.0
|
ref: v1.1.0
|
||||||
sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
|
sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
|
||||||
checkout_path: x/y/z/some-path/tests/multi-language-repo
|
checkout_path: x/y/z/some-path/tests/multi-language-repo
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
- name: Verify SARIF after upload
|
- name: Verify SARIF after upload
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -140,4 +141,4 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ on:
|
|||||||
# by other workflows.
|
# by other workflows.
|
||||||
types: [opened, synchronize, reopened, ready_for_review]
|
types: [opened, synchronize, reopened, ready_for_review]
|
||||||
|
|
||||||
env:
|
|
||||||
CODEQL_ACTION_TESTING_ENVIRONMENT: codeql-action-pr-checks
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Identify the CodeQL tool versions to use in the analysis job.
|
# Identify the CodeQL tool versions to use in the analysis job.
|
||||||
check-codeql-versions:
|
check-codeql-versions:
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ jobs:
|
|||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest]
|
||||||
name: Upload debug artifacts after failure in analyze
|
name: Upload debug artifacts after failure in analyze
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
env:
|
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
@@ -37,15 +35,14 @@ jobs:
|
|||||||
uses: ./.github/prepare-test
|
uses: ./.github/prepare-test
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ^1.13.1
|
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
debug: true
|
debug: true
|
||||||
debug-artifact-name: my-debug-artifacts
|
debug-artifact-name: my-debug-artifacts
|
||||||
debug-database-name: my-db
|
debug-database-name: my-db
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
@@ -54,6 +51,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
expect-error: true
|
expect-error: true
|
||||||
ram: 1
|
ram: 1
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
download-and-check-artifacts:
|
download-and-check-artifacts:
|
||||||
name: Download and check debug artifacts after failure in analyze
|
name: Download and check debug artifacts after failure in analyze
|
||||||
needs: upload-artifacts
|
needs: upload-artifacts
|
||||||
@@ -88,4 +87,4 @@ jobs:
|
|||||||
popd
|
popd
|
||||||
done
|
done
|
||||||
env:
|
env:
|
||||||
GO111MODULE: auto
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
|
|||||||
@@ -21,17 +21,17 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20211005
|
version: stable-20210308
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220120
|
version: stable-20210319
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-20.04
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: stable-20220401
|
version: stable-20210809
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
@@ -45,8 +45,6 @@ jobs:
|
|||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
version: nightly-latest
|
version: nightly-latest
|
||||||
name: Upload debug artifacts
|
name: Upload debug artifacts
|
||||||
env:
|
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
@@ -57,20 +55,21 @@ jobs:
|
|||||||
uses: ./.github/prepare-test
|
uses: ./.github/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ^1.13.1
|
|
||||||
- uses: ./../action/init
|
- uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
debug: true
|
debug: true
|
||||||
debug-artifact-name: my-debug-artifacts
|
debug-artifact-name: my-debug-artifacts
|
||||||
debug-database-name: my-db
|
debug-database-name: my-db
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
id: analysis
|
id: analysis
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
download-and-check-artifacts:
|
download-and-check-artifacts:
|
||||||
name: Download and check debug artifacts
|
name: Download and check debug artifacts
|
||||||
needs: upload-artifacts
|
needs: upload-artifacts
|
||||||
@@ -82,10 +81,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-20210308 stable-20210319 stable-20210809 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
|
if [[ "$version" =~ stable-(20210308|20210319|20210809) ]]; then
|
||||||
# Note the absence of the period in "ubuntu-2004": this is present in the image name
|
# Note the absence of the period in "ubuntu-2004": this is present in the image name
|
||||||
# but not the artifact name
|
# but not the artifact name
|
||||||
OPERATING_SYSTEMS="ubuntu-2004 macos-latest"
|
OPERATING_SYSTEMS="ubuntu-2004 macos-latest"
|
||||||
@@ -114,4 +113,4 @@ jobs:
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
env:
|
env:
|
||||||
GO111MODULE: auto
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
@@ -17,8 +17,6 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
expected-queries:
|
expected-queries:
|
||||||
name: Expected Queries Tests
|
name: Expected Queries Tests
|
||||||
env:
|
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -33,11 +31,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
languages: javascript
|
languages: javascript
|
||||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
with:
|
with:
|
||||||
output: ${{ runner.temp }}/results
|
output: ${{ runner.temp }}/results
|
||||||
upload-database: false
|
upload-database: false
|
||||||
upload: false
|
upload: false
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
- name: Check Sarif
|
- name: Check Sarif
|
||||||
uses: ./../action/.github/check-sarif
|
uses: ./../action/.github/check-sarif
|
||||||
|
|||||||
@@ -148,7 +148,6 @@ jobs:
|
|||||||
python_deps_type: pipenv
|
python_deps_type: pipenv
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
|
||||||
PYTHON_DEPS_TYPE: ${{ matrix.python_deps_type }}
|
PYTHON_DEPS_TYPE: ${{ matrix.python_deps_type }}
|
||||||
PYTHON_VERSION: ${{ matrix.python_version }}
|
PYTHON_VERSION: ${{ matrix.python_version }}
|
||||||
|
|
||||||
@@ -166,6 +165,8 @@ jobs:
|
|||||||
tools: latest
|
tools: latest
|
||||||
languages: python
|
languages: python
|
||||||
setup-python-dependencies: false
|
setup-python-dependencies: false
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
- name: Test Auto Package Installation
|
- name: Test Auto Package Installation
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -0,0 +1,412 @@
|
|||||||
|
name: CodeQL Runner Checks
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, releases/v1, releases/v2]
|
||||||
|
pull_request:
|
||||||
|
# Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened
|
||||||
|
# by other workflows.
|
||||||
|
types: [opened, synchronize, reopened, ready_for_review]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
runner-analyze-javascript-ubuntu:
|
||||||
|
name: Runner ubuntu JS analyze
|
||||||
|
|
||||||
|
timeout-minutes: 45
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Build runner
|
||||||
|
run: |
|
||||||
|
cd runner
|
||||||
|
npm install
|
||||||
|
npm run build-runner
|
||||||
|
|
||||||
|
- name: Run init
|
||||||
|
run: |
|
||||||
|
# Pass --config-file here, but not for other jobs in this workflow.
|
||||||
|
# This means we're testing the config file parsing in the runner
|
||||||
|
# but not slowing down all jobs unnecessarily as it doesn't add much
|
||||||
|
# testing the parsing on different operating systems and languages.
|
||||||
|
runner/dist/codeql-runner-linux init --repository $GITHUB_REPOSITORY --languages javascript --config-file ./.github/codeql/codeql-config.yml --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
- name: Run analyze
|
||||||
|
run: |
|
||||||
|
runner/dist/codeql-runner-linux analyze --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
runner-analyze-javascript-windows:
|
||||||
|
name: Runner windows JS analyze
|
||||||
|
timeout-minutes: 45
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Build runner
|
||||||
|
run: |
|
||||||
|
cd runner
|
||||||
|
npm install
|
||||||
|
npm run build-runner
|
||||||
|
|
||||||
|
- name: Run init
|
||||||
|
run: |
|
||||||
|
runner/dist/codeql-runner-win.exe init --repository $Env:GITHUB_REPOSITORY --languages javascript --github-url $Env:GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
- name: Run analyze
|
||||||
|
run: |
|
||||||
|
runner/dist/codeql-runner-win.exe analyze --repository $Env:GITHUB_REPOSITORY --commit $Env:GITHUB_SHA --ref $Env:GITHUB_REF --github-url $Env:GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
runner-analyze-javascript-macos:
|
||||||
|
name: Runner macos JS analyze
|
||||||
|
timeout-minutes: 45
|
||||||
|
runs-on: macos-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Build runner
|
||||||
|
run: |
|
||||||
|
cd runner
|
||||||
|
npm install
|
||||||
|
npm run build-runner
|
||||||
|
|
||||||
|
- name: Run init
|
||||||
|
run: |
|
||||||
|
runner/dist/codeql-runner-macos init --repository $GITHUB_REPOSITORY --languages javascript --config-file ./.github/codeql/codeql-config.yml --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
- name: Run analyze
|
||||||
|
run: |
|
||||||
|
runner/dist/codeql-runner-macos analyze --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
runner-analyze-csharp-ubuntu:
|
||||||
|
name: Runner ubuntu C# analyze
|
||||||
|
timeout-minutes: 45
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Move codeql-action
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir ../action
|
||||||
|
mv * .github ../action/
|
||||||
|
mv ../action/tests/multi-language-repo/{*,.github} .
|
||||||
|
mv ../action/.github/workflows .github
|
||||||
|
|
||||||
|
- name: Build runner
|
||||||
|
run: |
|
||||||
|
cd ../action/runner
|
||||||
|
npm install
|
||||||
|
npm run build-runner
|
||||||
|
|
||||||
|
- name: Run init
|
||||||
|
run: |
|
||||||
|
../action/runner/dist/codeql-runner-linux init --repository $GITHUB_REPOSITORY --languages csharp --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
- name: Build code
|
||||||
|
run: |
|
||||||
|
. ./codeql-runner/codeql-env.sh
|
||||||
|
$CODEQL_RUNNER dotnet build /p:UseSharedCompilation=false
|
||||||
|
|
||||||
|
- name: Run analyze
|
||||||
|
run: |
|
||||||
|
../action/runner/dist/codeql-runner-linux analyze --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
runner-analyze-csharp-windows:
|
||||||
|
name: Runner windows C# analyze
|
||||||
|
|
||||||
|
# Build tracing currently does not support Windows 2022, so use `windows-2019` instead of
|
||||||
|
# `windows-latest`.
|
||||||
|
timeout-minutes: 45
|
||||||
|
runs-on: windows-2019
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Move codeql-action
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir ../action
|
||||||
|
mv * .github ../action/
|
||||||
|
mv ../action/tests/multi-language-repo/{*,.github} .
|
||||||
|
mv ../action/.github/workflows .github
|
||||||
|
|
||||||
|
- name: Build runner
|
||||||
|
run: |
|
||||||
|
cd ../action/runner
|
||||||
|
npm install
|
||||||
|
npm run build-runner
|
||||||
|
|
||||||
|
- name: Run init
|
||||||
|
run: |
|
||||||
|
../action/runner/dist/codeql-runner-win.exe init --repository $Env:GITHUB_REPOSITORY --languages csharp --github-url $Env:GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
- name: Build code
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
cat ./codeql-runner/codeql-env.sh | Invoke-Expression
|
||||||
|
& $Env:CODEQL_RUNNER dotnet build /p:UseSharedCompilation=false
|
||||||
|
|
||||||
|
- name: Upload tracer logs
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: tracer-logs
|
||||||
|
path: ./codeql-runner/compound-build-tracer.log
|
||||||
|
|
||||||
|
- name: Run analyze
|
||||||
|
run: |
|
||||||
|
../action/runner/dist/codeql-runner-win.exe analyze --repository $Env:GITHUB_REPOSITORY --commit $Env:GITHUB_SHA --ref $Env:GITHUB_REF --github-url $Env:GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
runner-analyze-csharp-macos:
|
||||||
|
name: Runner macos C# analyze
|
||||||
|
timeout-minutes: 45
|
||||||
|
|
||||||
|
runs-on: macos-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Move codeql-action
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir ../action
|
||||||
|
mv * .github ../action/
|
||||||
|
mv ../action/tests/multi-language-repo/{*,.github} .
|
||||||
|
mv ../action/.github/workflows .github
|
||||||
|
|
||||||
|
- name: Build runner
|
||||||
|
run: |
|
||||||
|
cd ../action/runner
|
||||||
|
npm install
|
||||||
|
npm run build-runner
|
||||||
|
|
||||||
|
- name: Run init
|
||||||
|
run: |
|
||||||
|
../action/runner/dist/codeql-runner-macos init --repository $GITHUB_REPOSITORY --languages csharp --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
- name: Build code
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
. ./codeql-runner/codeql-env.sh
|
||||||
|
$CODEQL_RUNNER dotnet build /p:UseSharedCompilation=false
|
||||||
|
|
||||||
|
- name: Run analyze
|
||||||
|
run: |
|
||||||
|
../action/runner/dist/codeql-runner-macos analyze --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
runner-analyze-csharp-autobuild-ubuntu:
|
||||||
|
name: Runner ubuntu autobuild C# analyze
|
||||||
|
timeout-minutes: 45
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Move codeql-action
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir ../action
|
||||||
|
mv * .github ../action/
|
||||||
|
mv ../action/tests/multi-language-repo/{*,.github} .
|
||||||
|
mv ../action/.github/workflows .github
|
||||||
|
|
||||||
|
- name: Build runner
|
||||||
|
run: |
|
||||||
|
cd ../action/runner
|
||||||
|
npm install
|
||||||
|
npm run build-runner
|
||||||
|
|
||||||
|
- name: Run init
|
||||||
|
run: |
|
||||||
|
../action/runner/dist/codeql-runner-linux init --repository $GITHUB_REPOSITORY --languages csharp --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
- name: Build code
|
||||||
|
run: |
|
||||||
|
../action/runner/dist/codeql-runner-linux autobuild
|
||||||
|
|
||||||
|
- name: Run analyze
|
||||||
|
run: |
|
||||||
|
../action/runner/dist/codeql-runner-linux analyze --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
runner-analyze-csharp-autobuild-windows:
|
||||||
|
timeout-minutes: 45
|
||||||
|
name: Runner windows autobuild C# analyze
|
||||||
|
|
||||||
|
# Build tracing currently does not support Windows 2022, so use `windows-2019` instead of
|
||||||
|
# `windows-latest`.
|
||||||
|
runs-on: windows-2019
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Move codeql-action
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir ../action
|
||||||
|
mv * .github ../action/
|
||||||
|
mv ../action/tests/multi-language-repo/{*,.github} .
|
||||||
|
mv ../action/.github/workflows .github
|
||||||
|
|
||||||
|
- name: Build runner
|
||||||
|
run: |
|
||||||
|
cd ../action/runner
|
||||||
|
npm install
|
||||||
|
npm run build-runner
|
||||||
|
|
||||||
|
- name: Run init
|
||||||
|
run: |
|
||||||
|
../action/runner/dist/codeql-runner-win.exe init --repository $Env:GITHUB_REPOSITORY --languages csharp --github-url $Env:GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
- name: Build code
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
../action/runner/dist/codeql-runner-win.exe autobuild
|
||||||
|
|
||||||
|
- name: Run analyze
|
||||||
|
run: |
|
||||||
|
../action/runner/dist/codeql-runner-win.exe analyze --repository $Env:GITHUB_REPOSITORY --commit $Env:GITHUB_SHA --ref $Env:GITHUB_REF --github-url $Env:GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
runner-analyze-csharp-autobuild-macos:
|
||||||
|
name: Runner macos autobuild C# analyze
|
||||||
|
|
||||||
|
runs-on: macos-latest
|
||||||
|
timeout-minutes: 45
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Move codeql-action
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir ../action
|
||||||
|
mv * .github ../action/
|
||||||
|
mv ../action/tests/multi-language-repo/{*,.github} .
|
||||||
|
mv ../action/.github/workflows .github
|
||||||
|
|
||||||
|
- name: Build runner
|
||||||
|
run: |
|
||||||
|
cd ../action/runner
|
||||||
|
npm install
|
||||||
|
npm run build-runner
|
||||||
|
|
||||||
|
- name: Run init
|
||||||
|
run: |
|
||||||
|
../action/runner/dist/codeql-runner-macos init --repository $GITHUB_REPOSITORY --languages csharp --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
- name: Build code
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
. codeql-runner/codeql-env.sh
|
||||||
|
CODEQL_RUNNER="$(cat codeql-runner/codeql-env.json | jq -r '.CODEQL_RUNNER')"
|
||||||
|
echo "$CODEQL_RUNNER"
|
||||||
|
$CODEQL_RUNNER ../action/runner/dist/codeql-runner-macos autobuild
|
||||||
|
|
||||||
|
- name: Run analyze
|
||||||
|
run: |
|
||||||
|
../action/runner/dist/codeql-runner-macos analyze --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
runner-upload-sarif:
|
||||||
|
name: Runner upload sarif
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 45
|
||||||
|
|
||||||
|
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Build runner
|
||||||
|
run: |
|
||||||
|
cd runner
|
||||||
|
npm install
|
||||||
|
npm run build-runner
|
||||||
|
|
||||||
|
- name: Upload with runner
|
||||||
|
run: |
|
||||||
|
# Deliberately don't use TEST_MODE here. This is specifically testing
|
||||||
|
# the compatibility with the API.
|
||||||
|
runner/dist/codeql-runner-linux upload --sarif-file src/testdata/empty-sarif.sarif --repository $GITHUB_REPOSITORY --commit $GITHUB_SHA --ref $GITHUB_REF --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
|
||||||
|
runner-extractor-ram-threads-options:
|
||||||
|
name: Runner ubuntu extractor RAM and threads options
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 45
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Build runner
|
||||||
|
run: |
|
||||||
|
cd runner
|
||||||
|
npm install
|
||||||
|
npm run build-runner
|
||||||
|
|
||||||
|
- name: Run init
|
||||||
|
run: |
|
||||||
|
runner/dist/codeql-runner-linux init --ram=230 --threads=1 --repository $GITHUB_REPOSITORY --languages java --github-url $GITHUB_SERVER_URL --github-auth ${{ github.token }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
|
||||||
|
- name: Assert Results
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
. ./codeql-runner/codeql-env.sh
|
||||||
|
if [ "${CODEQL_RAM}" != "230" ]; then
|
||||||
|
echo "CODEQL_RAM is '${CODEQL_RAM}' instead of 230"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ "${CODEQL_EXTRACTOR_JAVA_RAM}" != "230" ]; then
|
||||||
|
echo "CODEQL_EXTRACTOR_JAVA_RAM is '${CODEQL_EXTRACTOR_JAVA_RAM}' instead of 230"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ "${CODEQL_THREADS}" != "1" ]; then
|
||||||
|
echo "CODEQL_THREADS is '${CODEQL_THREADS}' instead of 1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ "${CODEQL_EXTRACTOR_JAVA_THREADS}" != "1" ]; then
|
||||||
|
echo "CODEQL_EXTRACTOR_JAVA_THREADS is '${CODEQL_EXTRACTOR_JAVA_THREADS}' instead of 1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
@@ -7,10 +7,7 @@ if [ ! -z "$(git status --porcelain)" ]; then
|
|||||||
>&2 echo "Failed: Repo should be clean before testing!"
|
>&2 echo "Failed: Repo should be clean before testing!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# Pin npm to v8 since v9 doesn't support Node 12.
|
sudo npm install --force -g npm@8.19.2
|
||||||
# When updating this, make sure to update the npm version in
|
|
||||||
# `.github/workflows/update-dependencies.yml` too.
|
|
||||||
sudo npm install --force -g npm@^8.19.3
|
|
||||||
# Reinstall modules and then clean to remove absolute paths
|
# Reinstall modules and then clean to remove absolute paths
|
||||||
# Use 'npm ci' instead of 'npm install' as this is intended to be reproducible
|
# Use 'npm ci' instead of 'npm install' as this is intended to be reproducible
|
||||||
npm ci
|
npm ci
|
||||||
@@ -18,7 +15,7 @@ npm run removeNPMAbsolutePaths
|
|||||||
# Check that repo is still clean
|
# Check that repo is still clean
|
||||||
if [ ! -z "$(git status --porcelain)" ]; then
|
if [ ! -z "$(git status --porcelain)" ]; then
|
||||||
# If we get a fail here then the PR needs attention
|
# If we get a fail here then the PR needs attention
|
||||||
>&2 echo "Failed: node_modules are not up to date. Add the 'Update dependencies' label to your PR to update them. Note it is important that node modules are updated on macOS and not any other operating system as there is one dependency (fsevents) that is needed for macOS and may not be installed if dependencies are updated on a Windows or Linux machine."
|
>&2 echo "Failed: node_modules are not up to date. Run 'npm ci && npm run removeNPMAbsolutePaths' on a macOS machine to update and commit. Note it is important this command is run on macOS and not any other operating system as there is one dependency (fsevents) that is needed for macOS and may not be installed if the command is run on a Windows or Linux machine. If there are no changes, run 'npm install --force -g npm@8.19.2' with root permissions first."
|
||||||
git status
|
git status
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
+8
-17
@@ -1,9 +1,5 @@
|
|||||||
# Warning: This file is generated automatically, and should not be modified.
|
# See `unset-environment-old-cli.yml` for reasoning behind the separate tests.
|
||||||
# Instead, please modify the template in the pr-checks directory and run:
|
name: PR Check - Test unsetting environment variables for CLI version >= 2.5.1
|
||||||
# pip install ruamel.yaml && python3 sync.py
|
|
||||||
# to regenerate this file.
|
|
||||||
|
|
||||||
name: PR Check - Test unsetting environment variables
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
GO111MODULE: auto
|
GO111MODULE: auto
|
||||||
@@ -26,11 +22,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
version: stable-20211005
|
version: stable-20210809
|
||||||
- os: ubuntu-20.04
|
|
||||||
version: stable-20220120
|
|
||||||
- os: ubuntu-latest
|
|
||||||
version: stable-20220401
|
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
version: cached
|
version: cached
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
@@ -48,20 +40,19 @@ jobs:
|
|||||||
uses: ./.github/prepare-test
|
uses: ./.github/prepare-test
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
- name: Set up Go
|
|
||||||
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ^1.13.1
|
|
||||||
- uses: ./../action/init
|
- uses: ./../action/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 }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: env -i PATH="$PATH" HOME="$HOME" ./build.sh
|
run: env -i PATH="$PATH" HOME="$HOME" ./build.sh
|
||||||
- uses: ./../action/analyze
|
- uses: ./../action/analyze
|
||||||
id: analysis
|
id: analysis
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
- shell: bash
|
- shell: bash
|
||||||
run: |
|
run: |
|
||||||
CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}"
|
CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}"
|
||||||
@@ -101,4 +92,4 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CODEQL_ACTION_TEST_MODE: true
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
# There was a bug, fixed in CLI v2.5.1, that didn't propagate environment
|
||||||
|
# variables that the Java tracer needed. Here we test all languages
|
||||||
|
# except Java for these CLI versions. In `unset-environment-new-cli.yml`
|
||||||
|
# we test all languages for recent CLI versions.
|
||||||
|
name: PR Check - Test unsetting environment variables for CLI version < 2.5.1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GO111MODULE: auto
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- releases/v1
|
||||||
|
- releases/v2
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- ready_for_review
|
||||||
|
workflow_dispatch: {}
|
||||||
|
jobs:
|
||||||
|
unset-environment:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
version: stable-20210308
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
version: stable-20210319
|
||||||
|
name: Test unsetting environment variables
|
||||||
|
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
|
||||||
|
with:
|
||||||
|
languages: csharp,cpp,go,javascript,python
|
||||||
|
db-location: ${{ runner.temp }}/customDbLocation
|
||||||
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
- name: Build code
|
||||||
|
shell: bash
|
||||||
|
run: env -i PATH="$PATH" HOME="$HOME" ./build.sh
|
||||||
|
- uses: ./../action/analyze
|
||||||
|
id: analysis
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
- shell: bash
|
||||||
|
run: |
|
||||||
|
CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}"
|
||||||
|
if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/cpp" ]]; then
|
||||||
|
echo "::error::Did not create a database for CPP, or created it in the wrong location." \
|
||||||
|
"Expected location was '${RUNNER_TEMP}/customDbLocation/cpp' but actual was '${CPP_DB}'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}"
|
||||||
|
if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/csharp" ]]; then
|
||||||
|
echo "::error::Did not create a database for C Sharp, or created it in the wrong location." \
|
||||||
|
"Expected location was '${RUNNER_TEMP}/customDbLocation/csharp' but actual was '${CSHARP_DB}'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}"
|
||||||
|
if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/go" ]]; then
|
||||||
|
echo "::error::Did not create a database for Go, or created it in the wrong location." \
|
||||||
|
"Expected location was '${RUNNER_TEMP}/customDbLocation/go' but actual was '${GO_DB}'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}"
|
||||||
|
if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/javascript" ]]; then
|
||||||
|
echo "::error::Did not create a database for Javascript, or created it in the wrong location." \
|
||||||
|
"Expected location was '${RUNNER_TEMP}/customDbLocation/javascript' but actual was '${JAVASCRIPT_DB}'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}"
|
||||||
|
if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/python" ]]; then
|
||||||
|
echo "::error::Did not create a database for Python, or created it in the wrong location." \
|
||||||
|
"Expected location was '${RUNNER_TEMP}/customDbLocation/python' but actual was '${PYTHON_DB}'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
INTERNAL_CODEQL_ACTION_DEBUG_LOC: true
|
||||||
@@ -27,10 +27,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git fetch origin "$BRANCH" --depth=1
|
git fetch origin "$BRANCH" --depth=1
|
||||||
git checkout "origin/$BRANCH"
|
git checkout "origin/$BRANCH"
|
||||||
# Pin npm to v8 since v9 doesn't support Node 12.
|
sudo npm install --force -g npm@latest
|
||||||
# When updating this, make sure to update the npm version in
|
|
||||||
# `.github/workflows/script/check-node-modules.sh` too.
|
|
||||||
sudo npm install --force -g npm@^8.19.3
|
|
||||||
npm install
|
npm install
|
||||||
npm ci
|
npm ci
|
||||||
npm run removeNPMAbsolutePaths
|
npm run removeNPMAbsolutePaths
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
|
/runner/dist/
|
||||||
|
/runner/node_modules/
|
||||||
# Ignore for example failing-tests.json from AVA
|
# Ignore for example failing-tests.json from AVA
|
||||||
node_modules/.cache
|
node_modules/.cache
|
||||||
|
|||||||
+1
-11
@@ -2,17 +2,7 @@
|
|||||||
|
|
||||||
## [UNRELEASED]
|
## [UNRELEASED]
|
||||||
|
|
||||||
- Fixed a bug where some the `init` action and the `analyze` action would have different sets of experimental feature flags enabled. [#1384](https://github.com/github/codeql-action/pull/1384)
|
- Update the ML-powered additional query pack for JavaScript to version 0.4.0.
|
||||||
|
|
||||||
## 2.1.33 - 16 Nov 2022
|
|
||||||
|
|
||||||
- Go is now analyzed in the same way as other compiled languages such as C/C++, C#, and Java. This completes the rollout of the feature described in [CodeQL Action version 2.1.27](#2127---06-oct-2022). [#1322](https://github.com/github/codeql-action/pull/1322)
|
|
||||||
- Bump the minimum CodeQL bundle version to 2.6.3. [#1358](https://github.com/github/codeql-action/pull/1358)
|
|
||||||
|
|
||||||
## 2.1.32 - 14 Nov 2022
|
|
||||||
|
|
||||||
- Update default CodeQL bundle version to 2.11.3. [#1348](https://github.com/github/codeql-action/pull/1348)
|
|
||||||
- Update the ML-powered additional query pack for JavaScript to version 0.4.0. [#1351](https://github.com/github/codeql-action/pull/1351)
|
|
||||||
|
|
||||||
## 2.1.31 - 04 Nov 2022
|
## 2.1.31 - 04 Nov 2022
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ To see the effect of your changes and to test them, push your changes in a branc
|
|||||||
|
|
||||||
As well as the unit tests (see _Common tasks_ above), there are integration tests, defined in `.github/workflows/integration-testing.yml`. These are run by a CI check. Depending on the change you’re making, you may want to add a test to this file or extend an existing one.
|
As well as the unit tests (see _Common tasks_ above), there are integration tests, defined in `.github/workflows/integration-testing.yml`. These are run by a CI check. Depending on the change you’re making, you may want to add a test to this file or extend an existing one.
|
||||||
|
|
||||||
|
### Building the CodeQL runner
|
||||||
|
|
||||||
|
Navigate to the `runner` directory and run `npm install` to install dependencies needed only for compiling the CodeQL runner. Run `npm run build-runner` to output files to the `runner/dist` directory.
|
||||||
|
|
||||||
## Submitting a pull request
|
## Submitting a pull request
|
||||||
|
|
||||||
1. [Fork][fork] and clone the repository
|
1. [Fork][fork] and clone the repository
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ jobs:
|
|||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v2
|
||||||
# Override language selection by uncommenting this and choosing your languages
|
# Override language selection by uncommenting this and choosing your languages
|
||||||
# with:
|
# with:
|
||||||
# languages: go, javascript, csharp, python, cpp, java, ruby
|
# languages: go, javascript, csharp, python, cpp, java
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below).
|
# If this step fails, then you should remove it and run the build manually (see below).
|
||||||
|
|||||||
Generated
+11
-25
@@ -32,11 +32,16 @@ const sharedEnv = __importStar(require("./shared-environment"));
|
|||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
// eslint-disable-next-line import/no-commonjs
|
// eslint-disable-next-line import/no-commonjs
|
||||||
const pkg = require("../package.json");
|
const pkg = require("../package.json");
|
||||||
|
/**
|
||||||
|
* The utils in this module are meant to be run inside of the action only.
|
||||||
|
* Code paths from the runner should not enter this module.
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* Wrapper around core.getInput for inputs that always have a value.
|
* Wrapper around core.getInput for inputs that always have a value.
|
||||||
* Also see getOptionalInput.
|
* Also see getOptionalInput.
|
||||||
*
|
*
|
||||||
* This allows us to get stronger type checking of required/optional inputs.
|
* This allows us to get stronger type checking of required/optional inputs
|
||||||
|
* and make behaviour more consistent between actions and the runner.
|
||||||
*/
|
*/
|
||||||
function getRequiredInput(name) {
|
function getRequiredInput(name) {
|
||||||
return core.getInput(name, { required: true });
|
return core.getInput(name, { required: true });
|
||||||
@@ -46,7 +51,8 @@ exports.getRequiredInput = getRequiredInput;
|
|||||||
* Wrapper around core.getInput that converts empty inputs to undefined.
|
* Wrapper around core.getInput that converts empty inputs to undefined.
|
||||||
* Also see getRequiredInput.
|
* Also see getRequiredInput.
|
||||||
*
|
*
|
||||||
* This allows us to get stronger type checking of required/optional inputs.
|
* This allows us to get stronger type checking of required/optional inputs
|
||||||
|
* and make behaviour more consistent between actions and the runner.
|
||||||
*/
|
*/
|
||||||
const getOptionalInput = function (name) {
|
const getOptionalInput = function (name) {
|
||||||
const value = core.getInput(name);
|
const value = core.getInput(name);
|
||||||
@@ -343,7 +349,7 @@ async function getWorkflowPath() {
|
|||||||
const owner = repo_nwo[0];
|
const owner = repo_nwo[0];
|
||||||
const repo = repo_nwo[1];
|
const repo = repo_nwo[1];
|
||||||
const run_id = Number((0, util_1.getRequiredEnvParam)("GITHUB_RUN_ID"));
|
const run_id = Number((0, util_1.getRequiredEnvParam)("GITHUB_RUN_ID"));
|
||||||
const apiClient = api.getApiClient();
|
const apiClient = api.getActionsApiClient();
|
||||||
const runsResponse = await apiClient.request("GET /repos/:owner/:repo/actions/runs/:run_id?exclude_pull_requests=true", {
|
const runsResponse = await apiClient.request("GET /repos/:owner/:repo/actions/runs/:run_id?exclude_pull_requests=true", {
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
@@ -426,7 +432,7 @@ async function getRef() {
|
|||||||
if ((hasRefInput || hasShaInput) && !(hasRefInput && hasShaInput)) {
|
if ((hasRefInput || hasShaInput) && !(hasRefInput && hasShaInput)) {
|
||||||
throw new Error("Both 'ref' and 'sha' are required if one of them is provided.");
|
throw new Error("Both 'ref' and 'sha' are required if one of them is provided.");
|
||||||
}
|
}
|
||||||
const ref = refInput || getRefFromEnv();
|
const ref = refInput || (0, util_1.getRequiredEnvParam)("GITHUB_REF");
|
||||||
const sha = shaInput || (0, util_1.getRequiredEnvParam)("GITHUB_SHA");
|
const sha = shaInput || (0, util_1.getRequiredEnvParam)("GITHUB_SHA");
|
||||||
// If the ref is a user-provided input, we have to skip logic
|
// If the ref is a user-provided input, we have to skip logic
|
||||||
// and assume that it is really where they want to upload the results.
|
// and assume that it is really where they want to upload the results.
|
||||||
@@ -459,26 +465,6 @@ async function getRef() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.getRef = getRef;
|
exports.getRef = getRef;
|
||||||
function getRefFromEnv() {
|
|
||||||
// To workaround a limitation of Actions dynamic workflows not setting
|
|
||||||
// the GITHUB_REF in some cases, we accept also the ref within the
|
|
||||||
// CODE_SCANNING_REF variable. When possible, however, we prefer to use
|
|
||||||
// the GITHUB_REF as that is a protected variable and cannot be overwritten.
|
|
||||||
let refEnv;
|
|
||||||
try {
|
|
||||||
refEnv = (0, util_1.getRequiredEnvParam)("GITHUB_REF");
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
// If the GITHUB_REF is not set, we try to rescue by getting the
|
|
||||||
// CODE_SCANNING_REF.
|
|
||||||
const maybeRef = process.env["CODE_SCANNING_REF"];
|
|
||||||
if (maybeRef === undefined || maybeRef.length === 0) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
refEnv = maybeRef;
|
|
||||||
}
|
|
||||||
return refEnv;
|
|
||||||
}
|
|
||||||
function getActionsStatus(error, otherFailureCause) {
|
function getActionsStatus(error, otherFailureCause) {
|
||||||
if (error || otherFailureCause) {
|
if (error || otherFailureCause) {
|
||||||
return error instanceof util_1.UserError ? "user-error" : "failure";
|
return error instanceof util_1.UserError ? "user-error" : "failure";
|
||||||
@@ -593,7 +579,7 @@ async function sendStatusReport(statusReport) {
|
|||||||
}
|
}
|
||||||
const nwo = (0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY");
|
const nwo = (0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY");
|
||||||
const [owner, repo] = nwo.split("/");
|
const [owner, repo] = nwo.split("/");
|
||||||
const client = api.getApiClient();
|
const client = api.getActionsApiClient();
|
||||||
try {
|
try {
|
||||||
await client.request("PUT /repos/:owner/:repo/code-scanning/analysis/status", {
|
await client.request("PUT /repos/:owner/:repo/code-scanning/analysis/status", {
|
||||||
owner,
|
owner,
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Generated
+5
-1
@@ -471,8 +471,12 @@ on: ["push"]
|
|||||||
`)), []));
|
`)), []));
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("initializeEnvironment", (t) => {
|
(0, ava_1.default)("initializeEnvironment", (t) => {
|
||||||
(0, util_1.initializeEnvironment)("1.2.3");
|
(0, util_1.initializeEnvironment)(util_1.Mode.actions, "1.2.3");
|
||||||
|
t.deepEqual((0, util_1.getMode)(), util_1.Mode.actions);
|
||||||
t.deepEqual(process.env.CODEQL_ACTION_VERSION, "1.2.3");
|
t.deepEqual(process.env.CODEQL_ACTION_VERSION, "1.2.3");
|
||||||
|
(0, util_1.initializeEnvironment)(util_1.Mode.runner, "4.5.6");
|
||||||
|
t.deepEqual((0, util_1.getMode)(), util_1.Mode.runner);
|
||||||
|
t.deepEqual(process.env.CODEQL_ACTION_VERSION, "4.5.6");
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("isAnalyzingDefaultBranch()", async (t) => {
|
(0, ava_1.default)("isAnalyzingDefaultBranch()", async (t) => {
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Generated
+24
-19
@@ -96,9 +96,11 @@ function doesGoExtractionOutputExist(config) {
|
|||||||
].some((ext) => fileName.endsWith(ext))));
|
].some((ext) => fileName.endsWith(ext))));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* We attempt to autobuild Go to preserve compatibility for users who have
|
* When Go extraction reconciliation is enabled, either via the feature
|
||||||
* set up Go using a legacy scanning style CodeQL workflow, i.e. one without
|
* or an environment variable, we will attempt to autobuild Go to preserve
|
||||||
* an autobuild step or manual build steps.
|
* compatibility for users who have set up Go using a legacy scanning style
|
||||||
|
* CodeQL workflow, i.e. one without 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
|
* `util.DID_AUTOBUILD_GO_ENV_VAR_NAME` environment variable, which is set
|
||||||
@@ -106,22 +108,25 @@ function doesGoExtractionOutputExist(config) {
|
|||||||
* - We approximate whether manual build steps are present by looking at
|
* - We approximate whether manual build steps are present by looking at
|
||||||
* whether any extraction output already exists for Go.
|
* whether any extraction output already exists for Go.
|
||||||
*/
|
*/
|
||||||
async function runAutobuildIfLegacyGoWorkflow(config, logger) {
|
async function runAutobuildIfLegacyGoWorkflow(config, featureEnablement, logger) {
|
||||||
if (!config.languages.includes(languages_1.Language.go)) {
|
if (!config.languages.includes(languages_1.Language.go)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!(await util.isGoExtractionReconciliationEnabled(featureEnablement))) {
|
||||||
|
logger.debug("Won't run Go autobuild since Go extraction reconciliation is not enabled.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (process.env[util.DID_AUTOBUILD_GO_ENV_VAR_NAME] === "true") {
|
if (process.env[util.DID_AUTOBUILD_GO_ENV_VAR_NAME] === "true") {
|
||||||
logger.debug("Won't run Go autobuild since it has already been run.");
|
// This log line is info level while Go extraction reconciliation is in beta.
|
||||||
|
// We will make it debug level once Go extraction reconciliation is GA.
|
||||||
|
logger.info("Won't run Go autobuild since it has already been run.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// This captures whether a user has added manual build steps for Go
|
// This captures whether a user has added manual build steps for Go
|
||||||
if (doesGoExtractionOutputExist(config)) {
|
if (doesGoExtractionOutputExist(config)) {
|
||||||
logger.debug("Won't run Go autobuild since at least one file of Go code has already been extracted.");
|
// This log line is info level while Go extraction reconciliation is in beta.
|
||||||
// If the user has run the manual build step, and has set the `CODEQL_EXTRACTOR_GO_BUILD_TRACING`
|
// We will make it debug level once Go extraction reconciliation is GA.
|
||||||
// variable, we suggest they remove it from their workflow.
|
logger.info("Won't run Go autobuild since at least one file of Go code has already been extracted.");
|
||||||
if ("CODEQL_EXTRACTOR_GO_BUILD_TRACING" in process.env) {
|
|
||||||
logger.warning(`The CODEQL_EXTRACTOR_GO_BUILD_TRACING environment variable has no effect on workflows with manual build steps, so we recommend that you remove it from your workflow.`);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await (0, autobuild_1.runAutobuild)(languages_1.Language.go, config, logger);
|
await (0, autobuild_1.runAutobuild)(languages_1.Language.go, config, logger);
|
||||||
@@ -134,7 +139,7 @@ async function run() {
|
|||||||
let trapCacheUploadTime = undefined;
|
let trapCacheUploadTime = undefined;
|
||||||
let dbCreationTimings = undefined;
|
let dbCreationTimings = undefined;
|
||||||
let didUploadTrapCaches = false;
|
let didUploadTrapCaches = false;
|
||||||
util.initializeEnvironment(pkg.version);
|
util.initializeEnvironment(util.Mode.actions, pkg.version);
|
||||||
await util.checkActionVersion(pkg.version);
|
await util.checkActionVersion(pkg.version);
|
||||||
const logger = (0, logging_1.getActionsLogger)();
|
const logger = (0, logging_1.getActionsLogger)();
|
||||||
try {
|
try {
|
||||||
@@ -148,16 +153,16 @@ 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));
|
await util.enrichEnvironment(util.Mode.actions, 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);
|
||||||
const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"]);
|
const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"]);
|
||||||
const repositoryNwo = (0, repository_1.parseRepositoryNwo)(util.getRequiredEnvParam("GITHUB_REPOSITORY"));
|
const repositoryNwo = (0, repository_1.parseRepositoryNwo)(util.getRequiredEnvParam("GITHUB_REPOSITORY"));
|
||||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
const gitHubVersion = await (0, api_client_1.getGitHubVersionActionsOnly)();
|
||||||
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger);
|
const features = new feature_flags_1.Features(gitHubVersion, apiDetails, repositoryNwo, logger);
|
||||||
await runAutobuildIfLegacyGoWorkflow(config, logger);
|
await runAutobuildIfLegacyGoWorkflow(config, features, 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);
|
||||||
}
|
}
|
||||||
@@ -170,7 +175,7 @@ async function run() {
|
|||||||
}
|
}
|
||||||
core.setOutput("db-locations", dbLocations);
|
core.setOutput("db-locations", dbLocations);
|
||||||
if (runStats && actionsUtil.getRequiredInput("upload") === "true") {
|
if (runStats && actionsUtil.getRequiredInput("upload") === "true") {
|
||||||
uploadResult = await upload_lib.uploadFromActions(outputDir, config.gitHubVersion, logger);
|
uploadResult = await upload_lib.uploadFromActions(outputDir, config.gitHubVersion, apiDetails, logger);
|
||||||
core.setOutput("sarif-id", uploadResult.sarifID);
|
core.setOutput("sarif-id", uploadResult.sarifID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -189,7 +194,7 @@ async function run() {
|
|||||||
}
|
}
|
||||||
else if (uploadResult !== undefined &&
|
else if (uploadResult !== undefined &&
|
||||||
actionsUtil.getRequiredInput("wait-for-processing") === "true") {
|
actionsUtil.getRequiredInput("wait-for-processing") === "true") {
|
||||||
await upload_lib.waitForProcessing((0, repository_1.parseRepositoryNwo)(util.getRequiredEnvParam("GITHUB_REPOSITORY")), uploadResult.sarifID, (0, logging_1.getActionsLogger)());
|
await upload_lib.waitForProcessing((0, repository_1.parseRepositoryNwo)(util.getRequiredEnvParam("GITHUB_REPOSITORY")), uploadResult.sarifID, apiDetails, (0, logging_1.getActionsLogger)());
|
||||||
}
|
}
|
||||||
// If we did not throw an error yet here, but we expect one, throw it.
|
// If we did not throw an error yet here, but we expect one, throw it.
|
||||||
if (actionsUtil.getOptionalInput("expect-error") === "true") {
|
if (actionsUtil.getOptionalInput("expect-error") === "true") {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Generated
+59
-8
@@ -32,6 +32,7 @@ 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 count_loc_1 = require("./count-loc");
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const sharedEnv = __importStar(require("./shared-environment"));
|
const sharedEnv = __importStar(require("./shared-environment"));
|
||||||
const tracer_config_1 = require("./tracer-config");
|
const tracer_config_1 = require("./tracer-config");
|
||||||
@@ -69,12 +70,12 @@ 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, featureEnablement) {
|
||||||
// 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);
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
if ((0, languages_1.isScannedLanguage)(language) &&
|
if ((0, languages_1.isScannedLanguage)(language, await util.isGoExtractionReconciliationEnabled(featureEnablement), 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) {
|
||||||
@@ -98,10 +99,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, featureEnablement) {
|
||||||
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, featureEnablement);
|
||||||
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) {
|
||||||
@@ -123,6 +124,17 @@ async function finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger)
|
|||||||
// Runs queries and creates sarif files in the given folder
|
// Runs queries and creates sarif files in the given folder
|
||||||
async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag, automationDetailsId, config, logger, featureEnablement) {
|
async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag, automationDetailsId, config, logger, featureEnablement) {
|
||||||
const statusReport = {};
|
const statusReport = {};
|
||||||
|
let locPromise = Promise.resolve({});
|
||||||
|
const cliCanCountBaseline = await cliCanCountLoC();
|
||||||
|
const countLocDebugMode = process.env["INTERNAL_CODEQL_ACTION_DEBUG_LOC"] || config.debugMode;
|
||||||
|
if (!cliCanCountBaseline || countLocDebugMode) {
|
||||||
|
// count the number of lines in the background
|
||||||
|
locPromise = (0, count_loc_1.countLoc)(path.resolve(),
|
||||||
|
// config.paths specifies external directories. the current
|
||||||
|
// directory is included in the analysis by default. Replicate
|
||||||
|
// that here.
|
||||||
|
config.paths, config.pathsIgnore, config.languages, logger);
|
||||||
|
}
|
||||||
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
||||||
await util.logCodeScanningConfigInCli(codeql, featureEnablement, logger);
|
await util.logCodeScanningConfigInCli(codeql, featureEnablement, logger);
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
@@ -133,7 +145,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
|||||||
const hasCustomQueries = (queries === null || queries === void 0 ? void 0 : queries.custom.length) > 0;
|
const hasCustomQueries = (queries === null || queries === void 0 ? void 0 : queries.custom.length) > 0;
|
||||||
const hasPackWithCustomQueries = packsWithVersion.length > 0;
|
const hasPackWithCustomQueries = packsWithVersion.length > 0;
|
||||||
if (!hasBuiltinQueries && !hasCustomQueries && !hasPackWithCustomQueries) {
|
if (!hasBuiltinQueries && !hasCustomQueries && !hasPackWithCustomQueries) {
|
||||||
throw new Error(`Unable to analyze ${language} as no queries were selected for this language`);
|
throw new Error(`Unable to analyse ${language} as no queries were selected for this language`);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (await util.useCodeScanningConfigInCli(codeql, featureEnablement)) {
|
if (await util.useCodeScanningConfigInCli(codeql, featureEnablement)) {
|
||||||
@@ -188,13 +200,21 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
|||||||
const startTimeInterpretResults = new Date().getTime();
|
const startTimeInterpretResults = new Date().getTime();
|
||||||
const sarifFile = path.join(sarifFolder, `${language}.sarif`);
|
const sarifFile = path.join(sarifFolder, `${language}.sarif`);
|
||||||
const analysisSummary = await runInterpretResults(language, querySuitePaths, sarifFile, config.debugMode);
|
const analysisSummary = await runInterpretResults(language, querySuitePaths, sarifFile, config.debugMode);
|
||||||
|
if (!cliCanCountBaseline) {
|
||||||
|
await injectLinesOfCode(sarifFile, language, locPromise);
|
||||||
|
}
|
||||||
statusReport[`interpret_results_${language}_duration_ms`] =
|
statusReport[`interpret_results_${language}_duration_ms`] =
|
||||||
new Date().getTime() - startTimeInterpretResults;
|
new Date().getTime() - startTimeInterpretResults;
|
||||||
logger.endGroup();
|
logger.endGroup();
|
||||||
logger.info(analysisSummary);
|
logger.info(analysisSummary);
|
||||||
}
|
}
|
||||||
|
if (!cliCanCountBaseline || countLocDebugMode) {
|
||||||
|
printLinesOfCodeSummary(logger, language, await locPromise);
|
||||||
|
}
|
||||||
|
if (cliCanCountBaseline) {
|
||||||
logger.info(await runPrintLinesOfCode(language));
|
logger.info(await runPrintLinesOfCode(language));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
logger.info(String(e));
|
logger.info(String(e));
|
||||||
if (e instanceof Error) {
|
if (e instanceof Error) {
|
||||||
@@ -209,6 +229,9 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
|||||||
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, featureEnablement);
|
return await codeql.databaseInterpretResults(databasePath, queries, sarifFile, addSnippetsFlag, threadsFlag, enableDebugLogging ? "-vv" : "-v", automationDetailsId, featureEnablement);
|
||||||
}
|
}
|
||||||
|
async function cliCanCountLoC() {
|
||||||
|
return await util.codeQlVersionAbove(await (0, codeql_1.getCodeQL)(config.codeQLCmd), codeql_1.CODEQL_VERSION_COUNTS_LINES);
|
||||||
|
}
|
||||||
async function runPrintLinesOfCode(language) {
|
async function runPrintLinesOfCode(language) {
|
||||||
const databasePath = util.getCodeQLDatabasePath(config, language);
|
const databasePath = util.getCodeQLDatabasePath(config, language);
|
||||||
return await codeql.databasePrintBaseline(databasePath);
|
return await codeql.databasePrintBaseline(databasePath);
|
||||||
@@ -262,7 +285,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, featureEnablement) {
|
||||||
try {
|
try {
|
||||||
await (0, del_1.default)(outputDir, { force: true });
|
await (0, del_1.default)(outputDir, { force: true });
|
||||||
}
|
}
|
||||||
@@ -272,7 +295,7 @@ 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, featureEnablement);
|
||||||
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
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
|
||||||
@@ -281,7 +304,7 @@ async function runFinalize(outputDir, threadsFlag, memoryFlag, config, logger) {
|
|||||||
// step.
|
// step.
|
||||||
if (await util.codeQlVersionAbove(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING)) {
|
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, await util.isGoExtractionReconciliationEnabled(featureEnablement), logger);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Delete the tracer config env var to avoid tracing ourselves
|
// Delete the tracer config env var to avoid tracing ourselves
|
||||||
@@ -300,6 +323,34 @@ async function runCleanup(config, cleanupLevel, logger) {
|
|||||||
logger.endGroup();
|
logger.endGroup();
|
||||||
}
|
}
|
||||||
exports.runCleanup = runCleanup;
|
exports.runCleanup = runCleanup;
|
||||||
|
async function injectLinesOfCode(sarifFile, language, locPromise) {
|
||||||
|
var _a;
|
||||||
|
const lineCounts = await locPromise;
|
||||||
|
if (language in lineCounts) {
|
||||||
|
const sarif = JSON.parse(fs.readFileSync(sarifFile, "utf8"));
|
||||||
|
if (Array.isArray(sarif.runs)) {
|
||||||
|
for (const run of sarif.runs) {
|
||||||
|
run.properties = run.properties || {};
|
||||||
|
run.properties.metricResults = run.properties.metricResults || [];
|
||||||
|
for (const metric of run.properties.metricResults) {
|
||||||
|
// Baseline is inserted when matching rule has tag lines-of-code
|
||||||
|
if (metric.rule && metric.rule.toolComponent) {
|
||||||
|
const matchingRule = run.tool.extensions[metric.rule.toolComponent.index].rules[metric.rule.index];
|
||||||
|
if ((_a = matchingRule.properties.tags) === null || _a === void 0 ? void 0 : _a.includes("lines-of-code")) {
|
||||||
|
metric.baseline = lineCounts[language];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fs.writeFileSync(sarifFile, JSON.stringify(sarif));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function printLinesOfCodeSummary(logger, language, lineCounts) {
|
||||||
|
if (language in lineCounts) {
|
||||||
|
logger.info(`Counted a baseline of ${lineCounts[language]} lines of code for ${language}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
// exported for testing
|
// exported for testing
|
||||||
function validateQueryFilters(queryFilters) {
|
function validateQueryFilters(queryFilters) {
|
||||||
if (!queryFilters) {
|
if (!queryFilters) {
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Generated
+32
-1
@@ -26,8 +26,10 @@ const fs = __importStar(require("fs"));
|
|||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const ava_1 = __importDefault(require("ava"));
|
const ava_1 = __importDefault(require("ava"));
|
||||||
const yaml = __importStar(require("js-yaml"));
|
const yaml = __importStar(require("js-yaml"));
|
||||||
|
const sinon = __importStar(require("sinon"));
|
||||||
const analyze_1 = require("./analyze");
|
const analyze_1 = require("./analyze");
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
|
const count = __importStar(require("./count-loc"));
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
@@ -37,6 +39,12 @@ const util = __importStar(require("./util"));
|
|||||||
// and correct case of builtin or custom. Also checks the correct search
|
// and correct case of builtin or custom. Also checks the correct search
|
||||||
// paths are set in the database analyze invocation.
|
// paths are set in the database analyze invocation.
|
||||||
(0, ava_1.default)("status report fields and search path setting", async (t) => {
|
(0, ava_1.default)("status report fields and search path setting", async (t) => {
|
||||||
|
const mockLinesOfCode = Object.values(languages_1.Language).reduce((obj, lang, i) => {
|
||||||
|
// use a different line count for each language
|
||||||
|
obj[lang] = i + 1;
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
sinon.stub(count, "countLoc").resolves(mockLinesOfCode);
|
||||||
let searchPathsUsed = [];
|
let searchPathsUsed = [];
|
||||||
return await util.withTmpDir(async (tmpDir) => {
|
return await util.withTmpDir(async (tmpDir) => {
|
||||||
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
||||||
@@ -90,7 +98,6 @@ const util = __importStar(require("./util"));
|
|||||||
}));
|
}));
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
databasePrintBaseline: async () => "",
|
|
||||||
});
|
});
|
||||||
searchPathsUsed = [];
|
searchPathsUsed = [];
|
||||||
const config = {
|
const config = {
|
||||||
@@ -159,8 +166,32 @@ const util = __importStar(require("./util"));
|
|||||||
t.deepEqual(searchPathsUsed, expectedSearchPathsUsed);
|
t.deepEqual(searchPathsUsed, expectedSearchPathsUsed);
|
||||||
t.true(`interpret_results_${language}_duration_ms` in customStatusReport);
|
t.true(`interpret_results_${language}_duration_ms` in customStatusReport);
|
||||||
}
|
}
|
||||||
|
verifyLineCounts(tmpDir);
|
||||||
verifyQuerySuites(tmpDir);
|
verifyQuerySuites(tmpDir);
|
||||||
});
|
});
|
||||||
|
function verifyLineCounts(tmpDir) {
|
||||||
|
// eslint-disable-next-line github/array-foreach
|
||||||
|
Object.keys(languages_1.Language).forEach((lang, i) => {
|
||||||
|
verifyLineCountForFile(path.join(tmpDir, `${lang}.sarif`), i + 1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function verifyLineCountForFile(filePath, lineCount) {
|
||||||
|
const sarif = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
||||||
|
t.deepEqual(sarif.runs[0].properties.metricResults, [
|
||||||
|
{
|
||||||
|
rule: {
|
||||||
|
index: 0,
|
||||||
|
toolComponent: {
|
||||||
|
index: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
value: 123,
|
||||||
|
baseline: lineCount,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
// when the rule doesn't exist, it should not be added
|
||||||
|
t.deepEqual(sarif.runs[1].properties.metricResults, []);
|
||||||
|
}
|
||||||
function verifyQuerySuites(tmpDir) {
|
function verifyQuerySuites(tmpDir) {
|
||||||
const qlsContent = [
|
const qlsContent = [
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Generated
+32
-14
@@ -22,7 +22,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getGitHubVersion = exports.getApiClientWithExternalAuth = exports.getApiClient = exports.getApiDetails = exports.DisallowedAPIVersionReason = void 0;
|
exports.getGitHubVersionActionsOnly = exports.getActionsApiClient = exports.getApiDetails = exports.getApiClient = exports.DisallowedAPIVersionReason = void 0;
|
||||||
|
const path = __importStar(require("path"));
|
||||||
const githubUtils = __importStar(require("@actions/github/lib/utils"));
|
const githubUtils = __importStar(require("@actions/github/lib/utils"));
|
||||||
const retry = __importStar(require("@octokit/plugin-retry"));
|
const retry = __importStar(require("@octokit/plugin-retry"));
|
||||||
const console_log_level_1 = __importDefault(require("console-log-level"));
|
const console_log_level_1 = __importDefault(require("console-log-level"));
|
||||||
@@ -36,14 +37,28 @@ var DisallowedAPIVersionReason;
|
|||||||
DisallowedAPIVersionReason[DisallowedAPIVersionReason["ACTION_TOO_OLD"] = 0] = "ACTION_TOO_OLD";
|
DisallowedAPIVersionReason[DisallowedAPIVersionReason["ACTION_TOO_OLD"] = 0] = "ACTION_TOO_OLD";
|
||||||
DisallowedAPIVersionReason[DisallowedAPIVersionReason["ACTION_TOO_NEW"] = 1] = "ACTION_TOO_NEW";
|
DisallowedAPIVersionReason[DisallowedAPIVersionReason["ACTION_TOO_NEW"] = 1] = "ACTION_TOO_NEW";
|
||||||
})(DisallowedAPIVersionReason = exports.DisallowedAPIVersionReason || (exports.DisallowedAPIVersionReason = {}));
|
})(DisallowedAPIVersionReason = exports.DisallowedAPIVersionReason || (exports.DisallowedAPIVersionReason = {}));
|
||||||
function createApiClientWithDetails(apiDetails, { allowExternal = false } = {}) {
|
const getApiClient = function (apiDetails, { allowExternal = false } = {}) {
|
||||||
const auth = (allowExternal && apiDetails.externalRepoAuth) || apiDetails.auth;
|
const auth = (allowExternal && apiDetails.externalRepoAuth) || apiDetails.auth;
|
||||||
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||||
|
const apiURL = apiDetails.apiURL || deriveApiUrl(apiDetails.url);
|
||||||
return new retryingOctokit(githubUtils.getOctokitOptions(auth, {
|
return new retryingOctokit(githubUtils.getOctokitOptions(auth, {
|
||||||
baseUrl: apiDetails.apiURL,
|
baseUrl: apiURL,
|
||||||
userAgent: `CodeQL-Action/${pkg.version}`,
|
userAgent: `CodeQL-${(0, util_1.getMode)()}/${pkg.version}`,
|
||||||
log: (0, console_log_level_1.default)({ level: "debug" }),
|
log: (0, console_log_level_1.default)({ level: "debug" }),
|
||||||
}));
|
}));
|
||||||
|
};
|
||||||
|
exports.getApiClient = getApiClient;
|
||||||
|
// Once the runner is deleted, this can also be removed since the GitHub API URL is always available in an environment variable on Actions.
|
||||||
|
function deriveApiUrl(githubUrl) {
|
||||||
|
const url = new URL(githubUrl);
|
||||||
|
// If we detect this is trying to connect to github.com
|
||||||
|
// then return with a fixed canonical URL.
|
||||||
|
if (url.hostname === "github.com" || url.hostname === "api.github.com") {
|
||||||
|
return "https://api.github.com";
|
||||||
|
}
|
||||||
|
// Add the /api/v3 API prefix
|
||||||
|
url.pathname = path.join(url.pathname, "api", "v3");
|
||||||
|
return url.toString();
|
||||||
}
|
}
|
||||||
function getApiDetails() {
|
function getApiDetails() {
|
||||||
return {
|
return {
|
||||||
@@ -53,27 +68,30 @@ function getApiDetails() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.getApiDetails = getApiDetails;
|
exports.getApiDetails = getApiDetails;
|
||||||
function getApiClient() {
|
// Temporary function to aid in the transition to running on and off of github actions.
|
||||||
return createApiClientWithDetails(getApiDetails());
|
// Once all code has been converted this function should be removed or made canonical
|
||||||
|
// and called only from the action entrypoints.
|
||||||
|
function getActionsApiClient() {
|
||||||
|
return (0, exports.getApiClient)(getApiDetails());
|
||||||
}
|
}
|
||||||
exports.getApiClient = getApiClient;
|
exports.getActionsApiClient = getActionsApiClient;
|
||||||
function getApiClientWithExternalAuth(apiDetails) {
|
|
||||||
return createApiClientWithDetails(apiDetails, { allowExternal: true });
|
|
||||||
}
|
|
||||||
exports.getApiClientWithExternalAuth = getApiClientWithExternalAuth;
|
|
||||||
let cachedGitHubVersion = undefined;
|
let cachedGitHubVersion = undefined;
|
||||||
/**
|
/**
|
||||||
* Report the GitHub server version. This is a wrapper around
|
* Report the GitHub server version. This is a wrapper around
|
||||||
* util.getGitHubVersion() that automatically supplies GitHub API details using
|
* util.getGitHubVersion() that automatically supplies GitHub API details using
|
||||||
* GitHub Action inputs.
|
* GitHub Action inputs. If you need to get the GitHub server version from the
|
||||||
|
* Runner, please call util.getGitHubVersion() instead.
|
||||||
*
|
*
|
||||||
* @returns GitHub version
|
* @returns GitHub version
|
||||||
*/
|
*/
|
||||||
async function getGitHubVersion() {
|
async function getGitHubVersionActionsOnly() {
|
||||||
|
if (!util.isActions()) {
|
||||||
|
throw new Error("getGitHubVersionActionsOnly() works only in an action");
|
||||||
|
}
|
||||||
if (cachedGitHubVersion === undefined) {
|
if (cachedGitHubVersion === undefined) {
|
||||||
cachedGitHubVersion = await util.getGitHubVersion(getApiDetails());
|
cachedGitHubVersion = await util.getGitHubVersion(getApiDetails());
|
||||||
}
|
}
|
||||||
return cachedGitHubVersion;
|
return cachedGitHubVersion;
|
||||||
}
|
}
|
||||||
exports.getGitHubVersion = getGitHubVersion;
|
exports.getGitHubVersionActionsOnly = getGitHubVersionActionsOnly;
|
||||||
//# sourceMappingURL=api-client.js.map
|
//# sourceMappingURL=api-client.js.map
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAyD;AACzD,6DAA+C;AAC/C,0EAAgD;AAEhD,iDAAkD;AAClD,6CAA+B;AAC/B,iCAA4D;AAE5D,8CAA8C;AAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEvC,IAAY,0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perty(exports, "__esModule", { value: true });
|
|||||||
const githubUtils = __importStar(require("@actions/github/lib/utils"));
|
const githubUtils = __importStar(require("@actions/github/lib/utils"));
|
||||||
const ava_1 = __importDefault(require("ava"));
|
const ava_1 = __importDefault(require("ava"));
|
||||||
const sinon = __importStar(require("sinon"));
|
const sinon = __importStar(require("sinon"));
|
||||||
const actionsUtil = __importStar(require("./actions-util"));
|
|
||||||
const api_client_1 = require("./api-client");
|
const api_client_1 = require("./api-client");
|
||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
const util = __importStar(require("./util"));
|
const util_1 = require("./util");
|
||||||
// eslint-disable-next-line import/no-commonjs
|
// eslint-disable-next-line import/no-commonjs
|
||||||
const pkg = require("../package.json");
|
const pkg = require("../package.json");
|
||||||
(0, testing_utils_1.setupTests)(ava_1.default);
|
(0, testing_utils_1.setupTests)(ava_1.default);
|
||||||
@@ -38,23 +37,66 @@ ava_1.default.beforeEach(() => {
|
|||||||
pluginStub = sinon.stub(githubUtils.GitHub, "plugin");
|
pluginStub = sinon.stub(githubUtils.GitHub, "plugin");
|
||||||
githubStub = sinon.stub();
|
githubStub = sinon.stub();
|
||||||
pluginStub.returns(githubStub);
|
pluginStub.returns(githubStub);
|
||||||
util.initializeEnvironment(pkg.version);
|
(0, util_1.initializeEnvironment)(util_1.Mode.actions, pkg.version);
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("getApiClient", async (t) => {
|
(0, ava_1.default)("Get the client API", async (t) => {
|
||||||
sinon.stub(actionsUtil, "getRequiredInput").withArgs("token").returns("xyz");
|
doTest(t, {
|
||||||
const requiredEnvParamStub = sinon.stub(util, "getRequiredEnvParam");
|
auth: "xyz",
|
||||||
requiredEnvParamStub
|
externalRepoAuth: "abc",
|
||||||
.withArgs("GITHUB_SERVER_URL")
|
url: "http://hucairz",
|
||||||
.returns("http://github.localhost");
|
}, undefined, {
|
||||||
requiredEnvParamStub
|
auth: "token xyz",
|
||||||
.withArgs("GITHUB_API_URL")
|
baseUrl: "http://hucairz/api/v3",
|
||||||
.returns("http://api.github.localhost");
|
userAgent: `CodeQL-Action/${pkg.version}`,
|
||||||
(0, api_client_1.getApiClient)();
|
});
|
||||||
t.assert(githubStub.calledOnceWithExactly({
|
});
|
||||||
|
(0, ava_1.default)("Get the client API external", async (t) => {
|
||||||
|
doTest(t, {
|
||||||
|
auth: "xyz",
|
||||||
|
externalRepoAuth: "abc",
|
||||||
|
url: "http://hucairz",
|
||||||
|
}, { allowExternal: true }, {
|
||||||
|
auth: "token abc",
|
||||||
|
baseUrl: "http://hucairz/api/v3",
|
||||||
|
userAgent: `CodeQL-Action/${pkg.version}`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("Get the client API external not present", async (t) => {
|
||||||
|
doTest(t, {
|
||||||
|
auth: "xyz",
|
||||||
|
url: "http://hucairz",
|
||||||
|
}, { allowExternal: true }, {
|
||||||
|
auth: "token xyz",
|
||||||
|
baseUrl: "http://hucairz/api/v3",
|
||||||
|
userAgent: `CodeQL-Action/${pkg.version}`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("Get the client API with github url", async (t) => {
|
||||||
|
doTest(t, {
|
||||||
|
auth: "xyz",
|
||||||
|
url: "https://github.com/some/invalid/url",
|
||||||
|
}, undefined, {
|
||||||
|
auth: "token xyz",
|
||||||
|
baseUrl: "https://api.github.com",
|
||||||
|
userAgent: `CodeQL-Action/${pkg.version}`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("Get the API with an API URL directly", async (t) => {
|
||||||
|
doTest(t, {
|
||||||
|
auth: "xyz",
|
||||||
|
url: "http://github.localhost",
|
||||||
|
apiURL: "http://api.github.localhost",
|
||||||
|
}, undefined, {
|
||||||
auth: "token xyz",
|
auth: "token xyz",
|
||||||
baseUrl: "http://api.github.localhost",
|
baseUrl: "http://api.github.localhost",
|
||||||
log: sinon.match.any,
|
|
||||||
userAgent: `CodeQL-Action/${pkg.version}`,
|
userAgent: `CodeQL-Action/${pkg.version}`,
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
function doTest(t, clientArgs, clientOptions, expected) {
|
||||||
|
(0, api_client_1.getApiClient)(clientArgs, clientOptions);
|
||||||
|
const firstCallArgs = githubStub.args[0];
|
||||||
|
// log is a function, so we don't need to test for equality of it
|
||||||
|
delete firstCallArgs[0].log;
|
||||||
|
t.deepEqual(firstCallArgs, [expected]);
|
||||||
|
}
|
||||||
//# sourceMappingURL=api-client.test.js.map
|
//# sourceMappingURL=api-client.test.js.map
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"api-client.test.js","sourceRoot":"","sources":["../src/api-client.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAyD;AACzD,8CAAuB;AACvB,6CAA+B;AAE/B,4DAA8C;AAC9C,6CAA4C;AAC5C,mDAA6C;AAC7C,6CAA+B;AAE/B,8CAA8C;AAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEvC,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,IAAI,UAA2B,CAAC;AAChC,IAAI,UAA2B,CAAC;AAEhC,aAAI,CAAC,UAAU,CAAC,GAAG,EAAE;IACnB,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtD,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC1B,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/B,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC,CAAC,CAAC;AAEH,IAAA,aAAI,EAAC,cAAc,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC/B,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC,OA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C3C,EACD,SAAS,EACT;QACE,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,wBAAwB;QACjC,SAAS,EAAE,iBAAiB,GAAG,CAAC,OAAO,EAAE;KAC1C,CACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAA,aAAI,EAAC,sCAAsC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACvD,MAAM,CACJ,CAAC,EACD;QACE,IAAI,EAAE,KAAK;QACX,GAAG,EAAE,yBAAyB;QAC9B,MAAM,EAAE,6BAA6B;KACtC,EACD,SAAS,EACT;QACE,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,6BAA6B;QACtC,SAAS,EAAE,iBAAiB,GAAG,CAAC,OAAO,EAAE;KAC1C,CACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,SAAS,MAAM,CACb,CAA4B,EAC5B,UAAe,EACf,aAAkB,EAClB,QAAa;IAEb,IAAA,yBAAY,EAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAExC,MAAM,aAAa,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzC,iEAAiE;IACjE,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC5B,CAAC,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
||||||
@@ -1 +1 @@
|
|||||||
{ "maximumVersion": "3.8", "minimumVersion": "3.3" }
|
{ "maximumVersion": "3.7", "minimumVersion": "3.3" }
|
||||||
|
|||||||
Generated
+7
-4
@@ -24,13 +24,15 @@ const actions_util_1 = require("./actions-util");
|
|||||||
const api_client_1 = require("./api-client");
|
const api_client_1 = require("./api-client");
|
||||||
const autobuild_1 = require("./autobuild");
|
const autobuild_1 = require("./autobuild");
|
||||||
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 logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
|
const repository_1 = require("./repository");
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
// eslint-disable-next-line import/no-commonjs
|
// eslint-disable-next-line import/no-commonjs
|
||||||
const pkg = require("../package.json");
|
const pkg = require("../package.json");
|
||||||
async function sendCompletedStatusReport(startedAt, allLanguages, failingLanguage, cause) {
|
async function sendCompletedStatusReport(startedAt, allLanguages, failingLanguage, cause) {
|
||||||
(0, util_1.initializeEnvironment)(pkg.version);
|
(0, util_1.initializeEnvironment)(util_1.Mode.actions, pkg.version);
|
||||||
const status = (0, actions_util_1.getActionsStatus)(cause, failingLanguage);
|
const status = (0, actions_util_1.getActionsStatus)(cause, failingLanguage);
|
||||||
const statusReportBase = await (0, actions_util_1.createStatusReportBase)("autobuild", status, startedAt, cause === null || cause === void 0 ? void 0 : cause.message, cause === null || cause === void 0 ? void 0 : cause.stack);
|
const statusReportBase = await (0, actions_util_1.createStatusReportBase)("autobuild", status, startedAt, cause === null || cause === void 0 ? void 0 : cause.message, cause === null || cause === void 0 ? void 0 : cause.stack);
|
||||||
const statusReport = {
|
const statusReport = {
|
||||||
@@ -50,13 +52,14 @@ async function run() {
|
|||||||
if (!(await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("autobuild", "starting", startedAt)))) {
|
if (!(await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("autobuild", "starting", startedAt)))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
const gitHubVersion = await (0, api_client_1.getGitHubVersionActionsOnly)();
|
||||||
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger);
|
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger, util_1.Mode.actions);
|
||||||
|
const features = new feature_flags_1.Features(gitHubVersion, (0, api_client_1.getApiDetails)(), (0, repository_1.parseRepositoryNwo)((0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY")), logger);
|
||||||
const config = await configUtils.getConfig((0, actions_util_1.getTemporaryDirectory)(), logger);
|
const config = await configUtils.getConfig((0, actions_util_1.getTemporaryDirectory)(), logger);
|
||||||
if (config === undefined) {
|
if (config === undefined) {
|
||||||
throw new Error("Config file could not be found at expected location. Has the 'init' action been called?");
|
throw new Error("Config file could not be found at expected location. Has the 'init' action been called?");
|
||||||
}
|
}
|
||||||
languages = await (0, autobuild_1.determineAutobuildLanguages)(config, logger);
|
languages = await (0, autobuild_1.determineAutobuildLanguages)(config, features, logger);
|
||||||
if (languages !== undefined) {
|
if (languages !== undefined) {
|
||||||
const workingDirectory = (0, actions_util_1.getOptionalInput)("working-directory");
|
const workingDirectory = (0, actions_util_1.getOptionalInput)("working-directory");
|
||||||
if (workingDirectory) {
|
if (workingDirectory) {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAOwB;AACxB,6CAAgD;AAChD,2CAAwE;AACxE,4DAA8C;AAC9C,2CAAuC;AACvC,uCAA6C;AAC7C,iCAKgB;AAEhB,8CAA8C;AAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AASvC,KAAK,UAAU,yBAAyB,CACtC,SAAe,EACf,YAAsB,EACtB,eAAwB,EACxB,KAAa;IAEb,IAAA,4BAAqB,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEnC,MAAM,MAAM,GAAG,IAAA,+BAAgB,EAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACxD,MAAM,gBAAgB,GAAG,MAAM,IAAA,qCAAsB,EACnD,WAAW,EACX,MAAM,EACN,SAAS,EACT,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,EACd,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I,CAAC,SAAS,CACZ,mIACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CACvD,EAAE,CACH,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,yBAAyB,CAC7B,SAAS,EACT,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,EACf,eAAe,EACf,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAC1D,CAAC;QACF,OAAO;KACR;IAED,MAAM,yBAAyB,CAAC,SAAS,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,GAAG,EAAE,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,4BAA4B,KAAK,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACpB;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||||
Generated
+23
-2
@@ -1,14 +1,35 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.runAutobuild = exports.determineAutobuildLanguages = void 0;
|
exports.runAutobuild = exports.determineAutobuildLanguages = void 0;
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
async function determineAutobuildLanguages(config, logger) {
|
const util = __importStar(require("./util"));
|
||||||
|
async function determineAutobuildLanguages(config, featureEnablement, logger) {
|
||||||
|
const isGoExtractionReconciliationEnabled = await util.isGoExtractionReconciliationEnabled(featureEnablement);
|
||||||
// Attempt to find a language to autobuild
|
// Attempt to find a language to autobuild
|
||||||
// We want pick the dominant language in the repo from the ones we're able to build
|
// We want pick the dominant language in the repo from the ones we're able to build
|
||||||
// The languages are sorted in order specified by user or by lines of code if we got
|
// The languages are sorted in order specified by user or by lines of code if we got
|
||||||
// them from the GitHub API, so try to build the first language on the list.
|
// them from the GitHub API, so try to build the first language on the list.
|
||||||
const autobuildLanguages = config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l));
|
const autobuildLanguages = config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l, isGoExtractionReconciliationEnabled, logger));
|
||||||
if (!autobuildLanguages) {
|
if (!autobuildLanguages) {
|
||||||
logger.info("None of the languages in this project require extra build steps");
|
logger.info("None of the languages in this project require extra build steps");
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"autobuild.js","sourceRoot":"","sources":["../src/autobuild.ts"],"names":[],"mappings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C;AACpB,CAAC;AATD,oCASC"}
|
||||||
Generated
+52
-25
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getExtraOptions = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.convertToSemVer = exports.getCodeQLURLVersion = exports.setupCodeQL = exports.getCodeQLActionRepository = 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.CODEQL_VERSION_CONFIG_FILES = exports.CODEQL_DEFAULT_ACTION_REPOSITORY = exports.CommandInvocationError = void 0;
|
exports.getExtraOptions = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.convertToSemVer = exports.getCodeQLURLVersion = exports.setupCodeQL = exports.getCodeQLActionRepository = 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.CODEQL_VERSION_CONFIG_FILES = exports.CODEQL_VERSION_COUNTS_LINES = exports.CODEQL_DEFAULT_ACTION_REPOSITORY = 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"));
|
||||||
@@ -60,18 +60,25 @@ const CODEQL_BUNDLE_VERSION = defaults.bundleVersion;
|
|||||||
exports.CODEQL_DEFAULT_ACTION_REPOSITORY = "github/codeql-action";
|
exports.CODEQL_DEFAULT_ACTION_REPOSITORY = "github/codeql-action";
|
||||||
/**
|
/**
|
||||||
* The oldest version of CodeQL that the Action will run with. This should be
|
* The oldest version of CodeQL that the Action will run with. This should be
|
||||||
* at least three minor versions behind the current version and must include the
|
* at least three minor versions behind the current version. The version flags
|
||||||
* CLI versions shipped with each supported version of GHES.
|
* below can be used to conditionally enable certain features on versions newer
|
||||||
|
* than this. Please record the reason we cannot support an older version.
|
||||||
*
|
*
|
||||||
* The version flags below can be used to conditionally enable certain features
|
* Reason: First version containing fix for the "We still have not reached
|
||||||
* on versions newer than this.
|
* idleness" deadlock.
|
||||||
*/
|
*/
|
||||||
const CODEQL_MINIMUM_VERSION = "2.6.3";
|
const CODEQL_MINIMUM_VERSION = "2.4.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_RAM_FINALIZE = "2.5.8";
|
||||||
|
const CODEQL_VERSION_DIAGNOSTICS = "2.5.6";
|
||||||
|
const CODEQL_VERSION_METRICS = "2.5.5";
|
||||||
|
const CODEQL_VERSION_GROUP_RULES = "2.5.5";
|
||||||
|
const CODEQL_VERSION_SARIF_GROUP = "2.5.3";
|
||||||
|
exports.CODEQL_VERSION_COUNTS_LINES = "2.6.2";
|
||||||
const CODEQL_VERSION_CUSTOM_QUERY_HELP = "2.7.1";
|
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";
|
||||||
exports.CODEQL_VERSION_CONFIG_FILES = "2.10.1";
|
exports.CODEQL_VERSION_CONFIG_FILES = "2.10.1";
|
||||||
@@ -120,6 +127,15 @@ function getCodeQLBundleName() {
|
|||||||
return `codeql-bundle-${platform}.tar.gz`;
|
return `codeql-bundle-${platform}.tar.gz`;
|
||||||
}
|
}
|
||||||
function getCodeQLActionRepository(logger) {
|
function getCodeQLActionRepository(logger) {
|
||||||
|
if (!util.isActions()) {
|
||||||
|
return exports.CODEQL_DEFAULT_ACTION_REPOSITORY;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return getActionsCodeQLActionRepository(logger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.getCodeQLActionRepository = getCodeQLActionRepository;
|
||||||
|
function getActionsCodeQLActionRepository(logger) {
|
||||||
if (process.env["GITHUB_ACTION_REPOSITORY"] !== undefined) {
|
if (process.env["GITHUB_ACTION_REPOSITORY"] !== undefined) {
|
||||||
return process.env["GITHUB_ACTION_REPOSITORY"];
|
return process.env["GITHUB_ACTION_REPOSITORY"];
|
||||||
}
|
}
|
||||||
@@ -135,7 +151,6 @@ function getCodeQLActionRepository(logger) {
|
|||||||
const relativeScriptPathParts = (0, actions_util_1.getRelativeScriptPath)().split(path.sep);
|
const relativeScriptPathParts = (0, actions_util_1.getRelativeScriptPath)().split(path.sep);
|
||||||
return `${relativeScriptPathParts[0]}/${relativeScriptPathParts[1]}`;
|
return `${relativeScriptPathParts[0]}/${relativeScriptPathParts[1]}`;
|
||||||
}
|
}
|
||||||
exports.getCodeQLActionRepository = getCodeQLActionRepository;
|
|
||||||
async function getCodeQLBundleDownloadURL(apiDetails, variant, logger) {
|
async function getCodeQLBundleDownloadURL(apiDetails, variant, logger) {
|
||||||
const codeQLActionRepository = getCodeQLActionRepository(logger);
|
const codeQLActionRepository = getCodeQLActionRepository(logger);
|
||||||
const potentialDownloadSources = [
|
const potentialDownloadSources = [
|
||||||
@@ -155,14 +170,14 @@ async function getCodeQLBundleDownloadURL(apiDetails, variant, logger) {
|
|||||||
if (variant === util.GitHubVariant.GHAE) {
|
if (variant === util.GitHubVariant.GHAE) {
|
||||||
try {
|
try {
|
||||||
const release = await api
|
const release = await api
|
||||||
.getApiClient()
|
.getApiClient(apiDetails)
|
||||||
.request("GET /enterprise/code-scanning/codeql-bundle/find/{tag}", {
|
.request("GET /enterprise/code-scanning/codeql-bundle/find/{tag}", {
|
||||||
tag: CODEQL_BUNDLE_VERSION,
|
tag: CODEQL_BUNDLE_VERSION,
|
||||||
});
|
});
|
||||||
const assetID = release.data.assets[codeQLBundleName];
|
const assetID = release.data.assets[codeQLBundleName];
|
||||||
if (assetID !== undefined) {
|
if (assetID !== undefined) {
|
||||||
const download = await api
|
const download = await api
|
||||||
.getApiClient()
|
.getApiClient(apiDetails)
|
||||||
.request("GET /enterprise/code-scanning/codeql-bundle/download/{asset_id}", { asset_id: assetID });
|
.request("GET /enterprise/code-scanning/codeql-bundle/download/{asset_id}", { asset_id: assetID });
|
||||||
const downloadURL = download.data.url;
|
const downloadURL = download.data.url;
|
||||||
logger.info(`Found CodeQL bundle at GitHub AE endpoint with URL ${downloadURL}.`);
|
logger.info(`Found CodeQL bundle at GitHub AE endpoint with URL ${downloadURL}.`);
|
||||||
@@ -185,7 +200,7 @@ async function getCodeQLBundleDownloadURL(apiDetails, variant, logger) {
|
|||||||
}
|
}
|
||||||
const [repositoryOwner, repositoryName] = repository.split("/");
|
const [repositoryOwner, repositoryName] = repository.split("/");
|
||||||
try {
|
try {
|
||||||
const release = await api.getApiClient().repos.getReleaseByTag({
|
const release = await api.getApiClient(apiDetails).repos.getReleaseByTag({
|
||||||
owner: repositoryOwner,
|
owner: repositoryOwner,
|
||||||
repo: repositoryName,
|
repo: repositoryName,
|
||||||
tag: CODEQL_BUNDLE_VERSION,
|
tag: CODEQL_BUNDLE_VERSION,
|
||||||
@@ -496,25 +511,34 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
...getExtraOptionsFromEnv(["database", "init"]),
|
...getExtraOptionsFromEnv(["database", "init"]),
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
async databaseInitCluster(config, sourceRoot, processName, featureEnablement) {
|
async databaseInitCluster(config, sourceRoot, processName, processLevel, featureEnablement, 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) {
|
const isGoExtractionReconciliationEnabled = await util.isGoExtractionReconciliationEnabled(featureEnablement);
|
||||||
|
if (config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l, isGoExtractionReconciliationEnabled, logger)).length > 0) {
|
||||||
extraArgs.push("--begin-tracing");
|
extraArgs.push("--begin-tracing");
|
||||||
extraArgs.push(...(await (0, trap_caching_1.getTrapCachingExtractorConfigArgs)(config)));
|
extraArgs.push(...(await (0, trap_caching_1.getTrapCachingExtractorConfigArgs)(config)));
|
||||||
|
if (processName !== undefined) {
|
||||||
extraArgs.push(`--trace-process-name=${processName}`);
|
extraArgs.push(`--trace-process-name=${processName}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// We default to 3 if no other arguments are provided since this was the default
|
||||||
|
// behaviour of the Runner. Note this path never happens in the CodeQL Action
|
||||||
|
// because that always passes in a process name.
|
||||||
|
extraArgs.push(`--trace-process-level=${processLevel || 3}`);
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
// There's a bug in Lua tracing for Go on Windows in versions earlier than
|
// There's a bug in Lua tracing for Go on Windows in versions earlier than
|
||||||
// `CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED`, so don't use Lua tracing
|
// `CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED`, so don't use Lua tracing
|
||||||
// when tracing Go on Windows on these CodeQL versions.
|
// when tracing Go on Windows on these CodeQL versions.
|
||||||
(await util.codeQlVersionAbove(this, CODEQL_VERSION_LUA_TRACER_CONFIG)) &&
|
(await util.codeQlVersionAbove(this, CODEQL_VERSION_LUA_TRACER_CONFIG)) &&
|
||||||
config.languages.includes(languages_1.Language.go) &&
|
config.languages.includes(languages_1.Language.go) &&
|
||||||
(0, languages_1.isTracedLanguage)(languages_1.Language.go) &&
|
(0, languages_1.isTracedLanguage)(languages_1.Language.go, isGoExtractionReconciliationEnabled, logger) &&
|
||||||
process.platform === "win32" &&
|
process.platform === "win32" &&
|
||||||
!(await util.codeQlVersionAbove(this, CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED))) {
|
!(await util.codeQlVersionAbove(this, CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED))) {
|
||||||
extraArgs.push("--no-internal-use-lua-tracing");
|
extraArgs.push("--no-internal-use-lua-tracing");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const configLocation = await generateCodeScanningConfig(codeql, config, featureEnablement);
|
const configLocation = await generateCodescanningConfig(codeql, config, featureEnablement);
|
||||||
if (configLocation) {
|
if (configLocation) {
|
||||||
extraArgs.push(`--codescanning-config=${configLocation}`);
|
extraArgs.push(`--codescanning-config=${configLocation}`);
|
||||||
}
|
}
|
||||||
@@ -530,9 +554,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
},
|
},
|
||||||
async runAutobuild(language) {
|
async runAutobuild(language) {
|
||||||
const cmdName = process.platform === "win32" ? "autobuild.cmd" : "autobuild.sh";
|
const cmdName = process.platform === "win32" ? "autobuild.cmd" : "autobuild.sh";
|
||||||
// The autobuilder for Swift is located in the experimental/ directory.
|
const autobuildCmd = path.join(path.dirname(cmd), language, "tools", cmdName);
|
||||||
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
|
||||||
@@ -600,10 +622,11 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
"finalize",
|
"finalize",
|
||||||
"--finalize-dataset",
|
"--finalize-dataset",
|
||||||
threadsFlag,
|
threadsFlag,
|
||||||
memoryFlag,
|
|
||||||
...getExtraOptionsFromEnv(["database", "finalize"]),
|
...getExtraOptionsFromEnv(["database", "finalize"]),
|
||||||
databasePath,
|
databasePath,
|
||||||
];
|
];
|
||||||
|
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_RAM_FINALIZE))
|
||||||
|
args.push(memoryFlag);
|
||||||
await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, args, error_matcher_1.errorMatchers);
|
await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, args, error_matcher_1.errorMatchers);
|
||||||
},
|
},
|
||||||
async resolveLanguages() {
|
async resolveLanguages() {
|
||||||
@@ -684,14 +707,18 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
verbosityFlag,
|
verbosityFlag,
|
||||||
`--output=${sarifFile}`,
|
`--output=${sarifFile}`,
|
||||||
addSnippetsFlag,
|
addSnippetsFlag,
|
||||||
"--print-diagnostics-summary",
|
|
||||||
"--print-metrics-summary",
|
|
||||||
"--sarif-group-rules-by-pack",
|
|
||||||
...getExtraOptionsFromEnv(["database", "interpret-results"]),
|
...getExtraOptionsFromEnv(["database", "interpret-results"]),
|
||||||
];
|
];
|
||||||
|
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_DIAGNOSTICS))
|
||||||
|
codeqlArgs.push("--print-diagnostics-summary");
|
||||||
|
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_METRICS))
|
||||||
|
codeqlArgs.push("--print-metrics-summary");
|
||||||
|
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_GROUP_RULES))
|
||||||
|
codeqlArgs.push("--sarif-group-rules-by-pack");
|
||||||
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_CUSTOM_QUERY_HELP))
|
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_CUSTOM_QUERY_HELP))
|
||||||
codeqlArgs.push("--sarif-add-query-help");
|
codeqlArgs.push("--sarif-add-query-help");
|
||||||
if (automationDetailsId !== undefined) {
|
if (automationDetailsId !== undefined &&
|
||||||
|
(await util.codeQlVersionAbove(this, CODEQL_VERSION_SARIF_GROUP))) {
|
||||||
codeqlArgs.push("--sarif-category", automationDetailsId);
|
codeqlArgs.push("--sarif-category", automationDetailsId);
|
||||||
}
|
}
|
||||||
if (await featureEnablement.getValue(feature_flags_1.Feature.FileBaselineInformationEnabled, this)) {
|
if (await featureEnablement.getValue(feature_flags_1.Feature.FileBaselineInformationEnabled, this)) {
|
||||||
@@ -779,8 +806,8 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
await new toolrunner.ToolRunner(cmd, args).exec();
|
await new toolrunner.ToolRunner(cmd, args).exec();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
// To ensure that status reports include the CodeQL CLI version wherever
|
// To ensure that status reports include the CodeQL CLI version whereever
|
||||||
// possible, we want to call getVersion(), which populates the version value
|
// possbile, we want to call getVersion(), which populates the version value
|
||||||
// used by status reporting, at the earliest opportunity. But invoking
|
// used by status reporting, at the earliest opportunity. But invoking
|
||||||
// getVersion() directly here breaks tests that only pretend to create a
|
// getVersion() directly here breaks tests that only pretend to create a
|
||||||
// CodeQL object. So instead we rely on the assumption that all non-test
|
// CodeQL object. So instead we rely on the assumption that all non-test
|
||||||
@@ -874,7 +901,7 @@ async function runTool(cmd, args = []) {
|
|||||||
* @param config The configuration to use.
|
* @param config The configuration to use.
|
||||||
* @returns the path to the generated user configuration file.
|
* @returns the path to the generated user configuration file.
|
||||||
*/
|
*/
|
||||||
async function generateCodeScanningConfig(codeql, config, featureEnablement) {
|
async function generateCodescanningConfig(codeql, config, featureEnablement) {
|
||||||
var _a;
|
var _a;
|
||||||
if (!(await util.useCodeScanningConfigInCli(codeql, featureEnablement))) {
|
if (!(await util.useCodeScanningConfigInCli(codeql, featureEnablement))) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Generated
+8
-5
@@ -55,7 +55,7 @@ const sampleGHAEApiDetails = {
|
|||||||
};
|
};
|
||||||
let stubConfig;
|
let stubConfig;
|
||||||
ava_1.default.beforeEach(() => {
|
ava_1.default.beforeEach(() => {
|
||||||
(0, util_1.initializeEnvironment)("1.2.3");
|
(0, util_1.initializeEnvironment)(util_1.Mode.actions, "1.2.3");
|
||||||
stubConfig = {
|
stubConfig = {
|
||||||
languages: [languages_1.Language.cpp],
|
languages: [languages_1.Language.cpp],
|
||||||
queries: {},
|
queries: {},
|
||||||
@@ -291,7 +291,10 @@ for (const [isFeatureEnabled, toolsInput, shouldToolcacheBeBypassed,] of TOOLCAC
|
|||||||
});
|
});
|
||||||
(0, ava_1.default)("getCodeQLActionRepository", (t) => {
|
(0, ava_1.default)("getCodeQLActionRepository", (t) => {
|
||||||
const logger = (0, logging_1.getRunnerLogger)(true);
|
const logger = (0, logging_1.getRunnerLogger)(true);
|
||||||
(0, util_1.initializeEnvironment)("1.2.3");
|
(0, util_1.initializeEnvironment)(util_1.Mode.runner, "1.2.3");
|
||||||
|
const repoActions = codeql.getCodeQLActionRepository(logger);
|
||||||
|
t.deepEqual(repoActions, "github/codeql-action");
|
||||||
|
(0, util_1.initializeEnvironment)(util_1.Mode.actions, "1.2.3");
|
||||||
// isRunningLocalAction() === true
|
// isRunningLocalAction() === true
|
||||||
delete process.env["GITHUB_ACTION_REPOSITORY"];
|
delete process.env["GITHUB_ACTION_REPOSITORY"];
|
||||||
process.env["RUNNER_TEMP"] = path.dirname(__dirname);
|
process.env["RUNNER_TEMP"] = path.dirname(__dirname);
|
||||||
@@ -329,7 +332,7 @@ for (const [isFeatureEnabled, toolsInput, shouldToolcacheBeBypassed,] of TOOLCAC
|
|||||||
packsInputCombines: false,
|
packsInputCombines: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
await codeqlObject.databaseInitCluster(thisStubConfig, "", undefined, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
await codeqlObject.databaseInitCluster(thisStubConfig, "", undefined, undefined, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
const args = runnerConstructorStub.firstCall.args[1];
|
const args = runnerConstructorStub.firstCall.args[1];
|
||||||
// should NOT have used an config file
|
// should NOT have used an config file
|
||||||
const configArg = args.find((arg) => arg.startsWith("--codescanning-config="));
|
const configArg = args.find((arg) => arg.startsWith("--codescanning-config="));
|
||||||
@@ -351,7 +354,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
tempDir,
|
tempDir,
|
||||||
augmentationProperties,
|
augmentationProperties,
|
||||||
};
|
};
|
||||||
await codeqlObject.databaseInitCluster(thisStubConfig, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), (0, logging_1.getRunnerLogger)(true));
|
await codeqlObject.databaseInitCluster(thisStubConfig, "", undefined, undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), (0, logging_1.getRunnerLogger)(true));
|
||||||
const args = runnerConstructorStub.firstCall.args[1];
|
const args = runnerConstructorStub.firstCall.args[1];
|
||||||
// should have used an config file
|
// should have used an config file
|
||||||
const configArg = args.find((arg) => arg.startsWith("--codescanning-config="));
|
const configArg = args.find((arg) => arg.startsWith("--codescanning-config="));
|
||||||
@@ -551,7 +554,7 @@ const injectedConfigMacro = ava_1.default.macro({
|
|||||||
sinon
|
sinon
|
||||||
.stub(codeqlObject, "getVersion")
|
.stub(codeqlObject, "getVersion")
|
||||||
.resolves(codeql.CODEQL_VERSION_CONFIG_FILES);
|
.resolves(codeql.CODEQL_VERSION_CONFIG_FILES);
|
||||||
await codeqlObject.databaseInitCluster(stubConfig, "", undefined, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
await codeqlObject.databaseInitCluster(stubConfig, "", undefined, undefined, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
||||||
const args = runnerConstructorStub.firstCall.args[1];
|
const args = runnerConstructorStub.firstCall.args[1];
|
||||||
// should have used an config file
|
// should have used an config file
|
||||||
const configArg = args.find((arg) => arg.startsWith("--codescanning-config="));
|
const configArg = args.find((arg) => arg.startsWith("--codescanning-config="));
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Generated
+7
-7
@@ -387,9 +387,9 @@ exports.getUnknownLanguagesError = getUnknownLanguagesError;
|
|||||||
/**
|
/**
|
||||||
* Gets the set of languages in the current repository
|
* Gets the set of languages in the current repository
|
||||||
*/
|
*/
|
||||||
async function getLanguagesInRepo(repository, logger) {
|
async function getLanguagesInRepo(repository, apiDetails, logger) {
|
||||||
logger.debug(`GitHub repo ${repository.owner} ${repository.repo}`);
|
logger.debug(`GitHub repo ${repository.owner} ${repository.repo}`);
|
||||||
const response = await api.getApiClient().repos.listLanguages({
|
const response = await api.getApiClient(apiDetails).repos.listLanguages({
|
||||||
owner: repository.owner,
|
owner: repository.owner,
|
||||||
repo: repository.repo,
|
repo: repository.repo,
|
||||||
});
|
});
|
||||||
@@ -417,7 +417,7 @@ async function getLanguagesInRepo(repository, logger) {
|
|||||||
* If no languages could be detected from either the workflow or the repository
|
* If no languages could be detected from either the workflow or the repository
|
||||||
* then throw an error.
|
* then throw an error.
|
||||||
*/
|
*/
|
||||||
async function getLanguages(codeQL, languagesInput, repository, logger) {
|
async function getLanguages(codeQL, languagesInput, repository, apiDetails, logger) {
|
||||||
// Obtain from action input 'languages' if set
|
// Obtain from action input 'languages' if set
|
||||||
let languages = (languagesInput || "")
|
let languages = (languagesInput || "")
|
||||||
.split(",")
|
.split(",")
|
||||||
@@ -426,7 +426,7 @@ async function getLanguages(codeQL, languagesInput, repository, logger) {
|
|||||||
logger.info(`Languages from configuration: ${JSON.stringify(languages)}`);
|
logger.info(`Languages from configuration: ${JSON.stringify(languages)}`);
|
||||||
if (languages.length === 0) {
|
if (languages.length === 0) {
|
||||||
// Obtain languages as all languages in the repo that can be analysed
|
// Obtain languages as all languages in the repo that can be analysed
|
||||||
languages = await getLanguagesInRepo(repository, logger);
|
languages = await getLanguagesInRepo(repository, apiDetails, logger);
|
||||||
const availableLanguages = await codeQL.resolveLanguages();
|
const availableLanguages = await codeQL.resolveLanguages();
|
||||||
languages = languages.filter((value) => value in availableLanguages);
|
languages = languages.filter((value) => value in availableLanguages);
|
||||||
logger.info(`Automatically detected languages: ${JSON.stringify(languages)}`);
|
logger.info(`Automatically detected languages: ${JSON.stringify(languages)}`);
|
||||||
@@ -478,7 +478,7 @@ function shouldAddConfigFileQueries(queriesInput) {
|
|||||||
* Get the default config for when the user has not supplied one.
|
* Get the default config for when the user has not supplied one.
|
||||||
*/
|
*/
|
||||||
async function getDefaultConfig(languagesInput, rawQueriesInput, rawPacksInput, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureEnablement, logger) {
|
async function getDefaultConfig(languagesInput, rawQueriesInput, rawPacksInput, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, featureEnablement, logger) {
|
||||||
const languages = await getLanguages(codeQL, languagesInput, repository, logger);
|
const languages = await getLanguages(codeQL, languagesInput, repository, apiDetails, logger);
|
||||||
const queries = {};
|
const queries = {};
|
||||||
for (const language of languages) {
|
for (const language of languages) {
|
||||||
queries[language] = {
|
queries[language] = {
|
||||||
@@ -552,7 +552,7 @@ async function loadConfig(languagesInput, rawQueriesInput, rawPacksInput, config
|
|||||||
throw new Error(getNameInvalid(configFile));
|
throw new Error(getNameInvalid(configFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const languages = await getLanguages(codeQL, languagesInput, repository, logger);
|
const languages = await getLanguages(codeQL, languagesInput, repository, apiDetails, logger);
|
||||||
const queries = {};
|
const queries = {};
|
||||||
for (const language of languages) {
|
for (const language of languages) {
|
||||||
queries[language] = {
|
queries[language] = {
|
||||||
@@ -954,7 +954,7 @@ async function getRemoteConfig(configFile, apiDetails) {
|
|||||||
throw new Error(getConfigFileRepoFormatInvalidMessage(configFile));
|
throw new Error(getConfigFileRepoFormatInvalidMessage(configFile));
|
||||||
}
|
}
|
||||||
const response = await api
|
const response = await api
|
||||||
.getApiClientWithExternalAuth(apiDetails)
|
.getApiClient(apiDetails, { allowExternal: true })
|
||||||
.repos.getContent({
|
.repos.getContent({
|
||||||
owner: pieces.groups.owner,
|
owner: pieces.groups.owner,
|
||||||
repo: pieces.groups.repo,
|
repo: pieces.groups.repo,
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Generated
-1
@@ -61,7 +61,6 @@ function mockGetContents(content) {
|
|||||||
.stub(client.repos, "getContent")
|
.stub(client.repos, "getContent")
|
||||||
.resolves(response);
|
.resolves(response);
|
||||||
sinon.stub(api, "getApiClient").value(() => client);
|
sinon.stub(api, "getApiClient").value(() => client);
|
||||||
sinon.stub(api, "getApiClientWithExternalAuth").value(() => client);
|
|
||||||
return spyGetContents;
|
return spyGetContents;
|
||||||
}
|
}
|
||||||
function mockListLanguages(languages) {
|
function mockListLanguages(languages) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Generated
+70
@@ -0,0 +1,70 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.countLoc = void 0;
|
||||||
|
const github_linguist_1 = require("github-linguist");
|
||||||
|
const languages_1 = require("./languages");
|
||||||
|
// Map from linguist language names to language prefixes used in the action and codeql
|
||||||
|
const linguistToMetrics = {
|
||||||
|
c: languages_1.Language.cpp,
|
||||||
|
"c++": languages_1.Language.cpp,
|
||||||
|
"c#": languages_1.Language.csharp,
|
||||||
|
go: languages_1.Language.go,
|
||||||
|
java: languages_1.Language.java,
|
||||||
|
javascript: languages_1.Language.javascript,
|
||||||
|
python: languages_1.Language.python,
|
||||||
|
ruby: languages_1.Language.ruby,
|
||||||
|
typescript: languages_1.Language.javascript,
|
||||||
|
};
|
||||||
|
const nameToLinguist = Object.entries(linguistToMetrics).reduce((obj, [key, name]) => {
|
||||||
|
if (!obj[name]) {
|
||||||
|
obj[name] = [];
|
||||||
|
}
|
||||||
|
obj[name].push(key);
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
/**
|
||||||
|
* Count the lines of code of the specified language using the include
|
||||||
|
* and exclude glob paths.
|
||||||
|
*
|
||||||
|
* @param cwd the root directory to start the count from
|
||||||
|
* @param include glob patterns to include in the search for relevant files
|
||||||
|
* @param exclude glob patterns to exclude in the search for relevant files
|
||||||
|
* @param dbLanguages list of languages to include in the results
|
||||||
|
* @param logger object to log results
|
||||||
|
*/
|
||||||
|
async function countLoc(cwd, include, exclude, dbLanguages, logger) {
|
||||||
|
const result = await new github_linguist_1.LocDir({
|
||||||
|
cwd,
|
||||||
|
include: Array.isArray(include) && include.length > 0 ? include : ["**"],
|
||||||
|
exclude,
|
||||||
|
analysisLanguages: dbLanguages.flatMap((lang) => nameToLinguist[lang]),
|
||||||
|
}).loadInfo();
|
||||||
|
// The analysis counts LoC in all languages. We need to
|
||||||
|
// extract the languages we care about. Also, note that
|
||||||
|
// the analysis uses slightly different names for language.
|
||||||
|
const lineCounts = Object.entries(result.languages).reduce((obj, [language, { code }]) => {
|
||||||
|
const metricsLanguage = linguistToMetrics[language];
|
||||||
|
if (metricsLanguage && dbLanguages.includes(metricsLanguage)) {
|
||||||
|
obj[metricsLanguage] = code + (obj[metricsLanguage] || 0);
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
if (Object.keys(lineCounts).length) {
|
||||||
|
logger.debug("Lines of code count:");
|
||||||
|
for (const [language, count] of Object.entries(lineCounts)) {
|
||||||
|
logger.debug(` ${language}: ${count}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
logger.info("Could not determine the baseline lines of code count in this repository. " +
|
||||||
|
"Because of this, it will not be possible to compare the lines " +
|
||||||
|
"of code analyzed by code scanning with the baseline. This will not affect " +
|
||||||
|
"the results produced by code scanning. If you have any questions, you can " +
|
||||||
|
"raise an issue at https://github.com/github/codeql-action/issues. Please " +
|
||||||
|
"include a link to the repository if public, or otherwise information about " +
|
||||||
|
"the code scanning workflow you are using.");
|
||||||
|
}
|
||||||
|
return lineCounts;
|
||||||
|
}
|
||||||
|
exports.countLoc = countLoc;
|
||||||
|
//# sourceMappingURL=count-loc.js.map
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"count-loc.js","sourceRoot":"","sources":["../src/count-loc.ts"],"names":[],"mappings":";;;AAAA,qDAAyC;AAEzC,2CAAuC;AAGvC,sFAAsF;AACtF,MAAM,iBAAiB,GAA6B;IAClD,CAAC,EAAE,oBAAQ,CAAC,GAAG;IACf,KAAK,EAAE,oBAAQ,CAAC,GAAG;IACnB,IAAI,EAAE,oBAAQ,CAAC,MAAM;IACrB,EAAE,EAAE,oBAAQ,CAAC,EAAE;IACf,IAAI,EAAE,oBAAQ,CAAC,IAAI;IACnB,UAAU,EAAE,oBAAQ,CAAC,UAAU;IAC/B,MAAM,EAAE,oBAAQ,CAAC,MAAM;IACvB,IAAI,EAAE,oBAAQ,CAAC,IAAI;IACnB,UAAU,EAAE,oBAAQ,CAAC,UAAU;CAChC,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAC7D,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,E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AAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;QAClC,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACrC,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YAC1D,MAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,KAAK,KAAK,EAAE,CAAC,CAAC;SACzC;KACF;SAAM;QACL,MAAM,CAAC,IAAI,CACT,2EAA2E;YACzE,gEAAgE;YAChE,4EAA4E;YAC5E,4EAA4E;YAC5E,2EAA2E;YAC3E,6EAA6E;YAC7E,2CAA2C,CAC9C,CAAC;KACH;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AA9CD,4BA8CC"}
|
||||||
Generated
+78
@@ -0,0 +1,78 @@
|
|||||||
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const path = __importStar(require("path"));
|
||||||
|
const ava_1 = __importDefault(require("ava"));
|
||||||
|
const count_loc_1 = require("./count-loc");
|
||||||
|
const languages_1 = require("./languages");
|
||||||
|
const logging_1 = require("./logging");
|
||||||
|
const testing_utils_1 = require("./testing-utils");
|
||||||
|
(0, testing_utils_1.setupTests)(ava_1.default);
|
||||||
|
(0, ava_1.default)("ensure lines of code works for cpp and js", async (t) => {
|
||||||
|
const results = await (0, count_loc_1.countLoc)(path.join(__dirname, "../tests/multi-language-repo"), [], [], [languages_1.Language.cpp, languages_1.Language.javascript], (0, logging_1.getRunnerLogger)(true));
|
||||||
|
t.deepEqual(results, {
|
||||||
|
cpp: 6,
|
||||||
|
javascript: 9,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("ensure lines of code works for csharp", async (t) => {
|
||||||
|
const results = await (0, count_loc_1.countLoc)(path.join(__dirname, "../tests/multi-language-repo"), [], [], [languages_1.Language.csharp], (0, logging_1.getRunnerLogger)(true));
|
||||||
|
t.deepEqual(results, {
|
||||||
|
csharp: 10,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("ensure lines of code can handle undefined language", async (t) => {
|
||||||
|
const results = await (0, count_loc_1.countLoc)(path.join(__dirname, "../tests/multi-language-repo"), [], [], [languages_1.Language.javascript, languages_1.Language.python, "hucairz"], (0, logging_1.getRunnerLogger)(true));
|
||||||
|
t.deepEqual(results, {
|
||||||
|
javascript: 9,
|
||||||
|
python: 5,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("ensure lines of code can handle empty languages", async (t) => {
|
||||||
|
const results = await (0, count_loc_1.countLoc)(path.join(__dirname, "../tests/multi-language-repo"), [], [], [], (0, logging_1.getRunnerLogger)(true));
|
||||||
|
t.deepEqual(results, {});
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("ensure lines of code can handle includes", async (t) => {
|
||||||
|
// note that "**" is always included. The includes are for extra
|
||||||
|
// directories outside the normal structure.
|
||||||
|
const results = await (0, count_loc_1.countLoc)(path.join(__dirname, "../tests/multi-language-repo"), ["../../src/testdata"], [], [languages_1.Language.javascript], (0, logging_1.getRunnerLogger)(true));
|
||||||
|
t.deepEqual(results, {
|
||||||
|
javascript: 12,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("ensure lines of code can handle empty includes", async (t) => {
|
||||||
|
// note that "**" is always included. The includes are for extra
|
||||||
|
// directories outside the normal structure.
|
||||||
|
const results = await (0, count_loc_1.countLoc)(path.join(__dirname, "../tests/multi-language-repo"), ["idontexist"], [], [languages_1.Language.javascript], (0, logging_1.getRunnerLogger)(true));
|
||||||
|
t.deepEqual(results, {
|
||||||
|
// should get no results
|
||||||
|
});
|
||||||
|
});
|
||||||
|
(0, ava_1.default)("ensure lines of code can handle exclude", async (t) => {
|
||||||
|
const results = await (0, count_loc_1.countLoc)(path.join(__dirname, "../tests/multi-language-repo"), [], ["**/*.py"], [languages_1.Language.javascript, languages_1.Language.python], (0, logging_1.getRunnerLogger)(true));
|
||||||
|
t.deepEqual(results, {
|
||||||
|
javascript: 9,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=count-loc.test.js.map
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"count-loc.test.js","sourceRoot":"","sources":["../src/count-loc.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAE7B,8CAAuB;AAEvB,2CAAuC;AACvC,2CAAuC;AACvC,uCAA4C;AAC5C,mDAA6C;AAE7C,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,IAAA,aAAI,EAAC,2CAA2C,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC5D,MAAM,OAAO,GAAG,MAAM,IAAA,oBAAQ,EAC5B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,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8BAA8B,CAAC,EACpD,EAAE,EACF,CAAC,SAAS,CAAC,EACX,CAAC,oBAAQ,CAAC,UAAU,EAAE,oBAAQ,CAAC,MAAM,CAAC,EACtC,IAAA,yBAAe,EAAC,IAAI,CAAC,CACtB,CAAC;IAEF,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE;QACnB,UAAU,EAAE,CAAC;KACd,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||||
Generated
+1
-1
@@ -41,7 +41,7 @@ async function uploadDatabases(repositoryNwo, config, apiDetails, logger) {
|
|||||||
logger.debug("Not analyzing default branch. Skipping upload.");
|
logger.debug("Not analyzing default branch. Skipping upload.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const client = (0, api_client_1.getApiClient)();
|
const client = (0, api_client_1.getApiClient)(apiDetails);
|
||||||
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
// Upload the database bundle.
|
// Upload the database bundle.
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"database-upload.js","sourceRoot":"","sources":["../src/database-upload.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,4DAA8C;AAC9C,6CAA8D;AAC9D,qCAAqC;AAIrC,6CAA+B;AAC/B,iCAAkC;AAE3B,KAAK,UAAU,eAAe,CACnC,aAA4B,EAC5B,MAAc,EACd,UAA4B,EAC5B,MAAc;IAEd,IAAI,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,MAAM,EAAE;QAC9D,MAAM,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;QACvE,OAAO;KACR;IAED,iDAAiD;IACjD,IAAI,MAAM,CAAC,aAAa,CAAC,IAAI,KAAK,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;QAC3D,MAAM,CAAC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,GAAG,QAAQ,WAAW;gBAC5B,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,UAAU,CAAC,IAAI,EAAE;oBACzC,cAAc,EAAE,iBAAiB;iBAClC;aACF,CACF,CAAC;YACF,MAAM,CAAC,KAAK,CAAC,sCAAsC,QAAQ,EAAE,CAAC,CAAC;SAChE;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACf,4CAA4C;YAC5C,MAAM,CAAC,OAAO,CAAC,iCAAiC,QAAQ,KAAK,CAAC,EAAE,CAAC,CAAC;SACnE;KACF;AACH,CAAC;AAxDD,0CAwDC"}
|
||||||
Generated
+1
-1
@@ -36,7 +36,7 @@ const testing_utils_1 = require("./testing-utils");
|
|||||||
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);
|
||||||
ava_1.default.beforeEach(() => {
|
ava_1.default.beforeEach(() => {
|
||||||
(0, util_1.initializeEnvironment)("1.2.3");
|
(0, util_1.initializeEnvironment)(util_1.Mode.actions, "1.2.3");
|
||||||
});
|
});
|
||||||
const testRepoName = { owner: "github", repo: "example" };
|
const testRepoName = { owner: "github", repo: "example" };
|
||||||
const testApiDetails = {
|
const testApiDetails = {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"bundleVersion": "codeql-bundle-20221105"
|
"bundleVersion": "codeql-bundle-20221024"
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+17
-57
@@ -19,17 +19,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.Features = exports.FEATURE_FLAGS_FILE_NAME = exports.featureConfig = exports.Feature = void 0;
|
exports.Features = exports.featureConfig = exports.Feature = void 0;
|
||||||
const fs = __importStar(require("fs"));
|
|
||||||
const path = __importStar(require("path"));
|
|
||||||
const api_client_1 = require("./api-client");
|
const api_client_1 = require("./api-client");
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
var Feature;
|
var Feature;
|
||||||
(function (Feature) {
|
(function (Feature) {
|
||||||
Feature["BypassToolcacheEnabled"] = "bypass_toolcache_enabled";
|
Feature["BypassToolcacheEnabled"] = "bypass_toolcache_enabled";
|
||||||
Feature["CliConfigFileEnabled"] = "cli_config_file_enabled";
|
Feature["CliConfigFileEnabled"] = "cli_config_file_enabled";
|
||||||
Feature["DisableKotlinAnalysisEnabled"] = "disable_kotlin_analysis_enabled";
|
|
||||||
Feature["FileBaselineInformationEnabled"] = "file_baseline_information_enabled";
|
Feature["FileBaselineInformationEnabled"] = "file_baseline_information_enabled";
|
||||||
|
Feature["GolangExtractionReconciliationEnabled"] = "golang_extraction_reconciliation_enabled";
|
||||||
Feature["MlPoweredQueriesEnabled"] = "ml_powered_queries_enabled";
|
Feature["MlPoweredQueriesEnabled"] = "ml_powered_queries_enabled";
|
||||||
Feature["TrapCachingEnabled"] = "trap_caching_enabled";
|
Feature["TrapCachingEnabled"] = "trap_caching_enabled";
|
||||||
})(Feature = exports.Feature || (exports.Feature = {}));
|
})(Feature = exports.Feature || (exports.Feature = {}));
|
||||||
@@ -38,10 +36,6 @@ exports.featureConfig = {
|
|||||||
envVar: "CODEQL_BYPASS_TOOLCACHE",
|
envVar: "CODEQL_BYPASS_TOOLCACHE",
|
||||||
minimumVersion: undefined,
|
minimumVersion: undefined,
|
||||||
},
|
},
|
||||||
[Feature.DisableKotlinAnalysisEnabled]: {
|
|
||||||
envVar: "CODEQL_DISABLE_KOTLIN_ANALYSIS",
|
|
||||||
minimumVersion: undefined,
|
|
||||||
},
|
|
||||||
[Feature.CliConfigFileEnabled]: {
|
[Feature.CliConfigFileEnabled]: {
|
||||||
envVar: "CODEQL_PASS_CONFIG_TO_CLI",
|
envVar: "CODEQL_PASS_CONFIG_TO_CLI",
|
||||||
minimumVersion: "2.11.1",
|
minimumVersion: "2.11.1",
|
||||||
@@ -50,6 +44,10 @@ exports.featureConfig = {
|
|||||||
envVar: "CODEQL_FILE_BASELINE_INFORMATION",
|
envVar: "CODEQL_FILE_BASELINE_INFORMATION",
|
||||||
minimumVersion: "2.11.3",
|
minimumVersion: "2.11.3",
|
||||||
},
|
},
|
||||||
|
[Feature.GolangExtractionReconciliationEnabled]: {
|
||||||
|
envVar: "CODEQL_GOLANG_EXTRACTION_RECONCILIATION",
|
||||||
|
minimumVersion: undefined,
|
||||||
|
},
|
||||||
[Feature.MlPoweredQueriesEnabled]: {
|
[Feature.MlPoweredQueriesEnabled]: {
|
||||||
envVar: "CODEQL_ML_POWERED_QUERIES",
|
envVar: "CODEQL_ML_POWERED_QUERIES",
|
||||||
minimumVersion: "2.7.5",
|
minimumVersion: "2.7.5",
|
||||||
@@ -59,15 +57,14 @@ exports.featureConfig = {
|
|||||||
minimumVersion: undefined,
|
minimumVersion: undefined,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
exports.FEATURE_FLAGS_FILE_NAME = "cached-feature-flags.json";
|
|
||||||
/**
|
/**
|
||||||
* Determines the enablement status of a number of features.
|
* Determines the enablement status of a number of features.
|
||||||
* If feature enablement is not able to be determined locally, a request to the
|
* If feature enablement is not able to be determined locally, a request to the
|
||||||
* GitHub API is made to determine the enablement status.
|
* GitHub API is made to determine the enablement status.
|
||||||
*/
|
*/
|
||||||
class Features {
|
class Features {
|
||||||
constructor(gitHubVersion, repositoryNwo, tempDir, logger) {
|
constructor(gitHubVersion, apiDetails, repositoryNwo, logger) {
|
||||||
this.gitHubFeatureFlags = new GitHubFeatureFlags(gitHubVersion, repositoryNwo, path.join(tempDir, exports.FEATURE_FLAGS_FILE_NAME), logger);
|
this.gitHubFeatureFlags = new GitHubFeatureFlags(gitHubVersion, apiDetails, repositoryNwo, logger);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -111,15 +108,15 @@ class Features {
|
|||||||
}
|
}
|
||||||
exports.Features = Features;
|
exports.Features = Features;
|
||||||
class GitHubFeatureFlags {
|
class GitHubFeatureFlags {
|
||||||
constructor(gitHubVersion, repositoryNwo, featureFlagsFile, logger) {
|
constructor(gitHubVersion, apiDetails, repositoryNwo, logger) {
|
||||||
this.gitHubVersion = gitHubVersion;
|
this.gitHubVersion = gitHubVersion;
|
||||||
|
this.apiDetails = apiDetails;
|
||||||
this.repositoryNwo = repositoryNwo;
|
this.repositoryNwo = repositoryNwo;
|
||||||
this.featureFlagsFile = featureFlagsFile;
|
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
/**/
|
/**/
|
||||||
}
|
}
|
||||||
async getValue(feature) {
|
async getValue(feature) {
|
||||||
const response = await this.getAllFeatures();
|
const response = await this.getApiResponse();
|
||||||
if (response === undefined) {
|
if (response === undefined) {
|
||||||
this.logger.debug(`No feature flags API response for ${feature}, considering it disabled.`);
|
this.logger.debug(`No feature flags API response for ${feature}, considering it disabled.`);
|
||||||
return false;
|
return false;
|
||||||
@@ -131,48 +128,10 @@ class GitHubFeatureFlags {
|
|||||||
}
|
}
|
||||||
return !!featureEnablement;
|
return !!featureEnablement;
|
||||||
}
|
}
|
||||||
async getAllFeatures() {
|
async getApiResponse() {
|
||||||
// if we have an in memory cache, use that
|
const apiResponse = this.cachedApiResponse || (await this.loadApiResponse());
|
||||||
if (this.cachedApiResponse !== undefined) {
|
this.cachedApiResponse = apiResponse;
|
||||||
return this.cachedApiResponse;
|
return apiResponse;
|
||||||
}
|
|
||||||
// if a previous step has written a feature flags file to disk, use that
|
|
||||||
const fileFlags = await this.readLocalFlags();
|
|
||||||
if (fileFlags !== undefined) {
|
|
||||||
this.cachedApiResponse = fileFlags;
|
|
||||||
return fileFlags;
|
|
||||||
}
|
|
||||||
// if not, request flags from the server
|
|
||||||
let remoteFlags = await this.loadApiResponse();
|
|
||||||
if (remoteFlags === undefined) {
|
|
||||||
remoteFlags = {};
|
|
||||||
}
|
|
||||||
// cache the response in memory
|
|
||||||
this.cachedApiResponse = remoteFlags;
|
|
||||||
// and cache them to disk so future workflow steps can use them
|
|
||||||
await this.writeLocalFlags(remoteFlags);
|
|
||||||
return remoteFlags;
|
|
||||||
}
|
|
||||||
async readLocalFlags() {
|
|
||||||
try {
|
|
||||||
if (fs.existsSync(this.featureFlagsFile)) {
|
|
||||||
this.logger.debug(`Loading feature flags from ${this.featureFlagsFile}`);
|
|
||||||
return JSON.parse(fs.readFileSync(this.featureFlagsFile, "utf8"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
this.logger.warning(`Error reading cached feature flags file ${this.featureFlagsFile}: ${e}. Requesting from GitHub instead.`);
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
async writeLocalFlags(flags) {
|
|
||||||
try {
|
|
||||||
this.logger.debug(`Writing feature flags to ${this.featureFlagsFile}`);
|
|
||||||
fs.writeFileSync(this.featureFlagsFile, JSON.stringify(flags));
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
this.logger.warning(`Error writing cached feature flags file ${this.featureFlagsFile}: ${e}.`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
async loadApiResponse() {
|
async loadApiResponse() {
|
||||||
// Do nothing when not running against github.com
|
// Do nothing when not running against github.com
|
||||||
@@ -180,8 +139,9 @@ class GitHubFeatureFlags {
|
|||||||
this.logger.debug("Not running against github.com. Disabling all toggleable features.");
|
this.logger.debug("Not running against github.com. Disabling all toggleable features.");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
const client = (0, api_client_1.getApiClient)(this.apiDetails);
|
||||||
try {
|
try {
|
||||||
const response = await (0, api_client_1.getApiClient)().request("GET /repos/:owner/:repo/code-scanning/codeql-action/features", {
|
const response = await client.request("GET /repos/:owner/:repo/code-scanning/codeql-action/features", {
|
||||||
owner: this.repositoryNwo.owner,
|
owner: this.repositoryNwo.owner,
|
||||||
repo: this.repositoryNwo.repo,
|
repo: this.repositoryNwo.repo,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"feature-flags.js","sourceRoot":"","sources":["../src/feature-flags.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,6CAA4C;AAI5C,6CAA+B;AAM/B,IAAY,OAOX;AAPD,WAAY,OAAO;IACjB,8DAAmD,CAAA;IACnD,2DAAgD,CAAA;IAChD,2EAAgE,CAAA;IAChE,+EAAoE,CAAA;IACpE,iEAAsD,CAAA;IACtD,sDAA2C,CAAA;AAC7C,CAAC,EAPW,OAAO,GAAP,eAAO,KAAP,eAAO,QAOlB;AAEY,QAAA,aAAa,GAGtB;IACF,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE;QAChC,MAAM,EAAE,yBAAyB;QACjC,cAAc,EAAE,SAAS;KAC1B;IACD,CAAC,OAAO,CAAC,4BAA4B,CAAC,EAAE;QACtC,MAAM,EAAE,gCAAgC;QACxC,cAAc,EAAE,SAAS;KAC1B;IACD,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE;QAC9B,MAAM,EAAE,2BAA2B;QACnC,cAAc,EAAE,QAAQ;KACzB;IACD,CAAC,OAAO,CAAC,8BAA8B,CAAC,EAAE;QACxC,MAAM,EAAE,kCAAkC;QAC1C,cAAc,EAAE,QAAQ;KACzB;IACD,CAAC,OAAO,CAAC,uBAAuB,CAAC,EAAE;QACjC,MAAM,EAAE,2BAA2B;QACnC,cAAc,EAAE,OAAO;KACxB;IACD,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;QAC5B,MAAM,EAAE,qBAAqB;QAC7B,cAAc,EAAE,SAAS;KAC1B;CACF,CAAC;AAUW,QAAA,uBAAuB,GAAG,2BAA2B,CAAC;AAEn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Ae,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,iBAAiB,GAAG,WAAW,CAAC;QACrC,OAAO,WAAW,CAAC;IACrB,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,iDAAiD;QACjD,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;YACzD,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,oEAAoE,CACrE,CAAC;YACF,OAAO,EAAE,CAAC;SACX;QACD,MAAM,MAAM,GAAG,IAAA,yBAAY,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CACnC,8DAA8D,EAC9D;gBACE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK;gBAC/B,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI;aAC9B,CACF,CAAC;YACF,OAAO,QAAQ,CAAC,IAAI,CAAC;SACtB;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG,EAAE;gBAC3C,IAAI,CAAC,MAAM,CAAC,OAAO,CACjB,gGAAgG;oBAC9F,oEAAoE;oBACpE,qFAAqF;oBACrF,kFAAkF,CAAC,EAAE,CACxF,CAAC;aACH;iBAAM;gBACL,kFAAkF;gBAClF,8EAA8E;gBAC9E,2FAA2F;gBAC3F,eAAe;gBACf,MAAM,IAAI,KAAK,CACb,sEAAsE,CAAC,EAAE,CAC1E,CAAC;aACH;SACF;IACH,CAAC;CACF"}
|
||||||
Generated
+17
-64
@@ -1,29 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
||||||
__setModuleDefault(result, mod);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const fs = __importStar(require("fs"));
|
|
||||||
const path = __importStar(require("path"));
|
|
||||||
const ava_1 = __importDefault(require("ava"));
|
const ava_1 = __importDefault(require("ava"));
|
||||||
const feature_flags_1 = require("./feature-flags");
|
const feature_flags_1 = require("./feature-flags");
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
@@ -32,8 +11,13 @@ const testing_utils_1 = require("./testing-utils");
|
|||||||
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);
|
||||||
ava_1.default.beforeEach(() => {
|
ava_1.default.beforeEach(() => {
|
||||||
(0, util_1.initializeEnvironment)("1.2.3");
|
(0, util_1.initializeEnvironment)(util_1.Mode.actions, "1.2.3");
|
||||||
});
|
});
|
||||||
|
const testApiDetails = {
|
||||||
|
auth: "1234",
|
||||||
|
url: "https://github.com",
|
||||||
|
apiURL: undefined,
|
||||||
|
};
|
||||||
const testRepositoryNwo = (0, repository_1.parseRepositoryNwo)("github/example");
|
const testRepositoryNwo = (0, repository_1.parseRepositoryNwo)("github/example");
|
||||||
const ALL_FEATURES_DISABLED_VARIANTS = [
|
const ALL_FEATURES_DISABLED_VARIANTS = [
|
||||||
{
|
{
|
||||||
@@ -46,7 +30,7 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) {
|
|||||||
(0, ava_1.default)(`All features are disabled if running against ${variant.description}`, async (t) => {
|
(0, ava_1.default)(`All features are disabled if running against ${variant.description}`, async (t) => {
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
const loggedMessages = [];
|
const loggedMessages = [];
|
||||||
const featureEnablement = setUpFeatureFlagTests(tmpDir, (0, testing_utils_1.getRecordingLogger)(loggedMessages), variant.gitHubVersion);
|
const featureEnablement = setUpTests(tmpDir, (0, testing_utils_1.getRecordingLogger)(loggedMessages), variant.gitHubVersion);
|
||||||
for (const feature of Object.values(feature_flags_1.Feature)) {
|
for (const feature of Object.values(feature_flags_1.Feature)) {
|
||||||
t.false(await featureEnablement.getValue(feature, includeCodeQlIfRequired(feature)));
|
t.false(await featureEnablement.getValue(feature, includeCodeQlIfRequired(feature)));
|
||||||
}
|
}
|
||||||
@@ -59,7 +43,7 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) {
|
|||||||
(0, ava_1.default)("API response missing", async (t) => {
|
(0, ava_1.default)("API response missing", async (t) => {
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
const loggedMessages = [];
|
const loggedMessages = [];
|
||||||
const featureEnablement = setUpFeatureFlagTests(tmpDir, (0, testing_utils_1.getRecordingLogger)(loggedMessages));
|
const featureEnablement = setUpTests(tmpDir, (0, testing_utils_1.getRecordingLogger)(loggedMessages));
|
||||||
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(403, {});
|
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(403, {});
|
||||||
for (const feature of Object.values(feature_flags_1.Feature)) {
|
for (const feature of Object.values(feature_flags_1.Feature)) {
|
||||||
t.assert((await featureEnablement.getValue(feature, includeCodeQlIfRequired(feature))) === false);
|
t.assert((await featureEnablement.getValue(feature, includeCodeQlIfRequired(feature))) === false);
|
||||||
@@ -70,7 +54,7 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) {
|
|||||||
(0, ava_1.default)("Features are disabled if they're not returned in API response", async (t) => {
|
(0, ava_1.default)("Features are disabled if they're not returned in API response", async (t) => {
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
const loggedMessages = [];
|
const loggedMessages = [];
|
||||||
const featureEnablement = setUpFeatureFlagTests(tmpDir, (0, testing_utils_1.getRecordingLogger)(loggedMessages));
|
const featureEnablement = setUpTests(tmpDir, (0, testing_utils_1.getRecordingLogger)(loggedMessages));
|
||||||
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, {});
|
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, {});
|
||||||
for (const feature of Object.values(feature_flags_1.Feature)) {
|
for (const feature of Object.values(feature_flags_1.Feature)) {
|
||||||
t.assert((await featureEnablement.getValue(feature, includeCodeQlIfRequired(feature))) === false);
|
t.assert((await featureEnablement.getValue(feature, includeCodeQlIfRequired(feature))) === false);
|
||||||
@@ -80,7 +64,7 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) {
|
|||||||
});
|
});
|
||||||
(0, ava_1.default)("Feature flags exception is propagated if the API request errors", async (t) => {
|
(0, ava_1.default)("Feature flags exception is propagated if the API request errors", async (t) => {
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
const featureEnablement = setUpFeatureFlagTests(tmpDir);
|
const featureEnablement = setUpTests(tmpDir);
|
||||||
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(500, {});
|
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(500, {});
|
||||||
await t.throwsAsync(async () => featureEnablement.getValue(feature_flags_1.Feature.MlPoweredQueriesEnabled, includeCodeQlIfRequired(feature_flags_1.Feature.MlPoweredQueriesEnabled)), {
|
await t.throwsAsync(async () => featureEnablement.getValue(feature_flags_1.Feature.MlPoweredQueriesEnabled, includeCodeQlIfRequired(feature_flags_1.Feature.MlPoweredQueriesEnabled)), {
|
||||||
message: "Encountered an error while trying to determine feature enablement: Error: some error message",
|
message: "Encountered an error while trying to determine feature enablement: Error: some error message",
|
||||||
@@ -90,7 +74,7 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) {
|
|||||||
for (const feature of Object.keys(feature_flags_1.featureConfig)) {
|
for (const feature of Object.keys(feature_flags_1.featureConfig)) {
|
||||||
(0, ava_1.default)(`Only feature '${feature}' is enabled if enabled in the API response. Other features disabled`, async (t) => {
|
(0, ava_1.default)(`Only feature '${feature}' is enabled if enabled in the API response. Other features disabled`, async (t) => {
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
const featureEnablement = setUpFeatureFlagTests(tmpDir);
|
const featureEnablement = setUpTests(tmpDir);
|
||||||
// set all features to false except the one we're testing
|
// set all features to false except the one we're testing
|
||||||
const expectedFeatureEnablement = {};
|
const expectedFeatureEnablement = {};
|
||||||
for (const f of Object.keys(feature_flags_1.featureConfig)) {
|
for (const f of Object.keys(feature_flags_1.featureConfig)) {
|
||||||
@@ -108,7 +92,7 @@ for (const feature of Object.keys(feature_flags_1.featureConfig)) {
|
|||||||
});
|
});
|
||||||
(0, ava_1.default)(`Only feature '${feature}' is enabled if the associated environment variable is true. Others disabled.`, async (t) => {
|
(0, ava_1.default)(`Only feature '${feature}' is enabled if the associated environment variable is true. Others disabled.`, async (t) => {
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
const featureEnablement = setUpFeatureFlagTests(tmpDir);
|
const featureEnablement = setUpTests(tmpDir);
|
||||||
const expectedFeatureEnablement = initializeFeatures(false);
|
const expectedFeatureEnablement = initializeFeatures(false);
|
||||||
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
||||||
// feature should be disabled initially
|
// feature should be disabled initially
|
||||||
@@ -120,7 +104,7 @@ for (const feature of Object.keys(feature_flags_1.featureConfig)) {
|
|||||||
});
|
});
|
||||||
(0, ava_1.default)(`Feature '${feature}' is disabled if the associated environment variable is false, even if enabled in API`, async (t) => {
|
(0, ava_1.default)(`Feature '${feature}' is disabled if the associated environment variable is false, even if enabled in API`, async (t) => {
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
const featureEnablement = setUpFeatureFlagTests(tmpDir);
|
const featureEnablement = setUpTests(tmpDir);
|
||||||
const expectedFeatureEnablement = initializeFeatures(true);
|
const expectedFeatureEnablement = initializeFeatures(true);
|
||||||
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
||||||
// feature should be enabled initially
|
// feature should be enabled initially
|
||||||
@@ -133,7 +117,7 @@ for (const feature of Object.keys(feature_flags_1.featureConfig)) {
|
|||||||
if (feature_flags_1.featureConfig[feature].minimumVersion !== undefined) {
|
if (feature_flags_1.featureConfig[feature].minimumVersion !== undefined) {
|
||||||
(0, ava_1.default)(`Getting feature '${feature} should throw if no codeql is provided`, async (t) => {
|
(0, ava_1.default)(`Getting feature '${feature} should throw if no codeql is provided`, async (t) => {
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
const featureEnablement = setUpFeatureFlagTests(tmpDir);
|
const featureEnablement = setUpTests(tmpDir);
|
||||||
const expectedFeatureEnablement = initializeFeatures(true);
|
const expectedFeatureEnablement = initializeFeatures(true);
|
||||||
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
||||||
await t.throwsAsync(async () => featureEnablement.getValue(feature), {
|
await t.throwsAsync(async () => featureEnablement.getValue(feature), {
|
||||||
@@ -145,7 +129,7 @@ for (const feature of Object.keys(feature_flags_1.featureConfig)) {
|
|||||||
if (feature_flags_1.featureConfig[feature].minimumVersion !== undefined) {
|
if (feature_flags_1.featureConfig[feature].minimumVersion !== undefined) {
|
||||||
(0, ava_1.default)(`Feature '${feature}' is disabled if the minimum CLI version is below ${feature_flags_1.featureConfig[feature].minimumVersion}`, async (t) => {
|
(0, ava_1.default)(`Feature '${feature}' is disabled if the minimum CLI version is below ${feature_flags_1.featureConfig[feature].minimumVersion}`, async (t) => {
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
const featureEnablement = setUpFeatureFlagTests(tmpDir);
|
const featureEnablement = setUpTests(tmpDir);
|
||||||
const expectedFeatureEnablement = initializeFeatures(true);
|
const expectedFeatureEnablement = initializeFeatures(true);
|
||||||
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
||||||
// feature should be disabled when an old CLI version is set
|
// feature should be disabled when an old CLI version is set
|
||||||
@@ -177,37 +161,6 @@ for (const feature of Object.keys(feature_flags_1.featureConfig)) {
|
|||||||
// An even less likely scenario is that we no longer have any features.
|
// An even less likely scenario is that we no longer have any features.
|
||||||
t.assert(Object.values(feature_flags_1.featureConfig).length > 0, "There should be at least one feature");
|
t.assert(Object.values(feature_flags_1.featureConfig).length > 0, "There should be at least one feature");
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("Feature flags are saved to disk", async (t) => {
|
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
|
||||||
const featureEnablement = setUpFeatureFlagTests(tmpDir);
|
|
||||||
const expectedFeatureEnablement = initializeFeatures(true);
|
|
||||||
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
|
||||||
const cachedFeatureFlags = path.join(tmpDir, feature_flags_1.FEATURE_FLAGS_FILE_NAME);
|
|
||||||
t.false(fs.existsSync(cachedFeatureFlags), "Feature flag cached file should not exist before getting feature flags");
|
|
||||||
t.true(await featureEnablement.getValue(feature_flags_1.Feature.CliConfigFileEnabled, includeCodeQlIfRequired(feature_flags_1.Feature.CliConfigFileEnabled)), "Feature flag should be enabled initially");
|
|
||||||
t.true(fs.existsSync(cachedFeatureFlags), "Feature flag cached file should exist after getting feature flags");
|
|
||||||
const actualFeatureEnablement = JSON.parse(fs.readFileSync(cachedFeatureFlags, "utf8"));
|
|
||||||
t.deepEqual(actualFeatureEnablement, expectedFeatureEnablement);
|
|
||||||
// now test that we actually use the feature flag cache instead of the server
|
|
||||||
actualFeatureEnablement[feature_flags_1.Feature.CliConfigFileEnabled] = false;
|
|
||||||
fs.writeFileSync(cachedFeatureFlags, JSON.stringify(actualFeatureEnablement));
|
|
||||||
// delete the in memory cache so that we are forced to use the cached file
|
|
||||||
featureEnablement.gitHubFeatureFlags.cachedApiResponse = undefined;
|
|
||||||
t.false(await featureEnablement.getValue(feature_flags_1.Feature.CliConfigFileEnabled, includeCodeQlIfRequired(feature_flags_1.Feature.CliConfigFileEnabled)), "Feature flag should be enabled after reading from cached file");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
(0, ava_1.default)("Environment variable can override feature flag cache", async (t) => {
|
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
|
||||||
const featureEnablement = setUpFeatureFlagTests(tmpDir);
|
|
||||||
const expectedFeatureEnablement = initializeFeatures(true);
|
|
||||||
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement);
|
|
||||||
const cachedFeatureFlags = path.join(tmpDir, feature_flags_1.FEATURE_FLAGS_FILE_NAME);
|
|
||||||
t.true(await featureEnablement.getValue(feature_flags_1.Feature.CliConfigFileEnabled, includeCodeQlIfRequired(feature_flags_1.Feature.CliConfigFileEnabled)), "Feature flag should be enabled initially");
|
|
||||||
t.true(fs.existsSync(cachedFeatureFlags), "Feature flag cached file should exist after getting feature flags");
|
|
||||||
process.env.CODEQL_PASS_CONFIG_TO_CLI = "false";
|
|
||||||
t.false(await featureEnablement.getValue(feature_flags_1.Feature.CliConfigFileEnabled, includeCodeQlIfRequired(feature_flags_1.Feature.CliConfigFileEnabled)), "Feature flag should be disabled after setting env var");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
function assertAllFeaturesUndefinedInApi(t, loggedMessages) {
|
function assertAllFeaturesUndefinedInApi(t, loggedMessages) {
|
||||||
for (const feature of Object.keys(feature_flags_1.featureConfig)) {
|
for (const feature of Object.keys(feature_flags_1.featureConfig)) {
|
||||||
t.assert(loggedMessages.find((v) => v.type === "debug" &&
|
t.assert(loggedMessages.find((v) => v.type === "debug" &&
|
||||||
@@ -221,9 +174,9 @@ function initializeFeatures(initialValue) {
|
|||||||
return features;
|
return features;
|
||||||
}, {});
|
}, {});
|
||||||
}
|
}
|
||||||
function setUpFeatureFlagTests(tmpDir, logger = (0, logging_1.getRunnerLogger)(true), gitHubVersion = { type: util_1.GitHubVariant.DOTCOM }) {
|
function setUpTests(tmpDir, logger = (0, logging_1.getRunnerLogger)(true), gitHubVersion = { type: util_1.GitHubVariant.DOTCOM }) {
|
||||||
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
||||||
return new feature_flags_1.Features(gitHubVersion, testRepositoryNwo, tmpDir, logger);
|
return new feature_flags_1.Features(gitHubVersion, testApiDetails, testRepositoryNwo, logger);
|
||||||
}
|
}
|
||||||
function includeCodeQlIfRequired(feature) {
|
function includeCodeQlIfRequired(feature) {
|
||||||
return feature_flags_1.featureConfig[feature].minimumVersion !== undefined
|
return feature_flags_1.featureConfig[feature].minimumVersion !== undefined
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Generated
+6
-11
@@ -74,7 +74,7 @@ async function sendSuccessStatusReport(startedAt, config, toolsVersion, logger)
|
|||||||
async function run() {
|
async function run() {
|
||||||
const startedAt = new Date();
|
const startedAt = new Date();
|
||||||
const logger = (0, logging_1.getActionsLogger)();
|
const logger = (0, logging_1.getActionsLogger)();
|
||||||
(0, util_1.initializeEnvironment)(pkg.version);
|
(0, util_1.initializeEnvironment)(util_1.Mode.actions, pkg.version);
|
||||||
await (0, util_1.checkActionVersion)(pkg.version);
|
await (0, util_1.checkActionVersion)(pkg.version);
|
||||||
let config;
|
let config;
|
||||||
let codeql;
|
let codeql;
|
||||||
@@ -85,10 +85,10 @@ async function run() {
|
|||||||
url: (0, util_1.getRequiredEnvParam)("GITHUB_SERVER_URL"),
|
url: (0, util_1.getRequiredEnvParam)("GITHUB_SERVER_URL"),
|
||||||
apiURL: (0, util_1.getRequiredEnvParam)("GITHUB_API_URL"),
|
apiURL: (0, util_1.getRequiredEnvParam)("GITHUB_API_URL"),
|
||||||
};
|
};
|
||||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
const gitHubVersion = await (0, api_client_1.getGitHubVersionActionsOnly)();
|
||||||
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger);
|
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger, util_1.Mode.actions);
|
||||||
const repositoryNwo = (0, repository_1.parseRepositoryNwo)((0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY"));
|
const repositoryNwo = (0, repository_1.parseRepositoryNwo)((0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY"));
|
||||||
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), logger);
|
const features = new feature_flags_1.Features(gitHubVersion, apiDetails, repositoryNwo, logger);
|
||||||
try {
|
try {
|
||||||
const workflowErrors = await (0, actions_util_1.validateWorkflow)();
|
const workflowErrors = await (0, actions_util_1.validateWorkflow)();
|
||||||
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)))) {
|
||||||
@@ -97,7 +97,7 @@ async function run() {
|
|||||||
const initCodeQLResult = await (0, init_1.initCodeQL)((0, actions_util_1.getOptionalInput)("tools"), apiDetails, (0, actions_util_1.getTemporaryDirectory)(), gitHubVersion.type, features, logger);
|
const initCodeQLResult = await (0, init_1.initCodeQL)((0, actions_util_1.getOptionalInput)("tools"), apiDetails, (0, actions_util_1.getTemporaryDirectory)(), gitHubVersion.type, features, logger);
|
||||||
codeql = initCodeQLResult.codeql;
|
codeql = initCodeQLResult.codeql;
|
||||||
toolsVersion = initCodeQLResult.toolsVersion;
|
toolsVersion = initCodeQLResult.toolsVersion;
|
||||||
await (0, util_1.enrichEnvironment)(codeql);
|
await (0, util_1.enrichEnvironment)(util_1.Mode.actions, codeql);
|
||||||
config = await (0, init_1.initConfig)((0, actions_util_1.getOptionalInput)("languages"), (0, actions_util_1.getOptionalInput)("queries"), (0, actions_util_1.getOptionalInput)("packs"), (0, actions_util_1.getOptionalInput)("registries"), (0, actions_util_1.getOptionalInput)("config-file"), (0, actions_util_1.getOptionalInput)("db-location"), await getTrapCachingEnabled(features),
|
config = await (0, init_1.initConfig)((0, actions_util_1.getOptionalInput)("languages"), (0, actions_util_1.getOptionalInput)("queries"), (0, actions_util_1.getOptionalInput)("packs"), (0, actions_util_1.getOptionalInput)("registries"), (0, actions_util_1.getOptionalInput)("config-file"), (0, actions_util_1.getOptionalInput)("db-location"), await getTrapCachingEnabled(features),
|
||||||
// Debug mode is enabled if:
|
// Debug mode is enabled if:
|
||||||
// - The `init` Action is passed `debug: true`.
|
// - The `init` Action is passed `debug: true`.
|
||||||
@@ -137,12 +137,8 @@ async function run() {
|
|||||||
core.exportVariable("CODEQL_RAM", process.env["CODEQL_RAM"] ||
|
core.exportVariable("CODEQL_RAM", process.env["CODEQL_RAM"] ||
|
||||||
(0, util_1.getMemoryFlagValue)((0, actions_util_1.getOptionalInput)("ram")).toString());
|
(0, util_1.getMemoryFlagValue)((0, actions_util_1.getOptionalInput)("ram")).toString());
|
||||||
core.exportVariable("CODEQL_THREADS", (0, util_1.getThreadsFlagValue)((0, actions_util_1.getOptionalInput)("threads"), logger).toString());
|
core.exportVariable("CODEQL_THREADS", (0, util_1.getThreadsFlagValue)((0, actions_util_1.getOptionalInput)("threads"), logger).toString());
|
||||||
// Disable Kotlin extractor if feature flag set
|
|
||||||
if (await features.getValue(feature_flags_1.Feature.DisableKotlinAnalysisEnabled)) {
|
|
||||||
core.exportVariable("CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN", "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", features, logger);
|
const tracerConfig = await (0, init_1.runInit)(codeql, config, sourceRoot, "Runner.Worker.exe", undefined, features, 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);
|
||||||
@@ -181,7 +177,6 @@ async function runWrapper() {
|
|||||||
core.setFailed(`init action failed: ${error}`);
|
core.setFailed(`init action failed: ${error}`);
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
await (0, util_1.checkForTimeout)();
|
|
||||||
}
|
}
|
||||||
void runWrapper();
|
void runWrapper();
|
||||||
//# sourceMappingURL=init-action.js.map
|
//# sourceMappingURL=init-action.js.map
|
||||||
File diff suppressed because one or more lines are too long
Generated
+3
-3
@@ -46,12 +46,12 @@ async function initConfig(languagesInput, queriesInput, packsInput, registriesIn
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
exports.initConfig = initConfig;
|
exports.initConfig = initConfig;
|
||||||
async function runInit(codeql, config, sourceRoot, processName, featureEnablement, logger) {
|
async function runInit(codeql, config, sourceRoot, processName, processLevel, featureEnablement, 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)) {
|
if (await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING)) {
|
||||||
// Init a database cluster
|
// Init a database cluster
|
||||||
await codeql.databaseInitCluster(config, sourceRoot, processName, featureEnablement, logger);
|
await codeql.databaseInitCluster(config, sourceRoot, processName, processLevel, featureEnablement, logger);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
@@ -63,7 +63,7 @@ async function runInit(codeql, config, sourceRoot, processName, featureEnablemen
|
|||||||
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, codeql, await util.isGoExtractionReconciliationEnabled(featureEnablement), logger);
|
||||||
}
|
}
|
||||||
exports.runInit = runInit;
|
exports.runInit = runInit;
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,yEAA2D;AAC3D,kEAAoD;AAEpD,gEAAkD;AAElD,qCAA2E;AAC3E,4DAA8C;AAI9C,mDAAwE;AACxE,6CAA+B;AAC/B,iCAA4C;AAErC,KAAK,UAAU,UAAU,CAC9B,SAA6B,EAC7B,UAA4B,EAC5B,OAAe,EACf,OAA2B,EAC3B,iBAAoC,EACpC,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,oBAAW,EAChD,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,MAAM,EACN,IAAI,CACL,CAAC;IACF,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;IAC5B,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AAClC,CAAC;AArBD,gCAqBC;AAEM,KAAK,UAAU,UAAU,CAC9B,cAAkC,EAClC,YAAgC,EAChC,UAA8B,EAC9B,eAAmC,EACnC,UAA8B,EAC9B,UAA8B,EAC9B,kBAA2B,EAC3B,SAAkB,EAClB,iBAAyB,EACzB,iBAAyB,EACzB,UAAyB,EACzB,OAAe,EACf,MAAc,EACd,aAAqB,EACrB,aAAiC,EACjC,UAAoC,EACpC,iBAAoC,EACpC,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,6BAA6B,CAAC,CAAC;IACjD,MAAM,MAAM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,OAAO,CACZ,gFAAgF,CAAC,IAAI;YACnF,qGAAqG;YACrG,oGAAoG;YACpG,iDAAiD,CACpD,CAAC;QACF,OAAO;KACR;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAzCD,8CAyCC"}
|
||||||
Generated
+33
-11
@@ -1,6 +1,26 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.isScannedLanguage = exports.isTracedLanguage = exports.parseLanguage = exports.Language = void 0;
|
exports.isScannedLanguage = exports.isTracedLanguage = exports.parseLanguage = exports.Language = void 0;
|
||||||
|
const core = __importStar(require("@actions/core"));
|
||||||
// All the languages supported by CodeQL
|
// All the languages supported by CodeQL
|
||||||
var Language;
|
var Language;
|
||||||
(function (Language) {
|
(function (Language) {
|
||||||
@@ -18,7 +38,6 @@ const LANGUAGE_ALIASES = {
|
|||||||
c: Language.cpp,
|
c: Language.cpp,
|
||||||
"c++": Language.cpp,
|
"c++": Language.cpp,
|
||||||
"c#": Language.csharp,
|
"c#": Language.csharp,
|
||||||
kotlin: Language.java,
|
|
||||||
typescript: Language.javascript,
|
typescript: Language.javascript,
|
||||||
};
|
};
|
||||||
// Translate from user input or GitHub's API names for languages to CodeQL's names for languages
|
// Translate from user input or GitHub's API names for languages to CodeQL's names for languages
|
||||||
@@ -36,18 +55,21 @@ function parseLanguage(language) {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
exports.parseLanguage = parseLanguage;
|
exports.parseLanguage = parseLanguage;
|
||||||
function isTracedLanguage(language) {
|
function isTracedLanguage(language, isGoExtractionReconciliationEnabled, logger) {
|
||||||
return [
|
if (process.env["CODEQL_EXTRACTOR_GO_BUILD_TRACING"] === "true") {
|
||||||
Language.cpp,
|
logger.warning("The CODEQL_EXTRACTOR_GO_BUILD_TRACING environment variable was set to 'true', but it must " +
|
||||||
Language.csharp,
|
"be 'on' to enable Go build tracing. Setting it to 'on'.");
|
||||||
Language.go,
|
process.env["CODEQL_EXTRACTOR_GO_BUILD_TRACING"] = "on";
|
||||||
Language.java,
|
core.exportVariable("CODEQL_EXTRACTOR_GO_BUILD_TRACING", "on");
|
||||||
Language.swift,
|
}
|
||||||
].includes(language);
|
const shouldTraceGo = process.env["CODEQL_EXTRACTOR_GO_BUILD_TRACING"] === "on" ||
|
||||||
|
isGoExtractionReconciliationEnabled;
|
||||||
|
return (["cpp", "java", "csharp", "swift"].includes(language) ||
|
||||||
|
(shouldTraceGo && language === Language.go));
|
||||||
}
|
}
|
||||||
exports.isTracedLanguage = isTracedLanguage;
|
exports.isTracedLanguage = isTracedLanguage;
|
||||||
function isScannedLanguage(language) {
|
function isScannedLanguage(language, isGoExtractionReconciliationEnabled, logger) {
|
||||||
return !isTracedLanguage(language);
|
return !isTracedLanguage(language, isGoExtractionReconciliationEnabled, logger);
|
||||||
}
|
}
|
||||||
exports.isScannedLanguage = isScannedLanguage;
|
exports.isScannedLanguage = isScannedLanguage;
|
||||||
//# sourceMappingURL=languages.js.map
|
//# sourceMappingURL=languages.js.map
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"languages.js","sourceRoot":"","sources":["../src/languages.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AACxC,IAAY,QASX;AATD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;IACjB,uBAAW,CAAA;IACX,qBAAS,CAAA;IACT,yBAAa,CAAA;IACb,qCAAyB,CAAA;IACzB,6BAAiB,CAAA;IACjB,yBAAa,CAAA;IACb,2BAAe,CAAA;AACjB,CAAC,EATW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QASnB;AAED,iCAAiC;AACjC,MAAM,gBAAgB,GAAiC;IACrD,CAAC,EAAE,QAAQ,CAAC,GAAG;IACf,KAAK,EAAE,QAAQ,CAAC,GAAG;IACnB,IAAI,EAAE,QAAQ,CAAC,MAAM;IACrB,MAAM,EAAE,QAAQ,CAAC,IAAI;IACrB,UAAU,EAAE,QAAQ,CAAC,UAAU;CAChC,CAAC;AAEF,gGAAgG;AAChG,SAAgB,aAAa,CAAC,QAAgB;IAC5C,0BAA0B;IAC1B,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IAElC,6BAA6B;IAC7B,IAAI,QAAQ,IAAI,QAAQ,EAAE;QACxB,OAAO,QAAoB,CAAC;KAC7B;IAED,yBAAyB;IACzB,IAAI,QAAQ,IAAI,gBAAgB,EAAE;QAChC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC;KACnC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAfD,sCAeC;AAED,SAAgB,gBAAgB,CAAC,QAAkB;IACjD,OAAO;QACL,QAAQ,CAAC,GAAG;QACZ,QAAQ,CAAC,MAAM;QACf,QAAQ,CAAC,EAAE;QACX,QAAQ,CAAC,IAAI;QACb,QAAQ,CAAC,KAAK;KACf,CAAC,QAAQ,CAAC,QAAQ,CA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F;YAC1F,yDAAyD,CAC5D,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,GAAG,IAAI,CAAC;QACxD,IAAI,CAAC,cAAc,CAAC,mCAAmC,EAAE,IAAI,CAAC,CAAC;KAChE;IAED,MAAM,aAAa,GACjB,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,KAAK,IAAI;QACzD,mCAAmC,CAAC;IAEtC,OAAO,CACL,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACrD,CAAC,aAAa,IAAI,QAAQ,KAAK,QAAQ,CAAC,EAAE,CAAC,CAC5C,CAAC;AACJ,CAAC;AAtBD,4CAsBC;AAED,SAAgB,iBAAiB,CAC/B,QAAkB,EAClB,mCAA4C,EAC5C,MAAc;IAEd,OAAO,CAAC,gBAAgB,CACtB,QAAQ,EACR,mCAAmC,EACnC,MAAM,CACP,CAAC;AACJ,CAAC;AAVD,8CAUC"}
|
||||||
Generated
+19
-19
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const ava_1 = __importDefault(require("ava"));
|
const ava_1 = __importDefault(require("ava"));
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
|
const logging_1 = require("./logging");
|
||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
(0, testing_utils_1.setupTests)(ava_1.default);
|
(0, testing_utils_1.setupTests)(ava_1.default);
|
||||||
(0, ava_1.default)("parseLanguage", async (t) => {
|
(0, ava_1.default)("parseLanguage", async (t) => {
|
||||||
@@ -19,31 +20,30 @@ const testing_utils_1 = require("./testing-utils");
|
|||||||
t.deepEqual((0, languages_1.parseLanguage)("c"), languages_1.Language.cpp);
|
t.deepEqual((0, languages_1.parseLanguage)("c"), languages_1.Language.cpp);
|
||||||
t.deepEqual((0, languages_1.parseLanguage)("c++"), languages_1.Language.cpp);
|
t.deepEqual((0, languages_1.parseLanguage)("c++"), languages_1.Language.cpp);
|
||||||
t.deepEqual((0, languages_1.parseLanguage)("c#"), languages_1.Language.csharp);
|
t.deepEqual((0, languages_1.parseLanguage)("c#"), languages_1.Language.csharp);
|
||||||
t.deepEqual((0, languages_1.parseLanguage)("kotlin"), languages_1.Language.java);
|
|
||||||
t.deepEqual((0, languages_1.parseLanguage)("typescript"), languages_1.Language.javascript);
|
t.deepEqual((0, languages_1.parseLanguage)("typescript"), languages_1.Language.javascript);
|
||||||
// Not matches
|
// Not matches
|
||||||
t.deepEqual((0, languages_1.parseLanguage)("foo"), undefined);
|
t.deepEqual((0, languages_1.parseLanguage)("foo"), undefined);
|
||||||
t.deepEqual((0, languages_1.parseLanguage)(" "), undefined);
|
t.deepEqual((0, languages_1.parseLanguage)(" "), undefined);
|
||||||
t.deepEqual((0, languages_1.parseLanguage)(""), undefined);
|
t.deepEqual((0, languages_1.parseLanguage)(""), undefined);
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("isTracedLanguage", async (t) => {
|
for (const isReconciliationOn of [false, true]) {
|
||||||
t.true((0, languages_1.isTracedLanguage)(languages_1.Language.cpp));
|
(0, ava_1.default)(`isTracedLanguage (go reconciliation ${isReconciliationOn ? "enabled" : "disabled"})`, async (t) => {
|
||||||
t.true((0, languages_1.isTracedLanguage)(languages_1.Language.csharp));
|
const logger = (0, logging_1.getRunnerLogger)(true);
|
||||||
t.true((0, languages_1.isTracedLanguage)(languages_1.Language.go));
|
t.true((0, languages_1.isTracedLanguage)(languages_1.Language.cpp, isReconciliationOn, logger));
|
||||||
t.true((0, languages_1.isTracedLanguage)(languages_1.Language.java));
|
t.true((0, languages_1.isTracedLanguage)(languages_1.Language.java, isReconciliationOn, logger));
|
||||||
t.true((0, languages_1.isTracedLanguage)(languages_1.Language.swift));
|
t.true((0, languages_1.isTracedLanguage)(languages_1.Language.csharp, isReconciliationOn, logger));
|
||||||
t.false((0, languages_1.isTracedLanguage)(languages_1.Language.javascript));
|
t.is((0, languages_1.isTracedLanguage)(languages_1.Language.go, isReconciliationOn, logger), isReconciliationOn);
|
||||||
t.false((0, languages_1.isTracedLanguage)(languages_1.Language.python));
|
t.false((0, languages_1.isTracedLanguage)(languages_1.Language.javascript, isReconciliationOn, logger));
|
||||||
t.false((0, languages_1.isTracedLanguage)(languages_1.Language.ruby));
|
t.false((0, languages_1.isTracedLanguage)(languages_1.Language.python, isReconciliationOn, logger));
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("isScannedLanguage", async (t) => {
|
(0, ava_1.default)(`isScannedLanguage (go reconciliation ${isReconciliationOn ? "enabled" : "disabled"}`, async (t) => {
|
||||||
t.false((0, languages_1.isScannedLanguage)(languages_1.Language.cpp));
|
const logger = (0, logging_1.getRunnerLogger)(true);
|
||||||
t.false((0, languages_1.isScannedLanguage)(languages_1.Language.csharp));
|
t.false((0, languages_1.isScannedLanguage)(languages_1.Language.cpp, isReconciliationOn, logger));
|
||||||
t.false((0, languages_1.isScannedLanguage)(languages_1.Language.go));
|
t.false((0, languages_1.isScannedLanguage)(languages_1.Language.java, isReconciliationOn, logger));
|
||||||
t.false((0, languages_1.isScannedLanguage)(languages_1.Language.java));
|
t.false((0, languages_1.isScannedLanguage)(languages_1.Language.csharp, isReconciliationOn, logger));
|
||||||
t.false((0, languages_1.isScannedLanguage)(languages_1.Language.swift));
|
t.is((0, languages_1.isScannedLanguage)(languages_1.Language.go, isReconciliationOn, logger), !isReconciliationOn);
|
||||||
t.true((0, languages_1.isScannedLanguage)(languages_1.Language.javascript));
|
t.true((0, languages_1.isScannedLanguage)(languages_1.Language.javascript, isReconciliationOn, logger));
|
||||||
t.true((0, languages_1.isScannedLanguage)(languages_1.Language.python));
|
t.true((0, languages_1.isScannedLanguage)(languages_1.Language.python, isReconciliationOn, logger));
|
||||||
t.true((0, languages_1.isScannedLanguage)(languages_1.Language.ruby));
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
//# sourceMappingURL=languages.test.js.map
|
//# sourceMappingURL=languages.test.js.map
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"languages.test.js","sourceRoot":"","sources":["../src/languages.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAuB;AAEvB,2CAKqB;AACrB,mDAA6C;AAE7C,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,IAAA,aAAI,EAAC,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAChC,gBAAgB;IAChB,CAAC,CAAC,SAAS,CAAC,IAAA,yBAAa,EAAC,QAAQ,CAAC,EAAE,oBAAQ,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC,CAAC,SAAS,CAAC,IAAA,yBAAa,EAAC,KAAK,CAAC,EAAE,oBAAQ,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC,CAAC,SAAS,CAAC,IAAA,yBAAa,EAAC,IAAI,CAAC,EAAE,oBAAQ,CAAC,EAAE,CAAC,CAAC;IAC9C,CAAC,CAAC,SAAS,CAAC,IAAA,yBAAa,EAAC,MAAM,CAAC,EAAE,oBAAQ,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC,CAAC,SAAS,CAAC,IAAA,yBAAa,EAAC,YAAY,CAAC,EAAE,oBAAQ,CAAC,UAAU,CAAC,CAAC;IAC9D,CAAC,CAAC,SAAS,CAAC,IAAA,yBAAa,EAAC,QAAQ,CAAC,EAAE,oBAAQ,CAAC,MAAM,CAAC,CAAC;IAEtD,UAAU;IACV,CAAC,CAAC,SAAS,CAAC,IAAA,yBAAa,EAAC,GAAG,CAAC,EAAE,oBAAQ,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC,CAAC,SAAS,CAAC,IAAA,yBAAa,EAAC,KAAK,CAAC,EAAE,oBAAQ,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC,CAAC,SAAS,CAAC,IAAA,yBAAa,EAAC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C,CAAC,CAAC,KAAK,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,GAAG,EAAE,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;QACrE,CAAC,CAAC,KAAK,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,IAAI,EAAE,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;QACtE,CAAC,CAAC,KAAK,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,MAAM,EAAE,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;QAExE,CAAC,CAAC,EAAE,CACF,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,EAAE,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAC1D,CAAC,kBAAkB,CACpB,CAAC;QAEF,CAAC,CAAC,IAAI,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,UAAU,EAAE,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;QAC3E,CAAC,CAAC,IAAI,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,MAAM,EAAE,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;CACJ"}
|
||||||
Generated
+345
@@ -0,0 +1,345 @@
|
|||||||
|
"use strict";
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const fs = __importStar(require("fs"));
|
||||||
|
const path = __importStar(require("path"));
|
||||||
|
const commander_1 = require("commander");
|
||||||
|
const del_1 = __importDefault(require("del"));
|
||||||
|
const analyze_1 = require("./analyze");
|
||||||
|
const autobuild_1 = require("./autobuild");
|
||||||
|
const codeql_1 = require("./codeql");
|
||||||
|
const config_utils_1 = require("./config-utils");
|
||||||
|
const init_1 = require("./init");
|
||||||
|
const languages_1 = require("./languages");
|
||||||
|
const logging_1 = require("./logging");
|
||||||
|
const repository_1 = require("./repository");
|
||||||
|
const testing_utils_1 = require("./testing-utils");
|
||||||
|
const upload_lib = __importStar(require("./upload-lib"));
|
||||||
|
const util_1 = require("./util");
|
||||||
|
// eslint-disable-next-line import/no-commonjs
|
||||||
|
const pkg = require("../package.json");
|
||||||
|
const program = new commander_1.Command();
|
||||||
|
program.version(pkg.version).hook("preAction", () => {
|
||||||
|
(0, util_1.initializeEnvironment)(util_1.Mode.runner, pkg.version);
|
||||||
|
});
|
||||||
|
function getTempDir(userInput) {
|
||||||
|
const tempDir = path.join(userInput || process.cwd(), "codeql-runner");
|
||||||
|
if (!fs.existsSync(tempDir)) {
|
||||||
|
fs.mkdirSync(tempDir, { recursive: true });
|
||||||
|
}
|
||||||
|
return tempDir;
|
||||||
|
}
|
||||||
|
const codeqlEnvJsonFilename = "codeql-env.json";
|
||||||
|
function loadTracerEnvironment(config) {
|
||||||
|
const jsonEnvFile = path.join(config.tempDir, codeqlEnvJsonFilename);
|
||||||
|
return JSON.parse(fs.readFileSync(jsonEnvFile).toString("utf-8"));
|
||||||
|
}
|
||||||
|
// Imports the environment from codeqlEnvJsonFilename if not already present
|
||||||
|
function importTracerEnvironment(config) {
|
||||||
|
if (!("ODASA_TRACER_CONFIGURATION" in process.env)) {
|
||||||
|
const env = loadTracerEnvironment(config);
|
||||||
|
for (const key of Object.keys(env)) {
|
||||||
|
process.env[key] = env[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Allow the user to specify refs in full refs/heads/branch format
|
||||||
|
// or just the short branch name and prepend "refs/heads/" to it.
|
||||||
|
function parseRef(userInput) {
|
||||||
|
if (userInput.startsWith("refs/")) {
|
||||||
|
return userInput;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return `refs/heads/${userInput}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Parses the --trace-process-name arg from process.argv, or returns undefined
|
||||||
|
function parseTraceProcessName() {
|
||||||
|
for (let i = 0; i < process.argv.length - 1; i++) {
|
||||||
|
if (process.argv[i] === "--trace-process-name") {
|
||||||
|
return process.argv[i + 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
// Parses the --trace-process-level arg from process.argv, or returns undefined
|
||||||
|
function parseTraceProcessLevel() {
|
||||||
|
for (let i = 0; i < process.argv.length - 1; i++) {
|
||||||
|
if (process.argv[i] === "--trace-process-level") {
|
||||||
|
const v = parseInt(process.argv[i + 1], 10);
|
||||||
|
return isNaN(v) ? undefined : v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
program
|
||||||
|
.command("init")
|
||||||
|
.description("Initializes CodeQL")
|
||||||
|
.requiredOption("--repository <repository>", "Repository name. (Required)")
|
||||||
|
.requiredOption("--github-url <url>", "URL of GitHub instance. (Required)")
|
||||||
|
.option("--github-auth <auth>", "GitHub Apps token or personal access token. This option is insecure and deprecated, please use `--github-auth-stdin` instead.")
|
||||||
|
.option("--github-auth-stdin", "Read GitHub Apps token or personal access token from stdin.")
|
||||||
|
.option("--languages <languages>", "Comma-separated list of languages to analyze. Otherwise detects and analyzes all supported languages from the repo.")
|
||||||
|
.option("--queries <queries>", "Comma-separated list of additional queries to run. This overrides the same setting in a configuration file.")
|
||||||
|
.option("--packs <packs>", `[Experimental] Comma-separated list of packs to run. Reference a pack in the format scope/name[@version]. If version is not
|
||||||
|
specified, then the latest version of the pack is used. By default, this overrides the same setting in a
|
||||||
|
configuration file; prefix with "+" to use both sets of packs.
|
||||||
|
|
||||||
|
This option is only available in single-language analyses. To use packs in multi-language
|
||||||
|
analyses, you must specify packs in the codeql-config.yml file.`)
|
||||||
|
.option("--config-file <file>", "Path to config file.")
|
||||||
|
.option("--codeql-path <path>", "Path to a copy of the CodeQL CLI executable to use. Otherwise downloads a copy.")
|
||||||
|
.option("--temp-dir <dir>", 'Directory to use for temporary files. Default is "./codeql-runner".')
|
||||||
|
.option("--tools-dir <dir>", "Directory to use for CodeQL tools and other files to store between runs. Default is a subdirectory of the home directory.")
|
||||||
|
.option("--checkout-path <path>", "Checkout path. Default is the current working directory.")
|
||||||
|
.option("--debug", "Print more verbose output", false)
|
||||||
|
.option("--trace-process-name <string>", "(Advanced, windows-only) Inject a windows tracer of this process into a process with the given process name.")
|
||||||
|
.option("--trace-process-level <number>", "(Advanced, windows-only) Inject a windows tracer of this process into a parent process <number> levels up.")
|
||||||
|
.option("--ram <number>", "The amount of memory in MB that can be used by CodeQL extractors. " +
|
||||||
|
"By default, CodeQL extractors will use most of the memory available in the system. " +
|
||||||
|
'This input also sets the amount of memory that can later be used by the "analyze" command.')
|
||||||
|
.option("--threads <number>", "The number of threads that can be used by CodeQL extractors. " +
|
||||||
|
"By default, CodeQL extractors will use all the hardware threads available in the system. " +
|
||||||
|
'This input also sets the number of threads that can later be used by the "analyze" command.')
|
||||||
|
.action(async (cmd) => {
|
||||||
|
const logger = (0, logging_1.getRunnerLogger)(cmd.debug);
|
||||||
|
try {
|
||||||
|
const tempDir = getTempDir(cmd.tempDir);
|
||||||
|
const checkoutPath = cmd.checkoutPath || process.cwd();
|
||||||
|
// Wipe the temp dir
|
||||||
|
logger.info(`Cleaning temp directory ${tempDir}`);
|
||||||
|
await (0, del_1.default)(tempDir, { force: true });
|
||||||
|
fs.mkdirSync(tempDir, { recursive: true });
|
||||||
|
const auth = await (0, util_1.getGitHubAuth)(logger, cmd.githubAuth, cmd.githubAuthStdin);
|
||||||
|
const apiDetails = {
|
||||||
|
auth,
|
||||||
|
externalRepoAuth: auth,
|
||||||
|
url: (0, util_1.parseGitHubUrl)(cmd.githubUrl),
|
||||||
|
apiURL: undefined,
|
||||||
|
};
|
||||||
|
const gitHubVersion = await (0, util_1.getGitHubVersion)(apiDetails);
|
||||||
|
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger, util_1.Mode.runner);
|
||||||
|
// Limit RAM and threads for extractors. When running extractors, the CodeQL CLI obeys the
|
||||||
|
// CODEQL_RAM and CODEQL_THREADS environment variables to decide how much RAM and how many
|
||||||
|
// threads it would ask extractors to use. See help text for the "--ram" and "--threads"
|
||||||
|
// options at https://codeql.github.com/docs/codeql-cli/manual/database-trace-command/
|
||||||
|
// for details.
|
||||||
|
process.env["CODEQL_RAM"] = (0, util_1.getMemoryFlagValue)(cmd.ram).toString();
|
||||||
|
process.env["CODEQL_THREADS"] = (0, util_1.getThreadsFlagValue)(cmd.threads, logger).toString();
|
||||||
|
let codeql;
|
||||||
|
if (cmd.codeqlPath !== undefined) {
|
||||||
|
codeql = await (0, codeql_1.getCodeQL)(cmd.codeqlPath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
codeql = (await (0, init_1.initCodeQL)(undefined, apiDetails, tempDir, gitHubVersion.type, (0, testing_utils_1.createFeatures)([]), logger)).codeql;
|
||||||
|
}
|
||||||
|
await (0, util_1.enrichEnvironment)(util_1.Mode.runner, codeql);
|
||||||
|
const workspacePath = checkoutPath;
|
||||||
|
const config = await (0, init_1.initConfig)(cmd.languages, cmd.queries, cmd.packs, undefined, // we won't support registries in the runner
|
||||||
|
cmd.configFile, undefined, false, false, "", "", (0, repository_1.parseRepositoryNwo)(cmd.repository), tempDir, codeql, workspacePath, gitHubVersion, apiDetails, (0, testing_utils_1.createFeatures)([]), logger);
|
||||||
|
const sourceRoot = checkoutPath;
|
||||||
|
const tracerConfig = await (0, init_1.runInit)(codeql, config, sourceRoot, parseTraceProcessName(), parseTraceProcessLevel(), (0, testing_utils_1.createFeatures)([]), logger);
|
||||||
|
if (tracerConfig === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (process.platform === "win32" &&
|
||||||
|
!(await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING))) {
|
||||||
|
await (0, init_1.injectWindowsTracer)(parseTraceProcessName(), parseTraceProcessLevel(), config, codeql, tracerConfig);
|
||||||
|
}
|
||||||
|
// Always output a json file of the env that can be consumed programmatically
|
||||||
|
const jsonEnvFile = path.join(config.tempDir, codeqlEnvJsonFilename);
|
||||||
|
fs.writeFileSync(jsonEnvFile, JSON.stringify(tracerConfig.env));
|
||||||
|
if (process.platform === "win32") {
|
||||||
|
const batEnvFile = path.join(config.tempDir, "codeql-env.bat");
|
||||||
|
const batEnvFileContents = Object.entries(tracerConfig.env)
|
||||||
|
.map(([key, value]) => `Set ${key}=${value}`)
|
||||||
|
.join("\n");
|
||||||
|
fs.writeFileSync(batEnvFile, batEnvFileContents);
|
||||||
|
const powershellEnvFile = path.join(config.tempDir, "codeql-env.sh");
|
||||||
|
const powershellEnvFileContents = Object.entries(tracerConfig.env)
|
||||||
|
.map(([key, value]) => `$env:${key}="${value}"`)
|
||||||
|
.join("\n");
|
||||||
|
fs.writeFileSync(powershellEnvFile, powershellEnvFileContents);
|
||||||
|
logger.info(`\nCodeQL environment output to "${jsonEnvFile}", "${batEnvFile}" and "${powershellEnvFile}". ` +
|
||||||
|
`Please export these variables to future processes so that CodeQL can monitor the build. ` +
|
||||||
|
`If using cmd/batch run "call ${batEnvFile}" ` +
|
||||||
|
`or if using PowerShell run "cat ${powershellEnvFile} | Invoke-Expression".`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Assume that anything that's not windows is using a unix-style shell
|
||||||
|
const shEnvFile = path.join(config.tempDir, "codeql-env.sh");
|
||||||
|
const shEnvFileContents = Object.entries(tracerConfig.env)
|
||||||
|
// Some vars contain ${LIB} that we do not want to be expanded when executing this script
|
||||||
|
.map(([key, value]) => `export ${key}='${value.replace(/'/g, "'\"'\"'")}'`)
|
||||||
|
.join("\n");
|
||||||
|
fs.writeFileSync(shEnvFile, shEnvFileContents);
|
||||||
|
logger.info(`\nCodeQL environment output to "${jsonEnvFile}" and "${shEnvFile}". ` +
|
||||||
|
`Please export these variables to future processes so that CodeQL can monitor the build, ` +
|
||||||
|
`for example by running ". ${shEnvFile}".`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
logger.error("Init failed");
|
||||||
|
logger.error(e instanceof Error ? e : new Error(String(e)));
|
||||||
|
process.exitCode = 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
program
|
||||||
|
.command("autobuild")
|
||||||
|
.description("Attempts to automatically build code")
|
||||||
|
.option("--language <language>", "The language to build. Otherwise will detect the dominant compiled language.")
|
||||||
|
.option("--temp-dir <dir>", 'Directory to use for temporary files. Default is "./codeql-runner".')
|
||||||
|
.option("--debug", "Print more verbose output", false)
|
||||||
|
.action(async (cmd) => {
|
||||||
|
const logger = (0, logging_1.getRunnerLogger)(cmd.debug);
|
||||||
|
try {
|
||||||
|
const config = await (0, config_utils_1.getConfig)(getTempDir(cmd.tempDir), logger);
|
||||||
|
if (config === undefined) {
|
||||||
|
throw new Error("Config file could not be found at expected location. " +
|
||||||
|
"Was the 'init' command run with the same '--temp-dir' argument as this command.");
|
||||||
|
}
|
||||||
|
await (0, util_1.enrichEnvironment)(util_1.Mode.runner, await (0, codeql_1.getCodeQL)(config.codeQLCmd));
|
||||||
|
importTracerEnvironment(config);
|
||||||
|
let languages = undefined;
|
||||||
|
if (cmd.language !== undefined) {
|
||||||
|
const language = (0, languages_1.parseLanguage)(cmd.language);
|
||||||
|
if (language === undefined || !config.languages.includes(language)) {
|
||||||
|
throw new Error(`"${cmd.language}" is not a recognised language. ` +
|
||||||
|
`Known languages in this project are ${config.languages.join(", ")}.`);
|
||||||
|
}
|
||||||
|
languages = [language];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
languages = await (0, autobuild_1.determineAutobuildLanguages)(config, (0, testing_utils_1.createFeatures)([]), logger);
|
||||||
|
}
|
||||||
|
if (languages !== undefined) {
|
||||||
|
for (const language of languages) {
|
||||||
|
await (0, autobuild_1.runAutobuild)(language, config, logger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
logger.error("Autobuild failed");
|
||||||
|
logger.error(e instanceof Error ? e : new Error(String(e)));
|
||||||
|
process.exitCode = 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
program
|
||||||
|
.command("analyze")
|
||||||
|
.description("Finishes extracting code and runs CodeQL queries")
|
||||||
|
.requiredOption("--repository <repository>", "Repository name. (Required)")
|
||||||
|
.requiredOption("--commit <commit>", "SHA of commit that was analyzed. (Required)")
|
||||||
|
.requiredOption("--ref <ref>", "Name of ref that was analyzed. (Required)")
|
||||||
|
.requiredOption("--github-url <url>", "URL of GitHub instance. (Required)")
|
||||||
|
.option("--github-auth <auth>", "GitHub Apps token or personal access token. This option is insecure and deprecated, please use `--github-auth-stdin` instead.")
|
||||||
|
.option("--github-auth-stdin", "Read GitHub Apps token or personal access token from stdin.")
|
||||||
|
.option("--checkout-path <path>", "Checkout path. Default is the current working directory.")
|
||||||
|
.option("--no-upload", "Do not upload results after analysis.")
|
||||||
|
.option("--output-dir <dir>", "Directory to output SARIF files to. Default is in the temp directory.")
|
||||||
|
.option("--ram <ram>", "The amount of memory in MB that can be used by CodeQL for database finalization and query execution. " +
|
||||||
|
'By default, this command will use the same amount of memory as previously set in the "init" command. ' +
|
||||||
|
'If the "init" command also does not have an explicit "ram" flag, this command will use most of the ' +
|
||||||
|
"memory available in the system.")
|
||||||
|
.option("--no-add-snippets", "Specify whether to include code snippets in the sarif output.")
|
||||||
|
.option("--threads <threads>", "The number of threads that can be used by CodeQL for database finalization and query execution. " +
|
||||||
|
'By default, this command will use the same number of threads as previously set in the "init" command. ' +
|
||||||
|
'If the "init" command also does not have an explicit "threads" flag, this command will use all the ' +
|
||||||
|
"hardware threads available in the system.")
|
||||||
|
.option("--temp-dir <dir>", 'Directory to use for temporary files. Default is "./codeql-runner".')
|
||||||
|
.option("--category <category>", "String used by Code Scanning for matching the analyses.")
|
||||||
|
.option("--debug", "Print more verbose output", false)
|
||||||
|
.action(async (cmd) => {
|
||||||
|
const logger = (0, logging_1.getRunnerLogger)(cmd.debug);
|
||||||
|
try {
|
||||||
|
const config = await (0, config_utils_1.getConfig)(getTempDir(cmd.tempDir), logger);
|
||||||
|
if (config === undefined) {
|
||||||
|
throw new Error("Config file could not be found at expected location. " +
|
||||||
|
"Was the 'init' command run with the same '--temp-dir' argument as this command.");
|
||||||
|
}
|
||||||
|
await (0, util_1.enrichEnvironment)(util_1.Mode.runner, await (0, codeql_1.getCodeQL)(config.codeQLCmd));
|
||||||
|
const auth = await (0, util_1.getGitHubAuth)(logger, cmd.githubAuth, cmd.githubAuthStdin);
|
||||||
|
const apiDetails = {
|
||||||
|
auth,
|
||||||
|
url: (0, util_1.parseGitHubUrl)(cmd.githubUrl),
|
||||||
|
apiURL: undefined,
|
||||||
|
};
|
||||||
|
const outputDir = cmd.outputDir || path.join(config.tempDir, "codeql-sarif");
|
||||||
|
let initEnv = {};
|
||||||
|
try {
|
||||||
|
initEnv = loadTracerEnvironment(config);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// The init command did not generate a tracer environment file
|
||||||
|
}
|
||||||
|
const threads = (0, util_1.getThreadsFlag)(cmd.threads || initEnv["CODEQL_THREADS"], logger);
|
||||||
|
const memory = (0, util_1.getMemoryFlag)(cmd.ram || initEnv["CODEQL_RAM"]);
|
||||||
|
await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger, (0, testing_utils_1.createFeatures)([]));
|
||||||
|
await (0, analyze_1.runQueries)(outputDir, memory, (0, util_1.getAddSnippetsFlag)(cmd.addSnippets), threads, cmd.category, config, logger, (0, testing_utils_1.createFeatures)([]));
|
||||||
|
if (!cmd.upload) {
|
||||||
|
logger.info("Not uploading results");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const sourceRoot = cmd.checkoutPath || process.cwd();
|
||||||
|
await upload_lib.uploadFromRunner(outputDir, (0, repository_1.parseRepositoryNwo)(cmd.repository), cmd.commit, parseRef(cmd.ref), cmd.category, sourceRoot, config.gitHubVersion, apiDetails, logger);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
logger.error("Analyze failed");
|
||||||
|
logger.error(e instanceof Error ? e : new Error(String(e)));
|
||||||
|
process.exitCode = 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
program
|
||||||
|
.command("upload")
|
||||||
|
.description("Uploads a SARIF file, or all SARIF files from a directory, to code scanning")
|
||||||
|
.requiredOption("--sarif-file <file>", "SARIF file to upload, or a directory containing multiple SARIF files. (Required)")
|
||||||
|
.requiredOption("--repository <repository>", "Repository name. (Required)")
|
||||||
|
.requiredOption("--commit <commit>", "SHA of commit that was analyzed. (Required)")
|
||||||
|
.requiredOption("--ref <ref>", "Name of ref that was analyzed. (Required)")
|
||||||
|
.requiredOption("--github-url <url>", "URL of GitHub instance. (Required)")
|
||||||
|
.option("--github-auth <auth>", "GitHub Apps token or personal access token. This option is insecure and deprecated, please use `--github-auth-stdin` instead.")
|
||||||
|
.option("--github-auth-stdin", "Read GitHub Apps token or personal access token from stdin.")
|
||||||
|
.option("--checkout-path <path>", "Checkout path. Default is the current working directory.")
|
||||||
|
.option("--category <category>", "String used by Code Scanning for matching the analyses.")
|
||||||
|
.option("--debug", "Print more verbose output", false)
|
||||||
|
.action(async (cmd) => {
|
||||||
|
const logger = (0, logging_1.getRunnerLogger)(cmd.debug);
|
||||||
|
const auth = await (0, util_1.getGitHubAuth)(logger, cmd.githubAuth, cmd.githubAuthStdin);
|
||||||
|
const apiDetails = {
|
||||||
|
auth,
|
||||||
|
url: (0, util_1.parseGitHubUrl)(cmd.githubUrl),
|
||||||
|
apiURL: undefined,
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
const gitHubVersion = await (0, util_1.getGitHubVersion)(apiDetails);
|
||||||
|
const sourceRoot = cmd.checkoutPath || process.cwd();
|
||||||
|
await upload_lib.uploadFromRunner(cmd.sarifFile, (0, repository_1.parseRepositoryNwo)(cmd.repository), cmd.commit, parseRef(cmd.ref), cmd.category, sourceRoot, gitHubVersion, apiDetails, logger);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
logger.error("Upload failed");
|
||||||
|
logger.error(e instanceof Error ? e : new Error(String(e)));
|
||||||
|
process.exitCode = 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
program.parse(process.argv);
|
||||||
|
//# sourceMappingURL=runner.js.map
|
||||||
File diff suppressed because one or more lines are too long
Generated
+1
-3
@@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.CODEQL_ACTION_TEST_MODE = exports.CODEQL_ACTION_TESTING_ENVIRONMENT = exports.CODEQL_WORKFLOW_STARTED_AT = exports.ODASA_TRACER_CONFIGURATION = void 0;
|
exports.CODEQL_ACTION_TESTING_ENVIRONMENT = exports.CODEQL_WORKFLOW_STARTED_AT = exports.ODASA_TRACER_CONFIGURATION = void 0;
|
||||||
exports.ODASA_TRACER_CONFIGURATION = "ODASA_TRACER_CONFIGURATION";
|
exports.ODASA_TRACER_CONFIGURATION = "ODASA_TRACER_CONFIGURATION";
|
||||||
// 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
|
||||||
@@ -9,6 +9,4 @@ exports.ODASA_TRACER_CONFIGURATION = "ODASA_TRACER_CONFIGURATION";
|
|||||||
// rather that the init action.
|
// rather that the init action.
|
||||||
exports.CODEQL_WORKFLOW_STARTED_AT = "CODEQL_WORKFLOW_STARTED_AT";
|
exports.CODEQL_WORKFLOW_STARTED_AT = "CODEQL_WORKFLOW_STARTED_AT";
|
||||||
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 */
|
|
||||||
exports.CODEQL_ACTION_TEST_MODE = "CODEQL_ACTION_TEST_MODE";
|
|
||||||
//# sourceMappingURL=shared-environment.js.map
|
//# sourceMappingURL=shared-environment.js.map
|
||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"shared-environment.js","sourceRoot":"","sources":["../src/shared-environment.ts"],"names":[],"mappings":";;;AAAa,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AACvE,wEAAwE;AACxE,2EAA2E;AAC3E,4EAA4E;AAC5E,2EAA2E;AAC3E,+BAA+B;AAClB,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AAE1D,QAAA,iCAAiC,GAC5C,mCAAmC,CAAC;AAEtC,kFAAkF;AACrE,QAAA,uBAAuB,GAAG,yBAAyB,CAAC"}
|
{"version":3,"file":"shared-environment.js","sourceRoot":"","sources":["../src/shared-environment.ts"],"names":[],"mappings":";;;AAAa,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AACvE,wEAAwE;AACxE,2EAA2E;AAC3E,4EAA4E;AAC5E,2EAA2E;AAC3E,+BAA+B;AAClB,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AAE1D,QAAA,iCAAiC,GAC5C,mCAAmC,CAAC"}
|
||||||
Generated
+4
-4
@@ -33,9 +33,9 @@ const CRITICAL_TRACER_VARS = new Set([
|
|||||||
"SEMMLE_DEPTRACE_SOCKET",
|
"SEMMLE_DEPTRACE_SOCKET",
|
||||||
"SEMMLE_JAVA_TOOL_OPTIONS",
|
"SEMMLE_JAVA_TOOL_OPTIONS",
|
||||||
]);
|
]);
|
||||||
async function endTracingForCluster(config) {
|
async function endTracingForCluster(config, isGoExtractionReconciliationEnabled, logger) {
|
||||||
// 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, isGoExtractionReconciliationEnabled, logger)))
|
||||||
return;
|
return;
|
||||||
const envVariablesFile = path.resolve(config.dbLocation, "temp/tracingEnvironment/end-tracing.json");
|
const envVariablesFile = path.resolve(config.dbLocation, "temp/tracingEnvironment/end-tracing.json");
|
||||||
if (!fs.existsSync(envVariablesFile)) {
|
if (!fs.existsSync(envVariablesFile)) {
|
||||||
@@ -189,9 +189,9 @@ function concatTracerConfigs(tracerConfigs, config, writeBothEnvironments = fals
|
|||||||
return { env, spec };
|
return { env, spec };
|
||||||
}
|
}
|
||||||
exports.concatTracerConfigs = concatTracerConfigs;
|
exports.concatTracerConfigs = concatTracerConfigs;
|
||||||
async function getCombinedTracerConfig(config, codeql) {
|
async function getCombinedTracerConfig(config, codeql, isGoExtractionReconciliationEnabled, logger) {
|
||||||
// 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, isGoExtractionReconciliationEnabled, logger));
|
||||||
if (tracedLanguages.length === 0) {
|
if (tracedLanguages.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user