Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: github/codeql-action
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.26.0
Choose a base ref
...
head repository: github/codeql-action
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.26.1
Choose a head ref

Commits on Jul 26, 2024

  1. Add packs to init complete status report

    To support both the single language and multi language case we turn
    the single language case into a multi language case using the
    configured language.
    The entire packs record is then stored as a stringified JSON object.
    rvermeulen committed Jul 26, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    crazy-max CrazyMax
    Copy the full SHA
    a6c4760 View commit details
  2. Copy the full SHA
    25d2596 View commit details
  3. Add registries to the init status complete report

    Registries might require authentication, before we add it to the
    report we remove any credentials.
    rvermeulen committed Jul 26, 2024
    Copy the full SHA
    9f7e0af View commit details
  4. Reword comment

    rvermeulen committed Jul 26, 2024
    Copy the full SHA
    060c11b View commit details

Commits on Jul 31, 2024

  1. Address formatting issues

    rvermeulen committed Jul 31, 2024
    Copy the full SHA
    7ff117d View commit details
  2. Change removal of credentials to adhere to no-vars-unused

    rvermeulen committed Jul 31, 2024
    Copy the full SHA
    b7b85bb View commit details
  3. Update map and minified JS files

    rvermeulen committed Jul 31, 2024
    Copy the full SHA
    19a1da5 View commit details

Commits on Aug 1, 2024

  1. Copy the full SHA
    7be3a64 View commit details
  2. Clone packs from configuration to prevent modifications

    rvermeulen committed Aug 1, 2024
    Copy the full SHA
    ba3ac6f View commit details

Commits on Aug 2, 2024

  1. Explicitly set value of registries and query_filters when undefined

    Both are arrays, so we will use an empty array if they are undefined.
    rvermeulen committed Aug 2, 2024
    Copy the full SHA
    e6c9383 View commit details
  2. Merge branch 'main' into rvermeulen/extend-init-complete-status-report

    Signed-off-by: Remco Vermeulen <rvermeulen@github.com>
    rvermeulen committed Aug 2, 2024
    Copy the full SHA
    0f24d46 View commit details

Commits on Aug 6, 2024

  1. Merge remote-tracking branch 'upstream/main' into rvermeulen/extend-i…

    …nit-complete-status-report
    rvermeulen committed Aug 6, 2024
    Copy the full SHA
    7c2bec0 View commit details
  2. Update changelog and version after v3.26.0

    github-actions[bot] committed Aug 6, 2024
    Copy the full SHA
    1c5b392 View commit details
  3. Required checks script: Ignore skipped jobs

    henrymercer committed Aug 6, 2024
    Copy the full SHA
    ecf4658 View commit details
  4. Update checked-in dependencies

    github-actions[bot] committed Aug 6, 2024
    Copy the full SHA
    50d1f40 View commit details
  5. Merge pull request #2412 from github/henrymercer/update-required-igno…

    …re-skipped
    
    Required checks script: Ignore skipped jobs
    henrymercer authored Aug 6, 2024
    Copy the full SHA
    c056c18 View commit details
  6. Merge pull request #2411 from github/mergeback/v3.26.0-to-main-eb055d73

    Mergeback v3.26.0 refs/heads/releases/v3 into main
    henrymercer authored Aug 6, 2024
    Copy the full SHA
    3ec2588 View commit details
  7. Merge branch 'main' into rvermeulen/extend-init-complete-status-report

    rvermeulen authored Aug 6, 2024
    Copy the full SHA
    a8ab493 View commit details
  8. Merge pull request #2394 from rvermeulen/rvermeulen/extend-init-compl…

    …ete-status-report
    
    Extend init complete status report
    rvermeulen authored Aug 6, 2024
    Copy the full SHA
    5c02493 View commit details

Commits on Aug 8, 2024

  1. Copy the full SHA
    6ef274e View commit details
  2. Improve consistency in supported version naming

    henrymercer committed Aug 8, 2024
    Copy the full SHA
    def1e35 View commit details
  3. Update default bundle to codeql-bundle-v2.18.2

    github-actions[bot] committed Aug 8, 2024
    Copy the full SHA
    18c419e View commit details
  4. Add changelog note

    github-actions[bot] committed Aug 8, 2024
    Copy the full SHA
    5d9950f View commit details
  5. Add telemetry for time spent extracting CodeQL bundle

    henrymercer committed Aug 8, 2024
    Copy the full SHA
    50357f5 View commit details
  6. Fix matrixing of "submit SARIF after failure" check

    henrymercer committed Aug 8, 2024
    Copy the full SHA
    44ecae4 View commit details
  7. Merge pull request #2418 from github/henrymercer/extraction-time-tele…

    …metry
    
    Add telemetry for time spent extracting CodeQL bundle
    henrymercer authored Aug 8, 2024
    Copy the full SHA
    25ad3c8 View commit details

Commits on Aug 12, 2024

  1. Bump the npm group with 4 updates (#2419)

    * Bump the npm group with 4 updates
    
    Bumps the npm group with 4 updates: [adm-zip](https://github.com/cthackers/adm-zip), [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js), [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser).
    
    
    Updates `adm-zip` from 0.5.14 to 0.5.15
    - [Release notes](https://github.com/cthackers/adm-zip/releases)
    - [Changelog](https://github.com/cthackers/adm-zip/blob/master/history.md)
    - [Commits](cthackers/adm-zip@v0.5.14...v0.5.15)
    
    Updates `@eslint/js` from 9.8.0 to 9.9.0
    - [Release notes](https://github.com/eslint/eslint/releases)
    - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
    - [Commits](https://github.com/eslint/eslint/commits/v9.9.0/packages/js)
    
    Updates `@typescript-eslint/eslint-plugin` from 8.0.1 to 8.1.0
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.1.0/packages/eslint-plugin)
    
    Updates `@typescript-eslint/parser` from 8.0.1 to 8.1.0
    - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
    - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
    - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.1.0/packages/parser)
    
    ---
    updated-dependencies:
    - dependency-name: adm-zip
      dependency-type: direct:production
      update-type: version-update:semver-patch
      dependency-group: npm
    - dependency-name: "@eslint/js"
      dependency-type: direct:development
      update-type: version-update:semver-minor
      dependency-group: npm
    - dependency-name: "@typescript-eslint/eslint-plugin"
      dependency-type: direct:development
      update-type: version-update:semver-minor
      dependency-group: npm
    - dependency-name: "@typescript-eslint/parser"
      dependency-type: direct:development
      update-type: version-update:semver-minor
      dependency-group: npm
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    * Update checked-in dependencies
    
    ---------
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    dependabot[bot] and github-actions[bot] authored Aug 12, 2024
    Copy the full SHA
    d620faa View commit details

Commits on Aug 13, 2024

  1. Log job run UUID

    henrymercer committed Aug 13, 2024
    Copy the full SHA
    41833c7 View commit details
  2. Merge pull request #2417 from github/update-bundle/codeql-bundle-v2.18.2

    Update default bundle to 2.18.2
    alexet authored Aug 13, 2024
    Copy the full SHA
    c4c3c44 View commit details
  3. Merge pull request #2421 from github/henrymercer/log-job-run-uuid

    Log job run UUID
    henrymercer authored Aug 13, 2024
    Copy the full SHA
    da9ecb0 View commit details
  4. Merge pull request #2416 from github/henrymercer/ghes-3.14-compat-info

    Add details of supported versions for GHES 3.14
    henrymercer authored Aug 13, 2024
    Copy the full SHA
    0d5982a View commit details
  5. Update changelog for v3.26.1

    github-actions[bot] committed Aug 13, 2024
    Copy the full SHA
    18ac79e View commit details
  6. Revert "Merge pull request #2417 from github/update-bundle/codeql-bun…

    …dle-v2.18.2"
    
    This reverts commit c4c3c44, reversing
    changes made to d620faa.
    rvermeulen committed Aug 13, 2024
    Copy the full SHA
    5b15b9e View commit details
  7. Merge pull request #2422 from github/update-v3.26.1-0d5982aa3

    Merge main into releases/v3
    rvermeulen authored Aug 13, 2024
    Copy the full SHA
    29d86d2 View commit details
Showing with 1,932 additions and 858 deletions.
  1. +1 −0 .github/workflows/__submit-sarif-failure.yml
  2. +1 −2 .github/workflows/script/update-required-checks.sh
  3. +4 −0 CHANGELOG.md
  4. +8 −7 README.md
  5. +3 −6 lib/codeql.js
  6. +1 −1 lib/codeql.js.map
  7. +9 −9 lib/codeql.test.js
  8. +1 −1 lib/codeql.test.js.map
  9. +7 −0 lib/config-utils.js
  10. +1 −1 lib/config-utils.js.map
  11. +7 −2 lib/diagnostics.js
  12. +1 −1 lib/diagnostics.js.map
  13. +46 −8 lib/init-action.js
  14. +1 −1 lib/init-action.js.map
  15. +2 −2 lib/init.js
  16. +1 −1 lib/init.js.map
  17. +17 −11 lib/setup-codeql.js
  18. +1 −1 lib/setup-codeql.js.map
  19. +10 −4 lib/setup-codeql.test.js
  20. +1 −1 lib/setup-codeql.test.js.map
  21. +4 −0 lib/util.js
  22. +1 −1 lib/util.js.map
  23. +49 −48 node_modules/.package-lock.json
  24. +1 −1 node_modules/@eslint/js/package.json
  25. +9 −3 node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js
  26. +1 −1 node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js.map
  27. +5 −7 node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js
  28. +1 −1 node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js.map
  29. +19 −14 node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-floating-promises.js
  30. +1 −1 node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-floating-promises.js.map
  31. +69 −2 node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-misused-promises.js
  32. +1 −1 node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-misused-promises.js.map
  33. +2 −2 node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js
  34. +1 −1 node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js.map
  35. +44 −31 node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-type-parameters.js
  36. +1 −1 node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-type-parameters.js.map
  37. +31 −8 node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-return.js
  38. +1 −1 node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-return.js.map
  39. +2 −2 node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-use-before-define.js
  40. +1 −1 node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-use-before-define.js.map
  41. +47 −14 node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-optional-chain-utils/analyzeChain.js
  42. +1 −1 ...dules/@typescript-eslint/eslint-plugin/dist/rules/prefer-optional-chain-utils/analyzeChain.js.map
  43. +2 −2 node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-optional-chain.js
  44. +1 −1 node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-optional-chain.js.map
  45. +7 −0 node_modules/@typescript-eslint/eslint-plugin/dist/util/getFixOrSuggest.js
  46. +1 −0 node_modules/@typescript-eslint/eslint-plugin/dist/util/getFixOrSuggest.js.map
  47. +1 −1 node_modules/@typescript-eslint/eslint-plugin/dist/util/getWrappingFixer.js
  48. +1 −0 node_modules/@typescript-eslint/eslint-plugin/dist/util/index.js
  49. +1 −1 node_modules/@typescript-eslint/eslint-plugin/dist/util/index.js.map
  50. +1 −1 node_modules/@typescript-eslint/eslint-plugin/dist/util/misc.js.map
  51. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-types.md
  52. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/block-spacing.md
  53. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/brace-style.md
  54. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/camelcase.md
  55. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-dangle.md
  56. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-spacing.md
  57. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/func-call-spacing.md
  58. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/indent.md
  59. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/key-spacing.md
  60. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/keyword-spacing.md
  61. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/lines-around-comment.md
  62. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/lines-between-class-members.md
  63. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-delimiter-style.md
  64. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-imports.mdx
  65. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-parens.md
  66. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-semi.md
  67. +98 −53 node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-promises.mdx
  68. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-parameter-properties.mdx
  69. +3 −3 node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-parameters.mdx
  70. +9 −1 node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-return.mdx
  71. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-useless-template-literals.mdx
  72. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/object-curly-spacing.md
  73. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/padding-line-between-statements.md
  74. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/quotes.md
  75. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/semi.md
  76. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/sort-type-union-intersection-members.mdx
  77. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-blocks.md
  78. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-function-paren.md
  79. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-infix-ops.md
  80. +2 −2 node_modules/@typescript-eslint/eslint-plugin/docs/rules/strict-boolean-expressions.mdx
  81. +4 −0 node_modules/@typescript-eslint/eslint-plugin/docs/rules/type-annotation-spacing.md
  82. +7 −7 node_modules/@typescript-eslint/eslint-plugin/package.json
  83. +5 −5 node_modules/@typescript-eslint/parser/package.json
  84. +4 −4 node_modules/@typescript-eslint/scope-manager/package.json
  85. +5 −4 node_modules/@typescript-eslint/type-utils/dist/predicates.d.ts
  86. +1 −1 node_modules/@typescript-eslint/type-utils/dist/predicates.d.ts.map
  87. +17 −6 node_modules/@typescript-eslint/type-utils/dist/predicates.js
  88. +1 −1 node_modules/@typescript-eslint/type-utils/dist/predicates.js.map
  89. +4 −4 node_modules/@typescript-eslint/type-utils/package.json
  90. +96 −46 node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts
  91. +1 −1 node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts.map
  92. +15 −0 node_modules/@typescript-eslint/types/dist/ts-estree.d.ts
  93. +1 −1 node_modules/@typescript-eslint/types/dist/ts-estree.d.ts.map
  94. +1 −1 node_modules/@typescript-eslint/types/dist/ts-estree.js.map
  95. +1 −1 node_modules/@typescript-eslint/types/package.json
  96. +1 −1 node_modules/@typescript-eslint/typescript-estree/dist/convert.d.ts.map
  97. +63 −7 node_modules/@typescript-eslint/typescript-estree/dist/convert.js
  98. +1 −1 node_modules/@typescript-eslint/typescript-estree/dist/convert.js.map
  99. +1 −1 node_modules/@typescript-eslint/typescript-estree/dist/node-utils.d.ts.map
  100. +1 −0 node_modules/@typescript-eslint/typescript-estree/dist/node-utils.js
  101. +1 −1 node_modules/@typescript-eslint/typescript-estree/dist/node-utils.js.map
  102. +3 −3 node_modules/@typescript-eslint/typescript-estree/package.json
  103. +6 −5 node_modules/@typescript-eslint/utils/dist/ts-eslint/Config.d.ts
  104. +1 −1 node_modules/@typescript-eslint/utils/dist/ts-eslint/Config.d.ts.map
  105. +1 −1 node_modules/@typescript-eslint/utils/dist/ts-eslint/ESLint.d.ts.map
  106. +0 −1 node_modules/@typescript-eslint/utils/dist/ts-eslint/ESLint.js
  107. +1 −1 node_modules/@typescript-eslint/utils/dist/ts-eslint/ESLint.js.map
  108. +4 −4 node_modules/@typescript-eslint/utils/package.json
  109. +2 −2 node_modules/@typescript-eslint/visitor-keys/package.json
  110. +23 −2 node_modules/adm-zip/README.md
  111. +326 −164 node_modules/adm-zip/adm-zip.js
  112. +86 −52 node_modules/adm-zip/headers/entryHeader.js
  113. +1 −1 node_modules/adm-zip/headers/mainHeader.js
  114. +2 −1 node_modules/adm-zip/methods/zipcrypto.js
  115. +3 −2 node_modules/adm-zip/package.json
  116. +5 −0 node_modules/adm-zip/util/decoder.js
  117. +32 −5 node_modules/adm-zip/util/errors.js
  118. +1 −4 node_modules/adm-zip/util/fattr.js
  119. +0 −11 node_modules/adm-zip/util/fileSystem.js
  120. +1 −0 node_modules/adm-zip/util/index.js
  121. +113 −24 node_modules/adm-zip/util/utils.js
  122. +95 −44 node_modules/adm-zip/zipEntry.js
  123. +114 −52 node_modules/adm-zip/zipFile.js
  124. +54 −53 package-lock.json
  125. +5 −5 package.json
  126. +1 −0 pr-checks/checks/submit-sarif-failure.yml
  127. +23 −9 src/codeql.test.ts
  128. +16 −16 src/codeql.ts
  129. +9 −0 src/config-utils.ts
  130. +8 −3 src/diagnostics.ts
  131. +76 −9 src/init-action.ts
  132. +4 −4 src/init.ts
  133. +10 −4 src/setup-codeql.test.ts
  134. +25 −16 src/setup-codeql.ts
  135. +4 −0 src/util.ts
1 change: 1 addition & 0 deletions .github/workflows/__submit-sarif-failure.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions .github/workflows/script/update-required-checks.sh
Original file line number Diff line number Diff line change
@@ -28,8 +28,7 @@ fi
echo "Getting checks for $GITHUB_SHA"

# Ignore any checks with "https://", CodeQL, LGTM, and Update checks.
# Also ignore the non-matrixed "Unit Tests" job that only runs on pushes to protected branches.
CHECKS="$(gh api repos/github/codeql-action/commits/"${GITHUB_SHA}"/check-runs --paginate | jq --slurp --compact-output --raw-output '[.[].check_runs | .[].name | select(contains("https://") or . == "CodeQL" or . == "Dependabot" or . == "check-expected-release-files" or . == "Unit Tests" or contains("Update") or contains("update") or contains("test-setup-python-scripts") | not)] | unique | sort')"
CHECKS="$(gh api repos/github/codeql-action/commits/"${GITHUB_SHA}"/check-runs --paginate | jq --slurp --compact-output --raw-output '[.[].check_runs.[] | select(.conclusion != "skipped") | .name | select(contains("https://") or . == "CodeQL" or . == "Dependabot" or . == "check-expected-release-files" or contains("Update") or contains("update") or contains("test-setup-python-scripts") | not)] | unique | sort')"

echo "$CHECKS" | jq

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,10 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th

Note that the only difference between `v2` and `v3` of the CodeQL Action is the node version they support, with `v3` running on node 20 while we continue to release `v2` to support running on node 16. For example `3.22.11` was the first `v3` release and is functionally identical to `2.22.11`. This approach ensures an easy way to track exactly which features are included in different versions, indicated by the minor and patch version numbers.

## 3.26.1 - 13 Aug 2024

No user facing changes.

## 3.26.0 - 06 Aug 2024

- _Deprecation:_ Swift analysis on Ubuntu runner images is no longer supported. Please migrate to a macOS runner if this affects you. [#2403](https://github.com/github/codeql-action/pull/2403)
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -33,17 +33,18 @@ To provide the best experience to customers using older versions of GitHub Enter

For more information, see "[Code scanning: deprecation of CodeQL Action v2](https://github.blog/changelog/2024-01-12-code-scanning-deprecation-of-codeql-action-v2/)."

## Supported versions of the CodeQL CLI and GitHub Enterprise Server
## Supported versions of the CodeQL Bundle and GitHub Enterprise Server

We typically release new minor versions of the CodeQL Action and CLI when a new minor version of GitHub Enterprise Server (GHES) is released. When a version of GHES is deprecated, the CodeQL Action and CLI releases that shipped with it are deprecated as well.
We typically release new minor versions of the CodeQL Action and Bundle when a new minor version of GitHub Enterprise Server (GHES) is released. When a version of GHES is deprecated, the CodeQL Action and Bundle releases that shipped with it are deprecated as well.

| Recommended CodeQL Action | Recommended CodeQL CLI Version | GitHub Environment |
| Recommended CodeQL Action | Recommended CodeQL Bundle Version | GitHub Environment |
|---------|----------|--------------|
| `v3` | default (do not pass a `tools` input) | GitHub.com |
| `v3.24.11` | `v2.16.6` | Enterprise Server 3.13 |
| `3.22.12` | `2.15.5` | Enterprise Server 3.12 |
| `2.22.1` | `2.14.6` | Enterprise Server 3.11 |
| `2.20.3` | `2.13.5` | Enterprise Server 3.10 |
| `v3.25.11` | `2.17.6` | Enterprise Server 3.14 |
| `v3.24.11` | `2.16.6` | Enterprise Server 3.13 |
| `v3.22.12` | `2.15.5` | Enterprise Server 3.12 |
| `v2.22.1` | `2.14.6` | Enterprise Server 3.11 |
| `v2.20.3` | `2.13.5` | Enterprise Server 3.10 |

CodeQL Action `v2` will stop receiving updates when GHES 3.11 is deprecated.

9 changes: 3 additions & 6 deletions lib/codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions lib/codeql.test.js
2 changes: 1 addition & 1 deletion lib/codeql.test.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions lib/config-utils.js
2 changes: 1 addition & 1 deletion lib/config-utils.js.map

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions lib/diagnostics.js
2 changes: 1 addition & 1 deletion lib/diagnostics.js.map
54 changes: 46 additions & 8 deletions lib/init-action.js
2 changes: 1 addition & 1 deletion lib/init-action.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/init.js
2 changes: 1 addition & 1 deletion lib/init.js.map
28 changes: 17 additions & 11 deletions lib/setup-codeql.js
2 changes: 1 addition & 1 deletion lib/setup-codeql.js.map

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions lib/setup-codeql.test.js
2 changes: 1 addition & 1 deletion lib/setup-codeql.test.js.map
4 changes: 4 additions & 0 deletions lib/util.js
2 changes: 1 addition & 1 deletion lib/util.js.map

Large diffs are not rendered by default.

97 changes: 49 additions & 48 deletions node_modules/.package-lock.json
2 changes: 1 addition & 1 deletion node_modules/@eslint/js/package.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions node_modules/@typescript-eslint/eslint-plugin/package.json
10 changes: 5 additions & 5 deletions node_modules/@typescript-eslint/parser/package.json
8 changes: 4 additions & 4 deletions node_modules/@typescript-eslint/scope-manager/package.json
23 changes: 17 additions & 6 deletions node_modules/@typescript-eslint/type-utils/dist/predicates.js
8 changes: 4 additions & 4 deletions node_modules/@typescript-eslint/type-utils/package.json
142 changes: 96 additions & 46 deletions node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions node_modules/@typescript-eslint/types/dist/ts-estree.d.ts
2 changes: 1 addition & 1 deletion node_modules/@typescript-eslint/types/package.json
70 changes: 63 additions & 7 deletions node_modules/@typescript-eslint/typescript-estree/dist/convert.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions node_modules/@typescript-eslint/utils/dist/ts-eslint/Config.d.ts
8 changes: 4 additions & 4 deletions node_modules/@typescript-eslint/utils/package.json
4 changes: 2 additions & 2 deletions node_modules/@typescript-eslint/visitor-keys/package.json
25 changes: 23 additions & 2 deletions node_modules/adm-zip/README.md
490 changes: 326 additions & 164 deletions node_modules/adm-zip/adm-zip.js

Large diffs are not rendered by default.

138 changes: 86 additions & 52 deletions node_modules/adm-zip/headers/entryHeader.js
2 changes: 1 addition & 1 deletion node_modules/adm-zip/headers/mainHeader.js
3 changes: 2 additions & 1 deletion node_modules/adm-zip/methods/zipcrypto.js
5 changes: 3 additions & 2 deletions node_modules/adm-zip/package.json
5 changes: 5 additions & 0 deletions node_modules/adm-zip/util/decoder.js
37 changes: 32 additions & 5 deletions node_modules/adm-zip/util/errors.js
5 changes: 1 addition & 4 deletions node_modules/adm-zip/util/fattr.js
11 changes: 0 additions & 11 deletions node_modules/adm-zip/util/fileSystem.js

This file was deleted.

1 change: 1 addition & 0 deletions node_modules/adm-zip/util/index.js
137 changes: 113 additions & 24 deletions node_modules/adm-zip/util/utils.js
139 changes: 95 additions & 44 deletions node_modules/adm-zip/zipEntry.js
166 changes: 114 additions & 52 deletions node_modules/adm-zip/zipFile.js
107 changes: 54 additions & 53 deletions package-lock.json
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codeql",
"version": "3.26.0",
"version": "3.26.1",
"private": true,
"description": "CodeQL action",
"scripts": {
@@ -34,7 +34,7 @@
"@schemastore/package": "0.0.10",
"@types/node-forge": "^1.3.11",
"@types/uuid": "^10.0.0",
"adm-zip": "^0.5.14",
"adm-zip": "^0.5.15",
"check-disk-space": "^3.4.0",
"console-log-level": "^1.4.1",
"del": "^6.1.1",
@@ -58,16 +58,16 @@
"@ava/typescript": "4.1.0",
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0",
"@eslint/js": "^9.9.0",
"@types/adm-zip": "^0.5.5",
"@types/console-log-level": "^1.4.5",
"@types/get-folder-size": "^2.0.0",
"@types/js-yaml": "^4.0.9",
"@types/node": "20.9.0",
"@types/semver": "^7.5.8",
"@types/sinon": "^17.0.3",
"@typescript-eslint/eslint-plugin": "^8.0.1",
"@typescript-eslint/parser": "^8.0.1",
"@typescript-eslint/eslint-plugin": "^8.1.0",
"@typescript-eslint/parser": "^8.1.0",
"ava": "^5.3.1",
"eslint": "^8.57.0",
"eslint-import-resolver-typescript": "^3.6.1",
1 change: 1 addition & 0 deletions pr-checks/checks/submit-sarif-failure.yml
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ steps:
- uses: ./init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Fail
# We want this job to pass if the Action correctly uploads the SARIF file for
# the failed run.
32 changes: 23 additions & 9 deletions src/codeql.test.ts
Original file line number Diff line number Diff line change
@@ -134,7 +134,9 @@ test("downloads and caches explicitly requested bundles that aren't in the toolc
t.assert(toolcache.find("CodeQL", `0.0.0-${version}`));
t.is(result.toolsVersion, `0.0.0-${version}`);
t.is(result.toolsSource, ToolsSource.Download);
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
t.assert(
Number.isInteger(result.toolsDownloadStatusReport?.downloadDurationMs),
);
}

t.is(toolcache.findAllVersions("CodeQL").length, 2);
@@ -162,7 +164,9 @@ test("caches semantically versioned bundles using their semantic version number"
t.assert(toolcache.find("CodeQL", `2.14.0`));
t.is(result.toolsVersion, `2.14.0`);
t.is(result.toolsSource, ToolsSource.Download);
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
t.assert(
Number.isInteger(result.toolsDownloadStatusReport?.downloadDurationMs),
);
});
});

@@ -191,7 +195,9 @@ test("downloads an explicitly requested bundle even if a different version is ca
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
t.deepEqual(result.toolsVersion, "0.0.0-20200610");
t.is(result.toolsSource, ToolsSource.Download);
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
t.assert(
Number.isInteger(result.toolsDownloadStatusReport?.downloadDurationMs),
);
});
});

@@ -233,7 +239,9 @@ for (const {
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
t.deepEqual(result.toolsVersion, expectedToolcacheVersion);
t.is(result.toolsSource, ToolsSource.Download);
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
t.assert(
Number.isInteger(result.toolsDownloadStatusReport?.downloadDurationMs),
);
});
});
}
@@ -268,7 +276,7 @@ for (const toolcacheVersion of [
);
t.is(result.toolsVersion, SAMPLE_DEFAULT_CLI_VERSION.cliVersion);
t.is(result.toolsSource, ToolsSource.Toolcache);
t.is(result.toolsDownloadDurationMs, undefined);
t.is(result.toolsDownloadStatusReport?.downloadDurationMs, undefined);
});
},
);
@@ -298,7 +306,7 @@ test(`uses a cached bundle when no tools input is given on GHES`, async (t) => {
);
t.deepEqual(result.toolsVersion, "0.0.0-20200601");
t.is(result.toolsSource, ToolsSource.Toolcache);
t.is(result.toolsDownloadDurationMs, undefined);
t.is(result.toolsDownloadStatusReport?.downloadDurationMs, undefined);

const cachedVersions = toolcache.findAllVersions("CodeQL");
t.is(cachedVersions.length, 1);
@@ -332,7 +340,9 @@ test(`downloads bundle if only an unpinned version is cached on GHES`, async (t)
);
t.deepEqual(result.toolsVersion, defaults.cliVersion);
t.is(result.toolsSource, ToolsSource.Download);
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
t.assert(
Number.isInteger(result.toolsDownloadStatusReport?.downloadDurationMs),
);

const cachedVersions = toolcache.findAllVersions("CodeQL");
t.is(cachedVersions.length, 2);
@@ -363,7 +373,9 @@ test('downloads bundle if "latest" tools specified but not cached', async (t) =>
);
t.deepEqual(result.toolsVersion, defaults.cliVersion);
t.is(result.toolsSource, ToolsSource.Download);
t.assert(Number.isInteger(result.toolsDownloadDurationMs));
t.assert(
Number.isInteger(result.toolsDownloadStatusReport?.downloadDurationMs),
);

const cachedVersions = toolcache.findAllVersions("CodeQL");
t.is(cachedVersions.length, 2);
@@ -398,7 +410,9 @@ test("bundle URL from another repo is cached as 0.0.0-bundleVersion", async (t)

t.is(result.toolsVersion, "0.0.0-20230203");
t.is(result.toolsSource, ToolsSource.Download);
t.true(Number.isInteger(result.toolsDownloadDurationMs));
t.true(
Number.isInteger(result.toolsDownloadStatusReport?.downloadDurationMs),
);

const cachedVersions = toolcache.findAllVersions("CodeQL");
t.is(cachedVersions.length, 1);
32 changes: 16 additions & 16 deletions src/codeql.ts
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ import * as setupCodeql from "./setup-codeql";
import { ToolsFeature, isSupportedToolsFeature } from "./tools-features";
import { shouldEnableIndirectTracing } from "./tracer-config";
import * as util from "./util";
import { BuildMode, wrapError } from "./util";
import { BuildMode, wrapError, cloneObject } from "./util";

type Options = Array<string | number | boolean>;

@@ -350,20 +350,24 @@ export async function setupCodeQL(
checkVersion: boolean,
): Promise<{
codeql: CodeQL;
toolsDownloadDurationMs?: number;
toolsDownloadStatusReport?: setupCodeql.ToolsDownloadStatusReport;
toolsSource: setupCodeql.ToolsSource;
toolsVersion: string;
}> {
try {
const { codeqlFolder, toolsDownloadDurationMs, toolsSource, toolsVersion } =
await setupCodeql.setupCodeQLBundle(
toolsInput,
apiDetails,
tempDir,
variant,
defaultCliVersion,
logger,
);
const {
codeqlFolder,
toolsDownloadStatusReport,
toolsSource,
toolsVersion,
} = await setupCodeql.setupCodeQLBundle(
toolsInput,
apiDetails,
tempDir,
variant,
defaultCliVersion,
logger,
);
let codeqlCmd = path.join(codeqlFolder, "codeql", "codeql");
if (process.platform === "win32") {
codeqlCmd += ".exe";
@@ -376,7 +380,7 @@ export async function setupCodeQL(
cachedCodeQL = await getCodeQLForCmd(codeqlCmd, checkVersion);
return {
codeql: cachedCodeQL,
toolsDownloadDurationMs,
toolsDownloadStatusReport,
toolsSource,
toolsVersion,
};
@@ -1306,10 +1310,6 @@ async function generateCodeScanningConfig(
return codeScanningConfigFile;
}

function cloneObject<T>(obj: T): T {
return JSON.parse(JSON.stringify(obj)) as T;
}

// This constant sets the size of each TRAP cache in megabytes.
const TRAP_CACHE_SIZE_MB = 1024;

9 changes: 9 additions & 0 deletions src/config-utils.ts
Original file line number Diff line number Diff line change
@@ -881,6 +881,15 @@ function parseRegistries(
}
}

export function parseRegistriesWithoutCredentials(
registriesInput?: string,
): RegistryConfigNoCredentials[] | undefined {
return parseRegistries(registriesInput)?.map((r) => {
const { url, packages } = r;
return { url, packages };
});
}

function isLocal(configPath: string): boolean {
// If the path starts with ./, look locally
if (configPath.indexOf("./") === 0) {
11 changes: 8 additions & 3 deletions src/diagnostics.ts
Original file line number Diff line number Diff line change
@@ -100,7 +100,9 @@ export function addDiagnostic(
diagnostic: DiagnosticMessage,
) {
const logger = getActionsLogger();
const databasePath = getCodeQLDatabasePath(config, language);
const databasePath = language
? getCodeQLDatabasePath(config, language)
: config.dbLocation;

// Check that the database exists before writing to it. If the database does not yet exist,
// store the diagnostic in memory and write it later.
@@ -124,12 +126,15 @@ export function addDiagnostic(
*/
function writeDiagnostic(
config: Config,
language: Language,
language: Language | undefined,
diagnostic: DiagnosticMessage,
) {
const logger = getActionsLogger();
const databasePath = language
? getCodeQLDatabasePath(config, language)
: config.dbLocation;
const diagnosticsPath = path.resolve(
getCodeQLDatabasePath(config, language),
databasePath,
"diagnostic",
"codeql-action",
);
85 changes: 76 additions & 9 deletions src/init-action.ts
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ import {
import { Language } from "./languages";
import { getActionsLogger, Logger } from "./logging";
import { parseRepositoryNwo } from "./repository";
import { ToolsSource } from "./setup-codeql";
import { ToolsDownloadStatusReport, ToolsSource } from "./setup-codeql";
import {
ActionName,
StatusReportBase,
@@ -60,6 +60,7 @@ import {
ConfigurationError,
wrapError,
checkActionVersion,
cloneObject,
} from "./util";
import { validateWorkflow } from "./workflow";

@@ -85,12 +86,19 @@ interface InitWithConfigStatusReport extends InitStatusReport {
paths_ignore: string;
/** Comma-separated list of queries sources, from the 'queries' config field or workflow input. */
queries: string;
/** Stringified JSON object of packs, from the 'packs' config field or workflow input. */
packs: string;
/** Comma-separated list of languages for which we are using TRAP caching. */
trap_cache_languages: string;
/** Size of TRAP caches that we downloaded, in bytes. */
trap_cache_download_size_bytes: number;
/** Time taken to download TRAP caches, in milliseconds. */
trap_cache_download_duration_ms: number;
/** Stringified JSON array of registry configuration objects, from the 'registries' config field
or workflow input. **/
registries: string;
/** Stringified JSON object representing a query-filters, from the 'query-filters' config field. **/
query_filters: string;
}

/** Fields of the init status report populated when the tools source is `download`. */
@@ -106,7 +114,7 @@ interface InitToolsDownloadFields {
async function sendCompletedStatusReport(
startedAt: Date,
config: configUtils.Config | undefined,
toolsDownloadDurationMs: number | undefined,
toolsDownloadStatusReport: ToolsDownloadStatusReport | undefined,
toolsFeatureFlagsValid: boolean | undefined,
toolsSource: ToolsSource,
toolsVersion: string,
@@ -140,9 +148,9 @@ async function sendCompletedStatusReport(

const initToolsDownloadFields: InitToolsDownloadFields = {};

if (toolsDownloadDurationMs !== undefined) {
if (toolsDownloadStatusReport !== undefined) {
initToolsDownloadFields.tools_download_duration_ms =
toolsDownloadDurationMs;
toolsDownloadStatusReport.downloadDurationMs;
}
if (toolsFeatureFlagsValid !== undefined) {
initToolsDownloadFields.tools_feature_flags_valid = toolsFeatureFlagsValid;
@@ -174,18 +182,52 @@ async function sendCompletedStatusReport(
queries.push(...queriesInput.split(","));
}

let packs: Record<string, string[]> = {};
if (
(config.augmentationProperties.packsInputCombines ||
!config.augmentationProperties.packsInput) &&
config.originalUserInput.packs
) {
// Make a copy, because we might modify `packs`.
const copyPacksFromOriginalUserInput = cloneObject(
config.originalUserInput.packs,
);
// If it is an array, then assume there is only a single language being analyzed.
if (Array.isArray(copyPacksFromOriginalUserInput)) {
packs[config.languages[0]] = copyPacksFromOriginalUserInput;
} else {
packs = copyPacksFromOriginalUserInput;
}
}

if (config.augmentationProperties.packsInput) {
packs[config.languages[0]] ??= [];
packs[config.languages[0]].push(
...config.augmentationProperties.packsInput,
);
}

// Append fields that are dependent on `config`
const initWithConfigStatusReport: InitWithConfigStatusReport = {
...initStatusReport,
disable_default_queries: disableDefaultQueries,
paths,
paths_ignore: pathsIgnore,
queries: queries.join(","),
packs: JSON.stringify(packs),
trap_cache_languages: Object.keys(config.trapCaches).join(","),
trap_cache_download_size_bytes: Math.round(
await getTotalCacheSize(config.trapCaches, logger),
),
trap_cache_download_duration_ms: Math.round(config.trapCacheDownloadTime),
query_filters: JSON.stringify(
config.originalUserInput["query-filters"] ?? [],
),
registries: JSON.stringify(
configUtils.parseRegistriesWithoutCredentials(
getOptionalInput("registries"),
) ?? [],
),
};
await sendStatusReport({
...initWithConfigStatusReport,
@@ -203,7 +245,7 @@ async function run() {

let config: configUtils.Config | undefined;
let codeql: CodeQL;
let toolsDownloadDurationMs: number | undefined;
let toolsDownloadStatusReport: ToolsDownloadStatusReport | undefined;
let toolsFeatureFlagsValid: boolean | undefined;
let toolsSource: ToolsSource;
let toolsVersion: string;
@@ -230,7 +272,10 @@ async function run() {
logger,
);

core.exportVariable(EnvVar.JOB_RUN_UUID, uuidV4());
const jobRunUuid = uuidV4();
logger.info(`Job run UUID is ${jobRunUuid}.`);
core.exportVariable(EnvVar.JOB_RUN_UUID, jobRunUuid);

core.exportVariable(EnvVar.INIT_ACTION_HAS_RUN, "true");

try {
@@ -258,7 +303,7 @@ async function run() {
logger,
);
codeql = initCodeQLResult.codeql;
toolsDownloadDurationMs = initCodeQLResult.toolsDownloadDurationMs;
toolsDownloadStatusReport = initCodeQLResult.toolsDownloadStatusReport;
toolsVersion = initCodeQLResult.toolsVersion;
toolsSource = initCodeQLResult.toolsSource;

@@ -324,6 +369,28 @@ async function run() {
try {
cleanupDatabaseClusterDirectory(config, logger);

// Log CodeQL download telemetry, if appropriate
if (toolsDownloadStatusReport) {
addDiagnostic(
config,
// Arbitrarily choose the first language. We could also choose all languages, but that
// increases the risk of misinterpreting the data.
config.languages[0],
makeDiagnostic(
"codeql-action/bundle-download-telemetry",
"CodeQL bundle download telemetry",
{
attributes: toolsDownloadStatusReport,
visibility: {
cliSummaryTable: false,
statusPage: false,
telemetry: true,
},
},
),
);
}

// Forward Go flags
const goFlags = process.env["GOFLAGS"];
if (goFlags) {
@@ -561,7 +628,7 @@ async function run() {
await sendCompletedStatusReport(
startedAt,
config,
toolsDownloadDurationMs,
toolsDownloadStatusReport,
toolsFeatureFlagsValid,
toolsSource,
toolsVersion,
@@ -575,7 +642,7 @@ async function run() {
await sendCompletedStatusReport(
startedAt,
config,
toolsDownloadDurationMs,
toolsDownloadStatusReport,
toolsFeatureFlagsValid,
toolsSource,
toolsVersion,
8 changes: 4 additions & 4 deletions src/init.ts
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ import * as configUtils from "./config-utils";
import { CodeQLDefaultVersionInfo } from "./feature-flags";
import { Language, isScannedLanguage } from "./languages";
import { Logger } from "./logging";
import { ToolsSource } from "./setup-codeql";
import { ToolsDownloadStatusReport, ToolsSource } from "./setup-codeql";
import { ToolsFeature } from "./tools-features";
import { TracerConfig, getCombinedTracerConfig } from "./tracer-config";
import * as util from "./util";
@@ -26,12 +26,12 @@ export async function initCodeQL(
logger: Logger,
): Promise<{
codeql: CodeQL;
toolsDownloadDurationMs?: number;
toolsDownloadStatusReport?: ToolsDownloadStatusReport;
toolsSource: ToolsSource;
toolsVersion: string;
}> {
logger.startGroup("Setup CodeQL tools");
const { codeql, toolsDownloadDurationMs, toolsSource, toolsVersion } =
const { codeql, toolsDownloadStatusReport, toolsSource, toolsVersion } =
await setupCodeQL(
toolsInput,
apiDetails,
@@ -43,7 +43,7 @@ export async function initCodeQL(
);
await codeql.printVersion();
logger.endGroup();
return { codeql, toolsDownloadDurationMs, toolsSource, toolsVersion };
return { codeql, toolsDownloadStatusReport, toolsSource, toolsVersion };
}

export async function initConfig(
14 changes: 10 additions & 4 deletions src/setup-codeql.test.ts
Original file line number Diff line number Diff line change
@@ -152,9 +152,12 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to use
// Stub the downloadCodeQL function to prevent downloading artefacts
// during testing from being called.
sinon.stub(setupCodeql, "downloadCodeQL").resolves({
toolsVersion: LINKED_CLI_VERSION.cliVersion,
codeqlFolder: "codeql",
toolsDownloadDurationMs: 200,
statusReport: {
downloadDurationMs: 200,
extractionDurationMs: 300,
},
toolsVersion: LINKED_CLI_VERSION.cliVersion,
});

await withTmpDir(async (tmpDir) => {
@@ -195,9 +198,12 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to dow
// Stub the downloadCodeQL function to prevent downloading artefacts
// during testing from being called.
sinon.stub(setupCodeql, "downloadCodeQL").resolves({
toolsVersion: expectedVersion,
codeqlFolder: "codeql",
toolsDownloadDurationMs: 200,
statusReport: {
downloadDurationMs: 200,
extractionDurationMs: 300,
},
toolsVersion: expectedVersion,
});

await withTmpDir(async (tmpDir) => {
41 changes: 25 additions & 16 deletions src/setup-codeql.ts
Original file line number Diff line number Diff line change
@@ -461,6 +461,11 @@ export async function tryGetFallbackToolcacheVersion(
return fallbackVersion;
}

export interface ToolsDownloadStatusReport {
downloadDurationMs: number;
extractionDurationMs: number;
}

// Exported using `export const` for testing purposes. Specifically, we want to
// be able to stub this function and have other functions in this file use that stub.
export const downloadCodeQL = async function (
@@ -471,9 +476,9 @@ export const downloadCodeQL = async function (
tempDir: string,
logger: Logger,
): Promise<{
toolsVersion: string;
codeqlFolder: string;
toolsDownloadDurationMs: number;
statusReport: ToolsDownloadStatusReport;
toolsVersion: string;
}> {
const parsedCodeQLURL = new URL(codeqlURL);
const searchParams = new URLSearchParams(parsedCodeQLURL.search);
@@ -513,20 +518,18 @@ export const downloadCodeQL = async function (
authorization,
finalHeaders,
);
const toolsDownloadDurationMs = Math.round(
performance.now() - toolsDownloadStart,
);
const downloadDurationMs = Math.round(performance.now() - toolsDownloadStart);

logger.debug(
`Finished downloading CodeQL bundle to ${archivedBundlePath} (${toolsDownloadDurationMs} ms).`,
`Finished downloading CodeQL bundle to ${archivedBundlePath} (${downloadDurationMs} ms).`,
);

logger.debug("Extracting CodeQL bundle.");
const extractionStart = performance.now();
const extractedBundlePath = await toolcache.extractTar(archivedBundlePath);
const extractionMs = Math.round(performance.now() - extractionStart);
const extractionDurationMs = Math.round(performance.now() - extractionStart);
logger.debug(
`Finished extracting CodeQL bundle to ${extractedBundlePath} (${extractionMs} ms).`,
`Finished extracting CodeQL bundle to ${extractedBundlePath} (${extractionDurationMs} ms).`,
);
await cleanUpGlob(archivedBundlePath, "CodeQL bundle archive", logger);

@@ -539,9 +542,12 @@ export const downloadCodeQL = async function (
`URL ${codeqlURL}.`,
);
return {
toolsVersion: maybeCliVersion ?? "unknown",
codeqlFolder: extractedBundlePath,
toolsDownloadDurationMs,
statusReport: {
downloadDurationMs,
extractionDurationMs,
},
toolsVersion: maybeCliVersion ?? "unknown",
};
}

@@ -567,9 +573,12 @@ export const downloadCodeQL = async function (
}

return {
toolsVersion: maybeCliVersion ?? toolcacheVersion,
codeqlFolder: toolcachedBundlePath,
toolsDownloadDurationMs,
statusReport: {
downloadDurationMs,
extractionDurationMs,
},
toolsVersion: maybeCliVersion ?? toolcacheVersion,
};
};

@@ -632,7 +641,7 @@ export async function setupCodeQLBundle(
logger: Logger,
): Promise<{
codeqlFolder: string;
toolsDownloadDurationMs?: number;
toolsDownloadStatusReport?: ToolsDownloadStatusReport;
toolsSource: ToolsSource;
toolsVersion: string;
}> {
@@ -646,7 +655,7 @@ export async function setupCodeQLBundle(

let codeqlFolder: string;
let toolsVersion = source.toolsVersion;
let toolsDownloadDurationMs: number | undefined;
let toolsDownloadStatusReport: ToolsDownloadStatusReport | undefined;
let toolsSource: ToolsSource;
switch (source.sourceType) {
case "local":
@@ -669,14 +678,14 @@ export async function setupCodeQLBundle(
);
toolsVersion = result.toolsVersion;
codeqlFolder = result.codeqlFolder;
toolsDownloadDurationMs = result.toolsDownloadDurationMs;
toolsDownloadStatusReport = result.statusReport;
toolsSource = ToolsSource.Download;
break;
}
default:
util.assertNever(source);
}
return { codeqlFolder, toolsDownloadDurationMs, toolsSource, toolsVersion };
return { codeqlFolder, toolsDownloadStatusReport, toolsSource, toolsVersion };
}

async function cleanUpGlob(glob: string, name: string, logger: Logger) {
4 changes: 4 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
@@ -1100,3 +1100,7 @@ export enum BuildMode {
/** The database will be created by building the source root using manually specified build steps. */
Manual = "manual",
}

export function cloneObject<T>(obj: T): T {
return JSON.parse(JSON.stringify(obj)) as T;
}