Compare commits

...

102 Commits

Author SHA1 Message Date
Igwe Kalu
517782a2a0 Improve description of codeql-action/init languages input (#1919) 2023-10-04 12:01:23 -07:00
Michael B. Gale
3fb6719bea Merge pull request #1918 from github/mbg/support-version-features
Support `features` key in `version` JSON output
2023-10-04 17:23:13 +01:00
Michael B. Gale
bcbb900532 Rename VersionOutput to VersionInfo 2023-10-04 15:54:34 +01:00
Michael B. Gale
49b94f1a2d Remove unused properties from VersionOutput 2023-10-04 15:51:26 +01:00
Michael B. Gale
bb67eddd77 Wrap JSON parsing in try/catch 2023-10-04 15:49:25 +01:00
Michael B. Gale
e827ad5b71 Move makeVersionOutput to testing-utils.js 2023-10-04 15:49:04 +01:00
Michael B. Gale
a402be8739 Fix linter error 2023-10-04 11:43:14 +01:00
Michael B. Gale
74b46628c3 Support features key in version JSON output 2023-10-04 11:28:28 +01:00
dependabot[bot]
3dd4ad872b Bump the actions-setup-swift group (#1912)
Bumps the actions-setup-swift group in /.github/actions/setup-swift with 1 update: [swift-actions/setup-swift](https://github.com/swift-actions/setup-swift).

- [Release notes](https://github.com/swift-actions/setup-swift/releases)
- [Commits](cdcbe8e35d...f51889efb5)

---
updated-dependencies:
- dependency-name: swift-actions/setup-swift
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions-setup-swift
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Angela P Wen <angelapwen@github.com>
2023-10-03 15:21:00 -07:00
dependabot[bot]
b686e07c2b Bump urllib3 in /python-setup/tests/pipenv/python-3.8 (#1917)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.0.4 to 2.0.6.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.0.4...2.0.6)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-03 17:49:02 +00:00
dependabot[bot]
7de46310d9 Bump urllib3 in /python-setup/tests/poetry/python-3.8 (#1916)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.7 to 1.26.17.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.26.7...1.26.17)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-03 10:25:36 -07:00
dependabot[bot]
896a68d162 Bump urllib3 in /python-setup/tests/poetry/requests-3 (#1915)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.7 to 1.26.17.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.26.7...1.26.17)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-03 10:25:17 -07:00
dependabot[bot]
5f88bb1ffa Bump urllib3 in /python-setup/tests/pipenv/requests-3 (#1914)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.0.4 to 2.0.6.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.0.4...2.0.6)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-03 10:24:54 -07:00
dependabot[bot]
90f8ed12cc Bump the npm group with 3 updates (#1911)
* Bump the npm group with 3 updates

Bumps the npm group with 3 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) and [eslint-plugin-github](https://github.com/github/eslint-plugin-github).


Updates `@typescript-eslint/eslint-plugin` from 6.7.2 to 6.7.3
- [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/v6.7.3/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.7.2 to 6.7.3
- [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/v6.7.3/packages/parser)

Updates `eslint-plugin-github` from 4.10.0 to 4.10.1
- [Release notes](https://github.com/github/eslint-plugin-github/releases)
- [Commits](https://github.com/github/eslint-plugin-github/compare/v4.10.0...v4.10.1)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: eslint-plugin-github
  dependency-type: direct:development
  update-type: version-update:semver-patch
  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>
Co-authored-by: Angela P Wen <angelapwen@github.com>
2023-10-02 16:31:08 -07:00
Aditya Sharad
ed2a90b161 Merge pull request #1910 from github/henrymercer/remove-ml-powered-queries
Remove ML-powered queries
2023-10-02 14:40:55 -07:00
Henry Mercer
7b16c0dad0 Improve method name for addQueriesFromWorkflow. 2023-10-02 17:35:03 +01:00
Henry Mercer
37a2d1fe3c Remove ML-powered queries PR checks 2023-10-02 17:29:54 +01:00
Henry Mercer
5dac60ecef Add changelog note 2023-10-02 17:20:58 +01:00
Henry Mercer
ebbadee09e Remove ML-powered queries 2023-10-02 17:20:50 +01:00
Aditya Sharad
a370ce344f Merge pull request #1898 from Panquesito7/checkout_v4
Use `actions/checkout@v4` in test helper
2023-09-28 15:59:34 -07:00
David Leal
66572c69b0 Merge branch 'main' into checkout_v4 2023-09-28 14:31:04 -06:00
David Leal
e0103eab17 Use actions/checkout@v4 2023-09-28 20:30:31 +00:00
Henry Mercer
e7a6fa9589 Merge pull request #1907 from github/henrymercer/deprecate-codeql-2.9
Bump minimum CodeQL version to 2.10.5
2023-09-27 21:36:22 +01:00
Henry Mercer
f59bf3c458 Fix expected artifact directory name for semver versions 2023-09-27 19:44:41 +01:00
Henry Mercer
6e3f5b0184 Prompt maintainers to start process when GHES version deprecated 2023-09-27 19:40:26 +01:00
Henry Mercer
1d70a98580 Document CodeQL deprecation process 2023-09-27 19:10:31 +01:00
Henry Mercer
e4ef094279 Merge branch 'main' into henrymercer/deprecate-codeql-2.9 2023-09-27 17:18:42 +01:00
Henry Mercer
2cc1651ead Merge pull request #1906 from github/mergeback/v2.21.9-to-main-ddccb873
Mergeback v2.21.9 refs/heads/releases/v2 into main
2023-09-27 17:14:03 +01:00
Henry Mercer
a6484fa0f6 Merge pull request #1896 from github/update-supported-enterprise-server-versions
Update supported GitHub Enterprise Server versions
2023-09-27 16:44:20 +01:00
Henry Mercer
9ef3267030 Merge pull request #1904 from github/henrymercer/tweak-cgroup-ram-logging
Don't log invalid cgroup memory limits
2023-09-27 16:43:26 +01:00
Henry Mercer
219066c343 Fix error in generated workflow 2023-09-27 16:41:29 +01:00
Henry Mercer
a9a0f3b4c0 Add changelog note 2023-09-27 16:23:10 +01:00
Henry Mercer
467bfa1cff Update CodeQL versions tested in PR checks 2023-09-27 16:21:16 +01:00
Henry Mercer
1d5eed8d40 Remove deprecated functionality 2023-09-27 16:16:13 +01:00
Henry Mercer
96fa24c6ba Bump minimum CodeQL version to 2.10.5 2023-09-27 16:08:27 +01:00
Henry Mercer
f1752b0b55 Bump minor version 2023-09-27 16:07:45 +01:00
github-actions[bot]
7efe1c9625 Update checked-in dependencies 2023-09-27 15:01:27 +00:00
github-actions[bot]
0dd2eafff0 Update changelog and version after v2.21.9 2023-09-27 14:58:13 +00:00
Alexander Eyers-Taylor
ddccb87388 Merge pull request #1905 from github/update-v2.21.9-27cb1e1de
Merge main into releases/v2
2023-09-27 15:56:30 +01:00
github-actions[bot]
d8cb5a2a0f Update changelog for v2.21.9 2023-09-27 14:21:29 +00:00
Henry Mercer
378bbcd274 Don't log invalid cgroup memory limits 2023-09-27 13:56:20 +01:00
dependabot[bot]
27cb1e1de5 Bump the npm group with 6 updates (#1902)
* Bump the npm group with 6 updates

Bumps the npm group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [@octokit/types](https://github.com/octokit/types.ts) | `11.1.0` | `12.0.0` |
| [@types/adm-zip](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/adm-zip) | `0.5.1` | `0.5.2` |
| [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) | `7.5.2` | `7.5.3` |
| [@types/sinon](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/sinon) | `10.0.16` | `10.0.17` |
| [eslint](https://github.com/eslint/eslint) | `8.49.0` | `8.50.0` |
| [eslint-import-resolver-typescript](https://github.com/import-js/eslint-import-resolver-typescript) | `3.6.0` | `3.6.1` |


Updates `@octokit/types` from 11.1.0 to 12.0.0
- [Release notes](https://github.com/octokit/types.ts/releases)
- [Commits](https://github.com/octokit/types.ts/compare/v11.1.0...v12.0.0)

Updates `@types/adm-zip` from 0.5.1 to 0.5.2
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/adm-zip)

Updates `@types/semver` from 7.5.2 to 7.5.3
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver)

Updates `@types/sinon` from 10.0.16 to 10.0.17
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/sinon)

Updates `eslint` from 8.49.0 to 8.50.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/compare/v8.49.0...v8.50.0)

Updates `eslint-import-resolver-typescript` from 3.6.0 to 3.6.1
- [Release notes](https://github.com/import-js/eslint-import-resolver-typescript/releases)
- [Changelog](https://github.com/import-js/eslint-import-resolver-typescript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-import-resolver-typescript/compare/v3.6.0...v3.6.1)

---
updated-dependencies:
- dependency-name: "@octokit/types"
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: npm
- dependency-name: "@types/adm-zip"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@types/semver"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@types/sinon"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint-import-resolver-typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
  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>
2023-09-26 10:34:03 -07:00
Henry Mercer
4818fdd8ec Merge pull request #1903 from github/henrymercer/sublanguage-file-coverage
Enable sub-language file coverage behind a feature flag
2023-09-26 17:30:08 +01:00
Alexander Eyers-Taylor
e548601be3 Merge pull request #1897 from github/update-bundle/codeql-bundle-v2.14.6
Update default bundle to 2.14.6
2023-09-26 14:03:58 +01:00
Alexander Eyers-Taylor
cc6542087a Merge branch 'main' into update-bundle/codeql-bundle-v2.14.6 2023-09-26 13:37:33 +01:00
Henry Mercer
c95737bb43 Add changelog note 2023-09-26 11:38:39 +01:00
Henry Mercer
41d2ffad87 Enable sub-language file coverage behind a ff 2023-09-26 11:38:39 +01:00
Henry Mercer
650a85ef6d Merge pull request #1901 from github/henrymercer/check-for-duplicated-languages
Warn when workflow analyzes the same language twice
2023-09-25 14:25:34 +01:00
Henry Mercer
0de36d4594 Merge branch 'main' into henrymercer/check-for-duplicated-languages 2023-09-22 19:14:37 +01:00
Henry Mercer
0dfaf4ef65 Add a changelog note 2023-09-22 19:13:56 +01:00
Henry Mercer
d1a917f445 Test that workflow with two different languages doesn't produce an error 2023-09-22 19:08:38 +01:00
Henry Mercer
431174f620 Factor out groupLanguagesByExtractor 2023-09-22 18:55:52 +01:00
Nick Rolfe
3078f51bf0 Merge pull request #1900 from github/nickrolfe/fine-grained-version
Bump min. version for evaluator parallelism feature flag
2023-09-22 17:44:44 +01:00
Henry Mercer
d0c18ba23e Warn when workflow analyzes the same language twice 2023-09-22 14:54:03 +01:00
Nick Rolfe
724d64319a Bump min. version for evaluator parallelism feature flag
Since we suspect fine-grained parallelism may make the OOM issues worse,
we don't want to enable it on 2.14.0-2.14.5, even though they support
it.
2023-09-22 14:43:03 +01:00
Paolo Tranquilli
49aaa9a420 Merge pull request #1889 from github/redsun82/cpp-autoinstall-dependencies
C++: introduce automatic installation of dependencies in the autobuilder
2023-09-21 16:49:24 +02:00
Paolo Tranquilli
c21e1dd0da Lint and build 2023-09-21 16:23:27 +02:00
Paolo Tranquilli
53bed11e0b Apply suggestions from code review
Co-authored-by: Henry Mercer <henry.mercer@me.com>
2023-09-21 16:11:21 +02:00
Paolo Tranquilli
ab8159054c Add changelog entry 2023-09-20 16:33:46 +02:00
Paolo Tranquilli
765807bee7 Add RUNNER_ENVIRONMENT to the list of known default setup variables 2023-09-20 14:08:00 +02:00
Paolo Tranquilli
bf2187592f C++: simplify CppDependencyInstallation interface 2023-09-20 14:05:12 +02:00
Paolo Tranquilli
c4c06786f2 C++: introduce automatic installation of dependencies in the autobuilder
This introduces the possibility to automatically install dependencies
when running the C++ autobuilder on an Ubuntu runner, that will be
available with upcoming version 2.15.0.

An experimental `cpp-autoinstall-dependencies` input is added to the
`autobuild` action. When not set, the default is driven by a feature
flag.
2023-09-20 14:05:12 +02:00
github-actions[bot]
59aaff8718 Add changelog note 2023-09-20 10:53:17 +00:00
github-actions[bot]
5897cf73c4 Update default bundle to codeql-bundle-v2.14.6 2023-09-20 10:53:12 +00:00
github-actions[bot]
d467036438 Update supported GitHub Enterprise Server versions 2023-09-20 00:10:40 +00:00
Angela P Wen
8e0b1c74b1 Add continueOnError: true for debug artifact upload (#1895) 2023-09-19 15:10:13 -07:00
Henry Mercer
01b8760f90 Merge pull request #1894 from github/mergeback/v2.21.8-to-main-6a28655e
Mergeback v2.21.8 refs/heads/releases/v2 into main
2023-09-19 12:07:52 +01:00
github-actions[bot]
74e25cdac8 Update checked-in dependencies 2023-09-19 10:40:42 +00:00
github-actions[bot]
eac8f8cd93 Update changelog and version after v2.21.8 2023-09-19 10:19:21 +00:00
Henry Mercer
6a28655e3d Merge pull request #1893 from github/update-v2.21.8-dd1128f4f
Merge main into releases/v2
2023-09-19 11:17:36 +01:00
github-actions[bot]
2ca983a793 Update changelog for v2.21.8 2023-09-19 09:31:44 +00:00
dependabot[bot]
dd1128f4f1 Bump the npm group with 11 updates (#1892)
* Bump the npm group with 11 updates

Bumps the npm group with 11 updates:

| Package | From | To |
| --- | --- | --- |
| [@actions/artifact](https://github.com/actions/toolkit/tree/HEAD/packages/artifact) | `1.1.1` | `1.1.2` |
| [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) | `1.10.0` | `1.10.1` |
| [uuid](https://github.com/uuidjs/uuid) | `9.0.0` | `9.0.1` |
| [@types/uuid](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/uuid) | `9.0.3` | `9.0.4` |
| [@types/adm-zip](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/adm-zip) | `0.5.0` | `0.5.1` |
| [@types/js-yaml](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/js-yaml) | `4.0.5` | `4.0.6` |
| [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) | `7.5.1` | `7.5.2` |
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | `6.5.0` | `6.7.2` |
| [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | `6.6.0` | `6.7.2` |
| [eslint](https://github.com/eslint/eslint) | `8.48.0` | `8.49.0` |
| [sinon](https://github.com/sinonjs/sinon) | `15.2.0` | `16.0.0` |


Updates `@actions/artifact` from 1.1.1 to 1.1.2
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/artifact/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/artifact)

Updates `@actions/core` from 1.10.0 to 1.10.1
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Updates `uuid` from 9.0.0 to 9.0.1
- [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/uuidjs/uuid/compare/v9.0.0...v9.0.1)

Updates `@types/uuid` from 9.0.3 to 9.0.4
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/uuid)

Updates `@types/adm-zip` from 0.5.0 to 0.5.1
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/adm-zip)

Updates `@types/js-yaml` from 4.0.5 to 4.0.6
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/js-yaml)

Updates `@types/semver` from 7.5.1 to 7.5.2
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver)

Updates `@typescript-eslint/eslint-plugin` from 6.5.0 to 6.7.2
- [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/v6.7.2/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.6.0 to 6.7.2
- [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/v6.7.2/packages/parser)

Updates `eslint` from 8.48.0 to 8.49.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/compare/v8.48.0...v8.49.0)

Updates `sinon` from 15.2.0 to 16.0.0
- [Release notes](https://github.com/sinonjs/sinon/releases)
- [Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md)
- [Commits](https://github.com/sinonjs/sinon/compare/v15.2.0...v16.0.0)

---
updated-dependencies:
- dependency-name: "@actions/artifact"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: uuid
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@types/uuid"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@types/adm-zip"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@types/js-yaml"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@types/semver"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  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
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: sinon
  dependency-type: direct:development
  update-type: version-update:semver-major
  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>
2023-09-18 20:01:16 +00:00
Henry Mercer
f3a128e0fe Merge pull request #1891 from github/henrymercer/fix-cgroup-limits
Fix reading `cgroup` limits on `ubuntu-20.04`
2023-09-18 17:25:00 +01:00
Henry Mercer
6846be007d Address review comments 2023-09-18 16:00:59 +01:00
Henry Mercer
0e74cd1660 Handle cgroup file containing MAX_INT on ubuntu-20.04 2023-09-18 13:44:02 +01:00
Henry Mercer
379f89dc53 Log cgroup RAM limits 2023-09-18 13:05:29 +01:00
Henry Mercer
253d9cf358 Matrix CodeQL CI job over all runner images 2023-09-18 12:56:35 +01:00
Henry Mercer
4254f3a4c1 Merge pull request #1888 from github/henrymercer/constrained-ram
Respect RAM constraints imposed by Linux cgroups
2023-09-18 10:40:41 +01:00
Henry Mercer
9bfb9ba527 Handle files that exist but whose contents are not integers 2023-09-15 18:23:25 +01:00
Henry Mercer
d4c26876d3 Improve docs 2023-09-15 18:17:13 +01:00
Henry Mercer
d6f9faae0d Respect RAM constraints imposed by Linux cgroups 2023-09-15 18:09:37 +01:00
Henry Mercer
c459726691 Merge pull request #1884 from github/henrymercer/deprecation-warning-for-codeql-2.10.x
Add a deprecation warning for CodeQL 2.10.*
2023-09-15 17:47:36 +01:00
Henry Mercer
a087b01cdd Merge branch 'main' into henrymercer/deprecation-warning-for-codeql-2.10.x 2023-09-15 12:04:01 +01:00
Henry Mercer
f3051ed54e Merge pull request #1883 from github/henrymercer/language-aliasing
Add support for aliasing languages like C/C++, Java/Kotlin, and JS/TS
2023-09-15 12:00:12 +01:00
Henry Mercer
860e98cc4a Update changelog note 2023-09-15 11:16:37 +01:00
Henry Mercer
3ffd6c071a Update PR check description 2023-09-15 11:12:41 +01:00
Henry Mercer
2d646a3990 Merge pull request #1887 from github/henrymercer/add-token-to-update-dependencies
Add GitHub token to update dependencies workflow
2023-09-15 10:23:49 +01:00
Henry Mercer
a9313c9016 Merge pull request #1881 from github/henrymercer/fix-update-ghes-versions
Update ignored version number in GHES versions automation
2023-09-15 10:21:57 +01:00
Chuan-kai Lin
5f18c9ab80 Merge pull request #1886 from github/mergeback/v2.21.7-to-main-04daf014
Mergeback v2.21.7 refs/heads/releases/v2 into main
2023-09-14 10:37:27 -07:00
Henry Mercer
2c22b37a68 Add GitHub token to update dependencies workflow 2023-09-14 18:14:24 +01:00
github-actions[bot]
c07fd68e12 Update checked-in dependencies 2023-09-14 17:03:42 +00:00
github-actions[bot]
c33f0b4fc7 Update changelog and version after v2.21.7 2023-09-14 16:58:59 +00:00
Chuan-kai Lin
04daf014b5 Merge pull request #1885 from github/update-v2.21.7-e982de4fb
Merge main into releases/v2
2023-09-14 09:56:54 -07:00
github-actions[bot]
bb3bc25861 Update changelog for v2.21.7 2023-09-14 16:10:20 +00:00
Henry Mercer
ac4145f467 Add a deprecation warning for CodeQL 2.10.* 2023-09-14 16:34:07 +01:00
Henry Mercer
87a64c9c4c Add changelog note 2023-09-14 16:11:20 +01:00
Henry Mercer
897ddf2662 Add PR check 2023-09-14 16:11:20 +01:00
Henry Mercer
74714a34ca Implement support for language aliasing 2023-09-14 16:11:20 +01:00
Chuan-kai Lin
e982de4fb4 Merge pull request #1882 from github/update-bundle/codeql-bundle-v2.14.5
Update default bundle to 2.14.5
2023-09-14 08:04:05 -07:00
github-actions[bot]
19c02a4d16 Add changelog note 2023-09-14 14:29:33 +00:00
github-actions[bot]
71c7e82837 Update default bundle to codeql-bundle-v2.14.5 2023-09-14 14:29:25 +00:00
Henry Mercer
8b733e71a6 Update ignored version number in GHES versions automation 2023-09-14 12:27:25 +01:00
1261 changed files with 121556 additions and 23046 deletions

View File

@@ -31,7 +31,7 @@ runs:
fi fi
echo "version=$VERSION" | tee -a $GITHUB_OUTPUT echo "version=$VERSION" | tee -a $GITHUB_OUTPUT
- uses: swift-actions/setup-swift@cdcbe8e35d3801acd82d7109285e6ab22c9212c2 # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test. - uses: swift-actions/setup-swift@f51889efb55dccf13be0ee727e3d6c89a096fb4c # Please update the corresponding SHA in the CLI's CodeQL Action Integration Test.
if: runner.os == 'Linux' && steps.get_swift_version.outputs.version != 'null' if: runner.os == 'Linux' && steps.get_swift_version.outputs.version != 'null'
with: with:
swift-version: "${{ steps.get_swift_version.outputs.version }}" swift-version: "${{ steps.get_swift_version.outputs.version }}"

View File

@@ -25,12 +25,6 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: windows-latest
version: stable-20220615
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20220908 version: stable-20220908
- os: macos-latest - os: macos-latest
@@ -49,6 +43,18 @@ jobs:
version: stable-20230418 version: stable-20230418
- os: windows-latest - os: windows-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: windows-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: windows-latest
version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest

View File

@@ -25,12 +25,6 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: windows-latest
version: stable-20220615
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20220908 version: stable-20220908
- os: macos-latest - os: macos-latest
@@ -49,6 +43,18 @@ jobs:
version: stable-20230418 version: stable-20230418
- os: windows-latest - os: windows-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: windows-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: windows-latest
version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest

View File

@@ -25,10 +25,6 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20220908 version: stable-20220908
- os: macos-latest - os: macos-latest
@@ -41,6 +37,14 @@ jobs:
version: stable-20230418 version: stable-20230418
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest

View File

@@ -25,10 +25,6 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20220908 version: stable-20220908
- os: macos-latest - os: macos-latest
@@ -41,6 +37,14 @@ jobs:
version: stable-20230418 version: stable-20230418
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest

View File

@@ -25,10 +25,6 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20220908 version: stable-20220908
- os: macos-latest - os: macos-latest
@@ -41,6 +37,14 @@ jobs:
version: stable-20230418 version: stable-20230418
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest

69
.github/workflows/__language-aliases.yml generated vendored Normal file
View File

@@ -0,0 +1,69 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Language aliases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on:
push:
branches:
- main
- releases/v2
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
language-aliases:
strategy:
matrix:
include:
- os: ubuntu-latest
version: latest
name: Language aliases
permissions:
contents: read
security-events: write
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
matrix.version == '20220908' ||
matrix.version == '20221211'
)
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
languages: C#,java-kotlin,swift,typescript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- name: Check languages
run: |
expected_languages="csharp,java,swift,javascript"
actual_languages=$(jq -r '.languages | join(",")' "$RUNNER_TEMP"/config)
if [ "$expected_languages" != "$actual_languages" ]; then
echo "Resolved languages did not match expected list. " \
"Expected languages: $expected_languages. Actual languages: $actual_languages."
exit 1
fi
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -1,147 +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:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - ML-powered queries
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
on:
push:
branches:
- main
- releases/v2
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch: {}
jobs:
ml-powered-queries:
strategy:
matrix:
include:
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: windows-latest
version: stable-20220615
- os: ubuntu-latest
version: stable-20220908
- os: macos-latest
version: stable-20220908
- os: windows-latest
version: stable-20220908
- os: ubuntu-latest
version: stable-20221211
- os: macos-latest
version: stable-20221211
- os: windows-latest
version: stable-20221211
- os: ubuntu-latest
version: stable-20230418
- os: macos-latest
version: stable-20230418
- os: windows-latest
version: stable-20230418
- os: ubuntu-latest
version: default
- os: macos-latest
version: default
- os: windows-latest
version: default
- 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: ML-powered queries
permissions:
contents: read
security-events: write
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
- name: Set environment variable for Swift enablement
if: >-
runner.os != 'Windows' && (
matrix.version == '20220908' ||
matrix.version == '20221211'
)
shell: bash
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
- uses: ./../action/init
with:
languages: javascript
queries: security-extended
source-root: ./../action/tests/ml-powered-queries-repo
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Upload SARIF
uses: actions/upload-artifact@v3
with:
name: ml-powered-queries-${{ matrix.os }}-${{ matrix.version }}.sarif.json
path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7
- name: Check sarif
uses: ./../action/.github/actions/check-sarif
with:
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-not-run: foo,bar
- name: Check results
shell: bash
run: |
cd "$RUNNER_TEMP/results"
# We should run at least the ML-powered queries in `expected_rules`.
expected_rules="js/ml-powered/nosql-injection js/ml-powered/path-injection js/ml-powered/sql-injection js/ml-powered/xss"
for rule in ${expected_rules}; do
found_rule=$(jq --arg rule "${rule}" '[.runs[0].tool.extensions[].rules | select(. != null) |
flatten | .[].id] | any(. == $rule)' javascript.sarif)
echo "Did find rule '${rule}': ${found_rule}"
if [[ "${found_rule}" != "true" ]]; then
echo "Expected SARIF output to contain rule '${rule}', but found no such rule."
exit 1
fi
done
# We should have at least one alert from an ML-powered query.
num_alerts=$(jq '[.runs[0].results[] |
select(.properties.score != null and (.rule.id | startswith("js/ml-powered/")))] | length' \
javascript.sarif)
echo "Found ${num_alerts} alerts from ML-powered queries.";
if [[ "${num_alerts}" -eq 0 ]]; then
echo "Expected to find at least one alert from an ML-powered query but found ${num_alerts}."
exit 1
fi
env:
CODEQL_ACTION_TEST_MODE: true

View File

@@ -25,10 +25,6 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20220908 version: stable-20220908
- os: macos-latest - os: macos-latest
@@ -41,6 +37,14 @@ jobs:
version: stable-20230418 version: stable-20230418
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest

View File

@@ -25,12 +25,6 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: windows-latest
version: stable-20220615
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20220908 version: stable-20220908
- os: macos-latest - os: macos-latest
@@ -49,6 +43,18 @@ jobs:
version: stable-20230418 version: stable-20230418
- os: windows-latest - os: windows-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: windows-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: windows-latest
version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest

View File

@@ -25,10 +25,6 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20220908 version: stable-20220908
- os: macos-latest - os: macos-latest
@@ -41,6 +37,14 @@ jobs:
version: stable-20230418 version: stable-20230418
- os: macos-latest - os: macos-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest

View File

@@ -25,14 +25,16 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-20220615
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20220908 version: stable-20220908
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20221211 version: stable-20221211
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: ubuntu-latest - os: ubuntu-latest

View File

@@ -25,12 +25,6 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: windows-latest
version: stable-20220615
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20220908 version: stable-20220908
- os: macos-latest - os: macos-latest
@@ -49,6 +43,18 @@ jobs:
version: stable-20230418 version: stable-20230418
- os: windows-latest - os: windows-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: windows-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: windows-latest
version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest

View File

@@ -25,12 +25,6 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- os: ubuntu-latest
version: stable-20220615
- os: macos-latest
version: stable-20220615
- os: windows-latest
version: stable-20220615
- os: ubuntu-latest - os: ubuntu-latest
version: stable-20220908 version: stable-20220908
- os: macos-latest - os: macos-latest
@@ -49,6 +43,18 @@ jobs:
version: stable-20230418 version: stable-20230418
- os: windows-latest - os: windows-latest
version: stable-20230418 version: stable-20230418
- os: ubuntu-latest
version: stable-v2.13.5
- os: macos-latest
version: stable-v2.13.5
- os: windows-latest
version: stable-v2.13.5
- os: ubuntu-latest
version: stable-v2.14.6
- os: macos-latest
version: stable-v2.14.6
- os: windows-latest
version: stable-v2.14.6
- os: ubuntu-latest - os: ubuntu-latest
version: default version: default
- os: macos-latest - os: macos-latest

View File

@@ -73,7 +73,7 @@ jobs:
needs: [check-codeql-versions] needs: [check-codeql-versions]
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest,windows-latest,macos-latest] os: [ubuntu-20.04,ubuntu-22.04,windows-2019,windows-2022,macos-11,macos-12,macos-13]
tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }} tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}

View File

@@ -25,10 +25,11 @@ jobs:
- ubuntu-latest - ubuntu-latest
- macos-latest - macos-latest
version: version:
- stable-20220615
- stable-20220908 - stable-20220908
- stable-20221211 - stable-20221211
- stable-20230418 - stable-20230418
- stable-v2.13.5
- stable-v2.14.6
- default - default
- latest - latest
- nightly-latest - nightly-latest
@@ -74,11 +75,11 @@ jobs:
- name: Check expected artifacts exist - name: Check expected artifacts exist
shell: bash shell: bash
run: | run: |
VERSIONS="stable-20220615 stable-20220908 stable-20221211 stable-20230418 default latest nightly-latest" VERSIONS="stable-20220908 stable-20221211 stable-20230418 stable-v2.13.5 stable-v2.14.6 default 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
for os in ubuntu-latest macos-latest; do for os in ubuntu-latest macos-latest; do
pushd "./my-debug-artifacts-$os-$version" pushd "./my-debug-artifacts-$os-${version//./}"
echo "Artifacts from version $version on $os:" echo "Artifacts from version $version on $os:"
for language in $LANGUAGES; do for language in $LANGUAGES; do
echo "- Checking $language" echo "- Checking $language"

View File

@@ -15,15 +15,16 @@ jobs:
- name: Remove PR label - name: Remove PR label
env: env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
REPOSITORY: '${{ github.repository }}' REPOSITORY: '${{ github.repository }}'
PR_NUMBER: '${{ github.event.pull_request.number }}' PR_NUMBER: '${{ github.event.pull_request.number }}'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
run: | run: |
gh api "repos/$REPOSITORY/issues/$PR_NUMBER/labels/Update%20dependencies" -X DELETE gh api "repos/$REPOSITORY/issues/$PR_NUMBER/labels/Update%20dependencies" -X DELETE
- name: Push updated dependencies - name: Push updated dependencies
env: env:
BRANCH: '${{ github.head_ref }}' BRANCH: '${{ github.head_ref }}'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
run: | run: |
git fetch origin "$BRANCH" --depth=1 git fetch origin "$BRANCH" --depth=1
git checkout "origin/$BRANCH" git checkout "origin/$BRANCH"

View File

@@ -52,5 +52,13 @@ jobs:
git add . git add .
git commit --message "Update supported GitHub Enterprise Server versions" git commit --message "Update supported GitHub Enterprise Server versions"
git push origin update-supported-enterprise-server-versions git push origin update-supported-enterprise-server-versions
gh pr create --fill --draft
body="This PR updates the list of supported GitHub Enterprise Server versions, either because a new "
body+="version is about to be feature frozen, or because an old release has been deprecated.\n\n"
body+="If an old release has been deprecated, please follow the instructions in CONTRIBUTING.md to "
body+="deprecate the corresponding version of CodeQL."
gh pr create --draft \
--title "Update supported GitHub Enterprise Server versions" \
--body "$body"
fi fi

View File

@@ -17,8 +17,8 @@ def main():
releases = json.loads(_RELEASE_FILE_PATH.read_text()) releases = json.loads(_RELEASE_FILE_PATH.read_text())
# Remove GHES version using a previous version numbering scheme. # Remove GHES version using a previous version numbering scheme.
if "11.10.340" in releases: if "11.10" in releases:
del releases["11.10.340"] del releases["11.10"]
oldest_supported_release = None oldest_supported_release = None
newest_supported_release = semver.VersionInfo.parse(api_compatibility_data["maximumVersion"] + ".0") newest_supported_release = semver.VersionInfo.parse(api_compatibility_data["maximumVersion"] + ".0")

View File

@@ -4,7 +4,26 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th
## [UNRELEASED] ## [UNRELEASED]
No user facing changes. - The CodeQL Action now requires CodeQL version 2.10.5 or later. For more information, see the corresponding changelog entry for CodeQL Action version 2.21.8. [#1907](https://github.com/github/codeql-action/pull/1907)
- The CodeQL Action no longer runs ML-powered queries. For more information, including details on our investment in AI-powered security technology, see ["CodeQL code scanning deprecates ML-powered alerts."](https://github.blog/changelog/2023-09-29-codeql-code-scanning-deprecates-ml-powered-alerts/) [#1910](https://github.com/github/codeql-action/pull/1910)
## 2.21.9 - 27 Sep 2023
- Update default CodeQL bundle version to 2.14.6. [#1897](https://github.com/github/codeql-action/pull/1897)
- We are rolling out a feature in October 2023 that will improve the success rate of C/C++ autobuild. [#1889](https://github.com/github/codeql-action/pull/1889)
- We are rolling out a feature in October 2023 that will provide specific file coverage information for C and C++, Java and Kotlin, and JavaScript and TypeScript. Currently file coverage information for each of these pairs of languages is grouped together. [#1903](https://github.com/github/codeql-action/pull/1903)
- Add a warning to help customers avoid inadvertently analyzing the same CodeQL language in multiple matrix jobs. [#1901](https://github.com/github/codeql-action/pull/1901)
## 2.21.8 - 19 Sep 2023
- Add a deprecation warning for customers using CodeQL version 2.10.4 and earlier. These versions of CodeQL were discontinued on 12 September 2023 alongside GitHub Enterprise Server 3.6, and will be unsupported by the next minor release of the CodeQL Action. [#1884](https://github.com/github/codeql-action/pull/1884)
- If you are using one of these versions, please update to CodeQL CLI version 2.10.5 or later. For instance, if you have specified a custom version of the CLI using the 'tools' input to the 'init' Action, you can remove this input to use the default version.
- Alternatively, if you want to continue using a version of the CodeQL CLI between 2.9.5 and 2.10.4, you can replace `github/codeql-action/*@v2` by `github/codeql-action/*@v2.21.7` in your code scanning workflow to ensure you continue using this version of the CodeQL Action.
- Enable the following language aliases when using CodeQL 2.14.4 and later: `c-cpp` for C/C++ analysis, `java-kotlin` for Java/Kotlin analysis, and `javascript-typescript` for JavaScript/TypeScript analysis. [#1883](https://github.com/github/codeql-action/pull/1883)
## 2.21.7 - 14 Sep 2023
- Update default CodeQL bundle version to 2.14.5. [#1882](https://github.com/github/codeql-action/pull/1882)
## 2.21.6 - 13 Sep 2023 ## 2.21.6 - 13 Sep 2023

View File

@@ -78,6 +78,27 @@ Since the `codeql-action` runs most of its testing through individual Actions wo
2. Run the script. If there's a reason to, you can pass in a different SHA as a CLI argument. 2. Run the script. If there's a reason to, you can pass in a different SHA as a CLI argument.
3. After running, go to the [branch protection rules settings page](https://github.com/github/codeql-action/settings/branches) and validate that the rules for `main`, `v1`, and `v2` have been updated. 3. After running, go to the [branch protection rules settings page](https://github.com/github/codeql-action/settings/branches) and validate that the rules for `main`, `v1`, and `v2` have been updated.
## Deprecating a CodeQL version (write access required)
We typically deprecate a version of CodeQL when the GitHub Enterprise Server (GHES) version that it first shipped in is deprecated.
1. Work out the next minimum version of CodeQL. This is the version that shipped in the version of GHES after the one that has just been deprecated.
1. Notify users using the old version of CodeQL about the deprecation.
- Update `CODEQL_NEXT_MINIMUM_VERSION`, `GHES_VERSION_MOST_RECENTLY_DEPRECATED`, and `GHES_MOST_RECENT_DEPRECATION_DATE` in `src/codeql.ts` to reflect the new minimum version of CodeQL and the GHES version that has just been deprecated.
- Add a changelog note announcing the deprecation.
- Example PR: https://github.com/github/codeql-action/pull/1884
1. Release the Action, or wait for the next scheduled release of the Action, then wait at least a week so users have time to see and act on the deprecation warning.
1. Remove support for the old version of CodeQL.
- Bump `CODEQL_MINIMUM_VERSION` in `src/codeql.ts` to the new minimum version of CodeQL.
- Remove any code that is only needed to support the old version of CodeQL. This is often behind a version guard, so look for instances of version numbers between the old minimum version and the new minimum version in the codebase. A good place to start is the list of version numbers in `src/codeql.ts`.
- Update the default set of CodeQL test versions in `pr-checks/sync.py`.
- Remove the old minimum version of CodeQL.
- Add the latest patch release for any new CodeQL minor version series that have shipped in GHES.
- Run the script to update the generated PR checks.
- Do the same for PR checks that aren't auto-generated.
- Add a changelog note announcing the new minimum version of CodeQL that is now required.
- Example PR: https://github.com/github/codeql-action/pull/1907
## Resources ## Resources
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) - [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)

View File

@@ -7,7 +7,8 @@ inputs:
required: false required: false
# If not specified the Action will check in several places until it finds the CodeQL tools. # If not specified the Action will check in several places until it finds the CodeQL tools.
languages: languages:
description: The languages to be analysed description: |
A comma-separated value of the languages to be analysed e.g. python,javascript
required: false required: false
token: token:
description: GitHub token to use for authenticating with this instance of GitHub. To download custom packs from multiple registries, use the registries input. description: GitHub token to use for authenticating with this instance of GitHub. To download custom packs from multiple registries, use the registries input.

7
lib/analyze-action.js generated
View File

@@ -54,11 +54,6 @@ async function sendStatusReport(startedAt, config, stats, error, trapCacheUpload
const statusReportBase = await (0, status_report_1.createStatusReportBase)("finish", status, startedAt, await util.checkDiskUsage(), error?.message, error?.stack); const statusReportBase = await (0, status_report_1.createStatusReportBase)("finish", status, startedAt, await util.checkDiskUsage(), error?.message, error?.stack);
const report = { const report = {
...statusReportBase, ...statusReportBase,
...(config
? {
ml_powered_javascript_queries: (0, config_utils_1.getMlPoweredJsQueriesStatus)(config),
}
: {}),
...(stats || {}), ...(stats || {}),
...(dbCreationTimings || {}), ...(dbCreationTimings || {}),
}; };
@@ -163,7 +158,7 @@ async function run() {
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.getGitHubVersion)();
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger); const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger);
const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"]); const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"], logger);
await runAutobuildIfLegacyGoWorkflow(config, logger); await runAutobuildIfLegacyGoWorkflow(config, logger);
dbCreationTimings = await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger, features); dbCreationTimings = await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger, features);
if (actionsUtil.getRequiredInput("skip-queries") !== "true") { if (actionsUtil.getRequiredInput("skip-queries") !== "true") {

File diff suppressed because one or more lines are too long

4
lib/analyze.test.js generated
View File

@@ -122,7 +122,6 @@ const util = __importStar(require("./util"));
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME, debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME, debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
augmentationProperties: { augmentationProperties: {
injectedMlQueries: false,
packsInputCombines: false, packsInputCombines: false,
queriesInputCombines: false, queriesInputCombines: false,
}, },
@@ -215,7 +214,7 @@ const util = __importStar(require("./util"));
}); });
function mockCodeQL() { function mockCodeQL() {
return { return {
getVersion: async () => "2.12.2", getVersion: async () => (0, testing_utils_1.makeVersionInfo)("1.0.0"),
databaseRunQueries: sinon.spy(), databaseRunQueries: sinon.spy(),
databaseInterpretResults: async () => "", databaseInterpretResults: async () => "",
databasePrintBaseline: async () => "", databasePrintBaseline: async () => "",
@@ -239,7 +238,6 @@ function createBaseConfig(tmpDir) {
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME, debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME, debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
augmentationProperties: { augmentationProperties: {
injectedMlQueries: false,
packsInputCombines: false, packsInputCombines: false,
queriesInputCombines: false, queriesInputCombines: false,
}, },

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{ "maximumVersion": "3.11", "minimumVersion": "3.6" } { "maximumVersion": "3.11", "minimumVersion": "3.7" }

58
lib/autobuild.js generated
View File

@@ -1,8 +1,37 @@
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (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 core = __importStar(require("@actions/core"));
const actions_util_1 = require("./actions-util");
const api_client_1 = require("./api-client");
const codeql_1 = require("./codeql"); const codeql_1 = require("./codeql");
const feature_flags_1 = require("./feature-flags");
const languages_1 = require("./languages"); const languages_1 = require("./languages");
const repository_1 = require("./repository");
const util_1 = require("./util");
async function determineAutobuildLanguages(config, logger) { async function determineAutobuildLanguages(config, logger) {
// 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
@@ -70,9 +99,38 @@ async function determineAutobuildLanguages(config, logger) {
return languages; return languages;
} }
exports.determineAutobuildLanguages = determineAutobuildLanguages; exports.determineAutobuildLanguages = determineAutobuildLanguages;
async function setupCppAutobuild(codeql, logger) {
const envVar = feature_flags_1.featureConfig[feature_flags_1.Feature.CppDependencyInstallation].envVar;
const featureName = "C++ automatic installation of dependencies";
const envDoc = "https://docs.github.com/en/actions/learn-github-actions/variables#defining-environment-variables-for-a-single-workflow";
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
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);
if (await features.getValue(feature_flags_1.Feature.CppDependencyInstallation, codeql)) {
// disable autoinstall on self-hosted runners unless explicitly requested
if (process.env["RUNNER_ENVIRONMENT"] === "self-hosted" &&
process.env[envVar] !== "true") {
logger.info(`Disabling ${featureName} as we are on a self-hosted runner.${(0, actions_util_1.getWorkflowEventName)() !== "dynamic"
? ` To override this, set the ${envVar} environment variable to 'true' in your workflow (see ${envDoc}).`
: ""}`);
core.exportVariable(envVar, "false");
}
else {
logger.info(`Enabling ${featureName}. This can be disabled by setting the ${envVar} environment variable to 'false' (see ${envDoc}).`);
core.exportVariable(envVar, "true");
}
}
else {
logger.info(`Disabling ${featureName}.`);
core.exportVariable(envVar, "false");
}
}
async function runAutobuild(language, config, logger) { async function runAutobuild(language, config, logger) {
logger.startGroup(`Attempting to automatically build ${language} code`); logger.startGroup(`Attempting to automatically build ${language} code`);
const codeQL = await (0, codeql_1.getCodeQL)(config.codeQLCmd); const codeQL = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
if (language === languages_1.Language.cpp) {
await setupCppAutobuild(codeQL, logger);
}
await codeQL.runAutobuild(language); await codeQL.runAutobuild(language);
logger.endGroup(); logger.endGroup();
} }

View File

@@ -1 +1 @@
{"version":3,"file":"autobuild.js","sourceRoot":"","sources":["../src/autobuild.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,2CAAyD;AAGlD,KAAK,UAAU,2BAA2B,CAC/C,MAA0B,EAC1B,MAAc;IAEd,0CAA0C;IAC1C,mFAAmF;IACnF,oFAAoF;IACpF,4EAA4E;IAC5E,MAAM,kBAAkB,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACvD,IAAA,4BAAgB,EAAC,CAAC,CAAC,CACpB,CAAC;IAEF,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,CAAC,IAAI,CACT,iEAAiE,CAClE,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,2BAA2B,GAAG,kBAAkB,CAAC,MAAM,CAC3D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,oBAAQ,CAAC,EAAE,CACzB,CAAC;IAEF,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,yEAAyE;IACzE,UAAU;IACV,IAAI,2BAA2B,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;QAChD,SAAS,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC;KAChD;IACD,uEAAuE;IACvE,wCAAwC;IACxC,IAAI,kBAAkB,CAAC,MAAM,KAAK,2BAA2B,CAAC,MAAM,EAAE;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C,MAAM,EAAE,OAAO,CAAC,CAAC;KACtC;AACH,CAAC;AAEM,KAAK,UAAU,YAAY,CAChC,QAAkB,EAClB,MAA0B,EAC1B,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,qCAAqC,QAAQ,OAAO,CAAC,CAAC;IACxE,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACjD,IAAI,QAAQ,KAAK,oBAAQ,CAAC,GAAG,EAAE;QAC7B,MAAM,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACzC;IACD,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAZD,oCAYC"}

97
lib/codeql.js generated
View File

@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getGeneratedCodeScanningConfigPath = exports.getTrapCachingExtractorConfigArgsForLang = exports.getTrapCachingExtractorConfigArgs = exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG = exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = exports.CODEQL_VERSION_DIAGNOSTICS_EXPORT_FIXED = exports.CODEQL_VERSION_BETTER_NO_CODE_ERROR_MESSAGE = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = exports.CommandInvocationError = void 0; exports.getGeneratedCodeScanningConfigPath = exports.getTrapCachingExtractorConfigArgsForLang = exports.getTrapCachingExtractorConfigArgs = exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_LANGUAGE_ALIASING = exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG = exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = exports.CODEQL_VERSION_DIAGNOSTICS_EXPORT_FIXED = exports.CODEQL_VERSION_BETTER_NO_CODE_ERROR_MESSAGE = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = 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 core = __importStar(require("@actions/core")); const core = __importStar(require("@actions/core"));
@@ -62,25 +62,25 @@ let cachedCodeQL = undefined;
* The version flags below can be used to conditionally enable certain features * The version flags below can be used to conditionally enable certain features
* on versions newer than this. * on versions newer than this.
*/ */
const CODEQL_MINIMUM_VERSION = "2.9.4"; const CODEQL_MINIMUM_VERSION = "2.10.5";
/** /**
* This version will shortly become the oldest version of CodeQL that the Action will run with. * This version will shortly become the oldest version of CodeQL that the Action will run with.
*/ */
const CODEQL_NEXT_MINIMUM_VERSION = "2.9.4"; const CODEQL_NEXT_MINIMUM_VERSION = "2.10.5";
/** /**
* This is the version of GHES that was most recently deprecated.
*/
const GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.6";
/**
* This is the deprecation date for the version of GHES that was most recently deprecated.
*/
const GHES_MOST_RECENT_DEPRECATION_DATE = "2023-09-12";
/*
* 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_LUA_TRACER_CONFIG = "2.10.0";
const CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED = "2.10.4";
exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = "2.10.4";
const CODEQL_VERSION_FILE_BASELINE_INFORMATION = "2.11.3"; const CODEQL_VERSION_FILE_BASELINE_INFORMATION = "2.11.3";
/**
* Previous versions had the option already, but were missing the
* --extractor-options-verbosity that we need.
*/
exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = "2.10.3";
/** /**
* Versions 2.11.1+ of the CodeQL Bundle include a `security-experimental` built-in query suite for * Versions 2.11.1+ of the CodeQL Bundle include a `security-experimental` built-in query suite for
* each language. * each language.
@@ -112,6 +112,10 @@ exports.CODEQL_VERSION_RESOLVE_ENVIRONMENT = "2.13.4";
* Versions 2.14.2+ of the CodeQL CLI support language-specific baseline configuration. * Versions 2.14.2+ of the CodeQL CLI support language-specific baseline configuration.
*/ */
exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG = "2.14.2"; exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG = "2.14.2";
/**
* Versions 2.14.4+ of the CodeQL CLI support language aliasing.
*/
exports.CODEQL_VERSION_LANGUAGE_ALIASING = "2.14.4";
/** /**
* Set up CodeQL CLI access. * Set up CodeQL CLI access.
* *
@@ -179,7 +183,9 @@ function resolveFunction(partialCodeql, methodName, defaultImplementation) {
function setCodeQL(partialCodeql) { function setCodeQL(partialCodeql) {
cachedCodeQL = { cachedCodeQL = {
getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"), getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"),
getVersion: resolveFunction(partialCodeql, "getVersion", () => new Promise((resolve) => resolve("1.0.0"))), getVersion: resolveFunction(partialCodeql, "getVersion", () => new Promise((resolve) => resolve({
version: "1.0.0",
}))),
printVersion: resolveFunction(partialCodeql, "printVersion"), printVersion: resolveFunction(partialCodeql, "printVersion"),
databaseInitCluster: resolveFunction(partialCodeql, "databaseInitCluster"), databaseInitCluster: resolveFunction(partialCodeql, "databaseInitCluster"),
runAutobuild: resolveFunction(partialCodeql, "runAutobuild"), runAutobuild: resolveFunction(partialCodeql, "runAutobuild"),
@@ -241,7 +247,13 @@ async function getCodeQLForCmd(cmd, checkVersion) {
async getVersion() { async getVersion() {
let result = util.getCachedCodeQlVersion(); let result = util.getCachedCodeQlVersion();
if (result === undefined) { if (result === undefined) {
result = (await runTool(cmd, ["version", "--format=terse"])).trim(); const output = await runTool(cmd, ["version", "--format=json"]);
try {
result = JSON.parse(output);
}
catch (err) {
throw Error(`Invalid JSON output from \`version --format=json\`: ${output}`);
}
util.cacheCodeQlVersion(result); util.cacheCodeQlVersion(result);
} }
return result; return result;
@@ -255,17 +267,6 @@ async function getCodeQLForCmd(cmd, checkVersion) {
extraArgs.push("--begin-tracing"); extraArgs.push("--begin-tracing");
extraArgs.push(...(await getTrapCachingExtractorConfigArgs(config))); extraArgs.push(...(await getTrapCachingExtractorConfigArgs(config)));
extraArgs.push(`--trace-process-name=${processName}`); extraArgs.push(`--trace-process-name=${processName}`);
if (
// 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
// when tracing Go on Windows on these CodeQL versions.
(await util.codeQlVersionAbove(this, CODEQL_VERSION_LUA_TRACER_CONFIG)) &&
config.languages.includes(languages_1.Language.go) &&
(0, languages_1.isTracedLanguage)(languages_1.Language.go) &&
process.platform === "win32" &&
!(await util.codeQlVersionAbove(this, CODEQL_VERSION_LUA_TRACING_GO_WINDOWS_FIXED))) {
extraArgs.push("--no-internal-use-lua-tracing");
}
} }
// A code scanning config file is only generated if the CliConfigFileEnabled feature flag is enabled. // A code scanning config file is only generated if the CliConfigFileEnabled feature flag is enabled.
const codeScanningConfigFile = await generateCodeScanningConfig(codeql, config, features, logger); const codeScanningConfigFile = await generateCodeScanningConfig(codeql, config, features, logger);
@@ -285,6 +286,12 @@ async function getCodeQLForCmd(cmd, checkVersion) {
if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG)) { if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_LANGUAGE_BASELINE_CONFIG)) {
extraArgs.push("--calculate-language-specific-baseline"); extraArgs.push("--calculate-language-specific-baseline");
} }
if (await features.getValue(feature_flags_1.Feature.SublanguageFileCoverageEnabled, this)) {
extraArgs.push("--sublanguage-file-coverage");
}
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)) {
extraArgs.push("--no-sublanguage-file-coverage");
}
await runTool(cmd, [ await runTool(cmd, [
"database", "database",
"init", "init",
@@ -378,11 +385,16 @@ async function getCodeQLForCmd(cmd, checkVersion) {
} }
}, },
async betterResolveLanguages() { async betterResolveLanguages() {
const extraArgs = [];
if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_LANGUAGE_ALIASING)) {
extraArgs.push("--extractor-include-aliases");
}
const codeqlArgs = [ const codeqlArgs = [
"resolve", "resolve",
"languages", "languages",
"--format=betterjson", "--format=betterjson",
"--extractor-options-verbosity=4", "--extractor-options-verbosity=4",
...extraArgs,
...getExtraOptionsFromEnv(["resolve", "languages"]), ...getExtraOptionsFromEnv(["resolve", "languages"]),
]; ];
const output = await runTool(cmd, codeqlArgs); const output = await runTool(cmd, codeqlArgs);
@@ -659,21 +671,23 @@ async function getCodeQLForCmd(cmd, checkVersion) {
// CodeQL object is created. // CodeQL object is created.
if (checkVersion && if (checkVersion &&
!(await util.codeQlVersionAbove(codeql, CODEQL_MINIMUM_VERSION))) { !(await util.codeQlVersionAbove(codeql, CODEQL_MINIMUM_VERSION))) {
throw new Error(`Expected a CodeQL CLI with version at least ${CODEQL_MINIMUM_VERSION} but got version ${await codeql.getVersion()}`); throw new Error(`Expected a CodeQL CLI with version at least ${CODEQL_MINIMUM_VERSION} but got version ${(await codeql.getVersion()).version}`);
} }
else if (checkVersion && else if (checkVersion &&
process.env[environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING] !== "true" && process.env[environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING] !== "true" &&
!(await util.codeQlVersionAbove(codeql, CODEQL_NEXT_MINIMUM_VERSION))) { !(await util.codeQlVersionAbove(codeql, CODEQL_NEXT_MINIMUM_VERSION))) {
core.warning(`CodeQL CLI version ${await codeql.getVersion()} was deprecated on 2023-06-20 alongside ` + const result = await codeql.getVersion();
"GitHub Enterprise Server 3.5 and will not be supported by the next release of the " + core.warning(`CodeQL CLI version ${result.version} was discontinued on ` +
`CodeQL Action. Please update to CodeQL CLI version ${CODEQL_NEXT_MINIMUM_VERSION} or ` + `${GHES_MOST_RECENT_DEPRECATION_DATE} alongside GitHub Enterprise Server ` +
"later. For instance, if you have specified a custom version of the CLI using the " + `${GHES_VERSION_MOST_RECENTLY_DEPRECATED} and will not be supported by the next minor ` +
"'tools' input to the 'init' Action, you can remove this input to use the default " + `release of the CodeQL Action. Please update to CodeQL CLI version ` +
"version.\n\n" + `${CODEQL_NEXT_MINIMUM_VERSION} or later. For instance, if you have specified a custom ` +
"version of the CLI using the 'tools' input to the 'init' Action, you can remove this " +
"input to use the default version.\n\n" +
"Alternatively, if you want to continue using CodeQL CLI version " + "Alternatively, if you want to continue using CodeQL CLI version " +
`${await codeql.getVersion()}, you can replace 'github/codeql-action/*@v2' by ` + `${result.version}, you can replace 'github/codeql-action/*@v2' by ` +
"'github/codeql-action/*@v2.20.4' in your code scanning workflow to ensure you continue " + `'github/codeql-action/*@v${(0, actions_util_1.getActionVersion)()}' in your code scanning workflow to ` +
"using this version of the CodeQL Action."); "continue using this version of the CodeQL Action.");
core.exportVariable(environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING, "true"); core.exportVariable(environment_1.EnvVar.SUPPRESS_DEPRECATED_SOON_WARNING, "true");
} }
return codeql; return codeql;
@@ -879,21 +893,6 @@ async function generateCodeScanningConfig(codeql, config, features, logger) {
if (Array.isArray(augmentedConfig.packs) && !augmentedConfig.packs.length) { if (Array.isArray(augmentedConfig.packs) && !augmentedConfig.packs.length) {
delete augmentedConfig.packs; delete augmentedConfig.packs;
} }
if (config.augmentationProperties.injectedMlQueries) {
// We need to inject the ML queries into the original user input before
// we pass this on to the CLI, to make sure these get run.
const packString = await util.getMlPoweredJsQueriesPack(codeql);
if (augmentedConfig.packs === undefined)
augmentedConfig.packs = [];
if (Array.isArray(augmentedConfig.packs)) {
augmentedConfig.packs.push(packString);
}
else {
if (!augmentedConfig.packs.javascript)
augmentedConfig.packs["javascript"] = [];
augmentedConfig.packs["javascript"].push(packString);
}
}
logger.info(`Writing augmented user configuration file to ${codeScanningConfigFile}`); logger.info(`Writing augmented user configuration file to ${codeScanningConfigFile}`);
logger.startGroup("Augmented user configuration file contents"); logger.startGroup("Augmented user configuration file contents");
logger.info(yaml.dump(augmentedConfig)); logger.info(yaml.dump(augmentedConfig));

File diff suppressed because one or more lines are too long

91
lib/codeql.test.js generated
View File

@@ -73,7 +73,6 @@ ava_1.default.beforeEach(() => {
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME, debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME, debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
augmentationProperties: { augmentationProperties: {
injectedMlQueries: false,
packsInputCombines: false, packsInputCombines: false,
queriesInputCombines: false, queriesInputCombines: false,
}, },
@@ -378,14 +377,13 @@ for (const isBundleVersionInUrl of [true, false]) {
await util.withTmpDir(async (tempDir) => { await util.withTmpDir(async (tempDir) => {
const runnerConstructorStub = stubToolRunnerConstructor(); const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.9.4"); sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.10.5"));
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
const thisStubConfig = { const thisStubConfig = {
...stubConfig, ...stubConfig,
tempDir, tempDir,
augmentationProperties: { augmentationProperties: {
injectedMlQueries: false,
queriesInputCombines: false, queriesInputCombines: false,
packsInputCombines: false, packsInputCombines: false,
}, },
@@ -405,7 +403,8 @@ const injectedConfigMacro = ava_1.default.macro({
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon sinon
.stub(codeqlObject, "getVersion") .stub(codeqlObject, "getVersion")
.resolves(feature_flags_1.featureConfig[feature_flags_1.Feature.CliConfigFileEnabled].minimumVersion); .resolves((0, testing_utils_1.makeVersionInfo)(feature_flags_1.featureConfig[feature_flags_1.Feature.CliConfigFileEnabled].minimumVersion ||
"1.0.0"));
const thisStubConfig = { const thisStubConfig = {
...stubConfig, ...stubConfig,
...configOverride, ...configOverride,
@@ -426,49 +425,10 @@ const injectedConfigMacro = ava_1.default.macro({
title: (providedTitle = "") => `databaseInitCluster() injected config: ${providedTitle}`, title: (providedTitle = "") => `databaseInitCluster() injected config: ${providedTitle}`,
}); });
(0, ava_1.default)("basic", injectedConfigMacro, { (0, ava_1.default)("basic", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: false, queriesInputCombines: false,
packsInputCombines: false, packsInputCombines: false,
}, {}, {}); }, {}, {});
(0, ava_1.default)("injected ML queries", injectedConfigMacro, {
injectedMlQueries: true,
queriesInputCombines: false,
packsInputCombines: false,
}, {}, {
packs: ["codeql/javascript-experimental-atm-queries@~0.4.0"],
});
(0, ava_1.default)("injected ML queries with existing packs", injectedConfigMacro, {
injectedMlQueries: true,
queriesInputCombines: false,
packsInputCombines: false,
}, {
originalUserInput: {
packs: { javascript: ["codeql/something-else"] },
},
}, {
packs: {
javascript: [
"codeql/something-else",
"codeql/javascript-experimental-atm-queries@~0.4.0",
],
},
});
(0, ava_1.default)("injected ML queries with existing packs of different language", injectedConfigMacro, {
injectedMlQueries: true,
queriesInputCombines: false,
packsInputCombines: false,
}, {
originalUserInput: {
packs: { cpp: ["codeql/something-else"] },
},
}, {
packs: {
cpp: ["codeql/something-else"],
javascript: ["codeql/javascript-experimental-atm-queries@~0.4.0"],
},
});
(0, ava_1.default)("injected packs from input", injectedConfigMacro, { (0, ava_1.default)("injected packs from input", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: false, queriesInputCombines: false,
packsInputCombines: false, packsInputCombines: false,
packsInput: ["xxx", "yyy"], packsInput: ["xxx", "yyy"],
@@ -476,7 +436,6 @@ const injectedConfigMacro = ava_1.default.macro({
packs: ["xxx", "yyy"], packs: ["xxx", "yyy"],
}); });
(0, ava_1.default)("injected packs from input with existing packs combines", injectedConfigMacro, { (0, ava_1.default)("injected packs from input with existing packs combines", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: false, queriesInputCombines: false,
packsInputCombines: true, packsInputCombines: true,
packsInput: ["xxx", "yyy"], packsInput: ["xxx", "yyy"],
@@ -492,7 +451,6 @@ const injectedConfigMacro = ava_1.default.macro({
}, },
}); });
(0, ava_1.default)("injected packs from input with existing packs overrides", injectedConfigMacro, { (0, ava_1.default)("injected packs from input with existing packs overrides", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: false, queriesInputCombines: false,
packsInputCombines: false, packsInputCombines: false,
packsInput: ["xxx", "yyy"], packsInput: ["xxx", "yyy"],
@@ -505,23 +463,8 @@ const injectedConfigMacro = ava_1.default.macro({
}, { }, {
packs: ["xxx", "yyy"], packs: ["xxx", "yyy"],
}); });
(0, ava_1.default)("injected packs from input with existing packs overrides and ML model inject", injectedConfigMacro, {
injectedMlQueries: true,
queriesInputCombines: false,
packsInputCombines: false,
packsInput: ["xxx", "yyy"],
}, {
originalUserInput: {
packs: {
cpp: ["codeql/something-else"],
},
},
}, {
packs: ["xxx", "yyy", "codeql/javascript-experimental-atm-queries@~0.4.0"],
});
// similar, but with queries // similar, but with queries
(0, ava_1.default)("injected queries from input", injectedConfigMacro, { (0, ava_1.default)("injected queries from input", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: false, queriesInputCombines: false,
packsInputCombines: false, packsInputCombines: false,
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }], queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
@@ -536,7 +479,6 @@ const injectedConfigMacro = ava_1.default.macro({
], ],
}); });
(0, ava_1.default)("injected queries from input overrides", injectedConfigMacro, { (0, ava_1.default)("injected queries from input overrides", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: false, queriesInputCombines: false,
packsInputCombines: false, packsInputCombines: false,
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }], queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
@@ -555,7 +497,6 @@ const injectedConfigMacro = ava_1.default.macro({
], ],
}); });
(0, ava_1.default)("injected queries from input combines", injectedConfigMacro, { (0, ava_1.default)("injected queries from input combines", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: true, queriesInputCombines: true,
packsInputCombines: false, packsInputCombines: false,
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }], queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
@@ -577,7 +518,6 @@ const injectedConfigMacro = ava_1.default.macro({
], ],
}); });
(0, ava_1.default)("injected queries from input combines 2", injectedConfigMacro, { (0, ava_1.default)("injected queries from input combines 2", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: true, queriesInputCombines: true,
packsInputCombines: true, packsInputCombines: true,
queriesInput: [{ uses: "xxx" }, { uses: "yyy" }], queriesInput: [{ uses: "xxx" }, { uses: "yyy" }],
@@ -592,7 +532,6 @@ const injectedConfigMacro = ava_1.default.macro({
], ],
}); });
(0, ava_1.default)("injected queries and packs, but empty", injectedConfigMacro, { (0, ava_1.default)("injected queries and packs, but empty", injectedConfigMacro, {
injectedMlQueries: false,
queriesInputCombines: true, queriesInputCombines: true,
packsInputCombines: true, packsInputCombines: true,
queriesInput: [], queriesInput: [],
@@ -608,7 +547,7 @@ const injectedConfigMacro = ava_1.default.macro({
const runnerConstructorStub = stubToolRunnerConstructor(); const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
// stubbed version doesn't matter. It just needs to be valid semver. // stubbed version doesn't matter. It just needs to be valid semver.
sinon.stub(codeqlObject, "getVersion").resolves("0.0.0"); sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("0.0.0"));
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true)); await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
const args = runnerConstructorStub.firstCall.args[1]; const args = runnerConstructorStub.firstCall.args[1];
// should not have used a config file // should not have used a config file
@@ -625,7 +564,7 @@ const injectedConfigMacro = ava_1.default.macro({
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon sinon
.stub(codeqlObject, "getVersion") .stub(codeqlObject, "getVersion")
.resolves(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG); .resolves((0, testing_utils_1.makeVersionInfo)(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG));
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true)); await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
const args = runnerConstructorStub.firstCall.args[1]; const args = runnerConstructorStub.firstCall.args[1];
// should have used a config file // should have used a config file
@@ -640,7 +579,7 @@ const injectedConfigMacro = ava_1.default.macro({
await util.withTmpDir(async (tempDir) => { await util.withTmpDir(async (tempDir) => {
const runnerConstructorStub = stubToolRunnerConstructor(); const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.12.2"); sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.2"));
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true)); await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), "/path/to/qlconfig.yml", (0, logging_1.getRunnerLogger)(true));
const args = runnerConstructorStub.firstCall.args[1]; const args = runnerConstructorStub.firstCall.args[1];
// should have used a config file // should have used a config file
@@ -657,7 +596,7 @@ const injectedConfigMacro = ava_1.default.macro({
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon sinon
.stub(codeqlObject, "getVersion") .stub(codeqlObject, "getVersion")
.resolves(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG); .resolves((0, testing_utils_1.makeVersionInfo)(codeql.CODEQL_VERSION_INIT_WITH_QLCONFIG));
await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), undefined, // undefined qlconfigFile await codeqlObject.databaseInitCluster({ ...stubConfig, tempDir }, "", undefined, (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.CliConfigFileEnabled]), undefined, // undefined qlconfigFile
(0, logging_1.getRunnerLogger)(true)); (0, logging_1.getRunnerLogger)(true));
const args = runnerConstructorStub.firstCall.args[1]; const args = runnerConstructorStub.firstCall.args[1];
@@ -668,7 +607,7 @@ const injectedConfigMacro = ava_1.default.macro({
(0, ava_1.default)("databaseInterpretResults() sets --sarif-add-baseline-file-info for 2.11.3", async (t) => { (0, ava_1.default)("databaseInterpretResults() sets --sarif-add-baseline-file-info for 2.11.3", async (t) => {
const runnerConstructorStub = stubToolRunnerConstructor(); const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.11.3"); sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.3"));
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true)); await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
@@ -677,7 +616,7 @@ const injectedConfigMacro = ava_1.default.macro({
(0, ava_1.default)("databaseInterpretResults() does not set --sarif-add-baseline-file-info for 2.11.2", async (t) => { (0, ava_1.default)("databaseInterpretResults() does not set --sarif-add-baseline-file-info for 2.11.2", async (t) => {
const runnerConstructorStub = stubToolRunnerConstructor(); const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.11.2"); sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.2"));
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true)); await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
@@ -711,7 +650,9 @@ for (const { featureEnabled, codeqlVersion, flagPassed, negativeFlagPassed, } of
: "nothing"} for CodeQL CLI v${codeqlVersion} when the new analysis summary feature is ${featureEnabled ? "enabled" : "disabled"}`, async (t) => { : "nothing"} for CodeQL CLI v${codeqlVersion} when the new analysis summary feature is ${featureEnabled ? "enabled" : "disabled"}`, async (t) => {
const runnerConstructorStub = stubToolRunnerConstructor(); const runnerConstructorStub = stubToolRunnerConstructor();
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves(codeqlVersion); sinon
.stub(codeqlObject, "getVersion")
.resolves((0, testing_utils_1.makeVersionInfo)(codeqlVersion));
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)(featureEnabled ? [feature_flags_1.Feature.AnalysisSummaryV2Enabled] : []), (0, logging_1.getRunnerLogger)(true)); await codeqlObject.databaseInterpretResults("", [], "", "", "", "-v", "", stubConfig, (0, testing_utils_1.createFeatures)(featureEnabled ? [feature_flags_1.Feature.AnalysisSummaryV2Enabled] : []), (0, logging_1.getRunnerLogger)(true));
@@ -725,7 +666,7 @@ for (const { featureEnabled, codeqlVersion, flagPassed, negativeFlagPassed, } of
2020-09-07T17:39:53.9052444Z [2020-09-07 17:39:53] [build-err] No JavaScript or TypeScript code found. 2020-09-07T17:39:53.9052444Z [2020-09-07 17:39:53] [build-err] No JavaScript or TypeScript code found.
2020-09-07T17:39:53.9251124Z [2020-09-07 17:39:53] [ERROR] Spawned process exited abnormally (code 255; tried to run: [/opt/hostedtoolcache/CodeQL/0.0.0-20200630/x64/codeql/javascript/tools/autobuild.sh])`); 2020-09-07T17:39:53.9251124Z [2020-09-07 17:39:53] [ERROR] Spawned process exited abnormally (code 255; tried to run: [/opt/hostedtoolcache/CodeQL/0.0.0-20200630/x64/codeql/javascript/tools/autobuild.sh])`);
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.11.6"); sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.6"));
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("", "", ""), { await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("", "", ""), {
@@ -736,7 +677,7 @@ for (const { featureEnabled, codeqlVersion, flagPassed, negativeFlagPassed, } of
(0, ava_1.default)("database finalize overrides no code found error on CodeQL 2.11.6", async (t) => { (0, ava_1.default)("database finalize overrides no code found error on CodeQL 2.11.6", async (t) => {
stubToolRunnerConstructor(32); stubToolRunnerConstructor(32);
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.11.6"); sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.11.6"));
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("", "", ""), { await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("", "", ""), {
@@ -749,7 +690,7 @@ for (const { featureEnabled, codeqlVersion, flagPassed, negativeFlagPassed, } of
"https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build."; "https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build.";
stubToolRunnerConstructor(32, cliMessage); stubToolRunnerConstructor(32, cliMessage);
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.12.4"); sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), { await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
@@ -764,7 +705,7 @@ for (const { featureEnabled, codeqlVersion, flagPassed, negativeFlagPassed, } of
`${heapError}\n${datasetImportError}.`; `${heapError}\n${datasetImportError}.`;
stubToolRunnerConstructor(32, cliStderr); stubToolRunnerConstructor(32, cliStderr);
const codeqlObject = await codeql.getCodeQLForTesting(); const codeqlObject = await codeql.getCodeQLForTesting();
sinon.stub(codeqlObject, "getVersion").resolves("2.12.4"); sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
// safeWhich throws because of the test CodeQL object. // safeWhich throws because of the test CodeQL object.
sinon.stub(safeWhich, "safeWhich").resolves(""); sinon.stub(safeWhich, "safeWhich").resolves("");
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), { await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {

File diff suppressed because one or more lines are too long

131
lib/config-utils.js generated
View File

@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapEnvironment = exports.generateRegistries = exports.downloadPacks = exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.getMlPoweredJsQueriesStatus = exports.parsePacks = exports.validatePackSpecification = exports.parsePacksSpecification = exports.parsePacksFromConfig = exports.calculateAugmentation = exports.getDefaultConfig = exports.getRawLanguages = exports.getLanguages = exports.getLanguagesInRepo = exports.getUnknownLanguagesError = exports.getNoLanguagesError = exports.getConfigFileDirectoryGivenMessage = exports.getConfigFileFormatInvalidMessage = exports.getConfigFileRepoFormatInvalidMessage = exports.getConfigFileDoesNotExistErrorMessage = exports.getConfigFileOutsideWorkspaceErrorMessage = exports.getLocalPathDoesNotExist = exports.getLocalPathOutsideOfRepository = exports.getPacksStrInvalid = exports.getPacksInvalid = exports.getPacksInvalidSplit = exports.getPathsInvalid = exports.getPathsIgnoreInvalid = exports.getQueryUsesInvalid = exports.getQueriesMissingUses = exports.getQueriesInvalid = exports.getDisableDefaultQueriesInvalid = exports.getNameInvalid = exports.validateAndSanitisePath = exports.defaultAugmentationProperties = void 0; exports.wrapEnvironment = exports.generateRegistries = exports.downloadPacks = exports.getConfig = exports.getPathToParsedConfigFile = exports.initConfig = exports.parsePacks = exports.validatePackSpecification = exports.parsePacksSpecification = exports.parsePacksFromConfig = exports.calculateAugmentation = exports.getDefaultConfig = exports.getRawLanguages = exports.getLanguageAliases = exports.getLanguages = exports.getLanguagesInRepo = exports.getUnknownLanguagesError = exports.getNoLanguagesError = exports.getConfigFileDirectoryGivenMessage = exports.getConfigFileFormatInvalidMessage = exports.getConfigFileRepoFormatInvalidMessage = exports.getConfigFileDoesNotExistErrorMessage = exports.getConfigFileOutsideWorkspaceErrorMessage = exports.getLocalPathDoesNotExist = exports.getLocalPathOutsideOfRepository = exports.getPacksStrInvalid = exports.getPacksInvalid = exports.getPacksInvalidSplit = exports.getPathsInvalid = exports.getPathsIgnoreInvalid = exports.getQueryUsesInvalid = exports.getQueriesMissingUses = exports.getQueriesInvalid = exports.getDisableDefaultQueriesInvalid = exports.getNameInvalid = exports.validateAndSanitisePath = exports.defaultAugmentationProperties = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
const perf_hooks_1 = require("perf_hooks"); const perf_hooks_1 = require("perf_hooks");
@@ -45,13 +45,12 @@ const PATHS_IGNORE_PROPERTY = "paths-ignore";
const PATHS_PROPERTY = "paths"; const PATHS_PROPERTY = "paths";
const PACKS_PROPERTY = "packs"; const PACKS_PROPERTY = "packs";
/** /**
* The default, empty augmentation properties. This is most useeful * The default, empty augmentation properties. This is most useful
* for tests. * for tests.
*/ */
exports.defaultAugmentationProperties = { exports.defaultAugmentationProperties = {
queriesInputCombines: false, queriesInputCombines: false,
packsInputCombines: false, packsInputCombines: false,
injectedMlQueries: false,
packsInput: undefined, packsInput: undefined,
queriesInput: undefined, queriesInput: undefined,
}; };
@@ -139,10 +138,8 @@ const builtinSuites = [
/** /**
* Determine the set of queries associated with suiteName's suites and add them to resultMap. * Determine the set of queries associated with suiteName's suites and add them to resultMap.
* Throws an error if suiteName is not a valid builtin suite. * Throws an error if suiteName is not a valid builtin suite.
* May inject ML queries, and the return value will declare if this was done.
*/ */
async function addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, suiteName, features, configFile) { async function addBuiltinSuiteQueries(languages, codeQL, resultMap, suiteName, configFile) {
let injectedMlQueries = false;
const found = builtinSuites.find((suite) => suite === suiteName); const found = builtinSuites.find((suite) => suite === suiteName);
if (!found) { if (!found) {
throw new util_1.UserError(getQueryUsesInvalid(configFile, suiteName)); throw new util_1.UserError(getQueryUsesInvalid(configFile, suiteName));
@@ -153,27 +150,8 @@ async function addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, suite
${codeql_1.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE}. Please upgrade to CodeQL CLI version ${codeql_1.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE}. Please upgrade to CodeQL CLI version
${codeql_1.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE} or later.`); ${codeql_1.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE} or later.`);
} }
// If we're running the JavaScript security-extended analysis (or a superset of it), the repo is
// opted into the ML-powered queries beta, and a user hasn't already added the ML-powered query
// pack, then add the ML-powered query pack so that we run ML-powered queries.
if (languages.includes("javascript") &&
(found === "security-experimental" ||
found === "security-extended" ||
found === "security-and-quality") &&
!packs.javascript?.some(isMlPoweredJsQueriesPack) &&
(await features.getValue(feature_flags_1.Feature.MlPoweredQueriesEnabled, codeQL))) {
if (!packs.javascript) {
packs.javascript = [];
}
packs.javascript.push(await (0, util_1.getMlPoweredJsQueriesPack)(codeQL));
injectedMlQueries = true;
}
const suites = languages.map((l) => `${l}-${suiteName}.qls`); const suites = languages.map((l) => `${l}-${suiteName}.qls`);
await runResolveQueries(codeQL, resultMap, suites, undefined); await runResolveQueries(codeQL, resultMap, suites, undefined);
return injectedMlQueries;
}
function isMlPoweredJsQueriesPack(pack) {
return parsePacksSpecification(pack).name === util_1.ML_POWERED_JS_QUERIES_PACK_NAME;
} }
/** /**
* Retrieve the set of queries at localQueryPath and add them to resultMap. * Retrieve the set of queries at localQueryPath and add them to resultMap.
@@ -230,13 +208,8 @@ async function addRemoteQueries(codeQL, resultMap, queryUses, tempDir, apiDetail
* parsing the 'uses' actions in the workflow file. So it can handle * parsing the 'uses' actions in the workflow file. So it can handle
* local paths starting with './', or references to remote repos, or * local paths starting with './', or references to remote repos, or
* a finite set of hardcoded terms for builtin suites. * a finite set of hardcoded terms for builtin suites.
*
* This may inject ML queries into the packs to use, and the return value will
* declare if this was done.
*
* @returns whether or not we injected ML queries into the packs
*/ */
async function parseQueryUses(languages, codeQL, resultMap, packs, queryUses, tempDir, workspacePath, apiDetails, features, logger, configFile) { async function parseQueryUses(languages, codeQL, resultMap, queryUses, tempDir, workspacePath, apiDetails, features, logger, configFile) {
queryUses = queryUses.trim(); queryUses = queryUses.trim();
if (queryUses === "") { if (queryUses === "") {
throw new util_1.UserError(getQueryUsesInvalid(configFile)); throw new util_1.UserError(getQueryUsesInvalid(configFile));
@@ -244,11 +217,12 @@ async function parseQueryUses(languages, codeQL, resultMap, packs, queryUses, te
// Check for the local path case before we start trying to parse the repository name // Check for the local path case before we start trying to parse the repository name
if (queryUses.startsWith("./")) { if (queryUses.startsWith("./")) {
await addLocalQueries(codeQL, resultMap, queryUses.slice(2), workspacePath, configFile); await addLocalQueries(codeQL, resultMap, queryUses.slice(2), workspacePath, configFile);
return false; return;
} }
// Check for one of the builtin suites // Check for one of the builtin suites
if (queryUses.indexOf("/") === -1 && queryUses.indexOf("@") === -1) { if (queryUses.indexOf("/") === -1 && queryUses.indexOf("@") === -1) {
return await addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, queryUses, features, configFile); await addBuiltinSuiteQueries(languages, codeQL, resultMap, queryUses, configFile);
return;
} }
// Otherwise, must be a reference to another repo. // Otherwise, must be a reference to another repo.
// If config parsing is handled in CLI, then this repo will be downloaded // If config parsing is handled in CLI, then this repo will be downloaded
@@ -256,7 +230,6 @@ async function parseQueryUses(languages, codeQL, resultMap, packs, queryUses, te
if (!(await (0, feature_flags_1.useCodeScanningConfigInCli)(codeQL, features))) { if (!(await (0, feature_flags_1.useCodeScanningConfigInCli)(codeQL, features))) {
await addRemoteQueries(codeQL, resultMap, queryUses, tempDir, apiDetails, logger, configFile); await addRemoteQueries(codeQL, resultMap, queryUses, tempDir, apiDetails, logger, configFile);
} }
return false;
} }
// Regex validating stars in paths or paths-ignore entries. // Regex validating stars in paths or paths-ignore entries.
// The intention is to only allow ** to appear when immediately // The intention is to only allow ** to appear when immediately
@@ -395,7 +368,7 @@ function getNoLanguagesError() {
} }
exports.getNoLanguagesError = getNoLanguagesError; exports.getNoLanguagesError = getNoLanguagesError;
function getUnknownLanguagesError(languages) { function getUnknownLanguagesError(languages) {
return `Did not recognise the following languages: ${languages.join(", ")}`; return `Did not recognize the following languages: ${languages.join(", ")}`;
} }
exports.getUnknownLanguagesError = getUnknownLanguagesError; exports.getUnknownLanguagesError = getUnknownLanguagesError;
/** /**
@@ -436,13 +409,20 @@ exports.getLanguagesInRepo = getLanguagesInRepo;
async function getLanguages(codeQL, languagesInput, repository, logger) { async function getLanguages(codeQL, languagesInput, repository, logger) {
// Obtain languages without filtering them. // Obtain languages without filtering them.
const { rawLanguages, autodetected } = await getRawLanguages(languagesInput, repository, logger); const { rawLanguages, autodetected } = await getRawLanguages(languagesInput, repository, logger);
let languages = rawLanguages.map(languages_1.resolveAlias); let languages = rawLanguages;
if (autodetected) { if (autodetected) {
const availableLanguages = await codeQL.resolveLanguages(); const supportedLanguages = Object.keys(await codeQL.resolveLanguages());
languages = languages.filter((value) => value in availableLanguages); languages = languages
.map(languages_1.parseLanguage)
.filter((value) => value && supportedLanguages.includes(value))
.map((value) => value);
logger.info(`Automatically detected languages: ${languages.join(", ")}`); logger.info(`Automatically detected languages: ${languages.join(", ")}`);
} }
else { else {
const aliases = await getLanguageAliases(codeQL);
if (aliases) {
languages = languages.map((lang) => aliases[lang] || lang);
}
logger.info(`Languages from configuration: ${languages.join(", ")}`); logger.info(`Languages from configuration: ${languages.join(", ")}`);
} }
// If the languages parameter was not given and no languages were // If the languages parameter was not given and no languages were
@@ -454,7 +434,6 @@ async function getLanguages(codeQL, languagesInput, repository, logger) {
const parsedLanguages = []; const parsedLanguages = [];
const unknownLanguages = []; const unknownLanguages = [];
for (const language of languages) { for (const language of languages) {
// We know this is not an alias since we resolved it above.
const parsedLanguage = (0, languages_1.parseLanguage)(language); const parsedLanguage = (0, languages_1.parseLanguage)(language);
if (parsedLanguage === undefined) { if (parsedLanguage === undefined) {
unknownLanguages.push(language); unknownLanguages.push(language);
@@ -471,6 +450,17 @@ async function getLanguages(codeQL, languagesInput, repository, logger) {
return parsedLanguages; return parsedLanguages;
} }
exports.getLanguages = getLanguages; exports.getLanguages = getLanguages;
/**
* Gets the set of languages supported by CodeQL, along with their aliases if supported by the
* version of the CLI.
*/
async function getLanguageAliases(codeql) {
if (await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_LANGUAGE_ALIASING)) {
return (await codeql.betterResolveLanguages()).aliases;
}
return undefined;
}
exports.getLanguageAliases = getLanguageAliases;
/** /**
* Gets the set of languages in the current repository without checking to * Gets the set of languages in the current repository without checking to
* see if these languages are actually supported by CodeQL. * see if these languages are actually supported by CodeQL.
@@ -499,16 +489,13 @@ async function getRawLanguages(languagesInput, repository, logger) {
return { rawLanguages, autodetected }; return { rawLanguages, autodetected };
} }
exports.getRawLanguages = getRawLanguages; exports.getRawLanguages = getRawLanguages;
async function addQueriesAndPacksFromWorkflow(codeQL, queriesInput, languages, resultMap, packs, tempDir, workspacePath, apiDetails, features, logger) { async function addQueriesFromWorkflow(codeQL, queriesInput, languages, resultMap, tempDir, workspacePath, apiDetails, features, logger) {
let injectedMlQueries = false;
queriesInput = queriesInput.trim(); queriesInput = queriesInput.trim();
// "+" means "don't override config file" - see shouldAddConfigFileQueries // "+" means "don't override config file" - see shouldAddConfigFileQueries
queriesInput = queriesInput.replace(/^\+/, ""); queriesInput = queriesInput.replace(/^\+/, "");
for (const query of queriesInput.split(",")) { for (const query of queriesInput.split(",")) {
const didInject = await parseQueryUses(languages, codeQL, resultMap, packs, query, tempDir, workspacePath, apiDetails, features, logger); await parseQueryUses(languages, codeQL, resultMap, query, tempDir, workspacePath, apiDetails, features, logger);
injectedMlQueries = injectedMlQueries || didInject;
} }
return injectedMlQueries;
} }
// Returns true if either no queries were provided in the workflow. // Returns true if either no queries were provided in the workflow.
// or if the queries in the workflow were provided in "additive" mode, // or if the queries in the workflow were provided in "additive" mode,
@@ -540,8 +527,7 @@ async function getDefaultConfig(languagesInput, rawQueriesInput, rawPacksInput,
} }
: {}; : {};
if (rawQueriesInput) { if (rawQueriesInput) {
augmentationProperties.injectedMlQueries = await addQueriesFromWorkflow(codeQL, rawQueriesInput, languages, queries, tempDir, workspacePath, apiDetails, features, logger);
await addQueriesAndPacksFromWorkflow(codeQL, rawQueriesInput, languages, queries, packs, tempDir, workspacePath, apiDetails, features, logger);
} }
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeQL, languages, logger); const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeQL, languages, logger);
return { return {
@@ -624,8 +610,7 @@ async function loadConfig(languagesInput, rawQueriesInput, rawPacksInput, config
// unless they're prefixed with "+", in which case they supplement those // unless they're prefixed with "+", in which case they supplement those
// in the config file. // in the config file.
if (rawQueriesInput) { if (rawQueriesInput) {
augmentationProperties.injectedMlQueries = await addQueriesFromWorkflow(codeQL, rawQueriesInput, languages, queries, tempDir, workspacePath, apiDetails, features, logger);
await addQueriesAndPacksFromWorkflow(codeQL, rawQueriesInput, languages, queries, packs, tempDir, workspacePath, apiDetails, features, logger);
} }
if (shouldAddConfigFileQueries(rawQueriesInput) && if (shouldAddConfigFileQueries(rawQueriesInput) &&
QUERIES_PROPERTY in parsedYAML) { QUERIES_PROPERTY in parsedYAML) {
@@ -637,7 +622,7 @@ async function loadConfig(languagesInput, rawQueriesInput, rawPacksInput, config
if (typeof query[QUERIES_USES_PROPERTY] !== "string") { if (typeof query[QUERIES_USES_PROPERTY] !== "string") {
throw new util_1.UserError(getQueriesMissingUses(configFile)); throw new util_1.UserError(getQueriesMissingUses(configFile));
} }
await parseQueryUses(languages, codeQL, queries, packs, query[QUERIES_USES_PROPERTY], tempDir, workspacePath, apiDetails, features, logger, configFile); await parseQueryUses(languages, codeQL, queries, query[QUERIES_USES_PROPERTY], tempDir, workspacePath, apiDetails, features, logger, configFile);
} }
} }
if (PATHS_IGNORE_PROPERTY in parsedYAML) { if (PATHS_IGNORE_PROPERTY in parsedYAML) {
@@ -707,7 +692,6 @@ function calculateAugmentation(rawPacksInput, rawQueriesInput, languages) {
const queriesInputCombines = shouldCombine(rawQueriesInput); const queriesInputCombines = shouldCombine(rawQueriesInput);
const queriesInput = parseQueriesFromInput(rawQueriesInput, queriesInputCombines); const queriesInput = parseQueriesFromInput(rawQueriesInput, queriesInputCombines);
return { return {
injectedMlQueries: false,
packsInputCombines, packsInputCombines,
packsInput: packsInput?.[languages[0]], packsInput: packsInput?.[languages[0]],
queriesInput, queriesInput,
@@ -915,46 +899,6 @@ function combinePacks(packs1, packs2) {
} }
return packs; return packs;
} }
/**
* Get information about ML-powered JS queries to populate status reports with.
*
* This will be:
*
* - The version string if the analysis is using a single version of the ML-powered query pack.
* - "latest" if the version string of the ML-powered query pack is undefined. This is unlikely to
* occur in practice (see comment below).
* - "false" if the analysis won't run any ML-powered JS queries.
* - "other" in all other cases.
*
* Our goal of the status report here is to allow us to compare the occurrence of timeouts and other
* errors with ML-powered queries turned on and off. We also want to be able to compare minor
* version bumps caused by us bumping the version range of `ML_POWERED_JS_QUERIES_PACK` in a new
* version of the CodeQL Action. For instance, we might want to compare the `~0.1.0` and `~0.0.2`
* version strings.
*
* This function lives here rather than in `init-action.ts` so it's easier to test, since tests for
* `init-action.ts` would each need to live in their own file. See `analyze-action-env.ts` for an
* explanation as to why this is.
*/
function getMlPoweredJsQueriesStatus(config) {
const mlPoweredJsQueryPacks = (config.packs.javascript || [])
.map((p) => parsePacksSpecification(p))
.filter((pack) => pack.name === util_1.ML_POWERED_JS_QUERIES_PACK_NAME && !pack.path);
switch (mlPoweredJsQueryPacks.length) {
case 1:
// We should always specify an explicit version string in `getMlPoweredJsQueriesPack`,
// otherwise we won't be able to make changes to the pack unless those changes are compatible
// with each version of the CodeQL Action. Therefore in practice we should only hit the
// `latest` case here when customers have explicitly added the ML-powered query pack to their
// CodeQL config.
return mlPoweredJsQueryPacks[0].version || "latest";
case 0:
return "false";
default:
return "other";
}
}
exports.getMlPoweredJsQueriesStatus = getMlPoweredJsQueriesStatus;
function dbLocationOrDefault(dbLocation, tempDir) { function dbLocationOrDefault(dbLocation, tempDir) {
return dbLocation || path.resolve(tempDir, "codeql_databases"); return dbLocation || path.resolve(tempDir, "codeql_databases");
} }
@@ -1098,7 +1042,7 @@ async function getConfig(tempDir, logger) {
exports.getConfig = getConfig; exports.getConfig = getConfig;
async function downloadPacks(codeQL, languages, packs, apiDetails, registriesInput, tempDir, logger) { async function downloadPacks(codeQL, languages, packs, apiDetails, registriesInput, tempDir, logger) {
// This code path is only used when config parsing occurs in the Action. // This code path is only used when config parsing occurs in the Action.
const { registriesAuthTokens, qlconfigFile } = await generateRegistries(registriesInput, codeQL, tempDir, logger); const { registriesAuthTokens, qlconfigFile } = await generateRegistries(registriesInput, tempDir, logger);
await wrapEnvironment({ await wrapEnvironment({
GITHUB_TOKEN: apiDetails.auth, GITHUB_TOKEN: apiDetails.auth,
CODEQL_REGISTRIES_AUTH: registriesAuthTokens, CODEQL_REGISTRIES_AUTH: registriesAuthTokens,
@@ -1138,14 +1082,11 @@ exports.downloadPacks = downloadPacks;
* @returns The path to the generated `qlconfig.yml` file and the auth tokens to * @returns The path to the generated `qlconfig.yml` file and the auth tokens to
* use for each registry. * use for each registry.
*/ */
async function generateRegistries(registriesInput, codeQL, tempDir, logger) { async function generateRegistries(registriesInput, tempDir, logger) {
const registries = parseRegistries(registriesInput); const registries = parseRegistries(registriesInput);
let registriesAuthTokens; let registriesAuthTokens;
let qlconfigFile; let qlconfigFile;
if (registries) { if (registries) {
if (!(await (0, util_1.codeQlVersionAbove)(codeQL, codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD))) {
throw new util_1.UserError(`The 'registries' input is not supported on CodeQL CLI versions earlier than ${codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD}. Please upgrade to CodeQL CLI version ${codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD} or later.`);
}
// generate a qlconfig.yml file to hold the registry configs. // generate a qlconfig.yml file to hold the registry configs.
const qlconfig = createRegistriesBlock(registries); const qlconfig = createRegistriesBlock(registries);
qlconfigFile = path.join(tempDir, "qlconfig.yml"); qlconfigFile = path.join(tempDir, "qlconfig.yml");

File diff suppressed because one or more lines are too long

189
lib/config-utils.test.js generated
View File

@@ -35,7 +35,6 @@ const sinon = __importStar(require("sinon"));
const api = __importStar(require("./api-client")); const api = __importStar(require("./api-client"));
const codeql_1 = require("./codeql"); const codeql_1 = require("./codeql");
const configUtils = __importStar(require("./config-utils")); const configUtils = __importStar(require("./config-utils"));
const feature_flags_1 = require("./feature-flags");
const languages_1 = require("./languages"); const languages_1 = require("./languages");
const logging_1 = require("./logging"); const logging_1 = require("./logging");
const repository_1 = require("./repository"); const repository_1 = require("./repository");
@@ -1062,66 +1061,6 @@ parseInputAndConfigErrorMacro.title = (providedTitle) => `Parse Packs input and
(0, ava_1.default)("input with two languages", parseInputAndConfigErrorMacro, {}, "c/d", [languages_1.Language.cpp, languages_1.Language.csharp], false, /multi-language analysis/); (0, ava_1.default)("input with two languages", parseInputAndConfigErrorMacro, {}, "c/d", [languages_1.Language.cpp, languages_1.Language.csharp], false, /multi-language analysis/);
(0, ava_1.default)("input with + only", parseInputAndConfigErrorMacro, {}, " + ", [languages_1.Language.cpp], true, /remove the '\+'/); (0, ava_1.default)("input with + only", parseInputAndConfigErrorMacro, {}, " + ", [languages_1.Language.cpp], true, /remove the '\+'/);
(0, ava_1.default)("input with invalid pack name", parseInputAndConfigErrorMacro, {}, " xxx", [languages_1.Language.cpp], false, /"xxx" is not a valid pack/); (0, ava_1.default)("input with invalid pack name", parseInputAndConfigErrorMacro, {}, " xxx", [languages_1.Language.cpp], false, /"xxx" is not a valid pack/);
const mlPoweredQueriesMacro = ava_1.default.macro({
exec: async (t, codeQLVersion, isMlPoweredQueriesEnabled, packsInput, queriesInput, expectedVersionString) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const codeQL = (0, codeql_1.setCodeQL)({
async getVersion() {
return codeQLVersion;
},
async resolveQueries() {
return {
byLanguage: {
javascript: { "fake-query.ql": {} },
},
noDeclaredLanguage: {},
multipleDeclaredLanguages: {},
};
},
async packDownload() {
return { packs: [] };
},
});
const { packs } = await configUtils.initConfig("javascript", queriesInput, packsInput, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, testing_utils_1.createFeatures)(isMlPoweredQueriesEnabled ? [feature_flags_1.Feature.MlPoweredQueriesEnabled] : []), (0, logging_1.getRunnerLogger)(true));
if (expectedVersionString !== undefined) {
t.deepEqual(packs, {
[languages_1.Language.javascript]: [
`codeql/javascript-experimental-atm-queries@${expectedVersionString}`,
],
});
}
else {
t.deepEqual(packs, {});
}
});
},
title: (_providedTitle, codeQLVersion, isMlPoweredQueriesEnabled, packsInput, queriesInput, expectedVersionString) => `ML-powered queries ${expectedVersionString !== undefined
? `${expectedVersionString} are`
: "aren't"} loaded for packs: ${packsInput}, queries: ${queriesInput} using CLI v${codeQLVersion} when feature is ${isMlPoweredQueriesEnabled ? "enabled" : "disabled"}`,
});
// macro, codeQLVersion, isMlPoweredQueriesEnabled, packsInput, queriesInput, expectedVersionString
// Test that ML-powered queries aren't run when the feature is off.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.12.3", false, undefined, "security-extended", undefined);
// Test that ML-powered queries aren't run when the user hasn't specified that we should run the
// `security-extended`, `security-and-quality`, or `security-experimental` query suite.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.12.3", true, undefined, undefined, undefined);
// Test that we don't inject an ML-powered query pack if the user has already specified one.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.12.3", true, "codeql/javascript-experimental-atm-queries@0.0.1", "security-and-quality", "0.0.1");
// Test that ML-powered queries ~0.3.0 are run on all platforms running `security-extended` on
// CodeQL CLI 2.9.4+.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.9.4", true, undefined, "security-extended", "~0.3.0");
// Test that ML-powered queries ~0.3.0 are run on all platforms running `security-and-quality` on
// CodeQL CLI 2.9.4+.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.9.4", true, undefined, "security-and-quality", "~0.3.0");
// Test that ML-powered queries ~0.4.0 are run on all platforms running `security-extended` on
// CodeQL CLI 2.11.3+.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.11.3", true, undefined, "security-extended", "~0.4.0");
// Test that ML-powered queries ~0.4.0 are run on all platforms running `security-and-quality` on
// CodeQL CLI 2.11.3+.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.11.3", true, undefined, "security-and-quality", "~0.4.0");
// Test that ML-powered queries are run on all platforms running `security-experimental` on CodeQL
// CLI 2.12.1+.
(0, ava_1.default)(mlPoweredQueriesMacro, "2.12.1", true, undefined, "security-experimental", "~0.4.0");
const calculateAugmentationMacro = ava_1.default.macro({ const calculateAugmentationMacro = ava_1.default.macro({
exec: async (t, _title, rawPacksInput, rawQueriesInput, languages, expectedAugmentationProperties) => { exec: async (t, _title, rawPacksInput, rawQueriesInput, languages, expectedAugmentationProperties) => {
const actualAugmentationProperties = configUtils.calculateAugmentation(rawPacksInput, rawQueriesInput, languages); const actualAugmentationProperties = configUtils.calculateAugmentation(rawPacksInput, rawQueriesInput, languages);
@@ -1134,35 +1073,30 @@ const calculateAugmentationMacro = ava_1.default.macro({
queriesInput: undefined, queriesInput: undefined,
packsInputCombines: false, packsInputCombines: false,
packsInput: undefined, packsInput: undefined,
injectedMlQueries: false,
}); });
(0, ava_1.default)(calculateAugmentationMacro, "With queries", undefined, " a, b , c, d", [languages_1.Language.javascript], { (0, ava_1.default)(calculateAugmentationMacro, "With queries", undefined, " a, b , c, d", [languages_1.Language.javascript], {
queriesInputCombines: false, queriesInputCombines: false,
queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }], queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }],
packsInputCombines: false, packsInputCombines: false,
packsInput: undefined, packsInput: undefined,
injectedMlQueries: false,
}); });
(0, ava_1.default)(calculateAugmentationMacro, "With queries combining", undefined, " + a, b , c, d ", [languages_1.Language.javascript], { (0, ava_1.default)(calculateAugmentationMacro, "With queries combining", undefined, " + a, b , c, d ", [languages_1.Language.javascript], {
queriesInputCombines: true, queriesInputCombines: true,
queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }], queriesInput: [{ uses: "a" }, { uses: "b" }, { uses: "c" }, { uses: "d" }],
packsInputCombines: false, packsInputCombines: false,
packsInput: undefined, packsInput: undefined,
injectedMlQueries: false,
}); });
(0, ava_1.default)(calculateAugmentationMacro, "With packs", " codeql/a , codeql/b , codeql/c , codeql/d ", undefined, [languages_1.Language.javascript], { (0, ava_1.default)(calculateAugmentationMacro, "With packs", " codeql/a , codeql/b , codeql/c , codeql/d ", undefined, [languages_1.Language.javascript], {
queriesInputCombines: false, queriesInputCombines: false,
queriesInput: undefined, queriesInput: undefined,
packsInputCombines: false, packsInputCombines: false,
packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"], packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"],
injectedMlQueries: false,
}); });
(0, ava_1.default)(calculateAugmentationMacro, "With packs combining", " + codeql/a, codeql/b, codeql/c, codeql/d", undefined, [languages_1.Language.javascript], { (0, ava_1.default)(calculateAugmentationMacro, "With packs combining", " + codeql/a, codeql/b, codeql/c, codeql/d", undefined, [languages_1.Language.javascript], {
queriesInputCombines: false, queriesInputCombines: false,
queriesInput: undefined, queriesInput: undefined,
packsInputCombines: true, packsInputCombines: true,
packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"], packsInput: ["codeql/a", "codeql/b", "codeql/c", "codeql/d"],
injectedMlQueries: false,
}); });
const calculateAugmentationErrorMacro = ava_1.default.macro({ const calculateAugmentationErrorMacro = ava_1.default.macro({
exec: async (t, _title, rawPacksInput, rawQueriesInput, languages, expectedError) => { exec: async (t, _title, rawPacksInput, rawQueriesInput, languages, expectedError) => {
@@ -1243,7 +1177,7 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
}); });
const codeQL = (0, codeql_1.setCodeQL)({ const codeQL = (0, codeql_1.setCodeQL)({
packDownload: packDownloadStub, packDownload: packDownloadStub,
getVersion: () => Promise.resolve("2.10.5"), getVersion: () => Promise.resolve((0, testing_utils_1.makeVersionInfo)("2.10.5")),
}); });
// packs are supplied for go, java, and python // packs are supplied for go, java, and python
// analyzed languages are java, javascript, and python // analyzed languages are java, javascript, and python
@@ -1267,33 +1201,6 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
t.deepEqual(process.env.CODEQL_REGISTRIES_AUTH, undefined); t.deepEqual(process.env.CODEQL_REGISTRIES_AUTH, undefined);
}); });
}); });
(0, ava_1.default)("downloadPacks-with-registries fails on 2.10.3", async (t) => {
// same thing, but this time include a registries block and
// associated env vars
return await (0, util_1.withTmpDir)(async (tmpDir) => {
process.env.GITHUB_TOKEN = "not-a-token";
process.env.CODEQL_REGISTRIES_AUTH = "not-a-registries-auth";
const logger = (0, logging_1.getRunnerLogger)(true);
const registriesInput = yaml.dump([
{
url: "http://ghcr.io",
packages: ["codeql/*", "codeql-testing/*"],
token: "not-a-token",
},
{
url: "https://containers.GHEHOSTNAME1/v2/",
packages: "semmle/*",
token: "still-not-a-token",
},
]);
const codeQL = (0, codeql_1.setCodeQL)({
getVersion: () => Promise.resolve("2.10.3"),
});
await t.throwsAsync(async () => {
return await configUtils.downloadPacks(codeQL, [languages_1.Language.javascript, languages_1.Language.java, languages_1.Language.python], {}, sampleApiDetails, registriesInput, tmpDir, logger);
}, { instanceOf: Error }, "'registries' input is not supported on CodeQL versions less than 2.10.4.");
});
});
(0, ava_1.default)("downloadPacks-with-registries fails with invalid registries block", async (t) => { (0, ava_1.default)("downloadPacks-with-registries fails with invalid registries block", async (t) => {
// same thing, but this time include a registries block and // same thing, but this time include a registries block and
// associated env vars // associated env vars
@@ -1314,42 +1221,18 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
}, },
]); ]);
const codeQL = (0, codeql_1.setCodeQL)({ const codeQL = (0, codeql_1.setCodeQL)({
getVersion: () => Promise.resolve("2.10.4"), getVersion: () => Promise.resolve((0, testing_utils_1.makeVersionInfo)("2.10.4")),
}); });
await t.throwsAsync(async () => { await t.throwsAsync(async () => {
return await configUtils.downloadPacks(codeQL, [languages_1.Language.javascript, languages_1.Language.java, languages_1.Language.python], {}, sampleApiDetails, registriesInput, tmpDir, logger); return await configUtils.downloadPacks(codeQL, [languages_1.Language.javascript, languages_1.Language.java, languages_1.Language.python], {}, sampleApiDetails, registriesInput, tmpDir, logger);
}, { instanceOf: Error }, "Invalid 'registries' input. Must be an array of objects with 'url' and 'packages' properties."); }, { instanceOf: Error }, "Invalid 'registries' input. Must be an array of objects with 'url' and 'packages' properties.");
}); });
}); });
// the happy path for generateRegistries is already tested in downloadPacks.
// these following tests are for the error cases and when nothing is generated.
(0, ava_1.default)("no generateRegistries when CLI is too old", async (t) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => {
const registriesInput = yaml.dump([
{
// no slash
url: "http://ghcr.io",
packages: ["codeql/*", "codeql-testing/*"],
token: "not-a-token",
},
]);
const codeQL = (0, codeql_1.setCodeQL)({
// Accepted CLI versions are 2.10.4 or higher
getVersion: () => Promise.resolve("2.10.3"),
});
const logger = (0, logging_1.getRunnerLogger)(true);
await t.throwsAsync(async () => await configUtils.generateRegistries(registriesInput, codeQL, tmpDir, logger), undefined, "'registries' input is not supported on CodeQL versions less than 2.10.4.");
});
});
(0, ava_1.default)("no generateRegistries when registries is undefined", async (t) => { (0, ava_1.default)("no generateRegistries when registries is undefined", async (t) => {
return await (0, util_1.withTmpDir)(async (tmpDir) => { return await (0, util_1.withTmpDir)(async (tmpDir) => {
const registriesInput = undefined; const registriesInput = undefined;
const codeQL = (0, codeql_1.setCodeQL)({
// Accepted CLI versions are 2.10.4 or higher
getVersion: () => Promise.resolve(codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD),
});
const logger = (0, logging_1.getRunnerLogger)(true); const logger = (0, logging_1.getRunnerLogger)(true);
const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, codeQL, tmpDir, logger); const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, tmpDir, logger);
t.is(registriesAuthTokens, undefined); t.is(registriesAuthTokens, undefined);
t.is(qlconfigFile, undefined); t.is(qlconfigFile, undefined);
}); });
@@ -1364,12 +1247,8 @@ const calculateAugmentationErrorMacro = ava_1.default.macro({
token: "not-a-token", token: "not-a-token",
}, },
]); ]);
const codeQL = (0, codeql_1.setCodeQL)({
// Accepted CLI versions are 2.10.4 or higher
getVersion: () => Promise.resolve(codeql_1.CODEQL_VERSION_GHES_PACK_DOWNLOAD),
});
const logger = (0, logging_1.getRunnerLogger)(true); const logger = (0, logging_1.getRunnerLogger)(true);
const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, codeQL, tmpDir, logger); const { registriesAuthTokens, qlconfigFile } = await configUtils.generateRegistries(registriesInput, tmpDir, logger);
t.is(registriesAuthTokens, "original"); t.is(registriesAuthTokens, "original");
t.is(qlconfigFile, path.join(tmpDir, "qlconfig.yml")); t.is(qlconfigFile, path.join(tmpDir, "qlconfig.yml"));
}); });
@@ -1456,64 +1335,4 @@ const mockRepositoryNwo = (0, repository_1.parseRepositoryNwo)("owner/repo");
t.deepEqual(mockRequest.called, args.expectedApiCall); t.deepEqual(mockRequest.called, args.expectedApiCall);
}); });
}); });
const ML_POWERED_JS_STATUS_TESTS = [
// If no packs are loaded, status is false.
[[], "false"],
// If another pack is loaded but not the ML-powered query pack, status is false.
[["some-other/pack"], "false"],
// If the ML-powered query pack is loaded with a specific version, status is that version.
[[`${util_1.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.1.0`], "~0.1.0"],
// If the ML-powered query pack is loaded with a specific version and another pack is loaded, the
// status is the version of the ML-powered query pack.
[["some-other/pack", `${util_1.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.1.0`], "~0.1.0"],
// If the ML-powered query pack is loaded without a version, the status is "latest".
[[util_1.ML_POWERED_JS_QUERIES_PACK_NAME], "latest"],
// If the ML-powered query pack is loaded with two different versions, the status is "other".
[
[
`${util_1.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.0.1`,
`${util_1.ML_POWERED_JS_QUERIES_PACK_NAME}@~0.0.2`,
],
"other",
],
// If the ML-powered query pack is loaded with no specific version, and another pack is loaded,
// the status is "latest".
[["some-other/pack", util_1.ML_POWERED_JS_QUERIES_PACK_NAME], "latest"],
];
for (const [packs, expectedStatus] of ML_POWERED_JS_STATUS_TESTS) {
const packDescriptions = `[${packs
.map((pack) => JSON.stringify(pack))
.join(", ")}]`;
(0, ava_1.default)(`ML-powered JS queries status report is "${expectedStatus}" for packs = ${packDescriptions}`, (t) => {
return (0, util_1.withTmpDir)(async (tmpDir) => {
const config = {
languages: [],
queries: {},
paths: [],
pathsIgnore: [],
originalUserInput: {},
tempDir: tmpDir,
codeQLCmd: "",
gitHubVersion: {
type: util_1.GitHubVariant.DOTCOM,
},
dbLocation: "",
packs: {
javascript: packs,
},
debugMode: false,
debugArtifactName: util_1.DEFAULT_DEBUG_ARTIFACT_NAME,
debugDatabaseName: util_1.DEFAULT_DEBUG_DATABASE_NAME,
augmentationProperties: {
injectedMlQueries: false,
packsInputCombines: false,
queriesInputCombines: false,
},
trapCaches: {},
trapCacheDownloadTime: 0,
};
t.is(configUtils.getMlPoweredJsQueriesStatus(config), expectedStatus);
});
});
}
//# sourceMappingURL=config-utils.test.js.map //# sourceMappingURL=config-utils.test.js.map

File diff suppressed because one or more lines are too long

View File

@@ -56,7 +56,7 @@ async function uploadDebugArtifacts(toUpload, rootDir, artifactName) {
core.info("Could not parse user-specified `matrix` input into JSON. The debug artifact will not be named with the user's `matrix` input."); core.info("Could not parse user-specified `matrix` input into JSON. The debug artifact will not be named with the user's `matrix` input.");
} }
} }
await artifact.create().uploadArtifact(sanitizeArifactName(`${artifactName}${suffix}`), toUpload.map((file) => path.normalize(file)), path.normalize(rootDir)); await artifact.create().uploadArtifact(sanitizeArifactName(`${artifactName}${suffix}`), toUpload.map((file) => path.normalize(file)), path.normalize(rootDir), { continueOnError: true });
} }
exports.uploadDebugArtifacts = uploadDebugArtifacts; exports.uploadDebugArtifacts = uploadDebugArtifacts;
async function uploadSarifDebugArtifact(config, outputDir) { async function uploadSarifDebugArtifact(config, outputDir) {

View File

@@ -1 +1 @@
{"version":3,"file":"debug-artifacts.js","sourceRoot":"","sources":["../src/debug-artifacts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,4DAA8C;AAC9C,oDAAsC;AACtC,sDAA6B;AAC7B,8CAAsB;AAEtB,iDAAkD;AAClD,uCAA0C;AAC1C,qCAAqC;AAIrC,iCAKgB;AAEhB,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;AAChD,CAAC;AAFD,kDAEC;AAEM,KAAK,UAAU,oBAAoB,CACxC,QAAkB,EAClB,OAAe,EACf,YAAoB;IAEpB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO;KACR;IACD,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,MAAM,MAAM,GAAG,IAAA,+BAAgB,EAAC,QAAQ,CAAC,CAAC;IAC1C,IAAI,MAAM,EAAE;QACV,IAAI;YACF,KAAK,MAAM,CAAC,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CACxC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAY,CAC9B,CAAC,IAAI,EAAE;gBACN,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;SAC7B;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,I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M,EAAE,QAAQ,CAAC,CAAC;aACtE;YACD,MAAM,oBAAoB,CACxB,CAAC,kBAAkB,CAAC,EACpB,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,iBAAiB,CACzB,CAAC;SACH;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,IAAI,CACP,8CAA8C,MAAM,CAAC,iBAAiB,IAAI,QAAQ,KAAK,KAAK,EAAE,CAC/F,CAAC;SACH;KACF;AACH,CAAC;AA1BD,8EA0BC"}

View File

@@ -1,6 +1,6 @@
{ {
"bundleVersion": "codeql-bundle-v2.14.4", "bundleVersion": "codeql-bundle-v2.14.6",
"cliVersion": "2.14.4", "cliVersion": "2.14.6",
"priorBundleVersion": "codeql-bundle-v2.14.3", "priorBundleVersion": "codeql-bundle-v2.14.5",
"priorCliVersion": "2.14.3" "priorCliVersion": "2.14.5"
} }

31
lib/feature-flags.js generated
View File

@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.logCodeScanningConfigInCli = exports.useCodeScanningConfigInCli = exports.Features = exports.FEATURE_FLAGS_FILE_NAME = exports.featureConfig = exports.Feature = exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = void 0; exports.logCodeScanningConfigInCli = exports.useCodeScanningConfigInCli = exports.Features = exports.FEATURE_FLAGS_FILE_NAME = exports.featureConfig = exports.Feature = exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
const semver = __importStar(require("semver")); const semver = __importStar(require("semver"));
@@ -41,9 +41,14 @@ exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = "2.13.4";
*/ */
exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.14.0"; exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.14.0";
/** /**
* Versions 2.14.0+ of the CodeQL CLI support intra-layer parallelism (aka fine-grained parallelism) options. * Versions 2.14.0+ of the CodeQL CLI support intra-layer parallelism (aka fine-grained parallelism) options, but we
* limit to 2.14.6 onwards, since that's the version that has mitigations against OOM failures.
*/ */
exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.0"; exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.6";
/**
* Versions 2.15.0+ of the CodeQL CLI support sub-language file coverage information.
*/
exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = "2.15.0";
/** /**
* Feature enablement as returned by the GitHub API endpoint. * Feature enablement as returned by the GitHub API endpoint.
* *
@@ -54,12 +59,13 @@ var Feature;
Feature["AnalysisSummaryV2Enabled"] = "analysis_summary_v2_enabled"; Feature["AnalysisSummaryV2Enabled"] = "analysis_summary_v2_enabled";
Feature["CliConfigFileEnabled"] = "cli_config_file_enabled"; Feature["CliConfigFileEnabled"] = "cli_config_file_enabled";
Feature["CodeqlJavaLombokEnabled"] = "codeql_java_lombok_enabled"; Feature["CodeqlJavaLombokEnabled"] = "codeql_java_lombok_enabled";
Feature["CppDependencyInstallation"] = "cpp_dependency_installation_enabled";
Feature["DisableKotlinAnalysisEnabled"] = "disable_kotlin_analysis_enabled"; Feature["DisableKotlinAnalysisEnabled"] = "disable_kotlin_analysis_enabled";
Feature["DisablePythonDependencyInstallationEnabled"] = "disable_python_dependency_installation_enabled"; Feature["DisablePythonDependencyInstallationEnabled"] = "disable_python_dependency_installation_enabled";
Feature["EvaluatorIntraLayerParallelismEnabled"] = "evaluator_intra_layer_parallelism_enabled"; Feature["EvaluatorIntraLayerParallelismEnabled"] = "evaluator_intra_layer_parallelism_enabled";
Feature["ExportDiagnosticsEnabled"] = "export_diagnostics_enabled"; Feature["ExportDiagnosticsEnabled"] = "export_diagnostics_enabled";
Feature["MlPoweredQueriesEnabled"] = "ml_powered_queries_enabled";
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled"; Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
Feature["SublanguageFileCoverageEnabled"] = "sublanguage_file_coverage_enabled";
Feature["UploadFailedSarifEnabled"] = "upload_failed_sarif_enabled"; Feature["UploadFailedSarifEnabled"] = "upload_failed_sarif_enabled";
})(Feature || (exports.Feature = Feature = {})); })(Feature || (exports.Feature = Feature = {}));
exports.featureConfig = { exports.featureConfig = {
@@ -73,6 +79,11 @@ exports.featureConfig = {
minimumVersion: "2.14.0", minimumVersion: "2.14.0",
defaultValue: false, defaultValue: false,
}, },
[Feature.CppDependencyInstallation]: {
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
minimumVersion: "2.15.0",
defaultValue: false,
},
[Feature.DisableKotlinAnalysisEnabled]: { [Feature.DisableKotlinAnalysisEnabled]: {
envVar: "CODEQL_DISABLE_KOTLIN_ANALYSIS", envVar: "CODEQL_DISABLE_KOTLIN_ANALYSIS",
minimumVersion: undefined, minimumVersion: undefined,
@@ -93,16 +104,16 @@ exports.featureConfig = {
minimumVersion: "2.12.4", minimumVersion: "2.12.4",
defaultValue: true, defaultValue: true,
}, },
[Feature.MlPoweredQueriesEnabled]: {
envVar: "CODEQL_ML_POWERED_QUERIES",
minimumVersion: undefined,
defaultValue: false,
},
[Feature.QaTelemetryEnabled]: { [Feature.QaTelemetryEnabled]: {
envVar: "CODEQL_ACTION_QA_TELEMETRY", envVar: "CODEQL_ACTION_QA_TELEMETRY",
minimumVersion: undefined, minimumVersion: undefined,
defaultValue: false, defaultValue: false,
}, },
[Feature.SublanguageFileCoverageEnabled]: {
envVar: "CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE",
minimumVersion: exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE,
defaultValue: false,
},
[Feature.UploadFailedSarifEnabled]: { [Feature.UploadFailedSarifEnabled]: {
envVar: "CODEQL_ACTION_UPLOAD_FAILED_SARIF", envVar: "CODEQL_ACTION_UPLOAD_FAILED_SARIF",
minimumVersion: "2.11.3", minimumVersion: "2.11.3",
@@ -164,7 +175,7 @@ class Features {
return false; return false;
} }
else { else {
this.logger.debug(`CodeQL CLI version ${await codeql.getVersion()} is newer than the minimum ` + this.logger.debug(`CodeQL CLI version ${(await codeql.getVersion()).version} is newer than the minimum ` +
`version ${minimumVersion} for feature ${feature}.`); `version ${minimumVersion} for feature ${feature}.`);
} }
} }

File diff suppressed because one or more lines are too long

View File

@@ -89,7 +89,8 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) {
await (0, util_1.withTmpDir)(async (tmpDir) => { await (0, util_1.withTmpDir)(async (tmpDir) => {
const features = setUpFeatureFlagTests(tmpDir); const features = setUpFeatureFlagTests(tmpDir);
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(500, {}); (0, testing_utils_1.mockFeatureFlagApiEndpoint)(500, {});
await t.throwsAsync(async () => features.getValue(feature_flags_1.Feature.MlPoweredQueriesEnabled, includeCodeQlIfRequired(feature_flags_1.Feature.MlPoweredQueriesEnabled)), { const someFeature = Object.values(feature_flags_1.Feature)[0];
await t.throwsAsync(async () => features.getValue(someFeature, includeCodeQlIfRequired(someFeature)), {
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",
}); });
}); });

File diff suppressed because one or more lines are too long

View File

@@ -88,7 +88,7 @@ const workflow = __importStar(require("./workflow"));
const actionsWorkflow = createTestWorkflow([ const actionsWorkflow = createTestWorkflow([
{ {
name: "Checkout repository", name: "Checkout repository",
uses: "actions/checkout@v3", uses: "actions/checkout@v4",
}, },
{ {
name: "Initialize CodeQL", name: "Initialize CodeQL",
@@ -111,7 +111,7 @@ const workflow = __importStar(require("./workflow"));
const actionsWorkflow = createTestWorkflow([ const actionsWorkflow = createTestWorkflow([
{ {
name: "Checkout repository", name: "Checkout repository",
uses: "actions/checkout@v3", uses: "actions/checkout@v4",
}, },
{ {
name: "Initialize CodeQL", name: "Initialize CodeQL",
@@ -137,7 +137,7 @@ const workflow = __importStar(require("./workflow"));
const actionsWorkflow = createTestWorkflow([ const actionsWorkflow = createTestWorkflow([
{ {
name: "Checkout repository", name: "Checkout repository",
uses: "actions/checkout@v3", uses: "actions/checkout@v4",
}, },
{ {
name: "Initialize CodeQL", name: "Initialize CodeQL",
@@ -190,7 +190,7 @@ for (const { uploadInput, shouldUpload } of UPLOAD_INPUT_TEST_CASES) {
const actionsWorkflow = createTestWorkflow([ const actionsWorkflow = createTestWorkflow([
{ {
name: "Checkout repository", name: "Checkout repository",
uses: "actions/checkout@v3", uses: "actions/checkout@v4",
}, },
{ {
name: "Initialize CodeQL", name: "Initialize CodeQL",
@@ -221,7 +221,7 @@ for (const { uploadInput, shouldUpload } of UPLOAD_INPUT_TEST_CASES) {
const actionsWorkflow = createTestWorkflow([ const actionsWorkflow = createTestWorkflow([
{ {
name: "Checkout repository", name: "Checkout repository",
uses: "actions/checkout@v3", uses: "actions/checkout@v4",
}, },
{ {
name: "Initialize CodeQL", name: "Initialize CodeQL",
@@ -247,7 +247,7 @@ for (const { uploadInput, shouldUpload } of UPLOAD_INPUT_TEST_CASES) {
const actionsWorkflow = createTestWorkflow([ const actionsWorkflow = createTestWorkflow([
{ {
name: "Checkout repository", name: "Checkout repository",
uses: "actions/checkout@v3", uses: "actions/checkout@v4",
}, },
{ {
name: "Initialize CodeQL", name: "Initialize CodeQL",
@@ -274,7 +274,7 @@ for (const { uploadInput, shouldUpload } of UPLOAD_INPUT_TEST_CASES) {
const actionsWorkflow = createTestWorkflow([ const actionsWorkflow = createTestWorkflow([
{ {
name: "Checkout repository", name: "Checkout repository",
uses: "actions/checkout@v3", uses: "actions/checkout@v4",
}, },
]); ]);
const result = await testFailedSarifUpload(t, actionsWorkflow, { const result = await testFailedSarifUpload(t, actionsWorkflow, {

8
lib/init-action.js generated
View File

@@ -28,7 +28,6 @@ const core = __importStar(require("@actions/core"));
const uuid_1 = require("uuid"); const uuid_1 = require("uuid");
const actions_util_1 = require("./actions-util"); const actions_util_1 = require("./actions-util");
const api_client_1 = require("./api-client"); const api_client_1 = require("./api-client");
const config_utils_1 = require("./config-utils");
const environment_1 = require("./environment"); const environment_1 = require("./environment");
const feature_flags_1 = require("./feature-flags"); const feature_flags_1 = require("./feature-flags");
const init_1 = require("./init"); const init_1 = require("./init");
@@ -81,7 +80,6 @@ async function sendCompletedStatusReport(startedAt, config, toolsDownloadDuratio
...initStatusReport, ...initStatusReport,
disable_default_queries: disableDefaultQueries, disable_default_queries: disableDefaultQueries,
languages, languages,
ml_powered_javascript_queries: (0, config_utils_1.getMlPoweredJsQueriesStatus)(config),
paths, paths,
paths_ignore: pathsIgnore, paths_ignore: pathsIgnore,
queries: queries.join(","), queries: queries.join(","),
@@ -121,8 +119,7 @@ async function run() {
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), logger); const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), logger);
core.exportVariable(environment_1.EnvVar.JOB_RUN_UUID, (0, uuid_1.v4)()); core.exportVariable(environment_1.EnvVar.JOB_RUN_UUID, (0, uuid_1.v4)());
try { try {
const workflowErrors = await (0, workflow_1.validateWorkflow)(logger); if (!(await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)("init", "starting", startedAt, await (0, util_1.checkDiskUsage)(logger))))) {
if (!(await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)("init", "starting", startedAt, await (0, util_1.checkDiskUsage)(logger), workflowErrors)))) {
return; return;
} }
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(gitHubVersion.type); const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(gitHubVersion.type);
@@ -132,6 +129,7 @@ async function run() {
toolsDownloadDurationMs = initCodeQLResult.toolsDownloadDurationMs; toolsDownloadDurationMs = initCodeQLResult.toolsDownloadDurationMs;
toolsVersion = initCodeQLResult.toolsVersion; toolsVersion = initCodeQLResult.toolsVersion;
toolsSource = initCodeQLResult.toolsSource; toolsSource = initCodeQLResult.toolsSource;
await (0, workflow_1.validateWorkflow)(codeql, logger);
config = await (0, init_1.initConfig)((0, actions_util_1.getOptionalInput)("languages"), (0, actions_util_1.getOptionalInput)("queries"), (0, actions_util_1.getOptionalInput)("packs"), registriesInput, (0, actions_util_1.getOptionalInput)("config-file"), (0, actions_util_1.getOptionalInput)("db-location"), (0, actions_util_1.getOptionalInput)("config"), getTrapCachingEnabled(), config = await (0, init_1.initConfig)((0, actions_util_1.getOptionalInput)("languages"), (0, actions_util_1.getOptionalInput)("queries"), (0, actions_util_1.getOptionalInput)("packs"), registriesInput, (0, actions_util_1.getOptionalInput)("config-file"), (0, actions_util_1.getOptionalInput)("db-location"), (0, actions_util_1.getOptionalInput)("config"), getTrapCachingEnabled(),
// Debug mode is enabled if: // Debug mode is enabled if:
// - The `init` Action is passed `debug: true`. // - The `init` Action is passed `debug: true`.
@@ -173,7 +171,7 @@ async function run() {
// options at https://codeql.github.com/docs/codeql-cli/manual/database-trace-command/ // options at https://codeql.github.com/docs/codeql-cli/manual/database-trace-command/
// for details. // for details.
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"), logger).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 // Disable Kotlin extractor if feature flag set
if (await features.getValue(feature_flags_1.Feature.DisableKotlinAnalysisEnabled)) { if (await features.getValue(feature_flags_1.Feature.DisableKotlinAnalysisEnabled)) {

File diff suppressed because one or more lines are too long

2
lib/init.js generated
View File

@@ -61,7 +61,7 @@ async function runInit(codeql, config, sourceRoot, processName, registriesInput,
let qlconfigFile; let qlconfigFile;
if (await (0, feature_flags_1.useCodeScanningConfigInCli)(codeql, features)) { if (await (0, feature_flags_1.useCodeScanningConfigInCli)(codeql, features)) {
({ registriesAuthTokens, qlconfigFile } = ({ registriesAuthTokens, qlconfigFile } =
await configUtils.generateRegistries(registriesInput, codeql, config.tempDir, logger)); await configUtils.generateRegistries(registriesInput, config.tempDir, logger));
} }
await configUtils.wrapEnvironment({ await configUtils.wrapEnvironment({
GITHUB_TOKEN: apiDetails.auth, GITHUB_TOKEN: apiDetails.auth,

View File

@@ -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,qCAA+C;AAC/C,4DAA8C;AAC9C,mDAIyB;AAIzB,mDAAwE;AACxE,6CAA+B;AAExB,KAAK,UAAU,UAAU,CAC9B,UAA8B,EAC9B,UAA4B,EAC5B,OAAe,EACf,OAA2B,EAC3B,iBAA2C,EAC3C,MAAc;IAOd,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,EAAE,uBAAuB,EAAE,WAAW,EAAE,YAAY,EAAE,GAClE,MAAM,IAAA,oBAAW,EACf,UAAU,EACV,UAAU,EACV,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,MAAM,EACN,IAAI,CACL,CAAC;IACJ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CC"}

13
lib/languages.js generated
View File

@@ -1,6 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.isScannedLanguage = exports.isTracedLanguage = exports.parseLanguage = exports.resolveAlias = exports.LANGUAGE_ALIASES = exports.Language = void 0; exports.isScannedLanguage = exports.isTracedLanguage = exports.parseLanguage = exports.LANGUAGE_ALIASES = exports.Language = void 0;
// All the languages supported by CodeQL // All the languages supported by CodeQL
var Language; var Language;
(function (Language) { (function (Language) {
@@ -21,18 +21,13 @@ exports.LANGUAGE_ALIASES = {
kotlin: Language.java, kotlin: Language.java,
typescript: Language.javascript, typescript: Language.javascript,
}; };
function resolveAlias(lang) {
return exports.LANGUAGE_ALIASES[lang] || lang;
}
exports.resolveAlias = resolveAlias;
/** /**
* Translate from user input or GitHub's API names for languages to CodeQL's * Translate from user input or GitHub's API names for languages to CodeQL's
* names for languages. This does not translate a language alias to the actual * names for languages.
* language used by CodeQL.
* *
* @param language The language to translate. * @param language The language to translate.
* @returns A language supported by CodeQL, an alias for a language, or * @returns A language supported by CodeQL, an alias for a language, or
* `undefined` if the input language cannot be parsed into a langauge supported * `undefined` if the input language cannot be parsed into a language supported
* by CodeQL. * by CodeQL.
*/ */
function parseLanguage(language) { function parseLanguage(language) {
@@ -45,7 +40,7 @@ function parseLanguage(language) {
// Check language aliases, but return the original language name, // Check language aliases, but return the original language name,
// the alias will be resolved later. // the alias will be resolved later.
if (language in exports.LANGUAGE_ALIASES) { if (language in exports.LANGUAGE_ALIASES) {
return language; return exports.LANGUAGE_ALIASES[language];
} }
return undefined; return undefined;
} }

View File

@@ -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,qCAA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,8CAEC"}

12
lib/languages.test.js generated
View File

@@ -16,14 +16,14 @@ const testing_utils_1 = require("./testing-utils");
t.deepEqual((0, languages_1.parseLanguage)("javascript"), languages_1.Language.javascript); t.deepEqual((0, languages_1.parseLanguage)("javascript"), languages_1.Language.javascript);
t.deepEqual((0, languages_1.parseLanguage)("python"), languages_1.Language.python); t.deepEqual((0, languages_1.parseLanguage)("python"), languages_1.Language.python);
// Aliases // Aliases
t.deepEqual((0, languages_1.parseLanguage)("c"), "c"); t.deepEqual((0, languages_1.parseLanguage)("c"), languages_1.Language.cpp);
t.deepEqual((0, languages_1.parseLanguage)("c++"), "c++"); t.deepEqual((0, languages_1.parseLanguage)("c++"), languages_1.Language.cpp);
t.deepEqual((0, languages_1.parseLanguage)("c#"), "c#"); t.deepEqual((0, languages_1.parseLanguage)("c#"), languages_1.Language.csharp);
t.deepEqual((0, languages_1.parseLanguage)("kotlin"), "kotlin"); t.deepEqual((0, languages_1.parseLanguage)("kotlin"), languages_1.Language.java);
t.deepEqual((0, languages_1.parseLanguage)("typescript"), "typescript"); t.deepEqual((0, languages_1.parseLanguage)("typescript"), languages_1.Language.javascript);
// spaces and case-insensitivity // spaces and case-insensitivity
t.deepEqual((0, languages_1.parseLanguage)(" \t\nCsHaRp\t\t"), languages_1.Language.csharp); t.deepEqual((0, languages_1.parseLanguage)(" \t\nCsHaRp\t\t"), languages_1.Language.csharp);
t.deepEqual((0, languages_1.parseLanguage)(" \t\nkOtLin\t\t"), "kotlin"); t.deepEqual((0, languages_1.parseLanguage)(" \t\nkOtLin\t\t"), languages_1.Language.java);
// 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);

View File

@@ -1 +1 @@
{"version":3,"file":"languages.test.js","sourceRoot":"","sources":["../src/languages.test.ts"],"names":[],"mappings":";;;;;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C,GAAG,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC,KAAK,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5C,CAAC,CAAC,KAAK,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC,KAAK,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,KAAK,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAE3C,CAAC,CAAC,IAAI,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC,IAAI,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC,IAAI,CAAC,IAAA,6BAAiB,EAAC,oBAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3C,CAAC,CAAC,CAAC"}

View File

@@ -38,11 +38,14 @@ const ENVIRONMENT_OUTPUT_NAME = "environment";
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)();
const language = (0, languages_1.resolveAlias)((0, actions_util_1.getRequiredInput)("language"));
try { try {
if (!(await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(ACTION_NAME, "starting", startedAt, await (0, util_1.checkDiskUsage)(logger))))) { if (!(await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(ACTION_NAME, "starting", startedAt, await (0, util_1.checkDiskUsage)(logger))))) {
return; return;
} }
const language = (0, languages_1.parseLanguage)((0, actions_util_1.getRequiredInput)("language"));
if (language === undefined) {
throw new Error(`Did not recognize the language "${(0, actions_util_1.getRequiredInput)("language")}".`);
}
const gitHubVersion = await (0, api_client_1.getGitHubVersion)(); const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger); (0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger);
const config = await configUtils.getConfig((0, actions_util_1.getTemporaryDirectory)(), logger); const config = await configUtils.getConfig((0, actions_util_1.getTemporaryDirectory)(), logger);

View File

@@ -1 +1 @@
{"version":3,"file":"resolve-environment-action.js","sourceRoot":"","sources":["../src/resolve-environment-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAIwB;AACxB,6CAAgD;AAChD,qCAAkD;AAClD,4DAA8C;AAC9C,2CAAqD;AACrD,uCAA6C;AAC7C,+DAAmE;AACnE,mDAIyB;AACzB,iCAKgB;AAEhB,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAC1C,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAE9C,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAClC,MAAM,QAAQ,GAAa,IAAA,wBAAY,EAAC,IAAA,+BAAgB,EAAC,UAAU,CAAC,CAAC,CAAC;IAEtE,IAAI;QACF,IACE,CAAC,CAAC,MAAM,IAAA,gCAAgB,EACtB,MAAM,IAAA,sCAAsB,EAC1B,WAAW,EACX,UAAU,EACV,SAAS,EACT,MAAM,IAAA,qBAAc,EAAC,MAAM,CAAC,CAC7B,CACF,CAAC,EACF;YACA,OAAO;SACR;QAED,MAAM,aAAa,GAAG,MAAM,IAAA,6BAAgB,GAAE,CAAC;QAC/C,IAAA,gCAAyB,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAEjD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,SAAS,CAAC,IAAA,oCAAqB,GAAE,EAAE,MAAM,CAAC,CAAC;QAC5E,IAAI,MAAM,KAAK,SAA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,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KAC7E;IACD,MAAM,IAAA,sBAAe,GAAE,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"} {"version":3,"file":"resolve-environment-action.js","sourceRoot":"","sources":["../src/resolve-environment-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAIwB;AACxB,6CAAgD;AAChD,qCAAkD;AAClD,4DAA8C;AAC9C,2CAAsD;AACtD,uCAA6C;AAC7C,+DAAmE;AACnE,mDAIyB;AACzB,iCAKgB;AAEhB,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAC1C,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAE9C,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAElC,IAAI;QACF,IACE,CAAC,CAAC,MAAM,IAAA,gCAAgB,EACtB,MAAM,IAAA,sCAAsB,EAC1B,WAAW,EACX,UAAU,EACV,SAAS,EACT,MAAM,IAAA,qBAAc,EAAC,MAAM,CAAC,CAC7B,CACF,CAAC,EACF;YACA,OAAO;SACR;QAED,MAAM,QAAQ,GAAyB,IAAA,yBAAa,EAClD,IAAA,+BAAgB,EAAC,UAAU,CAAC,CAC7B,CAAC;QAEF,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,MAAM,IAAI,KAAK,CACb,mCAAmC,IAAA,+BAAgB,EAAC,UAAU,CAAC,IAAI,CACpE,CAAC;SACH;QAED,MAAM,aAAa,GAAG,MAAM,IAAA,6BAAgB,GAAE,CAAC;QAC/C,IAAA,gCAAyB,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAEjD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,SAAS,CAAC,IAAA,oCAAqB,GAAE,EAAE,MAAM,CAAC,CAAC;QAC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GAAG,WAAW,mBAAmB,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KAC7E;IACD,MAAM,IAAA,sBAAe,GAAE,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}

2
lib/status-report.js generated
View File

@@ -118,7 +118,7 @@ async function createStatusReportBase(actionName, status, actionStartedAt, diskI
statusReport.runner_os_release = os.release(); statusReport.runner_os_release = os.release();
} }
if (codeQlCliVersion !== undefined) { if (codeQlCliVersion !== undefined) {
statusReport.codeql_version = codeQlCliVersion; statusReport.codeql_version = codeQlCliVersion.version;
} }
const imageVersion = process.env["ImageVersion"]; const imageVersion = process.env["ImageVersion"];
if (imageVersion) { if (imageVersion) {

View File

@@ -1 +1 @@
{"version":3,"file":"status-report.js","sourceRoot":"","sources":["../src/status-report.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,oDAAsC;AAEtC,iDAQwB;AACxB,6CAA4D;AAC5D,+CAAuC;AACvC,iCAQgB;AAqGhB,SAAgB,gBAAgB,CAC9B,KAAe,EACf,iBAA0B;IAE1B,IAAI,KAAK,IAAI,iBAAiB,EAAE;QAC9B,OAAO,KAAK,YAAY,gBAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;KAC9D;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AATD,4CASC;AAqBD;;;;;;;;GAQG;AACI,KAAK,UAAU,sBAAsB,CAC1C,UAAsB,EACtB,MAAoB,EACpB,eAAqB,EACrB,QAAmB,EACnB,KAAc,EACd,SAAkB;IAElB,MAAM,SAAS,GAAG,IAAA,+BAAgB,EAAC,KAAK,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAC7E,MAAM,GAAG,GAAG,MAAM,IAAA,qBAAM,GAAE,CAAC;IAC3B,MAAM,UAAU,GAAG,OAAO,C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AAE,KAAK,MAAM;wBACjC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,iBAAiB,EACjD;wBACA,IAAI,CAAC,SAAS,CACZ,mFAAmF;4BACjF,yDAAyD;4BACzD,iLAAiL;4BACjL,8JAA8J,CACjK,CAAC;qBACH;yBAAM;wBACL,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,IAAI,eAAe,CAAC,CAAC;qBAC9C;oBACD,OAAO,KAAK,CAAC;gBACf,KAAK,GAAG;oBACN,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;oBAChC,OAAO,KAAK,CAAC;gBACf,KAAK,GAAG;oBACN,+CAA+C;oBAC/C,2EAA2E;oBAC3E,4EAA4E;oBAC5E,IAAI,IAAA,0BAAmB,EAAC,mBAAmB,CAAC,KAAK,wBAAiB,EAAE;wBAClE,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;qBAC9B;yBAAM;wBACL,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;qBAC7B;oBACD,OAAO,IAAI,CAAC;aACf;SACF;QAED,mFAAmF;QACnF,0EAA0E;QAC1E,IAAI,CAAC,KAAK,CACR,wEAAwE,CACzE,CAAC;QACF,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AApED,4CAoEC"} {"version":3,"file":"status-report.js","sourceRoot":"","sources":["../src/status-report.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,oDAAsC;AAEtC,iDAQwB;AACxB,6CAA4D;AAC5D,+CAAuC;AACvC,iCAQgB;AAqGhB,SAAgB,gBAAgB,CAC9B,KAAe,EACf,iBAA0B;IAE1B,IAAI,KAAK,IAAI,iBAAiB,EAAE;QAC9B,OAAO,KAAK,YAAY,gBAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;KAC9D;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AATD,4CAS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QACF,MAAM,MAAM,CAAC,OAAO,CAClB,uDAAuD,EACvD;YACE,KAAK;YACL,IAAI;YACJ,IAAI,EAAE,gBAAgB;SACvB,CACF,CAAC;QAEF,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACf,IAAI,IAAA,kBAAW,EAAC,CAAC,CAAC,EAAE;YAClB,QAAQ,CAAC,CAAC,MAAM,EAAE;gBAChB,KAAK,GAAG;oBACN,IACE,IAAA,mCAAoB,GAAE,KAAK,MAAM;wBACjC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,iBAAiB,EACjD;wBACA,IAAI,CAAC,SAAS,CACZ,mFAAmF;4BACjF,yDAAyD;4BACzD,iLAAiL;4BACjL,8JAA8J,CACjK,CAAC;qBACH;yBAAM;wBACL,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,IAAI,eAAe,CAAC,CAAC;qBAC9C;oBACD,OAAO,KAAK,CAAC;gBACf,KAAK,GAAG;oBACN,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;oBAChC,OAAO,KAAK,CAAC;gBACf,KAAK,GAAG;oBACN,+CAA+C;oBAC/C,2EAA2E;oBAC3E,4EAA4E;oBAC5E,IAAI,IAAA,0BAAmB,EAAC,mBAAmB,CAAC,KAAK,wBAAiB,EAAE;wBAClE,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;qBAC9B;yBAAM;wBACL,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;qBAC7B;oBACD,OAAO,IAAI,CAAC;aACf;SACF;QAED,mFAAmF;QACnF,0EAA0E;QAC1E,IAAI,CAAC,KAAK,CACR,wEAAwE,CACzE,CAAC;QACF,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AApED,4CAoEC"}

11
lib/testing-utils.js generated
View File

@@ -26,7 +26,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.mockBundleDownloadApi = exports.createFeatures = exports.mockCodeQLVersion = exports.mockLanguagesInRepo = exports.mockFeatureFlagApiEndpoint = exports.getRecordingLogger = exports.setupActionsVars = exports.setupTests = exports.SAMPLE_DEFAULT_CLI_VERSION = exports.SAMPLE_DOTCOM_API_DETAILS = void 0; exports.mockBundleDownloadApi = exports.createFeatures = exports.mockCodeQLVersion = exports.makeVersionInfo = exports.mockLanguagesInRepo = exports.mockFeatureFlagApiEndpoint = exports.getRecordingLogger = exports.setupActionsVars = exports.setupTests = exports.SAMPLE_DEFAULT_CLI_VERSION = exports.SAMPLE_DOTCOM_API_DETAILS = void 0;
const node_util_1 = require("node:util"); const node_util_1 = require("node:util");
const path_1 = __importDefault(require("path")); const path_1 = __importDefault(require("path"));
const github = __importStar(require("@actions/github")); const github = __importStar(require("@actions/github"));
@@ -187,10 +187,17 @@ function mockLanguagesInRepo(languages) {
return listLanguages; return listLanguages;
} }
exports.mockLanguagesInRepo = mockLanguagesInRepo; exports.mockLanguagesInRepo = mockLanguagesInRepo;
/**
* Constructs a `VersionInfo` object for testing purposes only.
*/
const makeVersionInfo = (version) => ({
version,
});
exports.makeVersionInfo = makeVersionInfo;
function mockCodeQLVersion(version) { function mockCodeQLVersion(version) {
return { return {
async getVersion() { async getVersion() {
return version; return (0, exports.makeVersionInfo)(version);
}, },
}; };
} }

File diff suppressed because one or more lines are too long

5
lib/trap-caching.js generated
View File

@@ -28,7 +28,6 @@ const fs = __importStar(require("fs"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
const cache = __importStar(require("@actions/cache")); const cache = __importStar(require("@actions/cache"));
const actionsUtil = __importStar(require("./actions-util")); const actionsUtil = __importStar(require("./actions-util"));
const codeql_1 = require("./codeql");
const util_1 = require("./util"); const util_1 = require("./util");
// This constant should be bumped if we make a breaking change // This constant should be bumped if we make a breaking change
// to how the CodeQL Action stores or retrieves the TRAP cache, // to how the CodeQL Action stores or retrieves the TRAP cache,
@@ -133,8 +132,6 @@ async function uploadTrapCaches(codeql, config, logger) {
exports.uploadTrapCaches = uploadTrapCaches; exports.uploadTrapCaches = uploadTrapCaches;
async function getLanguagesSupportingCaching(codeql, languages, logger) { async function getLanguagesSupportingCaching(codeql, languages, logger) {
const result = []; const result = [];
if (!(await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES)))
return result;
const resolveResult = await codeql.betterResolveLanguages(); const resolveResult = await codeql.betterResolveLanguages();
outer: for (const lang of languages) { outer: for (const lang of languages) {
const extractorsForLanguage = resolveResult.extractors[lang]; const extractorsForLanguage = resolveResult.extractors[lang];
@@ -172,6 +169,6 @@ async function cacheKey(codeql, language, baseSha) {
return `${await cachePrefix(codeql, language)}${baseSha}`; return `${await cachePrefix(codeql, language)}${baseSha}`;
} }
async function cachePrefix(codeql, language) { async function cachePrefix(codeql, language) {
return `codeql-trap-${CACHE_VERSION}-${await codeql.getVersion()}-${language}-`; return `codeql-trap-${CACHE_VERSION}-${(await codeql.getVersion()).version}-${language}-`;
} }
//# sourceMappingURL=trap-caching.js.map //# sourceMappingURL=trap-caching.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"trap-caching.js","sourceRoot":"","sources":["../src/trap-caching.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,sDAAwC;AAExC,4DAA8C;AAC9C,qCAA2E;AAI3E,iCAA4E;AAE5E,8DAA8D;AAC9D,+DAA+D;AAC/D,6DAA6D;AAC7D,6DAA6D;AAC7D,2BAA2B;AAC3B,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,6DAA6D;AAC7D,+CAA+C;AAC/C,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAEtC,4DAA4D;AAC5D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,WAAW,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE;YACnD,IAAI,CAAC,CAAC,WAAW,IAAI,gBAAgB,CAAC,EAAE;gBACtC,MAAM,CAAC,IAAI,CACT,GAAG,IAAI,2CAA2C,WAAW,UAAU,CACxE,CAAC;gBACF,SAAS,KAAK,CAAC;aAChB;SACF;QACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACnB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAzCD,sEAyCC;AAEM,KAAK,UAAU,iBAAiB,CACrC,UAA6C,EAC7C,MAAc;IAEd,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAC7B,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CACzC,IAAA,wBAAiB,EAAC,QAAQ,EAAE,MAAM,CAAC,CACpC,CACF,CAAC;IACF,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAC7D,CAAC;AAVD,8CAUC;AAED,KAAK,UAAU,QAAQ,CACrB,MAAc,EACd,QAAkB,EAClB,OAAe;IAEf,OAAO,GAAG,MAAM,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,OAAO,EAAE,CAAC;AAC5D,CAAC;AAED,KAAK,UAAU,WAAW,CACxB,MAAc,EACd,QAAkB;IAElB,OAAO,eAAe,aAAa,IACjC,CAAC,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,OAC9B,IAAI,QAAQ,GAAG,CAAC;AAClB,CAAC"}

View File

@@ -40,7 +40,7 @@ const util = __importStar(require("./util"));
(0, testing_utils_1.setupTests)(ava_1.default); (0, testing_utils_1.setupTests)(ava_1.default);
const stubCodeql = (0, codeql_1.setCodeQL)({ const stubCodeql = (0, codeql_1.setCodeQL)({
async getVersion() { async getVersion() {
return "2.10.3"; return (0, testing_utils_1.makeVersionInfo)("2.10.3");
}, },
async betterResolveLanguages() { async betterResolveLanguages() {
return { return {
@@ -95,7 +95,6 @@ const testConfigWithoutTmpDir = {
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME, debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME, debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
augmentationProperties: { augmentationProperties: {
injectedMlQueries: false,
packsInputCombines: false, packsInputCombines: false,
queriesInputCombines: false, queriesInputCombines: false,
}, },
@@ -120,7 +119,6 @@ function getTestConfigWithTempDir(tmpDir) {
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME, debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME, debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
augmentationProperties: { augmentationProperties: {
injectedMlQueries: false,
packsInputCombines: false, packsInputCombines: false,
queriesInputCombines: false, queriesInputCombines: false,
}, },

File diff suppressed because one or more lines are too long

84
lib/util.js generated
View File

@@ -26,7 +26,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.checkDiskUsage = exports.prettyPrintPack = exports.getMlPoweredJsQueriesPack = exports.ML_POWERED_JS_QUERIES_PACK_NAME = exports.wrapError = exports.fixInvalidNotificationsInFile = exports.fixInvalidNotifications = exports.parseMatrixInput = exports.isHostedRunner = exports.checkForTimeout = exports.withTimeout = exports.tryGetFolderBytes = exports.listFolder = exports.doesDirectoryExist = exports.isInTestMode = exports.supportExpectDiscardedCache = exports.isGoodVersion = exports.delay = exports.bundleDb = exports.codeQlVersionAbove = exports.getCachedCodeQlVersion = exports.cacheCodeQlVersion = exports.isHTTPError = exports.UserError = exports.HTTPError = exports.getRequiredEnvParam = exports.initializeEnvironment = exports.assertNever = exports.apiVersionInRange = exports.DisallowedAPIVersionReason = exports.checkGitHubVersionInRange = exports.GitHubVariant = exports.parseGitHubUrl = exports.getCodeQLDatabasePath = exports.getThreadsFlag = exports.getThreadsFlagValue = exports.getAddSnippetsFlag = exports.getMemoryFlag = exports.getMemoryFlagValue = exports.getMemoryFlagValueForPlatform = exports.withTmpDir = exports.getToolNames = exports.getExtraOptionsEnvParam = exports.DEFAULT_DEBUG_DATABASE_NAME = exports.DEFAULT_DEBUG_ARTIFACT_NAME = exports.GITHUB_DOTCOM_URL = void 0; exports.checkDiskUsage = exports.prettyPrintPack = exports.wrapError = exports.fixInvalidNotificationsInFile = exports.fixInvalidNotifications = exports.parseMatrixInput = exports.isHostedRunner = exports.checkForTimeout = exports.withTimeout = exports.tryGetFolderBytes = exports.listFolder = exports.doesDirectoryExist = exports.isInTestMode = exports.supportExpectDiscardedCache = exports.isGoodVersion = exports.delay = exports.bundleDb = exports.codeQlVersionAbove = exports.getCachedCodeQlVersion = exports.cacheCodeQlVersion = exports.isHTTPError = exports.UserError = exports.HTTPError = exports.getRequiredEnvParam = exports.initializeEnvironment = exports.assertNever = exports.apiVersionInRange = exports.DisallowedAPIVersionReason = exports.checkGitHubVersionInRange = exports.GitHubVariant = exports.parseGitHubUrl = exports.getCodeQLDatabasePath = exports.getThreadsFlag = exports.getThreadsFlagValue = exports.getAddSnippetsFlag = exports.getMemoryFlag = exports.getMemoryFlagValue = exports.getMemoryFlagValueForPlatform = exports.withTmpDir = exports.getToolNames = exports.getExtraOptionsEnvParam = exports.DEFAULT_DEBUG_DATABASE_NAME = exports.DEFAULT_DEBUG_ARTIFACT_NAME = exports.GITHUB_DOTCOM_URL = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const os = __importStar(require("os")); const os = __importStar(require("os"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
@@ -59,6 +59,11 @@ exports.DEFAULT_DEBUG_DATABASE_NAME = "db";
* The default fraction of the total RAM above 8 GB that should be reserved for the system. * The default fraction of the total RAM above 8 GB that should be reserved for the system.
*/ */
const DEFAULT_RESERVED_RAM_SCALING_FACTOR = 0.05; const DEFAULT_RESERVED_RAM_SCALING_FACTOR = 0.05;
/**
* The minimum amount of memory imposed by a cgroup limit that we will consider. Memory limits below
* this amount are ignored.
*/
const MINIMUM_CGROUP_MEMORY_LIMIT_BYTES = 1024 * 1024;
/** /**
* Get the extra options for the codeql commands. * Get the extra options for the codeql commands.
*/ */
@@ -148,6 +153,54 @@ function getMemoryFlagValueForPlatform(userInput, totalMemoryBytes, platform) {
return Math.floor(memoryToUseMegaBytes); return Math.floor(memoryToUseMegaBytes);
} }
exports.getMemoryFlagValueForPlatform = getMemoryFlagValueForPlatform; exports.getMemoryFlagValueForPlatform = getMemoryFlagValueForPlatform;
/**
* Get the total amount of memory available to the Action, taking into account constraints imposed
* by cgroups on Linux.
*/
function getTotalMemoryBytes(logger) {
const limits = [os.totalmem()];
if (os.platform() === "linux") {
limits.push(...[
"/sys/fs/cgroup/memory/memory.limit_in_bytes",
"/sys/fs/cgroup/memory.max",
]
.map((file) => getCgroupMemoryLimitBytes(file, logger))
.filter((limit) => limit !== undefined)
.map((limit) => limit));
}
const limit = Math.min(...limits);
logger.debug(`While resolving RAM, determined that the total memory available to the Action is ${limit / (1024 * 1024)} MiB.`);
return limit;
}
/**
* Gets the number of bytes of available memory specified by the cgroup limit file at the given path.
*
* May be greater than the total memory reported by the operating system if there is no cgroup limit.
*/
function getCgroupMemoryLimitBytes(limitFile, logger) {
if (!fs.existsSync(limitFile)) {
logger.debug(`While resolving RAM, did not find a cgroup memory limit at ${limitFile}.`);
return undefined;
}
const limit = Number(fs.readFileSync(limitFile, "utf8"));
if (!Number.isInteger(limit)) {
logger.debug(`While resolving RAM, ignored the file ${limitFile} that may contain a cgroup memory limit ` +
"as this file did not contain an integer.");
return undefined;
}
const displayLimit = `${Math.floor(limit / (1024 * 1024))} MiB`;
if (limit > os.totalmem()) {
logger.debug(`While resolving RAM, ignored the file ${limitFile} that may contain a cgroup memory limit as ` +
`its contents ${displayLimit} were greater than the total amount of system memory.`);
return undefined;
}
if (limit < MINIMUM_CGROUP_MEMORY_LIMIT_BYTES) {
logger.info(`While resolving RAM, ignored a cgroup limit of ${displayLimit} in ${limitFile} as it was below ${MINIMUM_CGROUP_MEMORY_LIMIT_BYTES / (1024 * 1024)} MiB.`);
return undefined;
}
logger.info(`While resolving RAM, found a cgroup limit of ${displayLimit} in ${limitFile}.`);
return limit;
}
/** /**
* Get the value of the codeql `--ram` flag as configured by the `ram` input. * Get the value of the codeql `--ram` flag as configured by the `ram` input.
* If no value was specified, the total available memory will be used minus a * If no value was specified, the total available memory will be used minus a
@@ -155,8 +208,8 @@ exports.getMemoryFlagValueForPlatform = getMemoryFlagValueForPlatform;
* *
* @returns {number} the amount of RAM to use, in megabytes * @returns {number} the amount of RAM to use, in megabytes
*/ */
function getMemoryFlagValue(userInput) { function getMemoryFlagValue(userInput, logger) {
return getMemoryFlagValueForPlatform(userInput, os.totalmem(), process.platform); return getMemoryFlagValueForPlatform(userInput, getTotalMemoryBytes(logger), process.platform);
} }
exports.getMemoryFlagValue = getMemoryFlagValue; exports.getMemoryFlagValue = getMemoryFlagValue;
/** /**
@@ -166,8 +219,8 @@ exports.getMemoryFlagValue = getMemoryFlagValue;
* *
* @returns string * @returns string
*/ */
function getMemoryFlag(userInput) { function getMemoryFlag(userInput, logger) {
const megabytes = getMemoryFlagValue(userInput); const megabytes = getMemoryFlagValue(userInput, logger);
return `--ram=${megabytes}`; return `--ram=${megabytes}`;
} }
exports.getMemoryFlag = getMemoryFlag; exports.getMemoryFlag = getMemoryFlag;
@@ -388,7 +441,7 @@ function getCachedCodeQlVersion() {
} }
exports.getCachedCodeQlVersion = getCachedCodeQlVersion; exports.getCachedCodeQlVersion = getCachedCodeQlVersion;
async function codeQlVersionAbove(codeql, requiredVersion) { async function codeQlVersionAbove(codeql, requiredVersion) {
return semver.gte(await codeql.getVersion(), requiredVersion); return semver.gte((await codeql.getVersion()).version, requiredVersion);
} }
exports.codeQlVersionAbove = codeQlVersionAbove; exports.codeQlVersionAbove = codeQlVersionAbove;
// Create a bundle for the given DB, if it doesn't already exist // Create a bundle for the given DB, if it doesn't already exist
@@ -666,25 +719,6 @@ function wrapError(error) {
return error instanceof Error ? error : new Error(String(error)); return error instanceof Error ? error : new Error(String(error));
} }
exports.wrapError = wrapError; exports.wrapError = wrapError;
exports.ML_POWERED_JS_QUERIES_PACK_NAME = "codeql/javascript-experimental-atm-queries";
/**
* Gets the ML-powered JS query pack to add to the analysis if a repo is opted into the ML-powered
* queries beta.
*/
async function getMlPoweredJsQueriesPack(codeQL) {
let version;
if (await codeQlVersionAbove(codeQL, "2.11.3")) {
version = "~0.4.0";
}
else {
version = `~0.3.0`;
}
return prettyPrintPack({
name: exports.ML_POWERED_JS_QUERIES_PACK_NAME,
version,
});
}
exports.getMlPoweredJsQueriesPack = getMlPoweredJsQueriesPack;
function prettyPrintPack(pack) { function prettyPrintPack(pack) {
return `${pack.name}${pack.version ? `@${pack.version}` : ""}${pack.path ? `:${pack.path}` : ""}`; return `${pack.name}${pack.version ? `@${pack.version}` : ""}${pack.path ? `:${pack.path}` : ""}`;
} }

File diff suppressed because one or more lines are too long

2
lib/util.test.js generated
View File

@@ -97,7 +97,7 @@ for (const { input, totalMemoryMb, platform, expectedMemoryValue, reservedPercen
} }
(0, ava_1.default)("getMemoryFlag() throws if the ram input is < 0 or NaN", async (t) => { (0, ava_1.default)("getMemoryFlag() throws if the ram input is < 0 or NaN", async (t) => {
for (const input of ["-1", "hello!"]) { for (const input of ["-1", "hello!"]) {
t.throws(() => util.getMemoryFlag(input)); t.throws(() => util.getMemoryFlag(input, (0, logging_1.getRunnerLogger)(true)));
} }
}); });
(0, ava_1.default)("getAddSnippetsFlag() should return the correct flag", (t) => { (0, ava_1.default)("getAddSnippetsFlag() should return the correct flag", (t) => {

File diff suppressed because one or more lines are too long

52
lib/workflow.js generated
View File

@@ -78,11 +78,57 @@ exports.WorkflowErrors = toCodedErrors({
MissingPushHook: `Please specify an on.push hook to analyze and see code scanning alerts from the default branch on the Security tab.`, MissingPushHook: `Please specify an on.push hook to analyze and see code scanning alerts from the default branch on the Security tab.`,
CheckoutWrongHead: `git checkout HEAD^2 is no longer necessary. Please remove this step as Code Scanning recommends analyzing the merge commit for best results.`, CheckoutWrongHead: `git checkout HEAD^2 is no longer necessary. Please remove this step as Code Scanning recommends analyzing the merge commit for best results.`,
}); });
function getWorkflowErrors(doc) { /**
* Groups the given list of CodeQL languages by their extractor name.
*
* Resolves to `undefined` if the CodeQL version does not support language aliasing.
*/
async function groupLanguagesByExtractor(languages, codeql) {
const resolveResult = await codeql.betterResolveLanguages();
if (!resolveResult.aliases) {
return undefined;
}
const aliases = resolveResult.aliases;
const languagesByExtractor = {};
for (const language of languages) {
const extractorName = aliases[language] || language;
if (!languagesByExtractor[extractorName]) {
languagesByExtractor[extractorName] = [];
}
languagesByExtractor[extractorName].push(language);
}
return languagesByExtractor;
}
async function getWorkflowErrors(doc, codeql) {
const errors = []; const errors = [];
const jobName = process.env.GITHUB_JOB; const jobName = process.env.GITHUB_JOB;
if (jobName) { if (jobName) {
const job = doc?.jobs?.[jobName]; const job = doc?.jobs?.[jobName];
if (job?.strategy?.matrix?.language) {
const matrixLanguages = job.strategy.matrix.language;
if (Array.isArray(matrixLanguages)) {
// Map extractors to entries in the `language` matrix parameter. This will allow us to
// detect languages which are analyzed in more than one job.
const matrixLanguagesByExtractor = await groupLanguagesByExtractor(matrixLanguages, codeql);
// If the CodeQL version does not support language aliasing, then `matrixLanguagesByExtractor`
// will be `undefined`. In this case, we cannot detect duplicate languages in the matrix.
if (matrixLanguagesByExtractor !== undefined) {
// Check for duplicate languages in the matrix
for (const [extractor, languages] of Object.entries(matrixLanguagesByExtractor)) {
if (languages.length > 1) {
errors.push({
message: `CodeQL language '${extractor}' is referenced by more than one entry in the ` +
`'language' matrix parameter for job '${jobName}'. This may result in duplicate alerts. ` +
`Please edit the 'language' matrix parameter to keep only one of the following: ${languages
.map((language) => `'${language}'`)
.join(", ")}.`,
code: "DuplicateLanguageInMatrix",
});
}
}
}
}
}
const steps = job?.steps; const steps = job?.steps;
if (Array.isArray(steps)) { if (Array.isArray(steps)) {
for (const step of steps) { for (const step of steps) {
@@ -127,7 +173,7 @@ function getWorkflowErrors(doc) {
return errors; return errors;
} }
exports.getWorkflowErrors = getWorkflowErrors; exports.getWorkflowErrors = getWorkflowErrors;
async function validateWorkflow(logger) { async function validateWorkflow(codeql, logger) {
let workflow; let workflow;
try { try {
workflow = await getWorkflow(logger); workflow = await getWorkflow(logger);
@@ -137,7 +183,7 @@ async function validateWorkflow(logger) {
} }
let workflowErrors; let workflowErrors;
try { try {
workflowErrors = getWorkflowErrors(workflow); workflowErrors = await getWorkflowErrors(workflow, codeql);
} }
catch (e) { catch (e) {
return `error: getWorkflowErrors() failed: ${String(e)}`; return `error: getWorkflowErrors() failed: ${String(e)}`;

File diff suppressed because one or more lines are too long

240
lib/workflow.test.js generated
View File

@@ -28,119 +28,114 @@ 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 yaml = __importStar(require("js-yaml")); const yaml = __importStar(require("js-yaml"));
const sinon = __importStar(require("sinon"));
const codeql_1 = require("./codeql");
const testing_utils_1 = require("./testing-utils"); const testing_utils_1 = require("./testing-utils");
const workflow_1 = require("./workflow"); const workflow_1 = require("./workflow");
function errorCodes(actual, expected) { function errorCodes(actual, expected) {
return [actual.map(({ code }) => code), expected.map(({ code }) => code)]; return [actual.map(({ code }) => code), expected.map(({ code }) => code)];
} }
(0, testing_utils_1.setupTests)(ava_1.default); (0, testing_utils_1.setupTests)(ava_1.default);
(0, ava_1.default)("getWorkflowErrors() when on is empty", (t) => { (0, ava_1.default)("getWorkflowErrors() when on is empty", async (t) => {
const errors = (0, workflow_1.getWorkflowErrors)({ on: {} }); const errors = await (0, workflow_1.getWorkflowErrors)({ on: {} }, await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [])); t.deepEqual(...errorCodes(errors, []));
}); });
(0, ava_1.default)("getWorkflowErrors() when on.push is an array missing pull_request", (t) => { (0, ava_1.default)("getWorkflowErrors() when on.push is an array missing pull_request", async (t) => {
const errors = (0, workflow_1.getWorkflowErrors)({ on: ["push"] }); const errors = await (0, workflow_1.getWorkflowErrors)({ on: ["push"] }, await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [])); t.deepEqual(...errorCodes(errors, []));
}); });
(0, ava_1.default)("getWorkflowErrors() when on.push is an array missing push", (t) => { (0, ava_1.default)("getWorkflowErrors() when on.push is an array missing push", async (t) => {
const errors = (0, workflow_1.getWorkflowErrors)({ on: ["pull_request"] }); const errors = await (0, workflow_1.getWorkflowErrors)({ on: ["pull_request"] }, await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [workflow_1.WorkflowErrors.MissingPushHook])); t.deepEqual(...errorCodes(errors, [workflow_1.WorkflowErrors.MissingPushHook]));
}); });
(0, ava_1.default)("getWorkflowErrors() when on.push is valid", (t) => { (0, ava_1.default)("getWorkflowErrors() when on.push is valid", async (t) => {
const errors = (0, workflow_1.getWorkflowErrors)({ const errors = await (0, workflow_1.getWorkflowErrors)({
on: ["push", "pull_request"], on: ["push", "pull_request"],
}); }, await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [])); t.deepEqual(...errorCodes(errors, []));
}); });
(0, ava_1.default)("getWorkflowErrors() when on.push is a valid superset", (t) => { (0, ava_1.default)("getWorkflowErrors() when on.push is a valid superset", async (t) => {
const errors = (0, workflow_1.getWorkflowErrors)({ const errors = await (0, workflow_1.getWorkflowErrors)({
on: ["push", "pull_request", "schedule"], on: ["push", "pull_request", "schedule"],
}); }, await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [])); t.deepEqual(...errorCodes(errors, []));
}); });
(0, ava_1.default)("getWorkflowErrors() when on.push is a correct object", (t) => { (0, ava_1.default)("getWorkflowErrors() when on.push is a correct object", async (t) => {
const errors = (0, workflow_1.getWorkflowErrors)({ const errors = await (0, workflow_1.getWorkflowErrors)({
on: { push: { branches: ["main"] }, pull_request: { branches: ["main"] } }, on: {
}); push: { branches: ["main"] },
pull_request: { branches: ["main"] },
},
}, await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [])); t.deepEqual(...errorCodes(errors, []));
}); });
(0, ava_1.default)("getWorkflowErrors() when on.pull_requests is a string and correct", (t) => { (0, ava_1.default)("getWorkflowErrors() when on.pull_requests is a string and correct", async (t) => {
const errors = (0, workflow_1.getWorkflowErrors)({ const errors = await (0, workflow_1.getWorkflowErrors)({
on: { push: { branches: "*" }, pull_request: { branches: "*" } }, on: { push: { branches: "*" }, pull_request: { branches: "*" } },
}); }, await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [])); t.deepEqual(...errorCodes(errors, []));
}); });
(0, ava_1.default)("getWorkflowErrors() when on.push is correct with empty objects", (t) => { (0, ava_1.default)("getWorkflowErrors() when on.push is correct with empty objects", async (t) => {
const errors = (0, workflow_1.getWorkflowErrors)(yaml.load(` const errors = await (0, workflow_1.getWorkflowErrors)(yaml.load(`
on: on:
push: push:
pull_request: pull_request:
`)); `), await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [])); t.deepEqual(...errorCodes(errors, []));
}); });
(0, ava_1.default)("getWorkflowErrors() when on.push is not mismatched", (t) => { (0, ava_1.default)("getWorkflowErrors() when on.push is not mismatched", async (t) => {
const errors = (0, workflow_1.getWorkflowErrors)({ const errors = await (0, workflow_1.getWorkflowErrors)({
on: { on: {
push: { branches: ["main", "feature"] }, push: { branches: ["main", "feature"] },
pull_request: { branches: ["main"] }, pull_request: { branches: ["main"] },
}, },
}); }, await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [])); t.deepEqual(...errorCodes(errors, []));
}); });
(0, ava_1.default)("getWorkflowErrors() for a range of malformed workflows", (t) => { (0, ava_1.default)("getWorkflowErrors() for a range of malformed workflows", async (t) => {
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)({ t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
on: { on: {
push: 1, push: 1,
pull_request: 1, pull_request: 1,
}, },
}), [])); }, await (0, codeql_1.getCodeQLForTesting)()), []));
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)({ t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
on: 1, on: 1,
}), [])); }, await (0, codeql_1.getCodeQLForTesting)()), []));
t.deepEqual(...errorCodes( t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
(0, workflow_1.getWorkflowErrors)({
on: 1, on: 1,
jobs: 1, jobs: 1,
}), [])); }, await (0, codeql_1.getCodeQLForTesting)()), []));
t.deepEqual(...errorCodes( t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
(0, workflow_1.getWorkflowErrors)({
on: 1, on: 1,
jobs: [1], jobs: [1],
}), [])); }, await (0, codeql_1.getCodeQLForTesting)()), []));
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)({ t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
on: 1, on: 1,
jobs: { 1: 1 }, jobs: { 1: 1 },
}), [])); }, await (0, codeql_1.getCodeQLForTesting)()), []));
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)({ t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
on: 1, on: 1,
jobs: { test: 1 }, jobs: { test: 1 },
}), [])); }, await (0, codeql_1.getCodeQLForTesting)()), []));
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)({ t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
on: 1, on: 1,
jobs: { test: [1] }, jobs: { test: [1] },
}), [])); }, await (0, codeql_1.getCodeQLForTesting)()), []));
t.deepEqual(...errorCodes( t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
(0, workflow_1.getWorkflowErrors)({
on: 1, on: 1,
jobs: { test: { steps: 1 } }, jobs: { test: { steps: 1 } },
}), [])); }, await (0, codeql_1.getCodeQLForTesting)()), []));
t.deepEqual(...errorCodes( t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
(0, workflow_1.getWorkflowErrors)({
on: 1, on: 1,
jobs: { test: { steps: [{ notrun: "git checkout HEAD^2" }] } }, jobs: { test: { steps: [{ notrun: "git checkout HEAD^2" }] } },
}), [])); }, await (0, codeql_1.getCodeQLForTesting)()), []));
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)({ t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
on: 1, on: 1,
jobs: { test: [undefined] }, jobs: { test: [undefined] },
}), [])); }, await (0, codeql_1.getCodeQLForTesting)()), []));
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)(1), [])); t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)(1, await (0, codeql_1.getCodeQLForTesting)()), []));
t.deepEqual(...errorCodes( t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)({
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
(0, workflow_1.getWorkflowErrors)({
on: { on: {
push: { push: {
branches: 1, branches: 1,
@@ -149,25 +144,86 @@ function errorCodes(actual, expected) {
branches: 1, branches: 1,
}, },
}, },
}), [])); }, await (0, codeql_1.getCodeQLForTesting)()), []));
}); });
(0, ava_1.default)("getWorkflowErrors() when on.pull_request for wildcard branches", (t) => { (0, ava_1.default)("getWorkflowErrors() when on.pull_request for wildcard branches", async (t) => {
const errors = (0, workflow_1.getWorkflowErrors)({ const errors = await (0, workflow_1.getWorkflowErrors)({
on: { on: {
push: { branches: ["feature/*"] }, push: { branches: ["feature/*"] },
pull_request: { branches: "feature/moose" }, pull_request: { branches: "feature/moose" },
}, },
}); }, await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [])); t.deepEqual(...errorCodes(errors, []));
}); });
(0, ava_1.default)("getWorkflowErrors() when HEAD^2 is checked out", (t) => { (0, ava_1.default)("getWorkflowErrors() when HEAD^2 is checked out", async (t) => {
process.env.GITHUB_JOB = "test"; process.env.GITHUB_JOB = "test";
const errors = (0, workflow_1.getWorkflowErrors)({ const errors = await (0, workflow_1.getWorkflowErrors)({
on: ["push", "pull_request"], on: ["push", "pull_request"],
jobs: { test: { steps: [{ run: "git checkout HEAD^2" }] } }, jobs: { test: { steps: [{ run: "git checkout HEAD^2" }] } },
}); }, await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [workflow_1.WorkflowErrors.CheckoutWrongHead])); t.deepEqual(...errorCodes(errors, [workflow_1.WorkflowErrors.CheckoutWrongHead]));
}); });
(0, ava_1.default)("getWorkflowErrors() produces an error for workflow with language name and its alias", async (t) => {
await testLanguageAliases(t, ["java", "kotlin"], { java: ["java-kotlin", "kotlin"] }, [
"CodeQL language 'java' is referenced by more than one entry in the 'language' matrix " +
"parameter for job 'test'. This may result in duplicate alerts. Please edit the 'language' " +
"matrix parameter to keep only one of the following: 'java', 'kotlin'.",
]);
});
(0, ava_1.default)("getWorkflowErrors() produces an error for workflow with two aliases same language", async (t) => {
await testLanguageAliases(t, ["java-kotlin", "kotlin"], { java: ["java-kotlin", "kotlin"] }, [
"CodeQL language 'java' is referenced by more than one entry in the 'language' matrix " +
"parameter for job 'test'. This may result in duplicate alerts. Please edit the 'language' " +
"matrix parameter to keep only one of the following: 'java-kotlin', 'kotlin'.",
]);
});
(0, ava_1.default)("getWorkflowErrors() does not produce an error for workflow with two distinct languages", async (t) => {
await testLanguageAliases(t, ["java", "typescript"], {
java: ["java-kotlin", "kotlin"],
javascript: ["javascript-typescript", "typescript"],
}, []);
});
(0, ava_1.default)("getWorkflowErrors() does not produce an error if codeql doesn't support language aliases", async (t) => {
await testLanguageAliases(t, ["java-kotlin", "kotlin"], undefined, []);
});
async function testLanguageAliases(t, matrixLanguages, aliases, expectedErrorMessages) {
process.env.GITHUB_JOB = "test";
const codeql = await (0, codeql_1.getCodeQLForTesting)();
sinon.stub(codeql, "betterResolveLanguages").resolves({
aliases: aliases !== undefined
? // Remap from languageName -> aliases to alias -> languageName
Object.assign({}, ...Object.entries(aliases).flatMap(([language, languageAliases]) => languageAliases.map((alias) => ({
[alias]: language,
}))))
: undefined,
extractors: {
java: [
{
extractor_root: "",
},
],
},
});
const errors = await (0, workflow_1.getWorkflowErrors)({
on: ["push", "pull_request"],
jobs: {
test: {
strategy: {
matrix: {
language: matrixLanguages,
},
},
steps: [
{ uses: "actions/checkout@v2" },
{ uses: "github/codeql-action/init@v2" },
{ uses: "github/codeql-action/analyze@v2" },
],
},
},
}, codeql);
t.is(errors.length, expectedErrorMessages.length);
t.deepEqual(errors.map((e) => e.message), expectedErrorMessages);
}
(0, ava_1.default)("formatWorkflowErrors() when there is one error", (t) => { (0, ava_1.default)("formatWorkflowErrors() when there is one error", (t) => {
const message = (0, workflow_1.formatWorkflowErrors)([workflow_1.WorkflowErrors.CheckoutWrongHead]); const message = (0, workflow_1.formatWorkflowErrors)([workflow_1.WorkflowErrors.CheckoutWrongHead]);
t.true(message.startsWith("1 issue was detected with this workflow:")); t.true(message.startsWith("1 issue was detected with this workflow:"));
@@ -213,19 +269,19 @@ function errorCodes(actual, expected) {
t.true((0, workflow_1.patternIsSuperset)("/robin/*/release/*", "/robin/moose/release/goose")); t.true((0, workflow_1.patternIsSuperset)("/robin/*/release/*", "/robin/moose/release/goose"));
t.false((0, workflow_1.patternIsSuperset)("/robin/moose/release/goose", "/robin/*/release/*")); t.false((0, workflow_1.patternIsSuperset)("/robin/moose/release/goose", "/robin/*/release/*"));
}); });
(0, ava_1.default)("getWorkflowErrors() when branches contain dots", (t) => { (0, ava_1.default)("getWorkflowErrors() when branches contain dots", async (t) => {
const errors = (0, workflow_1.getWorkflowErrors)(yaml.load(` const errors = await (0, workflow_1.getWorkflowErrors)(yaml.load(`
on: on:
push: push:
branches: [4.1, master] branches: [4.1, master]
pull_request: pull_request:
# The branches below must be a subset of the branches above # The branches below must be a subset of the branches above
branches: [4.1, master] branches: [4.1, master]
`)); `), await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [])); t.deepEqual(...errorCodes(errors, []));
}); });
(0, ava_1.default)("getWorkflowErrors() when on.push has a trailing comma", (t) => { (0, ava_1.default)("getWorkflowErrors() when on.push has a trailing comma", async (t) => {
const errors = (0, workflow_1.getWorkflowErrors)(yaml.load(` const errors = await (0, workflow_1.getWorkflowErrors)(yaml.load(`
name: "CodeQL" name: "CodeQL"
on: on:
push: push:
@@ -233,12 +289,12 @@ function errorCodes(actual, expected) {
pull_request: pull_request:
# The branches below must be a subset of the branches above # The branches below must be a subset of the branches above
branches: [master] branches: [master]
`)); `), await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [])); t.deepEqual(...errorCodes(errors, []));
}); });
(0, ava_1.default)("getWorkflowErrors() should only report the current job's CheckoutWrongHead", (t) => { (0, ava_1.default)("getWorkflowErrors() should only report the current job's CheckoutWrongHead", async (t) => {
process.env.GITHUB_JOB = "test"; process.env.GITHUB_JOB = "test";
const errors = (0, workflow_1.getWorkflowErrors)(yaml.load(` const errors = await (0, workflow_1.getWorkflowErrors)(yaml.load(`
name: "CodeQL" name: "CodeQL"
on: on:
push: push:
@@ -257,12 +313,12 @@ function errorCodes(actual, expected) {
test3: test3:
steps: [] steps: []
`)); `), await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [workflow_1.WorkflowErrors.CheckoutWrongHead])); t.deepEqual(...errorCodes(errors, [workflow_1.WorkflowErrors.CheckoutWrongHead]));
}); });
(0, ava_1.default)("getWorkflowErrors() should not report a different job's CheckoutWrongHead", (t) => { (0, ava_1.default)("getWorkflowErrors() should not report a different job's CheckoutWrongHead", async (t) => {
process.env.GITHUB_JOB = "test3"; process.env.GITHUB_JOB = "test3";
const errors = (0, workflow_1.getWorkflowErrors)(yaml.load(` const errors = await (0, workflow_1.getWorkflowErrors)(yaml.load(`
name: "CodeQL" name: "CodeQL"
on: on:
push: push:
@@ -281,41 +337,41 @@ function errorCodes(actual, expected) {
test3: test3:
steps: [] steps: []
`)); `), await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [])); t.deepEqual(...errorCodes(errors, []));
}); });
(0, ava_1.default)("getWorkflowErrors() when on is missing", (t) => { (0, ava_1.default)("getWorkflowErrors() when on is missing", async (t) => {
const errors = (0, workflow_1.getWorkflowErrors)(yaml.load(` const errors = await (0, workflow_1.getWorkflowErrors)(yaml.load(`
name: "CodeQL" name: "CodeQL"
`)); `), await (0, codeql_1.getCodeQLForTesting)());
t.deepEqual(...errorCodes(errors, [])); t.deepEqual(...errorCodes(errors, []));
}); });
(0, ava_1.default)("getWorkflowErrors() with a different on setup", (t) => { (0, ava_1.default)("getWorkflowErrors() with a different on setup", async (t) => {
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)(yaml.load(` t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)(yaml.load(`
name: "CodeQL" name: "CodeQL"
on: "workflow_dispatch" on: "workflow_dispatch"
`)), [])); `), await (0, codeql_1.getCodeQLForTesting)()), []));
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)(yaml.load(` t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)(yaml.load(`
name: "CodeQL" name: "CodeQL"
on: [workflow_dispatch] on: [workflow_dispatch]
`)), [])); `), await (0, codeql_1.getCodeQLForTesting)()), []));
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)(yaml.load(` t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)(yaml.load(`
name: "CodeQL" name: "CodeQL"
on: on:
workflow_dispatch: {} workflow_dispatch: {}
`)), [])); `), await (0, codeql_1.getCodeQLForTesting)()), []));
}); });
(0, ava_1.default)("getWorkflowErrors() should not report an error if PRs are totally unconfigured", (t) => { (0, ava_1.default)("getWorkflowErrors() should not report an error if PRs are totally unconfigured", async (t) => {
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)(yaml.load(` t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)(yaml.load(`
name: "CodeQL" name: "CodeQL"
on: on:
push: push:
branches: [master] branches: [master]
`)), [])); `), await (0, codeql_1.getCodeQLForTesting)()), []));
t.deepEqual(...errorCodes((0, workflow_1.getWorkflowErrors)(yaml.load(` t.deepEqual(...errorCodes(await (0, workflow_1.getWorkflowErrors)(yaml.load(`
name: "CodeQL" name: "CodeQL"
on: ["push"] on: ["push"]
`)), [])); `), await (0, codeql_1.getCodeQLForTesting)()), []));
}); });
(0, ava_1.default)("getCategoryInputOrThrow returns category for simple workflow with category", (t) => { (0, ava_1.default)("getCategoryInputOrThrow returns category for simple workflow with category", (t) => {
process.env["GITHUB_REPOSITORY"] = "github/codeql-action-fake-repository"; process.env["GITHUB_REPOSITORY"] = "github/codeql-action-fake-repository";

File diff suppressed because one or more lines are too long

271
node_modules/.package-lock.json generated vendored
View File

@@ -1,6 +1,6 @@
{ {
"name": "codeql", "name": "codeql",
"version": "2.21.7", "version": "2.22.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
@@ -14,9 +14,9 @@
} }
}, },
"node_modules/@actions/artifact": { "node_modules/@actions/artifact": {
"version": "1.1.1", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-1.1.2.tgz",
"integrity": "sha512-Vv4y0EW0ptEkU+Pjs5RGS/0EryTvI6s79LjSV9Gg/h+O3H/ddpjhuX/Bi/HZE4pbNPyjGtQjbdFWphkZhmgabA==", "integrity": "sha512-1gLONA4xw3/Q/9vGxKwkFdV9u1LE2RWGx/IpAqg28ZjprCnJFjwn4pA7LtShqg5mg5WhMek2fjpyH1leCmOlQQ==",
"dependencies": { "dependencies": {
"@actions/core": "^1.9.1", "@actions/core": "^1.9.1",
"@actions/http-client": "^2.0.1", "@actions/http-client": "^2.0.1",
@@ -59,9 +59,9 @@
} }
}, },
"node_modules/@actions/core": { "node_modules/@actions/core": {
"version": "1.10.0", "version": "1.10.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.1.tgz",
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", "integrity": "sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==",
"dependencies": { "dependencies": {
"@actions/http-client": "^2.0.1", "@actions/http-client": "^2.0.1",
"uuid": "^8.3.2" "uuid": "^8.3.2"
@@ -448,9 +448,9 @@
} }
}, },
"node_modules/@eslint/js": { "node_modules/@eslint/js": {
"version": "8.48.0", "version": "8.50.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.48.0.tgz", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz",
"integrity": "sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==", "integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -463,9 +463,9 @@
"dev": true "dev": true
}, },
"node_modules/@humanwhocodes/config-array": { "node_modules/@humanwhocodes/config-array": {
"version": "0.11.10", "version": "0.11.11",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz",
"integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@humanwhocodes/object-schema": "^1.2.1", "@humanwhocodes/object-schema": "^1.2.1",
@@ -762,13 +762,18 @@
} }
}, },
"node_modules/@octokit/types": { "node_modules/@octokit/types": {
"version": "11.1.0", "version": "12.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-11.1.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.0.0.tgz",
"integrity": "sha512-Fz0+7GyLm/bHt8fwEqgvRBWwIV1S6wRRyq+V6exRKLVWaKGsuy6H9QFYeBVDV7rK6fO3XwHgQOPxv+cLj2zpXQ==", "integrity": "sha512-EzD434aHTFifGudYAygnFlS1Tl6KhbTynEWELQXIbTY8Msvb5nEqTZIm7sbPEt4mQYLZwu3zPKVdeIrw0g7ovg==",
"dependencies": { "dependencies": {
"@octokit/openapi-types": "^18.0.0" "@octokit/openapi-types": "^19.0.0"
} }
}, },
"node_modules/@octokit/types/node_modules/@octokit/openapi-types": {
"version": "19.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-19.0.0.tgz",
"integrity": "sha512-PclQ6JGMTE9iUStpzMkwLCISFn/wDeRjkZFIKALpvJQNBGwDoYYi2fFvuHwssoQ1rXI5mfh6jgTgWuddeUzfWw=="
},
"node_modules/@opentelemetry/api": { "node_modules/@opentelemetry/api": {
"version": "1.4.1", "version": "1.4.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.4.1.tgz", "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.4.1.tgz",
@@ -835,9 +840,9 @@
"dev": true "dev": true
}, },
"node_modules/@types/adm-zip": { "node_modules/@types/adm-zip": {
"version": "0.5.0", "version": "0.5.2",
"resolved": "https://registry.npmjs.org/@types/adm-zip/-/adm-zip-0.5.0.tgz", "resolved": "https://registry.npmjs.org/@types/adm-zip/-/adm-zip-0.5.2.tgz",
"integrity": "sha512-FCJBJq9ODsQZUNURo5ILAQueuA8WJhRvuihS3ke2iI25mJlfV2LK8jG2Qj2z2AWg8U0FtWWqBHVRetceLskSaw==", "integrity": "sha512-33OTTnnW3onOE6HJuoqsi7T7Ojupz7zO/Vs5ddRNVCYQnu4lg05RqH/pr9eidHGvGyYfdO4uPO9cvegAMixBCQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@types/node": "*" "@types/node": "*"
@@ -855,15 +860,15 @@
"dev": true "dev": true
}, },
"node_modules/@types/js-yaml": { "node_modules/@types/js-yaml": {
"version": "4.0.5", "version": "4.0.6",
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz", "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.6.tgz",
"integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==", "integrity": "sha512-ACTuifTSIIbyksx2HTon3aFtCKWcID7/h3XEmRpDYdMCXxPbl+m9GteOJeaAkiAta/NJaSFuA7ahZ0NkwajDSw==",
"dev": true "dev": true
}, },
"node_modules/@types/json-schema": { "node_modules/@types/json-schema": {
"version": "7.0.12", "version": "7.0.13",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.13.tgz",
"integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", "integrity": "sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==",
"dev": true "dev": true
}, },
"node_modules/@types/json5": { "node_modules/@types/json5": {
@@ -900,15 +905,15 @@
} }
}, },
"node_modules/@types/semver": { "node_modules/@types/semver": {
"version": "7.5.1", "version": "7.5.3",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.1.tgz", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.3.tgz",
"integrity": "sha512-cJRQXpObxfNKkFAZbJl2yjWtJCqELQIdShsogr1d2MilP8dKD9TE/nEKHkJgUNHdGKCQaf9HbIynuV2csLGVLg==", "integrity": "sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==",
"dev": true "dev": true
}, },
"node_modules/@types/sinon": { "node_modules/@types/sinon": {
"version": "10.0.16", "version": "10.0.17",
"resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.16.tgz", "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.17.tgz",
"integrity": "sha512-j2Du5SYpXZjJVJtXBokASpPRj+e2z+VUhCPHmM6WMfe3dpHu6iVKJMU6AiBcMp/XTAYnEj6Wc1trJUWwZ0QaAQ==", "integrity": "sha512-+6ILpcixQ0Ma3dHMTLv4rSycbDXkDljgKL+E0nI2RUxxhYTFyPSjt6RVMxh7jUshvyVcBvicb0Ktj+lAJcjgeA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@types/sinonjs__fake-timers": "*" "@types/sinonjs__fake-timers": "*"
@@ -929,21 +934,21 @@
} }
}, },
"node_modules/@types/uuid": { "node_modules/@types/uuid": {
"version": "9.0.3", "version": "9.0.4",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.3.tgz", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.4.tgz",
"integrity": "sha512-taHQQH/3ZyI3zP8M/puluDEIEvtQHVYcC6y3N8ijFtAd28+Ey/G4sg1u2gB01S8MwybLOKAp9/yCMu/uR5l3Ug==" "integrity": "sha512-zAuJWQflfx6dYJM62vna+Sn5aeSWhh3OB+wfUEACNcqUSc0AGc5JKl+ycL1vrH7frGTXhJchYjE1Hak8L819dA=="
}, },
"node_modules/@typescript-eslint/eslint-plugin": { "node_modules/@typescript-eslint/eslint-plugin": {
"version": "6.5.0", "version": "6.7.3",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.5.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.3.tgz",
"integrity": "sha512-2pktILyjvMaScU6iK3925uvGU87E+N9rh372uGZgiMYwafaw9SXq86U04XPq3UH6tzRvNgBsub6x2DacHc33lw==", "integrity": "sha512-vntq452UHNltxsaaN+L9WyuMch8bMd9CqJ3zhzTPXXidwbf5mqqKCVXEuvRZUqLJSTLeWE65lQwyXsRGnXkCTA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@eslint-community/regexpp": "^4.5.1", "@eslint-community/regexpp": "^4.5.1",
"@typescript-eslint/scope-manager": "6.5.0", "@typescript-eslint/scope-manager": "6.7.3",
"@typescript-eslint/type-utils": "6.5.0", "@typescript-eslint/type-utils": "6.7.3",
"@typescript-eslint/utils": "6.5.0", "@typescript-eslint/utils": "6.7.3",
"@typescript-eslint/visitor-keys": "6.5.0", "@typescript-eslint/visitor-keys": "6.7.3",
"debug": "^4.3.4", "debug": "^4.3.4",
"graphemer": "^1.4.0", "graphemer": "^1.4.0",
"ignore": "^5.2.4", "ignore": "^5.2.4",
@@ -969,15 +974,15 @@
} }
}, },
"node_modules/@typescript-eslint/parser": { "node_modules/@typescript-eslint/parser": {
"version": "6.6.0", "version": "6.7.3",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.6.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.7.3.tgz",
"integrity": "sha512-setq5aJgUwtzGrhW177/i+DMLqBaJbdwGj2CPIVFFLE0NCliy5ujIdLHd2D1ysmlmsjdL2GWW+hR85neEfc12w==", "integrity": "sha512-TlutE+iep2o7R8Lf+yoer3zU6/0EAUc8QIBB3GYBc1KGz4c4TRm83xwXUZVPlZ6YCLss4r77jbu6j3sendJoiQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": "6.6.0", "@typescript-eslint/scope-manager": "6.7.3",
"@typescript-eslint/types": "6.6.0", "@typescript-eslint/types": "6.7.3",
"@typescript-eslint/typescript-estree": "6.6.0", "@typescript-eslint/typescript-estree": "6.7.3",
"@typescript-eslint/visitor-keys": "6.6.0", "@typescript-eslint/visitor-keys": "6.7.3",
"debug": "^4.3.4" "debug": "^4.3.4"
}, },
"engines": { "engines": {
@@ -996,88 +1001,14 @@
} }
} }
}, },
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.6.0.tgz",
"integrity": "sha512-pT08u5W/GT4KjPUmEtc2kSYvrH8x89cVzkA0Sy2aaOUIw6YxOIjA8ilwLr/1fLjOedX1QAuBpG9XggWqIIfERw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.6.0",
"@typescript-eslint/visitor-keys": "6.6.0"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.6.0.tgz",
"integrity": "sha512-CB6QpJQ6BAHlJXdwUmiaXDBmTqIE2bzGTDLADgvqtHWuhfNP3rAOK7kAgRMAET5rDRr9Utt+qAzRBdu3AhR3sg==",
"dev": true,
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.6.0.tgz",
"integrity": "sha512-hMcTQ6Al8MP2E6JKBAaSxSVw5bDhdmbCEhGW/V8QXkb9oNsFkA4SBuOMYVPxD3jbtQ4R/vSODBsr76R6fP3tbA==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.6.0",
"@typescript-eslint/visitor-keys": "6.6.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
"semver": "^7.5.4",
"ts-api-utils": "^1.0.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.6.0.tgz",
"integrity": "sha512-L61uJT26cMOfFQ+lMZKoJNbAEckLe539VhTxiGHrWl5XSKQgA0RTBZJW2HFPy5T0ZvPVSD93QsrTKDkfNwJGyQ==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.6.0",
"eslint-visitor-keys": "^3.4.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/scope-manager": { "node_modules/@typescript-eslint/scope-manager": {
"version": "6.5.0", "version": "6.7.3",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.5.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.3.tgz",
"integrity": "sha512-A8hZ7OlxURricpycp5kdPTH3XnjG85UpJS6Fn4VzeoH4T388gQJ/PGP4ole5NfKt4WDVhmLaQ/dBLNDC4Xl/Kw==", "integrity": "sha512-wOlo0QnEou9cHO2TdkJmzF7DFGvAKEnB82PuPNHpT8ZKKaZu6Bm63ugOTn9fXNJtvuDPanBc78lGUGGytJoVzQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/types": "6.5.0", "@typescript-eslint/types": "6.7.3",
"@typescript-eslint/visitor-keys": "6.5.0" "@typescript-eslint/visitor-keys": "6.7.3"
}, },
"engines": { "engines": {
"node": "^16.0.0 || >=18.0.0" "node": "^16.0.0 || >=18.0.0"
@@ -1088,13 +1019,13 @@
} }
}, },
"node_modules/@typescript-eslint/type-utils": { "node_modules/@typescript-eslint/type-utils": {
"version": "6.5.0", "version": "6.7.3",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.5.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.3.tgz",
"integrity": "sha512-f7OcZOkRivtujIBQ4yrJNIuwyCQO1OjocVqntl9dgSIZAdKqicj3xFDqDOzHDlGCZX990LqhLQXWRnQvsapq8A==", "integrity": "sha512-Fc68K0aTDrKIBvLnKTZ5Pf3MXK495YErrbHb1R6aTpfK5OdSFj0rVN7ib6Tx6ePrZ2gsjLqr0s98NG7l96KSQw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/typescript-estree": "6.5.0", "@typescript-eslint/typescript-estree": "6.7.3",
"@typescript-eslint/utils": "6.5.0", "@typescript-eslint/utils": "6.7.3",
"debug": "^4.3.4", "debug": "^4.3.4",
"ts-api-utils": "^1.0.1" "ts-api-utils": "^1.0.1"
}, },
@@ -1115,9 +1046,9 @@
} }
}, },
"node_modules/@typescript-eslint/types": { "node_modules/@typescript-eslint/types": {
"version": "6.5.0", "version": "6.7.3",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.5.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.3.tgz",
"integrity": "sha512-eqLLOEF5/lU8jW3Bw+8auf4lZSbbljHR2saKnYqON12G/WsJrGeeDHWuQePoEf9ro22+JkbPfWQwKEC5WwLQ3w==", "integrity": "sha512-4g+de6roB2NFcfkZb439tigpAMnvEIg3rIjWQ+EM7IBaYt/CdJt6em9BJ4h4UpdgaBWdmx2iWsafHTrqmgIPNw==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": "^16.0.0 || >=18.0.0" "node": "^16.0.0 || >=18.0.0"
@@ -1128,13 +1059,13 @@
} }
}, },
"node_modules/@typescript-eslint/typescript-estree": { "node_modules/@typescript-eslint/typescript-estree": {
"version": "6.5.0", "version": "6.7.3",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.5.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.3.tgz",
"integrity": "sha512-q0rGwSe9e5Kk/XzliB9h2LBc9tmXX25G0833r7kffbl5437FPWb2tbpIV9wAATebC/018pGa9fwPDuvGN+LxWQ==", "integrity": "sha512-YLQ3tJoS4VxLFYHTw21oe1/vIZPRqAO91z6Uv0Ss2BKm/Ag7/RVQBcXTGcXhgJMdA4U+HrKuY5gWlJlvoaKZ5g==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/types": "6.5.0", "@typescript-eslint/types": "6.7.3",
"@typescript-eslint/visitor-keys": "6.5.0", "@typescript-eslint/visitor-keys": "6.7.3",
"debug": "^4.3.4", "debug": "^4.3.4",
"globby": "^11.1.0", "globby": "^11.1.0",
"is-glob": "^4.0.3", "is-glob": "^4.0.3",
@@ -1155,17 +1086,17 @@
} }
}, },
"node_modules/@typescript-eslint/utils": { "node_modules/@typescript-eslint/utils": {
"version": "6.5.0", "version": "6.7.3",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.5.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.3.tgz",
"integrity": "sha512-9nqtjkNykFzeVtt9Pj6lyR9WEdd8npPhhIPM992FWVkZuS6tmxHfGVnlUcjpUP2hv8r4w35nT33mlxd+Be1ACQ==", "integrity": "sha512-vzLkVder21GpWRrmSR9JxGZ5+ibIUSudXlW52qeKpzUEQhRSmyZiVDDj3crAth7+5tmN1ulvgKaCU2f/bPRCzg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.4.0", "@eslint-community/eslint-utils": "^4.4.0",
"@types/json-schema": "^7.0.12", "@types/json-schema": "^7.0.12",
"@types/semver": "^7.5.0", "@types/semver": "^7.5.0",
"@typescript-eslint/scope-manager": "6.5.0", "@typescript-eslint/scope-manager": "6.7.3",
"@typescript-eslint/types": "6.5.0", "@typescript-eslint/types": "6.7.3",
"@typescript-eslint/typescript-estree": "6.5.0", "@typescript-eslint/typescript-estree": "6.7.3",
"semver": "^7.5.4" "semver": "^7.5.4"
}, },
"engines": { "engines": {
@@ -1180,12 +1111,12 @@
} }
}, },
"node_modules/@typescript-eslint/visitor-keys": { "node_modules/@typescript-eslint/visitor-keys": {
"version": "6.5.0", "version": "6.7.3",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.5.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.3.tgz",
"integrity": "sha512-yCB/2wkbv3hPsh02ZS8dFQnij9VVQXJMN/gbQsaaY+zxALkZnxa/wagvLEFsAWMPv7d7lxQmNsIzGU1w/T/WyA==", "integrity": "sha512-HEVXkU9IB+nk9o63CeICMHxFWbHWr3E1mpilIQBe9+7L/lH97rleFLVtYsfnWB+JVMaiFnEaxvknvmIzX+CqVg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/types": "6.5.0", "@typescript-eslint/types": "6.7.3",
"eslint-visitor-keys": "^3.4.1" "eslint-visitor-keys": "^3.4.1"
}, },
"engines": { "engines": {
@@ -2539,16 +2470,16 @@
} }
}, },
"node_modules/eslint": { "node_modules/eslint": {
"version": "8.48.0", "version": "8.50.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.48.0.tgz", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz",
"integrity": "sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==", "integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1", "@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.2", "@eslint/eslintrc": "^2.1.2",
"@eslint/js": "8.48.0", "@eslint/js": "8.50.0",
"@humanwhocodes/config-array": "^0.11.10", "@humanwhocodes/config-array": "^0.11.11",
"@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8", "@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.12.4", "ajv": "^6.12.4",
@@ -2625,9 +2556,9 @@
} }
}, },
"node_modules/eslint-import-resolver-typescript": { "node_modules/eslint-import-resolver-typescript": {
"version": "3.6.0", "version": "3.6.1",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.0.tgz", "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.1.tgz",
"integrity": "sha512-QTHR9ddNnn35RTxlaEnx2gCxqFlF2SEN0SE2d17SqwyM7YOSI2GHWRYp5BiRkObTUNYPupC/3Fq2a0PpT+EKpg==", "integrity": "sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"debug": "^4.3.4", "debug": "^4.3.4",
@@ -2720,9 +2651,9 @@
} }
}, },
"node_modules/eslint-plugin-github": { "node_modules/eslint-plugin-github": {
"version": "4.10.0", "version": "4.10.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-github/-/eslint-plugin-github-4.10.0.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-github/-/eslint-plugin-github-4.10.1.tgz",
"integrity": "sha512-YKtqBtFbjih1wZNTwZjtLPEG6B/4ySMa38fgOo/rbMJpNKO3+OaKzwwOYkeKx/FapM/4MsTP9ExqUcDV+dkixA==", "integrity": "sha512-1AqQBockOM+m0ZUpwfjWtX0lWdX5cRi/hwJnSNvXoOmz/Hh+ULH6QFz6ENWueTWjoWpgPv0af3bj+snps6o4og==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@github/browserslist-config": "^1.0.0", "@github/browserslist-config": "^1.0.0",
@@ -5514,9 +5445,9 @@
"dev": true "dev": true
}, },
"node_modules/sinon": { "node_modules/sinon": {
"version": "15.2.0", "version": "16.0.0",
"resolved": "https://registry.npmjs.org/sinon/-/sinon-15.2.0.tgz", "resolved": "https://registry.npmjs.org/sinon/-/sinon-16.0.0.tgz",
"integrity": "sha512-nPS85arNqwBXaIsFCkolHjGIkFo+Oxu9vbgmBJizLAhqe6P2o3Qmj3KCUoRkfhHtvgDhZdWD3risLHAUJ8npjw==", "integrity": "sha512-B8AaZZm9CT5pqe4l4uWJztfD/mOTa7dL8Qo0W4+s+t74xECOgSZDDQCBjNgIK3+n4kyxQrSTv2V5ul8K25qkiQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@sinonjs/commons": "^3.0.0", "@sinonjs/commons": "^3.0.0",
@@ -6157,9 +6088,13 @@
} }
}, },
"node_modules/uuid": { "node_modules/uuid": {
"version": "9.0.0", "version": "9.0.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
"integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"bin": { "bin": {
"uuid": "dist/bin/uuid" "uuid": "dist/bin/uuid"
} }

View File

@@ -1,7 +1,11 @@
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@@ -52,9 +56,9 @@ class DefaultArtifactClient {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
core.info(`Starting artifact upload core.info(`Starting artifact upload
For more detailed logs during the artifact upload process, enable step-debugging: https://docs.github.com/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging`); For more detailed logs during the artifact upload process, enable step-debugging: https://docs.github.com/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging`);
path_and_artifact_name_validation_1.checkArtifactName(name); (0, path_and_artifact_name_validation_1.checkArtifactName)(name);
// Get specification for the files being uploaded // Get specification for the files being uploaded
const uploadSpecification = upload_specification_1.getUploadSpecification(name, rootDirectory, files); const uploadSpecification = (0, upload_specification_1.getUploadSpecification)(name, rootDirectory, files);
const uploadResponse = { const uploadResponse = {
artifactName: name, artifactName: name,
artifactItems: [], artifactItems: [],
@@ -113,20 +117,20 @@ Note: The size of downloaded zips can differ significantly from the reported siz
} }
const items = yield downloadHttpClient.getContainerItems(artifactToDownload.name, artifactToDownload.fileContainerResourceUrl); const items = yield downloadHttpClient.getContainerItems(artifactToDownload.name, artifactToDownload.fileContainerResourceUrl);
if (!path) { if (!path) {
path = config_variables_1.getWorkSpaceDirectory(); path = (0, config_variables_1.getWorkSpaceDirectory)();
} }
path = path_1.normalize(path); path = (0, path_1.normalize)(path);
path = path_1.resolve(path); path = (0, path_1.resolve)(path);
// During upload, empty directories are rejected by the remote server so there should be no artifacts that consist of only empty directories // During upload, empty directories are rejected by the remote server so there should be no artifacts that consist of only empty directories
const downloadSpecification = download_specification_1.getDownloadSpecification(name, items.value, path, (options === null || options === void 0 ? void 0 : options.createArtifactFolder) || false); const downloadSpecification = (0, download_specification_1.getDownloadSpecification)(name, items.value, path, (options === null || options === void 0 ? void 0 : options.createArtifactFolder) || false);
if (downloadSpecification.filesToDownload.length === 0) { if (downloadSpecification.filesToDownload.length === 0) {
core.info(`No downloadable files were found for the artifact: ${artifactToDownload.name}`); core.info(`No downloadable files were found for the artifact: ${artifactToDownload.name}`);
} }
else { else {
// Create all necessary directories recursively before starting any download // Create all necessary directories recursively before starting any download
yield utils_1.createDirectoriesForArtifact(downloadSpecification.directoryStructure); yield (0, utils_1.createDirectoriesForArtifact)(downloadSpecification.directoryStructure);
core.info('Directory structure has been setup for the artifact'); core.info('Directory structure has been set up for the artifact');
yield utils_1.createEmptyFilesForArtifact(downloadSpecification.emptyFilesToCreate); yield (0, utils_1.createEmptyFilesForArtifact)(downloadSpecification.emptyFilesToCreate);
yield downloadHttpClient.downloadSingleArtifact(downloadSpecification.filesToDownload); yield downloadHttpClient.downloadSingleArtifact(downloadSpecification.filesToDownload);
} }
return { return {
@@ -145,10 +149,10 @@ Note: The size of downloaded zips can differ significantly from the reported siz
return response; return response;
} }
if (!path) { if (!path) {
path = config_variables_1.getWorkSpaceDirectory(); path = (0, config_variables_1.getWorkSpaceDirectory)();
} }
path = path_1.normalize(path); path = (0, path_1.normalize)(path);
path = path_1.resolve(path); path = (0, path_1.resolve)(path);
let downloadedArtifacts = 0; let downloadedArtifacts = 0;
while (downloadedArtifacts < artifacts.count) { while (downloadedArtifacts < artifacts.count) {
const currentArtifactToDownload = artifacts.value[downloadedArtifacts]; const currentArtifactToDownload = artifacts.value[downloadedArtifacts];
@@ -156,13 +160,13 @@ Note: The size of downloaded zips can differ significantly from the reported siz
core.info(`starting download of artifact ${currentArtifactToDownload.name} : ${downloadedArtifacts}/${artifacts.count}`); core.info(`starting download of artifact ${currentArtifactToDownload.name} : ${downloadedArtifacts}/${artifacts.count}`);
// Get container entries for the specific artifact // Get container entries for the specific artifact
const items = yield downloadHttpClient.getContainerItems(currentArtifactToDownload.name, currentArtifactToDownload.fileContainerResourceUrl); const items = yield downloadHttpClient.getContainerItems(currentArtifactToDownload.name, currentArtifactToDownload.fileContainerResourceUrl);
const downloadSpecification = download_specification_1.getDownloadSpecification(currentArtifactToDownload.name, items.value, path, true); const downloadSpecification = (0, download_specification_1.getDownloadSpecification)(currentArtifactToDownload.name, items.value, path, true);
if (downloadSpecification.filesToDownload.length === 0) { if (downloadSpecification.filesToDownload.length === 0) {
core.info(`No downloadable files were found for any artifact ${currentArtifactToDownload.name}`); core.info(`No downloadable files were found for any artifact ${currentArtifactToDownload.name}`);
} }
else { else {
yield utils_1.createDirectoriesForArtifact(downloadSpecification.directoryStructure); yield (0, utils_1.createDirectoriesForArtifact)(downloadSpecification.directoryStructure);
yield utils_1.createEmptyFilesForArtifact(downloadSpecification.emptyFilesToCreate); yield (0, utils_1.createEmptyFilesForArtifact)(downloadSpecification.emptyFilesToCreate);
yield downloadHttpClient.downloadSingleArtifact(downloadSpecification.filesToDownload); yield downloadHttpClient.downloadSingleArtifact(downloadSpecification.filesToDownload);
} }
response.push({ response.push({

View File

@@ -1 +1 @@
{"version":3,"file":"artifact-client.js","sourceRoot":"","sources":["../../src/internal/artifact-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAqC;AACrC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B,CAC/B,qBAAqB,CAAC,kBAAkB,CACzC,CAAA;oBACD,MAAM,kBAAkB,CAAC,sBAAsB,CAC7C,qBAAqB,CAAC,eAAe,CACtC,CAAA;iBACF;gBAED,QAAQ,CAAC,IAAI,CAAC;oBACZ,YAAY,EAAE,yBAAyB,CAAC,IAAI;oBAC5C,YAAY,EAAE,qBAAqB,CAAC,oBAAoB;iBACzD,CAAC,CAAA;aACH;YACD,OAAO,QAAQ,CAAA;QACjB,CAAC;KAAA;CACF;AAhOD,sDAgOC"} {"version":3,"file":"artifact-client.js","sourceRoot":"","sources":["../../src/internal/artifact-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAqC;AACrC,iEAG+B;AAC/B,6DAAqD;AAKrD,mCAGgB;AAChB,2FAAqE;AACrE,iEAAyD;AACzD,qEAAiE;AACjE,yDAAwD;AACxD,+BAAuC;AAuCvC,MAAa,qBAAqB;IAChC;;OAEG;IACH,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,qBAAqB,EAAE,CAAA;IACpC,CAAC;IAED;;OAEG;IACG,cAAc,CAClB,IAAY,EACZ,KAAe,EACf,aAAqB,EACrB,OAAmC;;YAEnC,IAAI,CAAC,IAAI,CACP;8MACwM,CACzM,CAAA;YACD,IAAA,qDAAiB,EAAC,IAAI,CAAC,CAAA;YAEvB,iDAAiD;YACjD,MAAM,mBAAmB,GAA0B,IAAA,6CAAsB,EACvE,IAAI,EACJ,aAAa,EACb,KAAK,CACN,CAAA;YACD,MAAM,cAAc,GAAmB;gBACrC,YAAY,EAAE,IAAI;gBAClB,aAAa,EAAE,EAAE;gBACjB,IAAI,EAAE,CAAC;gBACP,WAAW,EAAE,EAAE;aAChB,CAAA;YAED,MAAM,gBAAgB,GAAG,IAAI,qCAAgB,EAAE,CAAA;YAE/C,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC,EAAE;gBACpC,IAAI,CAAC,OAAO,CAAC,qCAAqC,CAA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AS,CAAC,KAAK,EAAE,CAC9G,CAAA;gBAED,kDAAkD;gBAClD,MAAM,KAAK,GAAG,MAAM,kBAAkB,CAAC,iBAAiB,CACtD,yBAAyB,CAAC,IAAI,EAC9B,yBAAyB,CAAC,wBAAwB,CACnD,CAAA;gBAED,MAAM,qBAAqB,GAAG,IAAA,iDAAwB,EACpD,yBAAyB,CAAC,IAAI,EAC9B,KAAK,CAAC,KAAK,EACX,IAAI,EACJ,IAAI,CACL,CAAA;gBACD,IAAI,qBAAqB,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;oBACtD,IAAI,CAAC,IAAI,CACP,qDAAqD,yBAAyB,CAAC,IAAI,EAAE,CACtF,CAAA;iBACF;qBAAM;oBACL,MAAM,IAAA,oCAA4B,EAChC,qBAAqB,CAAC,kBAAkB,CACzC,CAAA;oBACD,MAAM,IAAA,mCAA2B,EAC/B,qBAAqB,CAAC,kBAAkB,CACzC,CAAA;oBACD,MAAM,kBAAkB,CAAC,sBAAsB,CAC7C,qBAAqB,CAAC,eAAe,CACtC,CAAA;iBACF;gBAED,QAAQ,CAAC,IAAI,CAAC;oBACZ,YAAY,EAAE,yBAAyB,CAAC,IAAI;oBAC5C,YAAY,EAAE,qBAAqB,CAAC,oBAAoB;iBACzD,CAAC,CAAA;aACH;YACD,OAAO,QAAQ,CAAA;QACjB,CAAC;KAAA;CACF;AAhOD,sDAgOC"}

View File

@@ -9,3 +9,4 @@ export declare function getRuntimeUrl(): string;
export declare function getWorkFlowRunId(): string; export declare function getWorkFlowRunId(): string;
export declare function getWorkSpaceDirectory(): string; export declare function getWorkSpaceDirectory(): string;
export declare function getRetentionDays(): string | undefined; export declare function getRetentionDays(): string | undefined;
export declare function isGhes(): boolean;

View File

@@ -1,6 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getRetentionDays = exports.getWorkSpaceDirectory = exports.getWorkFlowRunId = exports.getRuntimeUrl = exports.getRuntimeToken = exports.getDownloadFileConcurrency = exports.getInitialRetryIntervalInMilliseconds = exports.getRetryMultiplier = exports.getRetryLimit = exports.getUploadChunkSize = exports.getUploadFileConcurrency = void 0; exports.isGhes = exports.getRetentionDays = exports.getWorkSpaceDirectory = exports.getWorkFlowRunId = exports.getRuntimeUrl = exports.getRuntimeToken = exports.getDownloadFileConcurrency = exports.getInitialRetryIntervalInMilliseconds = exports.getRetryMultiplier = exports.getRetryLimit = exports.getUploadChunkSize = exports.getUploadFileConcurrency = void 0;
// The number of concurrent uploads that happens at the same time // The number of concurrent uploads that happens at the same time
function getUploadFileConcurrency() { function getUploadFileConcurrency() {
return 2; return 2;
@@ -69,4 +69,9 @@ function getRetentionDays() {
return process.env['GITHUB_RETENTION_DAYS']; return process.env['GITHUB_RETENTION_DAYS'];
} }
exports.getRetentionDays = getRetentionDays; exports.getRetentionDays = getRetentionDays;
function isGhes() {
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
}
exports.isGhes = isGhes;
//# sourceMappingURL=config-variables.js.map //# sourceMappingURL=config-variables.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"config-variables.js","sourceRoot":"","sources":["../../src/internal/config-variables.ts"],"names":[],"mappings":";;;AAAA,iEAAiE;AACjE,SAAgB,wBAAwB;IACtC,OAAO,CAAC,CAAA;AACV,CAAC;AAFD,4DAEC;AAED,2FAA2F;AAC3F,4CAA4C;AAC5C,SAAgB,kBAAkB;IAChC,OAAO,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA,CAAC,cAAc;AACvC,CAAC;AAFD,gDAEC;AAED,yFAAyF;AACzF,SAAgB,aAAa;IAC3B,OAAO,CAAC,CAAA;AACV,CAAC;AAFD,sCAEC;AAED,wGAAwG;AACxG,0GAA0G;AAC1G,SAAgB,kBAAkB;IAChC,OAAO,GAAG,CAAA;AACZ,CAAC;AAFD,gDAEC;AAED,yGAAyG;AACzG,SAAgB,qCAAqC;IACnD,OAAO,IAAI,CAAA;AACb,CAAC;AAFD,sFAEC;AAED,mEAAmE;AACnE,SAAgB,0BAA0B;IACxC,OAAO,CAAC,CAAA;AACV,CAAC;AAFD,gEAEC;AAED,SAAgB,eAAe;IAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;IAClD,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;KACpE;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAND,0CAMC;AAED,SAAgB,aAAa;IAC3B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;IACrD,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;KAClE;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAND,sCAMC;AAED,SAAgB,gBAAgB;IAC9B,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;IAClD,IAAI,CAAC,aAAa,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;KAC5D;IACD,OAAO,aAAa,CAAA;AACtB,CAAC;AAND,4CAMC;AAED,SAAgB,qBAAqB;IACnC,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;IAC1D,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;KAC/D;IACD,OAAO,kBAAkB,CAAA;AAC3B,CAAC;AAND,sDAMC;AAED,SAAgB,gBAAgB;IAC9B,OAAO,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;AAC7C,CAAC;AAFD,4CAEC"} {"version":3,"file":"config-variables.js","sourceRoot":"","sources":["../../src/internal/config-variables.ts"],"names":[],"mappings":";;;AAAA,iE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B,qBAAqB;IACnC,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;IAC1D,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;KAC/D;IACD,OAAO,kBAAkB,CAAA;AAC3B,CAAC;AAND,sDAMC;AAED,SAAgB,gBAAgB;IAC9B,OAAO,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;AAC7C,CAAC;AAFD,4CAEC;AAED,SAAgB,MAAM;IACpB,MAAM,KAAK,GAAG,IAAI,GAAG,CACnB,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,oBAAoB,CACzD,CAAA;IACD,OAAO,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,YAAY,CAAA;AACtD,CAAC;AALD,wBAKC"}

View File

@@ -9,7 +9,7 @@
* is used for Azure Storage: https://github.com/Azure/azure-storage-net/blob/cbe605f9faa01bfc3003d75fc5a16b2eaccfe102/Lib/Common/Core/Util/Crc64.cs#L27 * is used for Azure Storage: https://github.com/Azure/azure-storage-net/blob/cbe605f9faa01bfc3003d75fc5a16b2eaccfe102/Lib/Common/Core/Util/Crc64.cs#L27
*/ */
/// <reference types="node" /> /// <reference types="node" />
export declare type CRC64DigestEncoding = 'hex' | 'base64' | 'buffer'; export type CRC64DigestEncoding = 'hex' | 'base64' | 'buffer';
declare class CRC64 { declare class CRC64 {
private _crc; private _crc;
constructor(); constructor();

View File

@@ -1,7 +1,11 @@
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@@ -41,7 +45,7 @@ const config_variables_1 = require("./config-variables");
const requestUtils_1 = require("./requestUtils"); const requestUtils_1 = require("./requestUtils");
class DownloadHttpClient { class DownloadHttpClient {
constructor() { constructor() {
this.downloadHttpManager = new http_manager_1.HttpManager(config_variables_1.getDownloadFileConcurrency(), '@actions/artifact-download'); this.downloadHttpManager = new http_manager_1.HttpManager((0, config_variables_1.getDownloadFileConcurrency)(), '@actions/artifact-download');
// downloads are usually significantly faster than uploads so display status information every second // downloads are usually significantly faster than uploads so display status information every second
this.statusReporter = new status_reporter_1.StatusReporter(1000); this.statusReporter = new status_reporter_1.StatusReporter(1000);
} }
@@ -50,11 +54,11 @@ class DownloadHttpClient {
*/ */
listArtifacts() { listArtifacts() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const artifactUrl = utils_1.getArtifactUrl(); const artifactUrl = (0, utils_1.getArtifactUrl)();
// use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately // use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately
const client = this.downloadHttpManager.getClient(0); const client = this.downloadHttpManager.getClient(0);
const headers = utils_1.getDownloadHeaders('application/json'); const headers = (0, utils_1.getDownloadHeaders)('application/json');
const response = yield requestUtils_1.retryHttpClientRequest('List Artifacts', () => __awaiter(this, void 0, void 0, function* () { return client.get(artifactUrl, headers); })); const response = yield (0, requestUtils_1.retryHttpClientRequest)('List Artifacts', () => __awaiter(this, void 0, void 0, function* () { return client.get(artifactUrl, headers); }));
const body = yield response.readBody(); const body = yield response.readBody();
return JSON.parse(body); return JSON.parse(body);
}); });
@@ -71,8 +75,8 @@ class DownloadHttpClient {
resourceUrl.searchParams.append('itemPath', artifactName); resourceUrl.searchParams.append('itemPath', artifactName);
// use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately // use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately
const client = this.downloadHttpManager.getClient(0); const client = this.downloadHttpManager.getClient(0);
const headers = utils_1.getDownloadHeaders('application/json'); const headers = (0, utils_1.getDownloadHeaders)('application/json');
const response = yield requestUtils_1.retryHttpClientRequest('Get Container Items', () => __awaiter(this, void 0, void 0, function* () { return client.get(resourceUrl.toString(), headers); })); const response = yield (0, requestUtils_1.retryHttpClientRequest)('Get Container Items', () => __awaiter(this, void 0, void 0, function* () { return client.get(resourceUrl.toString(), headers); }));
const body = yield response.readBody(); const body = yield response.readBody();
return JSON.parse(body); return JSON.parse(body);
}); });
@@ -83,7 +87,7 @@ class DownloadHttpClient {
*/ */
downloadSingleArtifact(downloadItems) { downloadSingleArtifact(downloadItems) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const DOWNLOAD_CONCURRENCY = config_variables_1.getDownloadFileConcurrency(); const DOWNLOAD_CONCURRENCY = (0, config_variables_1.getDownloadFileConcurrency)();
// limit the number of files downloaded at a single time // limit the number of files downloaded at a single time
core.debug(`Download file concurrency is set to ${DOWNLOAD_CONCURRENCY}`); core.debug(`Download file concurrency is set to ${DOWNLOAD_CONCURRENCY}`);
const parallelDownloads = [...new Array(DOWNLOAD_CONCURRENCY).keys()]; const parallelDownloads = [...new Array(DOWNLOAD_CONCURRENCY).keys()];
@@ -123,9 +127,9 @@ class DownloadHttpClient {
downloadIndividualFile(httpClientIndex, artifactLocation, downloadPath) { downloadIndividualFile(httpClientIndex, artifactLocation, downloadPath) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let retryCount = 0; let retryCount = 0;
const retryLimit = config_variables_1.getRetryLimit(); const retryLimit = (0, config_variables_1.getRetryLimit)();
let destinationStream = fs.createWriteStream(downloadPath); let destinationStream = fs.createWriteStream(downloadPath);
const headers = utils_1.getDownloadHeaders('application/json', true, true); const headers = (0, utils_1.getDownloadHeaders)('application/json', true, true);
// a single GET request is used to download a file // a single GET request is used to download a file
const makeDownloadRequest = () => __awaiter(this, void 0, void 0, function* () { const makeDownloadRequest = () => __awaiter(this, void 0, void 0, function* () {
const client = this.downloadHttpManager.getClient(httpClientIndex); const client = this.downloadHttpManager.getClient(httpClientIndex);
@@ -149,13 +153,13 @@ class DownloadHttpClient {
if (retryAfterValue) { if (retryAfterValue) {
// Back off by waiting the specified time denoted by the retry-after header // Back off by waiting the specified time denoted by the retry-after header
core.info(`Backoff due to too many requests, retry #${retryCount}. Waiting for ${retryAfterValue} milliseconds before continuing the download`); core.info(`Backoff due to too many requests, retry #${retryCount}. Waiting for ${retryAfterValue} milliseconds before continuing the download`);
yield utils_1.sleep(retryAfterValue); yield (0, utils_1.sleep)(retryAfterValue);
} }
else { else {
// Back off using an exponential value that depends on the retry count // Back off using an exponential value that depends on the retry count
const backoffTime = utils_1.getExponentialRetryTimeInMilliseconds(retryCount); const backoffTime = (0, utils_1.getExponentialRetryTimeInMilliseconds)(retryCount);
core.info(`Exponential backoff for retry #${retryCount}. Waiting for ${backoffTime} milliseconds before continuing the download`); core.info(`Exponential backoff for retry #${retryCount}. Waiting for ${backoffTime} milliseconds before continuing the download`);
yield utils_1.sleep(backoffTime); yield (0, utils_1.sleep)(backoffTime);
} }
core.info(`Finished backoff for retry #${retryCount}, continuing with download`); core.info(`Finished backoff for retry #${retryCount}, continuing with download`);
} }
@@ -179,7 +183,7 @@ class DownloadHttpClient {
resolve(); resolve();
} }
}); });
yield utils_1.rmFile(fileDownloadPath); yield (0, utils_1.rmFile)(fileDownloadPath);
destinationStream = fs.createWriteStream(fileDownloadPath); destinationStream = fs.createWriteStream(fileDownloadPath);
}); });
// keep trying to download a file until a retry limit has been reached // keep trying to download a file until a retry limit has been reached
@@ -198,7 +202,7 @@ class DownloadHttpClient {
continue; continue;
} }
let forceRetry = false; let forceRetry = false;
if (utils_1.isSuccessStatusCode(response.message.statusCode)) { if ((0, utils_1.isSuccessStatusCode)(response.message.statusCode)) {
// The body contains the contents of the file however calling response.readBody() causes all the content to be converted to a string // The body contains the contents of the file however calling response.readBody() causes all the content to be converted to a string
// which can cause some gzip encoded data to be lost // which can cause some gzip encoded data to be lost
// Instead of using response.readBody(), response.message is a readableStream that can be directly used to get the raw body contents // Instead of using response.readBody(), response.message is a readableStream that can be directly used to get the raw body contents
@@ -206,7 +210,7 @@ class DownloadHttpClient {
const isGzipped = isGzip(response.message.headers); const isGzipped = isGzip(response.message.headers);
yield this.pipeResponseToFile(response, destinationStream, isGzipped); yield this.pipeResponseToFile(response, destinationStream, isGzipped);
if (isGzipped || if (isGzipped ||
isAllBytesReceived(response.message.headers['content-length'], yield utils_1.getFileSize(downloadPath))) { isAllBytesReceived(response.message.headers['content-length'], yield (0, utils_1.getFileSize)(downloadPath))) {
return; return;
} }
else { else {
@@ -218,17 +222,17 @@ class DownloadHttpClient {
forceRetry = true; forceRetry = true;
} }
} }
if (forceRetry || utils_1.isRetryableStatusCode(response.message.statusCode)) { if (forceRetry || (0, utils_1.isRetryableStatusCode)(response.message.statusCode)) {
core.info(`A ${response.message.statusCode} response code has been received while attempting to download an artifact`); core.info(`A ${response.message.statusCode} response code has been received while attempting to download an artifact`);
resetDestinationStream(downloadPath); resetDestinationStream(downloadPath);
// if a throttled status code is received, try to get the retryAfter header value, else differ to standard exponential backoff // if a throttled status code is received, try to get the retryAfter header value, else differ to standard exponential backoff
utils_1.isThrottledStatusCode(response.message.statusCode) (0, utils_1.isThrottledStatusCode)(response.message.statusCode)
? yield backOff(utils_1.tryGetRetryAfterValueTimeInMilliseconds(response.message.headers)) ? yield backOff((0, utils_1.tryGetRetryAfterValueTimeInMilliseconds)(response.message.headers))
: yield backOff(); : yield backOff();
} }
else { else {
// Some unexpected response code, fail immediately and stop the download // Some unexpected response code, fail immediately and stop the download
utils_1.displayHttpDiagnostics(response); (0, utils_1.displayHttpDiagnostics)(response);
return Promise.reject(new Error(`Unexpected http ${response.message.statusCode} during download for ${artifactLocation}`)); return Promise.reject(new Error(`Unexpected http ${response.message.statusCode} during download for ${artifactLocation}`));
} }
} }
@@ -247,14 +251,14 @@ class DownloadHttpClient {
const gunzip = zlib.createGunzip(); const gunzip = zlib.createGunzip();
response.message response.message
.on('error', error => { .on('error', error => {
core.error(`An error occurred while attempting to read the response stream`); core.info(`An error occurred while attempting to read the response stream`);
gunzip.close(); gunzip.close();
destinationStream.close(); destinationStream.close();
reject(error); reject(error);
}) })
.pipe(gunzip) .pipe(gunzip)
.on('error', error => { .on('error', error => {
core.error(`An error occurred while attempting to decompress the response stream`); core.info(`An error occurred while attempting to decompress the response stream`);
destinationStream.close(); destinationStream.close();
reject(error); reject(error);
}) })
@@ -263,14 +267,14 @@ class DownloadHttpClient {
resolve(); resolve();
}) })
.on('error', error => { .on('error', error => {
core.error(`An error occurred while writing a downloaded file to ${destinationStream.path}`); core.info(`An error occurred while writing a downloaded file to ${destinationStream.path}`);
reject(error); reject(error);
}); });
} }
else { else {
response.message response.message
.on('error', error => { .on('error', error => {
core.error(`An error occurred while attempting to read the response stream`); core.info(`An error occurred while attempting to read the response stream`);
destinationStream.close(); destinationStream.close();
reject(error); reject(error);
}) })
@@ -279,7 +283,7 @@ class DownloadHttpClient {
resolve(); resolve();
}) })
.on('error', error => { .on('error', error => {
core.error(`An error occurred while writing a downloaded file to ${destinationStream.path}`); core.info(`An error occurred while writing a downloaded file to ${destinationStream.path}`);
reject(error); reject(error);
}); });
} }

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,11 @@
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };

View File

@@ -1 +1 @@
{"version":3,"file":"download-specification.js","sourceRoot":"","sources":["../../src/internal/download-specification.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4B;AAyB5B;;;;;;GAMG;AACH,SAAgB,wBAAwB,CACtC,YAAoB,EACpB,eAAiC,EACjC,YAAoB,EACpB,oBAA6B;IAE7B,oEAAoE;IACpE,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAA;IAErC,MAAM,cAAc,GAA0B;QAC5C,oBAAoB,EAAE,oBAAo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AAA;AACvB,CAAC;AAtDD,4DAsDC"} {"version":3,"file":"download-specification.js","sourceRoot":"","sources":["../../src/internal/download-specification.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4B;AAyB5B;;;;;;GAMG;AACH,SAAgB,wBAAwB,CACtC,YAAoB,EACpB,eAAiC,EACjC,YAAoB,EACpB,oBAA6B;IAE7B,oEAAoE;IACpE,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAA;IAErC,MAAM,cAAc,GAA0B;QAC5C,oBAAoB,EAAE,oBAAoB;YACxC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC;YACvC,CAAC,CAAC,YAAY;QAChB,kBAAkB,EAAE,EAAE;QACtB,kBAAkB,EAAE,EAAE;QACtB,eAAe,EAAE,EAAE;KACpB,CAAA;IAED,KAAK,MAAM,KAAK,IAAI,eAAe,EAAE;QACnC,wEAAwE;QACxE,IACE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,YAAY,GAAG,CAAC;YACzC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,YAAY,IAAI,CAAC,EAC1C;YACA,2CAA2C;YAC3C,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YACtD,oIAAoI;YACpI,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CACxB,YAAY,EACZ,oBAAoB;gBAClB,CAAC,CAAC,mBAAmB;gBACrB,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAClD,CAAA;YAED,2GAA2G;YAC3G,6FAA6F;YAC7F,IAAI,KAAK,CAAC,QAAQ,KAAK,MAAM,EAAE;gBAC7B,wFAAwF;gBACxF,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;gBACvC,IAAI,KAAK,CAAC,UAAU,KAAK,CAAC,EAAE;oBAC1B,kGAAkG;oBAClG,cAAc,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;iBACjD;qBAAM;oBACL,cAAc,CAAC,eAAe,CAAC,IAAI,CAAC;wBAClC,cAAc,EAAE,KAAK,CAAC,eAAe;wBACrC,UAAU,EAAE,QAAQ;qBACrB,CAAC,CAAA;iBACH;aACF;SACF;KACF;IAED,cAAc,CAAC,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IAC3D,OAAO,cAAc,CAAA;AACvB,CAAC;AAtDD,4DAsDC"}

View File

@@ -11,7 +11,7 @@ class HttpManager {
throw new Error('There must be at least one client'); throw new Error('There must be at least one client');
} }
this.userAgent = userAgent; this.userAgent = userAgent;
this.clients = new Array(clientCount).fill(utils_1.createHttpClient(userAgent)); this.clients = new Array(clientCount).fill((0, utils_1.createHttpClient)(userAgent));
} }
getClient(index) { getClient(index) {
return this.clients[index]; return this.clients[index];
@@ -20,7 +20,7 @@ class HttpManager {
// for more information see: https://github.com/actions/http-client/blob/04e5ad73cd3fd1f5610a32116b0759eddf6570d2/index.ts#L292 // for more information see: https://github.com/actions/http-client/blob/04e5ad73cd3fd1f5610a32116b0759eddf6570d2/index.ts#L292
disposeAndReplaceClient(index) { disposeAndReplaceClient(index) {
this.clients[index].dispose(); this.clients[index].dispose();
this.clients[index] = utils_1.createHttpClient(this.userAgent); this.clients[index] = (0, utils_1.createHttpClient)(this.userAgent);
} }
disposeAndReplaceAllClients() { disposeAndReplaceAllClients() {
for (const [index] of this.clients.entries()) { for (const [index] of this.clients.entries()) {

View File

@@ -1 +1 @@
{"version":3,"file":"http-manager.js","sourceRoot":"","sources":["../../src/internal/http-manager.ts"],"names":[],"mappings":";;;AACA,mCAAwC;AAExC;;GAEG;AACH,MAAa,WAAW;IAItB,YAAY,WAAmB,EAAE,SAAiB;QAChD,IAAI,WAAW,GAAG,CAAC,EAAE;YACnB,MAAM,I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GAAmG;IACnG,+HAA+H;IAC/H,uBAAuB,CAAC,KAAa;QACnC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAA;QAC7B,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAA,wBAAgB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACxD,CAAC;IAED,2BAA2B;QACzB,KAAK,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE;YAC5C,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAA;SACpC;IACH,CAAC;CACF;AA5BD,kCA4BC"}

View File

@@ -42,7 +42,7 @@ Invalid characters include: ${Array.from(invalidArtifactNameCharacters.values())
These characters are not allowed in the artifact name due to limitations with certain file systems such as NTFS. To maintain file system agnostic behavior, these characters are intentionally not allowed to prevent potential problems with downloads on different file systems.`); These characters are not allowed in the artifact name due to limitations with certain file systems such as NTFS. To maintain file system agnostic behavior, these characters are intentionally not allowed to prevent potential problems with downloads on different file systems.`);
} }
} }
core_1.info(`Artifact name is valid!`); (0, core_1.info)(`Artifact name is valid!`);
} }
exports.checkArtifactName = checkArtifactName; exports.checkArtifactName = checkArtifactName;
/** /**

View File

@@ -1 +1 @@
{"version":3,"file":"path-and-artifact-name-validation.js","sourceRoot":"","sources":["../../src/internal/path-and-artifact-name-validation.ts"],"names":[],"mappings":";;;AAAA,wCAAkC;AAElC;;;;;;;GAOG;AACH,MAAM,iCAAiC,GAAG,IAAI,GAAG,CAAiB;IAChE,CAAC,GAAG,EAAE,iBAAiB,CAAC;IACxB,CAAC,GAAG,EAAE,UAAU,CAAC;IACjB,CAAC,GAAG,EAAE,cAAc,CAAC;IACrB,CAAC,GAAG,EAAE,iBAAiB,CAAC;IACxB,CAAC,GAAG,EAAE,iBAAiB,CAAC;IACxB,CAAC,GAAG,EAAE,aAAa,CAAC;IACpB,CAAC,GAAG,EAAE,kBAAkB,CAAC;IACz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AAC;AAtBD,sDAsBC"} {"version":3,"file":"path-and-artifact-name-validation.js","sourceRoot":"","sources":["../../src/internal/path-and-artifact-name-validation.ts"],"names":[],"mappings":";;;AAAA,wCAAkC;AAElC;;;;;;;GAOG;AACH,MAAM,iCAAiC,GAAG,IAAI,GAAG,CAAiB;IAChE,CAAC,GAAG,EAAE,iBAAiB,CAAC;IACxB,CAAC,GAAG,EAAE,UAAU,CAAC;IACjB,CAAC,GAAG,EAAE,cAAc,CAAC;IACrB,CAAC,GAAG,EAAE,iBAAiB,CAAC;IACxB,CAAC,GAAG,EAAE,iBAAiB,CAAC;IACxB,CAAC,GAAG,EAAE,aAAa,CAAC;IACpB,CAAC,GAAG,EAAE,kBAAkB,CAAC;IACzB,CAAC,IAAI,EAAE,sBAAsB,CAAC;IAC9B,CAAC,IAAI,EAAE,gBAAgB,CAAC;CACzB,CAAC,CAAA;AAEF,MAAM,6BAA6B,GAAG,IAAI,GAAG,CAAiB;IAC5D,GAAG,iCAAiC;IACpC,CAAC,IAAI,EAAE,eAAe,CAAC;IACvB,CAAC,GAAG,EAAE,kBAAkB,CAAC;CAC1B,CAAC,CAAA;AAEF;;GAEG;AACH,SAAgB,iBAAiB,CAAC,IAAY;IAC5C,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,2BAA2B,CAAC,CAAA;KACnE;IAED,KAAK,MAAM,CACT,mBAAmB,EACnB,wBAAwB,CACzB,IAAI,6BAA6B,EAAE;QAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE;YACtC,MAAM,IAAI,KAAK,CACb,+BAA+B,IAAI,uCAAuC,wBAAwB;;8BAE5E,KAAK,CAAC,IAAI,CAC9B,6BAA6B,CAAC,MAAM,EAAE,CACvC,CAAC,QAAQ,EAAE;;mRAE+P,CAC5Q,CAAA;SACF;KACF;IAED,IAAA,WAAI,EAAC,yBAAyB,CAAC,CAAA;AACjC,CAAC;AAvBD,8CAuBC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CAAC,IAAY;IAChD,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,2BAA2B,CAAC,CAAA;KACnE;IAED,KAAK,MAAM,CACT,mBAAmB,EACnB,wBAAwB,CACzB,IAAI,iCAAiC,EAAE;QACtC,IAAI,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE;YACtC,MAAM,IAAI,KAAK,CACb,+BAA+B,IAAI,uCAAuC,wBAAwB;;8BAE5E,KAAK,CAAC,IAAI,CAC9B,iCAAiC,CAAC,MAAM,EAAE,CAC3C,CAAC,QAAQ,EAAE;;;WAGT,CACJ,CAAA;SACF;KACF;AACH,CAAC;AAtBD,sDAsBC"}

View File

@@ -1,7 +1,11 @@
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@@ -44,14 +48,14 @@ function retry(name, operation, customErrorMessages, maxAttempts) {
try { try {
response = yield operation(); response = yield operation();
statusCode = response.message.statusCode; statusCode = response.message.statusCode;
if (utils_1.isSuccessStatusCode(statusCode)) { if ((0, utils_1.isSuccessStatusCode)(statusCode)) {
return response; return response;
} }
// Extra error information that we want to display if a particular response code is hit // Extra error information that we want to display if a particular response code is hit
if (statusCode) { if (statusCode) {
customErrorInformation = customErrorMessages.get(statusCode); customErrorInformation = customErrorMessages.get(statusCode);
} }
isRetryable = utils_1.isRetryableStatusCode(statusCode); isRetryable = (0, utils_1.isRetryableStatusCode)(statusCode);
errorMessage = `Artifact service responded with ${statusCode}`; errorMessage = `Artifact service responded with ${statusCode}`;
} }
catch (error) { catch (error) {
@@ -61,16 +65,16 @@ function retry(name, operation, customErrorMessages, maxAttempts) {
if (!isRetryable) { if (!isRetryable) {
core.info(`${name} - Error is not retryable`); core.info(`${name} - Error is not retryable`);
if (response) { if (response) {
utils_1.displayHttpDiagnostics(response); (0, utils_1.displayHttpDiagnostics)(response);
} }
break; break;
} }
core.info(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`); core.info(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`);
yield utils_1.sleep(utils_1.getExponentialRetryTimeInMilliseconds(attempt)); yield (0, utils_1.sleep)((0, utils_1.getExponentialRetryTimeInMilliseconds)(attempt));
attempt++; attempt++;
} }
if (response) { if (response) {
utils_1.displayHttpDiagnostics(response); (0, utils_1.displayHttpDiagnostics)(response);
} }
if (customErrorInformation) { if (customErrorInformation) {
throw Error(`${name} failed: ${customErrorInformation}`); throw Error(`${name} failed: ${customErrorInformation}`);
@@ -79,7 +83,7 @@ function retry(name, operation, customErrorMessages, maxAttempts) {
}); });
} }
exports.retry = retry; exports.retry = retry;
function retryHttpClientRequest(name, method, customErrorMessages = new Map(), maxAttempts = config_variables_1.getRetryLimit()) { function retryHttpClientRequest(name, method, customErrorMessages = new Map(), maxAttempts = (0, config_variables_1.getRetryLimit)()) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return yield retry(name, method, customErrorMessages, maxAttempts); return yield retry(name, method, customErrorMessages, maxAttempts);
}); });

View File

@@ -1 +1 @@
{"version":3,"file":"requestUtils.js","sourceRoot":"","sources":["../../src/internal/requestUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mCAMgB;AAChB,oDAAqC;AACrC,yDAAgD;AAEhD,SAAsB,KAAK,CACzB,IAAY,EACZ,SAA4C,EAC5C,mBAAwC,EACxC,WAAmB;;QAEnB,IAAI,QAAQ,GAAmC,SAAS,CAAA;QACxD,IAAI,UAAU,GAAuB,SAAS,CAAA;QAC9C,IAAI,WAAW,GAAG,KAAK,CAAA;QACvB,IAAI,YAAY,GAAG,EAAE,CAAA;QACrB,IAAI,sBAAsB,GAAuB,SAAS,CAAA;QAC1D,IAAI,OAAO,GAAG,CAAC,CAAA;QAEf,OAAO,OAAO,IAAI,WAAW,EAAE;YAC7B,IAAI;gBACF,QAAQ,GAAG,MAAM,SAAS,EAAE,CAAA;gBAC5B,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAA;gBAExC,IAAI,2BAAmB,CAAC,UAAU,CAAC,EAAE;oBACnC,OAAO,QAAQ,CAAA;iBAChB;gBAED,uFAAuF;gBACvF,IAAI,UAAU,EAAE;oBACd,sBAAsB,GAAG,mBAAmB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;iBAC7D;gBAED,WAAW,GAAG,6BAAqB,CAAC,UAAU,CAAC,CAAA;gBAC/C,YAAY,GAAG,mCAAmC,UAAU,EAAE,CAAA;aAC/D;YAAC,OAAO,KAAK,EAAE;gBACd,WAAW,GAAG,IAAI,CAAA;gBAClB,YAAY,GAAG,KAAK,CAAC,OAAO,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,CAAA;SACzD;QACD,MAAM,KAAK,CAAC,GAAG,IAAI,YAAY,YAAY,EAAE,CAAC,CAAA;IAChD,CAAC;CAAA;AA1DD,sBA0DC;AAED,SAAsB,sBAAsB,CAC1C,IAAY,EACZ,MAAyC,EACzC,sBAA2C,IAAI,GAAG,EAAE,EACpD,WAAW,GAAG,IAAA,gCAAa,GAAE;;QAE7B,OAAO,MAAM,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,mBAAmB,EAAE,WAAW,CAAC,CAAA;IACpE,CAAC;CAAA;AAPD,wDAOC"}

View File

@@ -26,14 +26,14 @@ class StatusReporter {
this.totalFileStatus = setInterval(() => { this.totalFileStatus = setInterval(() => {
// display 1 decimal place without any rounding // display 1 decimal place without any rounding
const percentage = this.formatPercentage(this.processedCount, this.totalNumberOfFilesToProcess); const percentage = this.formatPercentage(this.processedCount, this.totalNumberOfFilesToProcess);
core_1.info(`Total file count: ${this.totalNumberOfFilesToProcess} ---- Processed file #${this.processedCount} (${percentage.slice(0, percentage.indexOf('.') + 2)}%)`); (0, core_1.info)(`Total file count: ${this.totalNumberOfFilesToProcess} ---- Processed file #${this.processedCount} (${percentage.slice(0, percentage.indexOf('.') + 2)}%)`);
}, this.displayFrequencyInMilliseconds); }, this.displayFrequencyInMilliseconds);
} }
// if there is a large file that is being uploaded in chunks, this is used to display extra information about the status of the upload // if there is a large file that is being uploaded in chunks, this is used to display extra information about the status of the upload
updateLargeFileStatus(fileName, chunkStartIndex, chunkEndIndex, totalUploadFileSize) { updateLargeFileStatus(fileName, chunkStartIndex, chunkEndIndex, totalUploadFileSize) {
// display 1 decimal place without any rounding // display 1 decimal place without any rounding
const percentage = this.formatPercentage(chunkEndIndex, totalUploadFileSize); const percentage = this.formatPercentage(chunkEndIndex, totalUploadFileSize);
core_1.info(`Uploaded ${fileName} (${percentage.slice(0, percentage.indexOf('.') + 2)}%) bytes ${chunkStartIndex}:${chunkEndIndex}`); (0, core_1.info)(`Uploaded ${fileName} (${percentage.slice(0, percentage.indexOf('.') + 2)}%) bytes ${chunkStartIndex}:${chunkEndIndex}`);
} }
stop() { stop() {
if (this.totalFileStatus) { if (this.totalFileStatus) {

View File

@@ -1 +1 @@
{"version":3,"file":"status-reporter.js","sourceRoot":"","sources":["../../src/internal/status-reporter.ts"],"names":[],"mappings":";;;AAAA,wCAAkC;AAElC;;;;;;GAMG;AAEH,MAAa,cAAc;IAOzB,YAAY,8BAAsC;QAN1C,gCAA2B,GAAG,CAAC,CAAA;QAC/B,mBAAc,GAAG,CAAC,CAAA;QAElB,eAAU,GAAG,IAAI,GAAG,EAAkB,CAAA;QAI5C,IAAI,CAAC,eAAe,GAAG,SAAS,CAAA;QAChC,IAAI,CAAC,8BAA8B,GAAG,8BAA8B,CAAA;IACtE,CAAC;IAED,8BAA8B,CAAC,SAAiB;QAC9C,IAAI,CAAC,2BAA2B,GAAG,SAAS,CAAA;QAC5C,IAAI,CAAC,cAAc,GAAG,CAAC,CAAA;IACzB,CAAC;IAED,KAAK;QACH,8DAA8D;QAC9D,IAAI,CAAC,eAAe,GAAG,WAAW,CAAC,GAAG,EAAE;YACtC,+CAA+C;YAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CACtC,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,2BAA2B,CACjC,CAAA;YACD,WAAI,CACF,qBACE,IAAI,CAAC,2BACP,yBAAyB,IAAI,CAAC,cAAc,KAAK,UAAU,CAAC,KAAK,CAC/D,CAAC,EACD,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAC5B,IAAI,CACN,CAAA;QACH,CAAC,EAAE,IAAI,CAAC,8BAA8B,CAAC,CAAA;IACzC,CAAC;IAED,sIAAsI;IACtI,qBAAqB,CACnB,QAAgB,EAChB,eAAuB,EACvB,aAAqB,EACrB,mBAA2B;QAE3B,+CAA+C;QAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAA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,2BAA2B,CACjC,CAAA;YACD,IAAA,WAAI,EACF,qBACE,IAAI,CAAC,2BACP,yBAAyB,IAAI,CAAC,cAAc,KAAK,UAAU,CAAC,KAAK,CAC/D,CAAC,EACD,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAC5B,IAAI,CACN,CAAA;QACH,CAAC,EAAE,IAAI,CAAC,8BAA8B,CAAC,CAAA;IACzC,CAAC;IAED,sIAAsI;IACtI,qBAAqB,CACnB,QAAgB,EAChB,eAAuB,EACvB,aAAqB,EACrB,mBAA2B;QAE3B,+CAA+C;QAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAA;QAC5E,IAAA,WAAI,EACF,YAAY,QAAQ,KAAK,UAAU,CAAC,KAAK,CACvC,CAAC,EACD,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAC5B,YAAY,eAAe,IAAI,aAAa,EAAE,CAChD,CAAA;IACH,CAAC;IAED,IAAI;QACF,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;SACpC;IACH,CAAC;IAED,uBAAuB;QACrB,IAAI,CAAC,cAAc,EAAE,CAAA;IACvB,CAAC;IAEO,gBAAgB,CAAC,SAAiB,EAAE,WAAmB;QAC7D,0HAA0H;QAC1H,OAAO,CAAC,CAAC,SAAS,GAAG,WAAW,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;IAChE,CAAC;CACF;AAnED,wCAmEC"}

View File

@@ -1,7 +1,11 @@
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@@ -39,19 +43,34 @@ exports.createGZipFileInBuffer = exports.createGZipFileOnDisk = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const zlib = __importStar(require("zlib")); const zlib = __importStar(require("zlib"));
const util_1 = require("util"); const util_1 = require("util");
const stat = util_1.promisify(fs.stat); const stat = (0, util_1.promisify)(fs.stat);
/** /**
* GZipping certain files that are already compressed will likely not yield further size reductions. Creating large temporary gzip * GZipping certain files that are already compressed will likely not yield further size reductions. Creating large temporary gzip
* files then will just waste a lot of time before ultimately being discarded (especially for very large files). * files then will just waste a lot of time before ultimately being discarded (especially for very large files).
* If any of these types of files are encountered then on-disk gzip creation will be skipped and the original file will be uploaded as-is * If any of these types of files are encountered then on-disk gzip creation will be skipped and the original file will be uploaded as-is
*/ */
const gzipExemptFileExtensions = [ const gzipExemptFileExtensions = [
'.gz',
'.gzip', '.gzip',
'.tgz',
'.taz',
'.Z',
'.taZ',
'.bz2',
'.tbz',
'.tbz2',
'.tz2',
'.lz',
'.lzma',
'.tlz',
'.lzo',
'.xz',
'.txz',
'.zst',
'.zstd',
'.tzst',
'.zip', '.zip',
'.tar.lz', '.7z' // 7ZIP
'.tar.gz',
'.tar.bz2',
'.7z'
]; ];
/** /**
* Creates a Gzip compressed file of an original file at the provided temporary filepath location * Creates a Gzip compressed file of an original file at the provided temporary filepath location
@@ -80,7 +99,7 @@ function createGZipFileOnDisk(originalFilePath, tempFilePath) {
outputStream.on('error', error => { outputStream.on('error', error => {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);
reject; reject(error);
}); });
}); });
}); });
@@ -94,22 +113,29 @@ exports.createGZipFileOnDisk = createGZipFileOnDisk;
function createGZipFileInBuffer(originalFilePath) { function createGZipFileInBuffer(originalFilePath) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
var e_1, _a; var _a, e_1, _b, _c;
const inputStream = fs.createReadStream(originalFilePath); const inputStream = fs.createReadStream(originalFilePath);
const gzip = zlib.createGzip(); const gzip = zlib.createGzip();
inputStream.pipe(gzip); inputStream.pipe(gzip);
// read stream into buffer, using experimental async iterators see https://github.com/nodejs/readable-stream/issues/403#issuecomment-479069043 // read stream into buffer, using experimental async iterators see https://github.com/nodejs/readable-stream/issues/403#issuecomment-479069043
const chunks = []; const chunks = [];
try { try {
for (var gzip_1 = __asyncValues(gzip), gzip_1_1; gzip_1_1 = yield gzip_1.next(), !gzip_1_1.done;) { for (var _d = true, gzip_1 = __asyncValues(gzip), gzip_1_1; gzip_1_1 = yield gzip_1.next(), _a = gzip_1_1.done, !_a;) {
const chunk = gzip_1_1.value; _c = gzip_1_1.value;
_d = false;
try {
const chunk = _c;
chunks.push(chunk); chunks.push(chunk);
} }
finally {
_d = true;
}
}
} }
catch (e_1_1) { e_1 = { error: e_1_1 }; } catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally { finally {
try { try {
if (gzip_1_1 && !gzip_1_1.done && (_a = gzip_1.return)) yield _a.call(gzip_1); if (!_d && !_a && (_b = gzip_1.return)) yield _b.call(gzip_1);
} }
finally { if (e_1) throw e_1.error; } finally { if (e_1) throw e_1.error; }
} }

View File

@@ -1 +1 @@
{"version":3,"file":"upload-gzip.js","sourceRoot":"","sources":["../../src/internal/upload-gzip.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,2CAA4B;AAC5B,+BAA8B;AAC9B,MAAM,IAAI,GAAG,gBAAS,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;AAE/B;;;;GAIG;AACH,MAAM,wBAAwB,GAAG;IAC/B,OAAO;IACP,MAAM;IACN,SAAS;IACT,SAAS;IACT,UAAU;IACV,KAAK;CACN,CAAA;AAED;;;;;GAKG;AACH,SAAsB,oBAAoB,CACxC,gBAAwB,EACxB,YAAoB;;QAEpB,KAAK,MAAM,mBAAmB,IAAI,wBAAwB,EAAE;YAC1D,IAAI,gBAAgB,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE;gBAClD,uEAAuE;gBACvE,OAAO,MAAM,CAAC,gBAAgB,CAAA;aAC/B;SACF;QAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,WAAW,GAAG,EAAE,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAA;YACzD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAA;YAC9B,MAAM,YAAY,GAAG,EAAE,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAA;YACvD,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;YACzC,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAS,EAAE;gBACnC,qIAAqI;gBACrI,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,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AC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CAAA;AA3BD,oDA2BC;AAED;;;;GAIG;AACH,SAAsB,sBAAsB,CAC1C,gBAAwB;;QAExB,OAAO,IAAI,OAAO,CAAC,CAAM,OAAO,EAAC,EAAE;;YACjC,MAAM,WAAW,GAAG,EAAE,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAA;YACzD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAA;YAC9B,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACtB,8IAA8I;YAC9I,MAAM,MAAM,GAAiB,EAAE,CAAA;;gBAC/B,KAA0B,eAAA,SAAA,cAAA,IAAI,CAAA,UAAA;oBAAJ,oBAAI;oBAAJ,WAAI;;wBAAnB,MAAM,KAAK,KAAA,CAAA;wBACpB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;;;;;iBACnB;;;;;;;;;YACD,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;QAChC,CAAC,CAAA,CAAC,CAAA;IACJ,CAAC;CAAA;AAdD,wDAcC"}

View File

@@ -1,7 +1,11 @@
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@@ -43,10 +47,10 @@ const http_client_1 = require("@actions/http-client");
const http_manager_1 = require("./http-manager"); const http_manager_1 = require("./http-manager");
const upload_gzip_1 = require("./upload-gzip"); const upload_gzip_1 = require("./upload-gzip");
const requestUtils_1 = require("./requestUtils"); const requestUtils_1 = require("./requestUtils");
const stat = util_1.promisify(fs.stat); const stat = (0, util_1.promisify)(fs.stat);
class UploadHttpClient { class UploadHttpClient {
constructor() { constructor() {
this.uploadHttpManager = new http_manager_1.HttpManager(config_variables_1.getUploadFileConcurrency(), '@actions/artifact-upload'); this.uploadHttpManager = new http_manager_1.HttpManager((0, config_variables_1.getUploadFileConcurrency)(), '@actions/artifact-upload');
this.statusReporter = new status_reporter_1.StatusReporter(10000); this.statusReporter = new status_reporter_1.StatusReporter(10000);
} }
/** /**
@@ -62,28 +66,30 @@ class UploadHttpClient {
}; };
// calculate retention period // calculate retention period
if (options && options.retentionDays) { if (options && options.retentionDays) {
const maxRetentionStr = config_variables_1.getRetentionDays(); const maxRetentionStr = (0, config_variables_1.getRetentionDays)();
parameters.RetentionDays = utils_1.getProperRetention(options.retentionDays, maxRetentionStr); parameters.RetentionDays = (0, utils_1.getProperRetention)(options.retentionDays, maxRetentionStr);
} }
const data = JSON.stringify(parameters, null, 2); const data = JSON.stringify(parameters, null, 2);
const artifactUrl = utils_1.getArtifactUrl(); const artifactUrl = (0, utils_1.getArtifactUrl)();
// use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately // use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately
const client = this.uploadHttpManager.getClient(0); const client = this.uploadHttpManager.getClient(0);
const headers = utils_1.getUploadHeaders('application/json', false); const headers = (0, utils_1.getUploadHeaders)('application/json', false);
// Extra information to display when a particular HTTP code is returned // Extra information to display when a particular HTTP code is returned
// If a 403 is returned when trying to create a file container, the customer has exceeded // If a 403 is returned when trying to create a file container, the customer has exceeded
// their storage quota so no new artifact containers can be created // their storage quota so no new artifact containers can be created
const customErrorMessages = new Map([ const customErrorMessages = new Map([
[ [
http_client_1.HttpCodes.Forbidden, http_client_1.HttpCodes.Forbidden,
'Artifact storage quota has been hit. Unable to upload any new artifacts' (0, config_variables_1.isGhes)()
? 'Please reference [Enabling GitHub Actions for GitHub Enterprise Server](https://docs.github.com/en/enterprise-server@3.8/admin/github-actions/enabling-github-actions-for-github-enterprise-server) to ensure Actions storage is configured correctly.'
: 'Artifact storage quota has been hit. Unable to upload any new artifacts'
], ],
[ [
http_client_1.HttpCodes.BadRequest, http_client_1.HttpCodes.BadRequest,
`The artifact name ${artifactName} is not valid. Request URL ${artifactUrl}` `The artifact name ${artifactName} is not valid. Request URL ${artifactUrl}`
] ]
]); ]);
const response = yield requestUtils_1.retryHttpClientRequest('Create Artifact Container', () => __awaiter(this, void 0, void 0, function* () { return client.post(artifactUrl, data, headers); }), customErrorMessages); const response = yield (0, requestUtils_1.retryHttpClientRequest)('Create Artifact Container', () => __awaiter(this, void 0, void 0, function* () { return client.post(artifactUrl, data, headers); }), customErrorMessages);
const body = yield response.readBody(); const body = yield response.readBody();
return JSON.parse(body); return JSON.parse(body);
}); });
@@ -96,8 +102,8 @@ class UploadHttpClient {
*/ */
uploadArtifactToFileContainer(uploadUrl, filesToUpload, options) { uploadArtifactToFileContainer(uploadUrl, filesToUpload, options) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const FILE_CONCURRENCY = config_variables_1.getUploadFileConcurrency(); const FILE_CONCURRENCY = (0, config_variables_1.getUploadFileConcurrency)();
const MAX_CHUNK_SIZE = config_variables_1.getUploadChunkSize(); const MAX_CHUNK_SIZE = (0, config_variables_1.getUploadChunkSize)();
core.debug(`File Concurrency: ${FILE_CONCURRENCY}, and Chunk Size: ${MAX_CHUNK_SIZE}`); core.debug(`File Concurrency: ${FILE_CONCURRENCY}, and Chunk Size: ${MAX_CHUNK_SIZE}`);
const parameters = []; const parameters = [];
// by default, file uploads will continue if there is an error unless specified differently in the options // by default, file uploads will continue if there is an error unless specified differently in the options
@@ -187,7 +193,7 @@ class UploadHttpClient {
// with named pipes the file size is reported as zero in that case don't read the file in memory // with named pipes the file size is reported as zero in that case don't read the file in memory
if (!isFIFO && totalFileSize < 65536) { if (!isFIFO && totalFileSize < 65536) {
core.debug(`${parameters.file} is less than 64k in size. Creating a gzip file in-memory to potentially reduce the upload size`); core.debug(`${parameters.file} is less than 64k in size. Creating a gzip file in-memory to potentially reduce the upload size`);
const buffer = yield upload_gzip_1.createGZipFileInBuffer(parameters.file); const buffer = yield (0, upload_gzip_1.createGZipFileInBuffer)(parameters.file);
// An open stream is needed in the event of a failure and we need to retry. If a NodeJS.ReadableStream is directly passed in, // An open stream is needed in the event of a failure and we need to retry. If a NodeJS.ReadableStream is directly passed in,
// it will not properly get reset to the start of the stream if a chunk upload needs to be retried // it will not properly get reset to the start of the stream if a chunk upload needs to be retried
let openUploadStream; let openUploadStream;
@@ -227,7 +233,7 @@ class UploadHttpClient {
const tempFile = yield tmp.file(); const tempFile = yield tmp.file();
core.debug(`${parameters.file} is greater than 64k in size. Creating a gzip file on-disk ${tempFile.path} to potentially reduce the upload size`); core.debug(`${parameters.file} is greater than 64k in size. Creating a gzip file on-disk ${tempFile.path} to potentially reduce the upload size`);
// create a GZip file of the original file being uploaded, the original file should not be modified in any way // create a GZip file of the original file being uploaded, the original file should not be modified in any way
uploadFileSize = yield upload_gzip_1.createGZipFileOnDisk(parameters.file, tempFile.path); uploadFileSize = yield (0, upload_gzip_1.createGZipFileOnDisk)(parameters.file, tempFile.path);
let uploadFilePath = tempFile.path; let uploadFilePath = tempFile.path;
// compression did not help with size reduction, use the original file for upload and delete the temp GZip file // compression did not help with size reduction, use the original file for upload and delete the temp GZip file
// for named pipes totalFileSize is zero, this assumes compression did help // for named pipes totalFileSize is zero, this assumes compression did help
@@ -300,22 +306,22 @@ class UploadHttpClient {
uploadChunk(httpClientIndex, resourceUrl, openStream, start, end, uploadFileSize, isGzip, totalFileSize) { uploadChunk(httpClientIndex, resourceUrl, openStream, start, end, uploadFileSize, isGzip, totalFileSize) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
// open a new stream and read it to compute the digest // open a new stream and read it to compute the digest
const digest = yield utils_1.digestForStream(openStream()); const digest = yield (0, utils_1.digestForStream)(openStream());
// prepare all the necessary headers before making any http call // prepare all the necessary headers before making any http call
const headers = utils_1.getUploadHeaders('application/octet-stream', true, isGzip, totalFileSize, end - start + 1, utils_1.getContentRange(start, end, uploadFileSize), digest); const headers = (0, utils_1.getUploadHeaders)('application/octet-stream', true, isGzip, totalFileSize, end - start + 1, (0, utils_1.getContentRange)(start, end, uploadFileSize), digest);
const uploadChunkRequest = () => __awaiter(this, void 0, void 0, function* () { const uploadChunkRequest = () => __awaiter(this, void 0, void 0, function* () {
const client = this.uploadHttpManager.getClient(httpClientIndex); const client = this.uploadHttpManager.getClient(httpClientIndex);
return yield client.sendStream('PUT', resourceUrl, openStream(), headers); return yield client.sendStream('PUT', resourceUrl, openStream(), headers);
}); });
let retryCount = 0; let retryCount = 0;
const retryLimit = config_variables_1.getRetryLimit(); const retryLimit = (0, config_variables_1.getRetryLimit)();
// Increments the current retry count and then checks if the retry limit has been reached // Increments the current retry count and then checks if the retry limit has been reached
// If there have been too many retries, fail so the download stops // If there have been too many retries, fail so the download stops
const incrementAndCheckRetryLimit = (response) => { const incrementAndCheckRetryLimit = (response) => {
retryCount++; retryCount++;
if (retryCount > retryLimit) { if (retryCount > retryLimit) {
if (response) { if (response) {
utils_1.displayHttpDiagnostics(response); (0, utils_1.displayHttpDiagnostics)(response);
} }
core.info(`Retry limit has been reached for chunk at offset ${start} to ${resourceUrl}`); core.info(`Retry limit has been reached for chunk at offset ${start} to ${resourceUrl}`);
return true; return true;
@@ -326,12 +332,12 @@ class UploadHttpClient {
this.uploadHttpManager.disposeAndReplaceClient(httpClientIndex); this.uploadHttpManager.disposeAndReplaceClient(httpClientIndex);
if (retryAfterValue) { if (retryAfterValue) {
core.info(`Backoff due to too many requests, retry #${retryCount}. Waiting for ${retryAfterValue} milliseconds before continuing the upload`); core.info(`Backoff due to too many requests, retry #${retryCount}. Waiting for ${retryAfterValue} milliseconds before continuing the upload`);
yield utils_1.sleep(retryAfterValue); yield (0, utils_1.sleep)(retryAfterValue);
} }
else { else {
const backoffTime = utils_1.getExponentialRetryTimeInMilliseconds(retryCount); const backoffTime = (0, utils_1.getExponentialRetryTimeInMilliseconds)(retryCount);
core.info(`Exponential backoff for retry #${retryCount}. Waiting for ${backoffTime} milliseconds before continuing the upload at offset ${start}`); core.info(`Exponential backoff for retry #${retryCount}. Waiting for ${backoffTime} milliseconds before continuing the upload at offset ${start}`);
yield utils_1.sleep(backoffTime); yield (0, utils_1.sleep)(backoffTime);
} }
core.info(`Finished backoff for retry #${retryCount}, continuing with upload`); core.info(`Finished backoff for retry #${retryCount}, continuing with upload`);
return; return;
@@ -356,21 +362,21 @@ class UploadHttpClient {
// Always read the body of the response. There is potential for a resource leak if the body is not read which will // Always read the body of the response. There is potential for a resource leak if the body is not read which will
// result in the connection remaining open along with unintended consequences when trying to dispose of the client // result in the connection remaining open along with unintended consequences when trying to dispose of the client
yield response.readBody(); yield response.readBody();
if (utils_1.isSuccessStatusCode(response.message.statusCode)) { if ((0, utils_1.isSuccessStatusCode)(response.message.statusCode)) {
return true; return true;
} }
else if (utils_1.isRetryableStatusCode(response.message.statusCode)) { else if ((0, utils_1.isRetryableStatusCode)(response.message.statusCode)) {
core.info(`A ${response.message.statusCode} status code has been received, will attempt to retry the upload`); core.info(`A ${response.message.statusCode} status code has been received, will attempt to retry the upload`);
if (incrementAndCheckRetryLimit(response)) { if (incrementAndCheckRetryLimit(response)) {
return false; return false;
} }
utils_1.isThrottledStatusCode(response.message.statusCode) (0, utils_1.isThrottledStatusCode)(response.message.statusCode)
? yield backOff(utils_1.tryGetRetryAfterValueTimeInMilliseconds(response.message.headers)) ? yield backOff((0, utils_1.tryGetRetryAfterValueTimeInMilliseconds)(response.message.headers))
: yield backOff(); : yield backOff();
} }
else { else {
core.error(`Unexpected response. Unable to upload chunk to ${resourceUrl}`); core.error(`Unexpected response. Unable to upload chunk to ${resourceUrl}`);
utils_1.displayHttpDiagnostics(response); (0, utils_1.displayHttpDiagnostics)(response);
return false; return false;
} }
} }
@@ -383,14 +389,14 @@ class UploadHttpClient {
*/ */
patchArtifactSize(size, artifactName) { patchArtifactSize(size, artifactName) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const resourceUrl = new url_1.URL(utils_1.getArtifactUrl()); const resourceUrl = new url_1.URL((0, utils_1.getArtifactUrl)());
resourceUrl.searchParams.append('artifactName', artifactName); resourceUrl.searchParams.append('artifactName', artifactName);
const parameters = { Size: size }; const parameters = { Size: size };
const data = JSON.stringify(parameters, null, 2); const data = JSON.stringify(parameters, null, 2);
core.debug(`URL is ${resourceUrl.toString()}`); core.debug(`URL is ${resourceUrl.toString()}`);
// use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately // use the first client from the httpManager, `keep-alive` is not used so the connection will close immediately
const client = this.uploadHttpManager.getClient(0); const client = this.uploadHttpManager.getClient(0);
const headers = utils_1.getUploadHeaders('application/json', false); const headers = (0, utils_1.getUploadHeaders)('application/json', false);
// Extra information to display when a particular HTTP code is returned // Extra information to display when a particular HTTP code is returned
const customErrorMessages = new Map([ const customErrorMessages = new Map([
[ [
@@ -399,7 +405,7 @@ class UploadHttpClient {
] ]
]); ]);
// TODO retry for all possible response codes, the artifact upload is pretty much complete so it at all costs we should try to finish this // TODO retry for all possible response codes, the artifact upload is pretty much complete so it at all costs we should try to finish this
const response = yield requestUtils_1.retryHttpClientRequest('Finalize artifact upload', () => __awaiter(this, void 0, void 0, function* () { return client.patch(resourceUrl.toString(), data, headers); }), customErrorMessages); const response = yield (0, requestUtils_1.retryHttpClientRequest)('Finalize artifact upload', () => __awaiter(this, void 0, void 0, function* () { return client.patch(resourceUrl.toString(), data, headers); }), customErrorMessages);
yield response.readBody(); yield response.readBody();
core.debug(`Artifact ${artifactName} has been successfully uploaded, total size in bytes: ${size}`); core.debug(`Artifact ${artifactName} has been successfully uploaded, total size in bytes: ${size}`);
}); });

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,11 @@
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) { }) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k; if (k2 === undefined) k2 = k;
o[k2] = m[k]; o[k2] = m[k];
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
var __importStar = (this && this.__importStar) || function (mod) { var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod; if (mod && mod.__esModule) return mod;
var result = {}; var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@@ -36,12 +40,12 @@ function getUploadSpecification(artifactName, rootDirectory, artifactFiles) {
if (!fs.existsSync(rootDirectory)) { if (!fs.existsSync(rootDirectory)) {
throw new Error(`Provided rootDirectory ${rootDirectory} does not exist`); throw new Error(`Provided rootDirectory ${rootDirectory} does not exist`);
} }
if (!fs.lstatSync(rootDirectory).isDirectory()) { if (!fs.statSync(rootDirectory).isDirectory()) {
throw new Error(`Provided rootDirectory ${rootDirectory} is not a valid directory`); throw new Error(`Provided rootDirectory ${rootDirectory} is not a valid directory`);
} }
// Normalize and resolve, this allows for either absolute or relative paths to be used // Normalize and resolve, this allows for either absolute or relative paths to be used
rootDirectory = path_1.normalize(rootDirectory); rootDirectory = (0, path_1.normalize)(rootDirectory);
rootDirectory = path_1.resolve(rootDirectory); rootDirectory = (0, path_1.resolve)(rootDirectory);
/* /*
Example to demonstrate behavior Example to demonstrate behavior
@@ -65,16 +69,16 @@ function getUploadSpecification(artifactName, rootDirectory, artifactFiles) {
if (!fs.existsSync(file)) { if (!fs.existsSync(file)) {
throw new Error(`File ${file} does not exist`); throw new Error(`File ${file} does not exist`);
} }
if (!fs.lstatSync(file).isDirectory()) { if (!fs.statSync(file).isDirectory()) {
// Normalize and resolve, this allows for either absolute or relative paths to be used // Normalize and resolve, this allows for either absolute or relative paths to be used
file = path_1.normalize(file); file = (0, path_1.normalize)(file);
file = path_1.resolve(file); file = (0, path_1.resolve)(file);
if (!file.startsWith(rootDirectory)) { if (!file.startsWith(rootDirectory)) {
throw new Error(`The rootDirectory: ${rootDirectory} is not a parent directory of the file: ${file}`); throw new Error(`The rootDirectory: ${rootDirectory} is not a parent directory of the file: ${file}`);
} }
// Check for forbidden characters in file paths that will be rejected during upload // Check for forbidden characters in file paths that will be rejected during upload
const uploadPath = file.replace(rootDirectory, ''); const uploadPath = file.replace(rootDirectory, '');
path_and_artifact_name_validation_1.checkArtifactFilePath(uploadPath); (0, path_and_artifact_name_validation_1.checkArtifactFilePath)(uploadPath);
/* /*
uploadFilePath denotes where the file will be uploaded in the file container on the server. During a run, if multiple artifacts are uploaded, they will all uploadFilePath denotes where the file will be uploaded in the file container on the server. During a run, if multiple artifacts are uploaded, they will all
be saved in the same container. The artifact name is used as the root directory in the container to separate and distinguish uploaded artifacts be saved in the same container. The artifact name is used as the root directory in the container to separate and distinguish uploaded artifacts
@@ -87,12 +91,12 @@ function getUploadSpecification(artifactName, rootDirectory, artifactFiles) {
*/ */
specifications.push({ specifications.push({
absoluteFilePath: file, absoluteFilePath: file,
uploadFilePath: path_1.join(artifactName, uploadPath) uploadFilePath: (0, path_1.join)(artifactName, uploadPath)
}); });
} }
else { else {
// Directories are rejected by the server during upload // Directories are rejected by the server during upload
core_1.debug(`Removing ${file} from rawSearchResults because it is a directory`); (0, core_1.debug)(`Removing ${file} from rawSearchResults because it is a directory`);
} }
} }
return specifications; return specifications;

View File

@@ -1 +1 @@
{"version":3,"file":"upload-specification.js","sourceRoot":"","sources":["../../src/internal/upload-specification.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,wCAAmC;AACnC,+BAA6C;AAC7C,2FAAyE;AAOzE;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,YAAoB,EACpB,aAAqB,EACrB,aAAuB;IAEvB,+DAA+D;IAC/D,MAAM,cAAc,GAA0B,EAAE,CAAA;IAEhD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;QACjC,MAAM,IAAI,KAAK,CAAC,0BAA0B,aAAa,iBAAiB,CAAC,CAAA;KAC1E;IACD,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,WAAW,EAAE,EAAE;QAC9C,MAAM,IAAI,KAAK,CACb,0BAA0B,aAAa,2BAA2B,CACnE,CAAA;KACF;IACD,sFAAsF;IACtF,aAAa,GAAG,gBAAS,CAAC,aAAa,CAAC,CAAA;IACxC,aAAa,GAAG,cAAO,CAAC,aAAa,CAAC,CAAA;IAEtC;;;;;;;;;;;;;;;;;;MAkBE;IACF,KAAK,IAAI,IAAI,IAAI,aAAa,EAAE;QAC9B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,iBAAiB,CAAC,CAAA;SAC/C;QACD,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE;YACrC,sFAAsF;YACtF,IAAI,GAAG,gBAAS,CAAC,IAAI,CAAC,CAAA;YACtB,IAAI,GAAG,cAAO,CAAC,IAAI,CAAC,CAAA;YACpB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;gBACnC,MAAM,IAAI,KAAK,CACb,sBAAsB,aAAa,2CAA2C,IAAI,EAAE,CACrF,CAAA;aACF;YAED,mFAAmF;YACnF,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAA;YAClD,yDAAqB,CAAC,UAAU,CAAC,CAAA;YAEjC;;;;;;;;;cASE;YACF,cAAc,CAAC,IAAI,CAAC;gBAClB,gBAAgB,EAAE,IAAI;gBACtB,cAAc,EAAE,WAAI,CAAC,YAAY,EAAE,UAAU,CAAC;aAC/C,CAAC,CAAA;SACH;aAAM;YACL,uDAAuD;YACvD,YAAK,CAAC,YAAY,IAAI,kDAAkD,CAAC,CAAA;SAC1E;KACF;IACD,OAAO,cAAc,CAAA;AACvB,CAAC;AA7ED,wDA6EC"} {"version":3,"file":"upload-specification.js","sourceRoot":"","sources":["../../src/internal/upload-specification.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,wCAAmC;AACnC,+BAA6C;AAC7C,2FAAyE;AAOzE;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,YAAoB,EACpB,aAAqB,EACrB,aAAuB;IAEvB,+DAA+D;IAC/D,MAAM,cAAc,GA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AAE,UAAU,CAAC;aAC/C,CAAC,CAAA;SACH;aAAM;YACL,uDAAuD;YACvD,IAAA,YAAK,EAAC,YAAY,IAAI,kDAAkD,CAAC,CAAA;SAC1E;KACF;IACD,OAAO,cAAc,CAAA;AACvB,CAAC;AA7ED,wDA6EC"}

View File

@@ -1,4 +1,5 @@
/// <reference types="node" /> /// <reference types="node" />
/// <reference types="node" />
import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http'; import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http';
import { HttpClient, HttpClientResponse } from '@actions/http-client'; import { HttpClient, HttpClientResponse } from '@actions/http-client';
/** /**

View File

@@ -29,10 +29,10 @@ function getExponentialRetryTimeInMilliseconds(retryCount) {
throw new Error('RetryCount should not be negative'); throw new Error('RetryCount should not be negative');
} }
else if (retryCount === 0) { else if (retryCount === 0) {
return config_variables_1.getInitialRetryIntervalInMilliseconds(); return (0, config_variables_1.getInitialRetryIntervalInMilliseconds)();
} }
const minTime = config_variables_1.getInitialRetryIntervalInMilliseconds() * config_variables_1.getRetryMultiplier() * retryCount; const minTime = (0, config_variables_1.getInitialRetryIntervalInMilliseconds)() * (0, config_variables_1.getRetryMultiplier)() * retryCount;
const maxTime = minTime * config_variables_1.getRetryMultiplier(); const maxTime = minTime * (0, config_variables_1.getRetryMultiplier)();
// returns a random number between the minTime (inclusive) and the maxTime (exclusive) // returns a random number between the minTime (inclusive) and the maxTime (exclusive)
return Math.trunc(Math.random() * (maxTime - minTime) + minTime); return Math.trunc(Math.random() * (maxTime - minTime) + minTime);
} }
@@ -100,13 +100,13 @@ function tryGetRetryAfterValueTimeInMilliseconds(headers) {
if (headers['retry-after']) { if (headers['retry-after']) {
const retryTime = Number(headers['retry-after']); const retryTime = Number(headers['retry-after']);
if (!isNaN(retryTime)) { if (!isNaN(retryTime)) {
core_1.info(`Retry-After header is present with a value of ${retryTime}`); (0, core_1.info)(`Retry-After header is present with a value of ${retryTime}`);
return retryTime * 1000; return retryTime * 1000;
} }
core_1.info(`Returned retry-after header value: ${retryTime} is non-numeric and cannot be used`); (0, core_1.info)(`Returned retry-after header value: ${retryTime} is non-numeric and cannot be used`);
return undefined; return undefined;
} }
core_1.info(`No retry-after header was found. Dumping all headers for diagnostic purposes`); (0, core_1.info)(`No retry-after header was found. Dumping all headers for diagnostic purposes`);
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(headers); console.log(headers);
return undefined; return undefined;
@@ -190,13 +190,13 @@ function getUploadHeaders(contentType, isKeepAlive, isGzip, uncompressedLength,
exports.getUploadHeaders = getUploadHeaders; exports.getUploadHeaders = getUploadHeaders;
function createHttpClient(userAgent) { function createHttpClient(userAgent) {
return new http_client_1.HttpClient(userAgent, [ return new http_client_1.HttpClient(userAgent, [
new auth_1.BearerCredentialHandler(config_variables_1.getRuntimeToken()) new auth_1.BearerCredentialHandler((0, config_variables_1.getRuntimeToken)())
]); ]);
} }
exports.createHttpClient = createHttpClient; exports.createHttpClient = createHttpClient;
function getArtifactUrl() { function getArtifactUrl() {
const artifactUrl = `${config_variables_1.getRuntimeUrl()}_apis/pipelines/workflows/${config_variables_1.getWorkFlowRunId()}/artifacts?api-version=${getApiVersion()}`; const artifactUrl = `${(0, config_variables_1.getRuntimeUrl)()}_apis/pipelines/workflows/${(0, config_variables_1.getWorkFlowRunId)()}/artifacts?api-version=${getApiVersion()}`;
core_1.debug(`Artifact Url: ${artifactUrl}`); (0, core_1.debug)(`Artifact Url: ${artifactUrl}`);
return artifactUrl; return artifactUrl;
} }
exports.getArtifactUrl = getArtifactUrl; exports.getArtifactUrl = getArtifactUrl;
@@ -210,7 +210,7 @@ exports.getArtifactUrl = getArtifactUrl;
* Other information such as the headers, the response code and message might be useful, so this is displayed. * Other information such as the headers, the response code and message might be useful, so this is displayed.
*/ */
function displayHttpDiagnostics(response) { function displayHttpDiagnostics(response) {
core_1.info(`##### Begin Diagnostic HTTP information ##### (0, core_1.info)(`##### Begin Diagnostic HTTP information #####
Status Code: ${response.message.statusCode} Status Code: ${response.message.statusCode}
Status Message: ${response.message.statusMessage} Status Message: ${response.message.statusMessage}
Header Information: ${JSON.stringify(response.message.headers, undefined, 2)} Header Information: ${JSON.stringify(response.message.headers, undefined, 2)}
@@ -238,7 +238,7 @@ exports.createEmptyFilesForArtifact = createEmptyFilesForArtifact;
function getFileSize(filePath) { function getFileSize(filePath) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const stats = yield fs_1.promises.stat(filePath); const stats = yield fs_1.promises.stat(filePath);
core_1.debug(`${filePath} size:(${stats.size}) blksize:(${stats.blksize}) blocks:(${stats.blocks})`); (0, core_1.debug)(`${filePath} size:(${stats.size}) blksize:(${stats.blksize}) blocks:(${stats.blocks})`);
return stats.size; return stats.size;
}); });
} }
@@ -257,7 +257,7 @@ function getProperRetention(retentionInput, retentionSetting) {
if (retentionSetting) { if (retentionSetting) {
const maxRetention = parseInt(retentionSetting); const maxRetention = parseInt(retentionSetting);
if (!isNaN(maxRetention) && maxRetention < retention) { if (!isNaN(maxRetention) && maxRetention < retention) {
core_1.warning(`Retention days is greater than the max value allowed by the repository setting, reduce retention to ${maxRetention} days`); (0, core_1.warning)(`Retention days is greater than the max value allowed by the repository setting, reduce retention to ${maxRetention} days`);
retention = maxRetention; retention = maxRetention;
} }
} }

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{ {
"name": "@actions/artifact", "name": "@actions/artifact",
"version": "1.1.1", "version": "1.1.2",
"preview": true, "preview": true,
"description": "Actions artifact lib", "description": "Actions artifact lib",
"keywords": [ "keywords": [
@@ -31,7 +31,9 @@
"scripts": { "scripts": {
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json", "audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
"test": "echo \"Error: run tests from root\" && exit 1", "test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc" "bootstrap": "cd ../../ && npm run bootstrap",
"tsc-run": "tsc",
"tsc": "npm run bootstrap && npm run tsc-run"
}, },
"bugs": { "bugs": {
"url": "https://github.com/actions/toolkit/issues" "url": "https://github.com/actions/toolkit/issues"
@@ -44,6 +46,6 @@
}, },
"devDependencies": { "devDependencies": {
"@types/tmp": "^0.2.1", "@types/tmp": "^0.2.1",
"typescript": "^3.8.3" "typescript": "^4.3.0"
} }
} }

Some files were not shown because too many files have changed in this diff Show More