Compare commits

...

48 Commits

Author SHA1 Message Date
Henning Makholm
f5d822707e Merge pull request #965 from github/update-v1.1.4-308528ba
Merge main into v1
2022-03-07 22:01:06 +01:00
Henning Makholm
1f44993f56 Update CHANGELOG.md 2022-03-07 20:24:16 +01:00
Henning Makholm
701b6a5569 Update CHANGELOG.md
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-03-07 18:15:18 +01:00
Henning Makholm
e75fa83dde Update CHANGELOG.md 2022-03-07 17:49:53 +01:00
Henning Makholm
a33ae09fb8 Update CHANGELOG.md
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-03-07 17:44:04 +01:00
github-actions[bot]
44198be781 1.1.4 2022-03-07 16:22:37 +00:00
Andrew Eisenberg
308528ba13 Merge pull request #958 from daniel-beck/fix-link
Fix link to docs
2022-03-04 10:48:08 -08:00
Chuan-kai Lin
939659ccd0 Merge pull request #959 from cklin/report-runner-os-arch
Add runner OS and arch to status report
2022-03-03 14:59:41 -08:00
Chuan-kai Lin
401a76f245 Add runner OS release to status report 2022-03-03 13:06:02 -08:00
Andrew Eisenberg
5e27f57127 Merge pull request #961 from github/dependabot/npm_and_yarn/actions/artifact-1.0.0
Bump @actions/artifact from 0.5.2 to 1.0.0
2022-03-03 11:23:57 -08:00
github-actions[bot]
4154eaf0e9 Update checked-in dependencies 2022-03-03 17:18:51 +00:00
dependabot[bot]
75e4d9f140 Bump @actions/artifact from 0.5.2 to 1.0.0
Bumps [@actions/artifact](https://github.com/actions/toolkit/tree/HEAD/packages/artifact) from 0.5.2 to 1.0.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/artifact/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/@actions/io@1.0.0/packages/artifact)

---
updated-dependencies:
- dependency-name: "@actions/artifact"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-03 17:01:31 +00:00
Chuan-kai Lin
870dbaaebe Use getRequiredEnvParam()
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-03-02 16:23:13 -08:00
Chuan-kai Lin
3615d8ac45 Add runner OS and arch to status report 2022-03-02 10:57:12 -08:00
Daniel Beck
47dd636fbc Fix link to docs 2022-03-02 15:30:11 +01:00
Edoardo Pirovano
e4766c87d5 Merge pull request #957 from github/edoardo/reuse-codescanning-config
Second attempt to use `--codescanning-config` flag of CLI
2022-03-02 00:27:29 +00:00
Edoardo Pirovano
527d5153ad Bump version flag for using --codescanning-config flag 2022-03-01 14:34:53 +00:00
Edoardo Pirovano
07990f07e5 Revert "Revert "Use --codescanning-config flag of CLI""
This reverts commit 326e5118c5.
2022-03-01 14:33:00 +00:00
Edoardo Pirovano
fa19286989 Merge pull request #954 from github/edoardo/expand-tests
Expand PR checks to cover `windows-2022`
2022-03-01 09:24:51 +00:00
Chris Gavin
b1c781d398 Merge pull request #955 from github/delete-results-directory
Delete the results directory in between runs.
2022-02-28 20:26:51 +00:00
Chris Gavin
938e0a0743 Add retryDelay and a type cast to make it work. 2022-02-28 19:42:58 +00:00
Chris Gavin
d63f798314 Retry directory deletion to avoid Windows file locking issues.
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-02-28 18:55:45 +00:00
Chris Gavin
86940df49f Delete the results directory in between runs. 2022-02-28 18:55:45 +00:00
Henning Makholm
25313901b7 Merge pull request #950 from github/hmakholm/pr/2.8.2
Update default CodeQL bundle version to 2.8.2
2022-02-28 19:11:10 +01:00
Edoardo Pirovano
8ec6a84629 Expand PR checks to cover windows-2022 2022-02-28 15:39:34 +00:00
Henning Makholm
162ecaff35 Update default CodeQL bundle version to 2.8.2 2022-02-25 14:09:56 +01:00
Henry Mercer
117a67b074 Merge pull request #949 from github/dependabot/npm_and_yarn/removeNPMAbsolutePaths-3.0.0
Bump removeNPMAbsolutePaths from 2.0.0 to 3.0.0
2022-02-24 18:49:56 +00:00
github-actions[bot]
0da815296a Update checked-in dependencies 2022-02-24 17:03:29 +00:00
dependabot[bot]
4e02f8e87a Bump removeNPMAbsolutePaths from 2.0.0 to 3.0.0
Bumps [removeNPMAbsolutePaths](https://github.com/juanjoDiaz/removeNPMAbsolutePaths) from 2.0.0 to 3.0.0.
- [Release notes](https://github.com/juanjoDiaz/removeNPMAbsolutePaths/releases)
- [Commits](https://github.com/juanjoDiaz/removeNPMAbsolutePaths/compare/v2.0.0...v3.0.0)

---
updated-dependencies:
- dependency-name: removeNPMAbsolutePaths
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-24 17:01:55 +00:00
Edoardo Pirovano
438f654919 Merge pull request #948 from github/edoardo/revert-windows-11
Revert "Merge pull request #869 from github/edoardo/windows-11-error"
2022-02-24 14:36:46 +00:00
Edoardo Pirovano
42af7232c3 Revert "Merge pull request #869 from github/edoardo/windows-11-error"
This reverts commit faa9ba7363, reversing
changes made to 71112ab35d.
2022-02-24 11:29:26 +00:00
Andrew Eisenberg
360221eece Merge pull request #947 from github/mergeback/v1.1.3-to-main-75f07e7a
Mergeback v1.1.3 refs/heads/v1 into main
2022-02-23 14:09:47 -08:00
github-actions[bot]
9169d2461f Update checked-in dependencies 2022-02-23 19:50:02 +00:00
github-actions[bot]
949eeb2dcf 1.1.4 2022-02-23 19:33:33 +00:00
github-actions[bot]
507795f5c4 Update changelog and version after v1.1.3 2022-02-23 19:33:31 +00:00
Andrew Eisenberg
75f07e7ab2 Merge pull request #946 from github/update-v1.1.3-d7ad71d8
Merge main into v1
2022-02-23 11:32:12 -08:00
Andrew Eisenberg
42c72a10c8 Update runner version
For some reason, the runner was still on 1.0.x.
2022-02-23 11:02:14 -08:00
Andrew Eisenberg
fa57ef0579 Update changelog 2022-02-23 09:29:10 -08:00
github-actions[bot]
4b66d317a4 1.1.3 2022-02-23 17:13:38 +00:00
Edoardo Pirovano
d7ad71d803 Merge pull request #938 from github/respect-end-tracing
Respect `end-tracing` script instead of deleting one variable
2022-02-23 17:08:20 +00:00
Edoardo Pirovano
afbddca263 Improve error handling for ending tracing 2022-02-23 16:43:38 +00:00
Edoardo Pirovano
c592525a67 Respect end-tracing script instead of deleting one variable 2022-02-23 16:21:35 +00:00
Edoardo Pirovano
f14beebc58 Merge pull request #942 from github/aeisenberg/user-error
Add `UserError`
2022-02-23 11:21:14 +00:00
Andrew Eisenberg
3d93bb2ac9 Add UserError
This commit adds a `UserError` class that should be thrown when the
cause of an error is fundamentally from user configuration.

When sending status reports, avoid sending a `failure` for `UserError`s.
This will prevent our diagnostics from pinging us for errors outside of
our control.
2022-02-17 11:47:31 -08:00
Henry Mercer
040feefecf Merge pull request #941 from github/mergeback/v1.1.2-to-main-d39d5d5c
Mergeback v1.1.2 refs/heads/v1 into main
2022-02-17 19:36:22 +00:00
github-actions[bot]
4d875a922c Update checked-in dependencies 2022-02-17 18:13:39 +00:00
github-actions[bot]
cbc9c75e8f 1.1.3 2022-02-17 17:57:14 +00:00
github-actions[bot]
65174f238c Update changelog and version after v1.1.2 2022-02-17 17:57:09 +00:00
613 changed files with 2962 additions and 2751 deletions

View File

@@ -23,14 +23,47 @@ jobs:
analyze-ref-input: analyze-ref-input:
strategy: strategy:
matrix: matrix:
version: include:
- stable-20210308 - os: ubuntu-latest
- stable-20210319 version: stable-20210308
- stable-20210809 - os: macos-latest
- cached version: stable-20210308
- latest - os: windows-2019
- nightly-latest version: stable-20210308
os: [ubuntu-latest, macos-latest, windows-2019] - os: ubuntu-latest
version: stable-20210319
- os: macos-latest
version: stable-20210319
- os: windows-2019
version: stable-20210319
- os: ubuntu-latest
version: stable-20210809
- os: macos-latest
version: stable-20210809
- os: windows-2019
version: stable-20210809
- os: ubuntu-latest
version: cached
- os: macos-latest
version: cached
- os: windows-2019
version: cached
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: windows-2019
version: latest
- os: windows-2022
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-2019
version: nightly-latest
- os: windows-2022
version: nightly-latest
name: "Analyze: 'ref' and 'sha' from inputs" name: "Analyze: 'ref' and 'sha' from inputs"
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,14 +23,31 @@ jobs:
debug-artifacts: debug-artifacts:
strategy: strategy:
matrix: matrix:
version: include:
- stable-20210308 - os: ubuntu-latest
- stable-20210319 version: stable-20210308
- stable-20210809 - os: macos-latest
- cached version: stable-20210308
- latest - os: ubuntu-latest
- nightly-latest version: stable-20210319
os: [ubuntu-latest, macos-latest] - os: macos-latest
version: stable-20210319
- os: ubuntu-latest
version: stable-20210809
- os: macos-latest
version: stable-20210809
- os: ubuntu-latest
version: cached
- os: macos-latest
version: cached
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
name: Debug artifact upload name: Debug artifact upload
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,8 +23,9 @@ jobs:
extractor-ram-threads: extractor-ram-threads:
strategy: strategy:
matrix: matrix:
version: [latest] include:
os: [ubuntu-latest] - os: ubuntu-latest
version: latest
name: Extractor ram and threads options test name: Extractor ram and threads options test
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,14 +23,47 @@ jobs:
go-custom-queries: go-custom-queries:
strategy: strategy:
matrix: matrix:
version: include:
- stable-20210308 - os: ubuntu-latest
- stable-20210319 version: stable-20210308
- stable-20210809 - os: macos-latest
- cached version: stable-20210308
- latest - os: windows-2019
- nightly-latest version: stable-20210308
os: [ubuntu-latest, macos-latest, windows-2019] - os: ubuntu-latest
version: stable-20210319
- os: macos-latest
version: stable-20210319
- os: windows-2019
version: stable-20210319
- os: ubuntu-latest
version: stable-20210809
- os: macos-latest
version: stable-20210809
- os: windows-2019
version: stable-20210809
- os: ubuntu-latest
version: cached
- os: macos-latest
version: cached
- os: windows-2019
version: cached
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: windows-2019
version: latest
- os: windows-2022
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-2019
version: nightly-latest
- os: windows-2022
version: nightly-latest
name: 'Go: Custom queries' name: 'Go: Custom queries'
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,14 +23,31 @@ jobs:
go-custom-tracing-autobuild: go-custom-tracing-autobuild:
strategy: strategy:
matrix: matrix:
version: include:
- stable-20210308 - os: ubuntu-latest
- stable-20210319 version: stable-20210308
- stable-20210809 - os: macos-latest
- cached version: stable-20210308
- latest - os: ubuntu-latest
- nightly-latest version: stable-20210319
os: [ubuntu-latest, macos-latest] - os: macos-latest
version: stable-20210319
- os: ubuntu-latest
version: stable-20210809
- os: macos-latest
version: stable-20210809
- os: ubuntu-latest
version: cached
- os: macos-latest
version: cached
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
name: 'Go: Autobuild custom tracing' name: 'Go: Autobuild custom tracing'
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,14 +23,47 @@ jobs:
go-custom-tracing: go-custom-tracing:
strategy: strategy:
matrix: matrix:
version: include:
- stable-20210308 - os: ubuntu-latest
- stable-20210319 version: stable-20210308
- stable-20210809 - os: macos-latest
- cached version: stable-20210308
- latest - os: windows-2019
- nightly-latest version: stable-20210308
os: [ubuntu-latest, macos-latest, windows-2019] - os: ubuntu-latest
version: stable-20210319
- os: macos-latest
version: stable-20210319
- os: windows-2019
version: stable-20210319
- os: ubuntu-latest
version: stable-20210809
- os: macos-latest
version: stable-20210809
- os: windows-2019
version: stable-20210809
- os: ubuntu-latest
version: cached
- os: macos-latest
version: cached
- os: windows-2019
version: cached
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: windows-2019
version: latest
- os: windows-2022
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-2019
version: nightly-latest
- os: windows-2022
version: nightly-latest
name: 'Go: Custom tracing' name: 'Go: Custom tracing'
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,8 +23,13 @@ jobs:
javascript-source-root: javascript-source-root:
strategy: strategy:
matrix: matrix:
version: [latest, cached, nightly-latest] # This feature is not compatible with old CLIs include:
os: [ubuntu-latest] - os: ubuntu-latest
version: latest
- os: ubuntu-latest
version: cached
- os: ubuntu-latest
version: nightly-latest
name: Custom source root name: Custom source root
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,14 +23,31 @@ jobs:
multi-language-autodetect: multi-language-autodetect:
strategy: strategy:
matrix: matrix:
version: include:
- stable-20210308 - os: ubuntu-latest
- stable-20210319 version: stable-20210308
- stable-20210809 - os: macos-latest
- cached version: stable-20210308
- latest - os: ubuntu-latest
- nightly-latest version: stable-20210319
os: [ubuntu-latest, macos-latest] - os: macos-latest
version: stable-20210319
- os: ubuntu-latest
version: stable-20210809
- os: macos-latest
version: stable-20210809
- os: ubuntu-latest
version: cached
- os: macos-latest
version: cached
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
name: Multi-language repository name: Multi-language repository
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,8 +23,11 @@ jobs:
packaging-config-inputs-js: packaging-config-inputs-js:
strategy: strategy:
matrix: matrix:
version: [nightly-20210831] # This CLI version is known to work with package used in this test include:
os: [ubuntu-latest, macos-latest] - os: ubuntu-latest
version: nightly-20210831
- os: macos-latest
version: nightly-20210831
name: 'Packaging: Config and input' name: 'Packaging: Config and input'
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,8 +23,11 @@ jobs:
packaging-config-js: packaging-config-js:
strategy: strategy:
matrix: matrix:
version: [nightly-20210831] # This CLI version is known to work with package used in this test include:
os: [ubuntu-latest, macos-latest] - os: ubuntu-latest
version: nightly-20210831
- os: macos-latest
version: nightly-20210831
name: 'Packaging: Config file' name: 'Packaging: Config file'
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,8 +23,11 @@ jobs:
packaging-inputs-js: packaging-inputs-js:
strategy: strategy:
matrix: matrix:
version: [nightly-20210831] # This CLI version is known to work with package used in this test include:
os: [ubuntu-latest, macos-latest] - os: ubuntu-latest
version: nightly-20210831
- os: macos-latest
version: nightly-20210831
name: 'Packaging: Action input' name: 'Packaging: Action input'
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,14 +23,47 @@ jobs:
remote-config: remote-config:
strategy: strategy:
matrix: matrix:
version: include:
- stable-20210308 - os: ubuntu-latest
- stable-20210319 version: stable-20210308
- stable-20210809 - os: macos-latest
- cached version: stable-20210308
- latest - os: windows-2019
- nightly-latest version: stable-20210308
os: [ubuntu-latest, macos-latest, windows-2019] - os: ubuntu-latest
version: stable-20210319
- os: macos-latest
version: stable-20210319
- os: windows-2019
version: stable-20210319
- os: ubuntu-latest
version: stable-20210809
- os: macos-latest
version: stable-20210809
- os: windows-2019
version: stable-20210809
- os: ubuntu-latest
version: cached
- os: macos-latest
version: cached
- os: windows-2019
version: cached
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: windows-2019
version: latest
- os: windows-2022
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-2019
version: nightly-latest
- os: windows-2022
version: nightly-latest
name: Remote config file name: Remote config file
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,14 +23,19 @@ jobs:
rubocop-multi-language: rubocop-multi-language:
strategy: strategy:
matrix: matrix:
version: include:
- stable-20210308 - os: ubuntu-latest
- stable-20210319 version: stable-20210308
- stable-20210809 - os: ubuntu-latest
- cached version: stable-20210319
- latest - os: ubuntu-latest
- nightly-latest version: stable-20210809
os: [ubuntu-latest] - os: ubuntu-latest
version: cached
- os: ubuntu-latest
version: latest
- os: ubuntu-latest
version: nightly-latest
name: RuboCop multi-language name: RuboCop multi-language
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,8 +23,11 @@ jobs:
split-workflow: split-workflow:
strategy: strategy:
matrix: matrix:
version: [nightly-20210831] # This CLI version is known to work with package used in this test include:
os: [ubuntu-latest, macos-latest] - os: ubuntu-latest
version: nightly-20210831
- os: macos-latest
version: nightly-20210831
name: Split workflow name: Split workflow
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,8 +23,9 @@ jobs:
test-local-codeql: test-local-codeql:
strategy: strategy:
matrix: matrix:
version: [nightly-latest] include:
os: [ubuntu-latest] - os: ubuntu-latest
version: nightly-latest
name: Local CodeQL bundle name: Local CodeQL bundle
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

5
.github/workflows/__test-proxy.yml generated vendored
View File

@@ -23,8 +23,9 @@ jobs:
test-proxy: test-proxy:
strategy: strategy:
matrix: matrix:
version: [latest] include:
os: [ubuntu-latest] - os: ubuntu-latest
version: latest
name: Proxy test name: Proxy test
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

15
.github/workflows/__test-ruby.yml generated vendored
View File

@@ -23,8 +23,19 @@ jobs:
test-ruby: test-ruby:
strategy: strategy:
matrix: matrix:
version: [latest, cached, nightly-latest] include:
os: [ubuntu-latest, macos-latest] - os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: ubuntu-latest
version: cached
- os: macos-latest
version: cached
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
name: Ruby analysis name: Ruby analysis
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,14 +23,19 @@ jobs:
unset-environment: unset-environment:
strategy: strategy:
matrix: matrix:
version: include:
- stable-20210308 - os: ubuntu-latest
- stable-20210319 version: stable-20210308
- stable-20210809 - os: ubuntu-latest
- cached version: stable-20210319
- latest - os: ubuntu-latest
- nightly-latest version: stable-20210809
os: [ubuntu-latest] - os: ubuntu-latest
version: cached
- os: ubuntu-latest
version: latest
- os: ubuntu-latest
version: nightly-latest
name: Test unsetting environment variables name: Test unsetting environment variables
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -23,14 +23,47 @@ jobs:
upload-ref-sha-input: upload-ref-sha-input:
strategy: strategy:
matrix: matrix:
version: include:
- stable-20210308 - os: ubuntu-latest
- stable-20210319 version: stable-20210308
- stable-20210809 - os: macos-latest
- cached version: stable-20210308
- latest - os: windows-2019
- nightly-latest version: stable-20210308
os: [ubuntu-latest, macos-latest, windows-2019] - os: ubuntu-latest
version: stable-20210319
- os: macos-latest
version: stable-20210319
- os: windows-2019
version: stable-20210319
- os: ubuntu-latest
version: stable-20210809
- os: macos-latest
version: stable-20210809
- os: windows-2019
version: stable-20210809
- os: ubuntu-latest
version: cached
- os: macos-latest
version: cached
- os: windows-2019
version: cached
- os: ubuntu-latest
version: latest
- os: macos-latest
version: latest
- os: windows-2019
version: latest
- os: windows-2022
version: latest
- os: ubuntu-latest
version: nightly-latest
- os: macos-latest
version: nightly-latest
- os: windows-2019
version: nightly-latest
- os: windows-2022
version: nightly-latest
name: "Upload-sarif: 'ref' and 'sha' from inputs" name: "Upload-sarif: 'ref' and 'sha' from inputs"
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:

View File

@@ -1,5 +1,14 @@
# CodeQL Action and CodeQL Runner Changelog # CodeQL Action and CodeQL Runner Changelog
## 1.1.4 - 07 Mar 2022
- Update default CodeQL bundle version to 2.8.2. [#950](https://github.com/github/codeql-action/pull/950)
- Fix a bug where old results can be uploaded if the languages in a repository change when using a non-ephemeral self-hosted runner. [#955](https://github.com/github/codeql-action/pull/955)
## 1.1.3 - 23 Feb 2022
- Fix bug where the CLR traces can continue tracing even after tracing should be stopped. [#938](https://github.com/github/codeql-action/pull/938)
## 1.1.2 - 17 Feb 2022 ## 1.1.2 - 17 Feb 2022
- Due to potential issues for GHES 3.13.3 customers who are using recent versions of the CodeQL Action via GHES Connect, the CodeQL Action now uses Node.js v12 rather than Node.js v16. [#937](https://github.com/github/codeql-action/pull/937) - Due to potential issues for GHES 3.13.3 customers who are using recent versions of the CodeQL Action via GHES Connect, the CodeQL Action now uses Node.js v12 rather than Node.js v16. [#937](https://github.com/github/codeql-action/pull/937)

View File

@@ -146,4 +146,4 @@ The very first time code scanning is run and if it is on a pull request, you wil
After code scanning has analyzed the code in a pull request, it needs to compare the analysis of the topic branch (the merge commit of the branch you used to create the pull request) with the analysis of the base branch (the branch into which you want to merge the pull request). This allows code scanning to compute which alerts are newly introduced by the pull request, which alerts were already present in the base branch, and whether any existing alerts are fixed by the changes in the pull request. Initially, if you use a pull request to add code scanning to a repository, the base branch has not yet been analyzed, so it's not possible to compute these details. In this case, when you click through from the results check on the pull request you will see the "Missing analysis for base commit SHA-HASH" message. After code scanning has analyzed the code in a pull request, it needs to compare the analysis of the topic branch (the merge commit of the branch you used to create the pull request) with the analysis of the base branch (the branch into which you want to merge the pull request). This allows code scanning to compute which alerts are newly introduced by the pull request, which alerts were already present in the base branch, and whether any existing alerts are fixed by the changes in the pull request. Initially, if you use a pull request to add code scanning to a repository, the base branch has not yet been analyzed, so it's not possible to compute these details. In this case, when you click through from the results check on the pull request you will see the "Missing analysis for base commit SHA-HASH" message.
For more information and other causes of this message, see [Reasons for the "missing analysis" message](https://docs.github.com/en/code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/setting-up-code-scanning-for-a-repository#reasons-for-the-missing-analysis-message) For more information and other causes of this message, see [Reasons for the "Analysis not found" message](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/setting-up-code-scanning-for-a-repository#reasons-for-the-analysis-not-found-message)

24
lib/actions-util.js generated
View File

@@ -19,8 +19,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.sanitizeArifactName = exports.isAnalyzingDefaultBranch = exports.getRelativeScriptPath = exports.isRunningLocalAction = exports.sendStatusReport = exports.createStatusReportBase = exports.getRef = exports.computeAutomationID = exports.getAutomationID = exports.getAnalysisKey = exports.getWorkflowRunID = exports.getWorkflow = exports.formatWorkflowCause = exports.formatWorkflowErrors = exports.validateWorkflow = exports.getWorkflowErrors = exports.WorkflowErrors = exports.patternIsSuperset = exports.determineMergeBaseCommitOid = exports.getCommitOid = exports.getToolCacheDirectory = exports.getTemporaryDirectory = exports.getOptionalInput = exports.getRequiredInput = void 0; exports.sanitizeArifactName = exports.isAnalyzingDefaultBranch = exports.getRelativeScriptPath = exports.isRunningLocalAction = exports.sendStatusReport = exports.createStatusReportBase = exports.getActionsStatus = exports.getRef = exports.computeAutomationID = exports.getAutomationID = exports.getAnalysisKey = exports.getWorkflowRunID = exports.getWorkflow = exports.formatWorkflowCause = exports.formatWorkflowErrors = exports.validateWorkflow = exports.getWorkflowErrors = exports.WorkflowErrors = exports.patternIsSuperset = exports.determineMergeBaseCommitOid = exports.getCommitOid = exports.getToolCacheDirectory = exports.getTemporaryDirectory = exports.getOptionalInput = exports.getRequiredInput = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const os = __importStar(require("os"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
const core = __importStar(require("@actions/core")); const core = __importStar(require("@actions/core"));
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner")); const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
@@ -464,6 +465,15 @@ async function getRef() {
} }
} }
exports.getRef = getRef; exports.getRef = getRef;
function getActionsStatus(error, otherFailureCause) {
if (error || otherFailureCause) {
return error instanceof util_1.UserError ? "user-error" : "failure";
}
else {
return "success";
}
}
exports.getActionsStatus = getActionsStatus;
/** /**
* Compose a StatusReport. * Compose a StatusReport.
* *
@@ -489,6 +499,8 @@ async function createStatusReportBase(actionName, status, actionStartedAt, cause
workflowStartedAt = actionStartedAt.toISOString(); workflowStartedAt = actionStartedAt.toISOString();
core.exportVariable(sharedEnv.CODEQL_WORKFLOW_STARTED_AT, workflowStartedAt); core.exportVariable(sharedEnv.CODEQL_WORKFLOW_STARTED_AT, workflowStartedAt);
} }
const runnerOs = (0, util_1.getRequiredEnvParam)("RUNNER_OS");
const runnerArch = (0, util_1.getRequiredEnvParam)("RUNNER_ARCH");
// If running locally then the GITHUB_ACTION_REF cannot be trusted as it may be for the previous action // If running locally then the GITHUB_ACTION_REF cannot be trusted as it may be for the previous action
// See https://github.com/actions/runner/issues/803 // See https://github.com/actions/runner/issues/803
const actionRef = isRunningLocalAction() const actionRef = isRunningLocalAction()
@@ -507,6 +519,8 @@ async function createStatusReportBase(actionName, status, actionStartedAt, cause
started_at: workflowStartedAt, started_at: workflowStartedAt,
action_started_at: actionStartedAt.toISOString(), action_started_at: actionStartedAt.toISOString(),
status, status,
runner_os: runnerOs,
runner_arch: runnerArch,
}; };
// Add optional parameters // Add optional parameters
if (cause) { if (cause) {
@@ -515,13 +529,19 @@ async function createStatusReportBase(actionName, status, actionStartedAt, cause
if (exception) { if (exception) {
statusReport.exception = exception; statusReport.exception = exception;
} }
if (status === "success" || status === "failure" || status === "aborted") { if (status === "success" ||
status === "failure" ||
status === "aborted" ||
status === "user-error") {
statusReport.completed_at = new Date().toISOString(); statusReport.completed_at = new Date().toISOString();
} }
const matrix = getRequiredInput("matrix"); const matrix = getRequiredInput("matrix");
if (matrix) { if (matrix) {
statusReport.matrix_vars = matrix; statusReport.matrix_vars = matrix;
} }
if (runnerOs === "Windows" || runnerOs === "macOS") {
statusReport.runner_os_release = os.release();
}
return statusReport; return statusReport;
} }
exports.createStatusReportBase = createStatusReportBase; exports.createStatusReportBase = createStatusReportBase;

File diff suppressed because one or more lines are too long

4
lib/analyze-action.js generated
View File

@@ -37,9 +37,7 @@ const util_1 = require("./util");
// eslint-disable-next-line import/no-commonjs // eslint-disable-next-line import/no-commonjs
const pkg = require("../package.json"); const pkg = require("../package.json");
async function sendStatusReport(startedAt, config, stats, error) { async function sendStatusReport(startedAt, config, stats, error) {
const status = (stats === null || stats === void 0 ? void 0 : stats.analyze_failure_language) !== undefined || error !== undefined const status = actionsUtil.getActionsStatus(error, stats === null || stats === void 0 ? void 0 : stats.analyze_failure_language);
? "failure"
: "success";
const statusReportBase = await actionsUtil.createStatusReportBase("finish", status, startedAt, error === null || error === void 0 ? void 0 : error.message, error === null || error === void 0 ? void 0 : error.stack); const statusReportBase = await actionsUtil.createStatusReportBase("finish", status, startedAt, error === null || error === void 0 ? void 0 : error.message, error === null || error === void 0 ? void 0 : error.stack);
const statusReport = { const statusReport = {
...statusReportBase, ...statusReportBase,

File diff suppressed because one or more lines are too long

23
lib/analyze.js generated
View File

@@ -29,6 +29,7 @@ const codeql_1 = require("./codeql");
const count_loc_1 = require("./count-loc"); const count_loc_1 = require("./count-loc");
const languages_1 = require("./languages"); const languages_1 = require("./languages");
const sharedEnv = __importStar(require("./shared-environment")); const sharedEnv = __importStar(require("./shared-environment"));
const tracer_config_1 = require("./tracer-config");
const util = __importStar(require("./util")); const util = __importStar(require("./util"));
class CodeQLAnalysisError extends Error { class CodeQLAnalysisError extends Error {
constructor(queriesStatusReport, message) { constructor(queriesStatusReport, message) {
@@ -232,9 +233,29 @@ function packWithVersionToQuerySuiteEntry(pack) {
return text; return text;
} }
async function runFinalize(outputDir, threadsFlag, memoryFlag, config, logger) { async function runFinalize(outputDir, threadsFlag, memoryFlag, config, logger) {
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
if (await util.codeQlVersionAbove(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING)) {
// Delete variables as specified by the end-tracing script
await (0, tracer_config_1.endTracingForCluster)(config);
}
else {
// Delete the tracer config env var to avoid tracing ourselves // Delete the tracer config env var to avoid tracing ourselves
delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION]; delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION];
fs.mkdirSync(outputDir, { recursive: true }); }
// After switching to Node16, this entire block can be replaced with `await fs.promises.rm(outputDir, { recursive: true, force: true });`.
try {
await fs.promises.rmdir(outputDir, {
recursive: true,
maxRetries: 5,
retryDelay: 2000,
});
}
catch (error) {
if ((error === null || error === void 0 ? void 0 : error.code) !== "ENOENT") {
throw error;
}
}
await fs.promises.mkdir(outputDir, { recursive: true });
await finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger); await finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger);
} }
exports.runFinalize = runFinalize; exports.runFinalize = runFinalize;

File diff suppressed because one or more lines are too long

View File

@@ -29,9 +29,7 @@ const util_1 = require("./util");
const pkg = require("../package.json"); const pkg = require("../package.json");
async function sendCompletedStatusReport(startedAt, allLanguages, failingLanguage, cause) { async function sendCompletedStatusReport(startedAt, allLanguages, failingLanguage, cause) {
(0, util_1.initializeEnvironment)(util_1.Mode.actions, pkg.version); (0, util_1.initializeEnvironment)(util_1.Mode.actions, pkg.version);
const status = failingLanguage !== undefined || cause !== undefined const status = (0, actions_util_1.getActionsStatus)(cause, failingLanguage);
? "failure"
: "success";
const statusReportBase = await (0, actions_util_1.createStatusReportBase)("autobuild", status, startedAt, cause === null || cause === void 0 ? void 0 : cause.message, cause === null || cause === void 0 ? void 0 : cause.stack); const statusReportBase = await (0, actions_util_1.createStatusReportBase)("autobuild", status, startedAt, cause === null || cause === void 0 ? void 0 : cause.message, cause === null || cause === void 0 ? void 0 : cause.stack);
const statusReport = { const statusReport = {
...statusReportBase, ...statusReportBase,

View File

@@ -1 +1 @@
{"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC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EAAE;YACxB,MAAM,IAAI,KAAK,CACb,yFAAyF,CAC1F,CAAC;SACH;QACD,QAAQ,GAAG,IAAA,sCAA0B,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtD,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,MAAM,IAAA,wBAAY,EAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;SAC9C;KACF;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CACZ,mIACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CACvD,EAAE,CACH,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,yBAAyB,CAC7B,SAAS,EACT,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,EAC1B,QAAQ,EACR,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAC1D,CAAC;QACF,OAAO;KACR;IAED,MAAM,yBAAyB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,GAAG,EAAE,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,4BAA4B,KAAK,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACpB;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}

25
lib/codeql.js generated
View File

@@ -27,6 +27,7 @@ const fs = __importStar(require("fs"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner")); const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
const fast_deep_equal_1 = __importDefault(require("fast-deep-equal")); const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
const yaml = __importStar(require("js-yaml"));
const query_string_1 = __importDefault(require("query-string")); const query_string_1 = __importDefault(require("query-string"));
const semver = __importStar(require("semver")); const semver = __importStar(require("semver"));
const actions_util_1 = require("./actions-util"); const actions_util_1 = require("./actions-util");
@@ -75,6 +76,7 @@ const CODEQL_VERSION_GROUP_RULES = "2.5.5";
const CODEQL_VERSION_SARIF_GROUP = "2.5.3"; const CODEQL_VERSION_SARIF_GROUP = "2.5.3";
exports.CODEQL_VERSION_COUNTS_LINES = "2.6.2"; exports.CODEQL_VERSION_COUNTS_LINES = "2.6.2";
const CODEQL_VERSION_CUSTOM_QUERY_HELP = "2.7.1"; const CODEQL_VERSION_CUSTOM_QUERY_HELP = "2.7.1";
const CODEQL_VERSION_CONFIG_FILES = "2.8.2"; // Versions before 2.8.2 weren't tolerant to unknown properties
exports.CODEQL_VERSION_ML_POWERED_QUERIES = "2.7.5"; exports.CODEQL_VERSION_ML_POWERED_QUERIES = "2.7.5";
/** /**
* This variable controls using the new style of tracing from the CodeQL * This variable controls using the new style of tracing from the CodeQL
@@ -429,22 +431,30 @@ async function getCodeQLForCmd(cmd, checkVersion) {
...getExtraOptionsFromEnv(["database", "init"]), ...getExtraOptionsFromEnv(["database", "init"]),
]); ]);
}, },
async databaseInitCluster(databasePath, languages, sourceRoot, processName, processLevel) { async databaseInitCluster(config, sourceRoot, processName, processLevel) {
const extraArgs = languages.map((language) => `--language=${language}`); const extraArgs = config.languages.map((language) => `--language=${language}`);
if (languages.filter(languages_1.isTracedLanguage).length > 0) { if (config.languages.filter(languages_1.isTracedLanguage).length > 0) {
extraArgs.push("--begin-tracing"); extraArgs.push("--begin-tracing");
if (processName !== undefined) { if (processName !== undefined) {
extraArgs.push(`--trace-process-name=${processName}`); extraArgs.push(`--trace-process-name=${processName}`);
} }
else { else {
// We default to 3 if no other arguments are provided since this was the default
// behaviour of the Runner. Note this path never happens in the CodeQL Action
// because that always passes in a process name.
extraArgs.push(`--trace-process-level=${processLevel || 3}`); extraArgs.push(`--trace-process-level=${processLevel || 3}`);
} }
} }
if (await util.codeQlVersionAbove(codeql, CODEQL_VERSION_CONFIG_FILES)) {
const configLocation = path.resolve(config.tempDir, "user-config.yaml");
fs.writeFileSync(configLocation, yaml.dump(config.originalUserInput));
extraArgs.push(`--codescanning-config=${configLocation}`);
}
await runTool(cmd, [ await runTool(cmd, [
"database", "database",
"init", "init",
"--db-cluster", "--db-cluster",
databasePath, config.dbLocation,
`--source-root=${sourceRoot}`, `--source-root=${sourceRoot}`,
...extraArgs, ...extraArgs,
...getExtraOptionsFromEnv(["database", "init"]), ...getExtraOptionsFromEnv(["database", "init"]),
@@ -560,7 +570,9 @@ async function getCodeQLForCmd(cmd, checkVersion) {
if (extraSearchPath !== undefined) { if (extraSearchPath !== undefined) {
codeqlArgs.push("--additional-packs", extraSearchPath); codeqlArgs.push("--additional-packs", extraSearchPath);
} }
if (!(await util.codeQlVersionAbove(this, CODEQL_VERSION_CONFIG_FILES))) {
codeqlArgs.push(querySuitePath); codeqlArgs.push(querySuitePath);
}
await runTool(cmd, codeqlArgs); await runTool(cmd, codeqlArgs);
}, },
async databaseInterpretResults(databasePath, querySuitePaths, sarifFile, addSnippetsFlag, threadsFlag, automationDetailsId) { async databaseInterpretResults(databasePath, querySuitePaths, sarifFile, addSnippetsFlag, threadsFlag, automationDetailsId) {
@@ -586,7 +598,10 @@ async function getCodeQLForCmd(cmd, checkVersion) {
(await util.codeQlVersionAbove(this, CODEQL_VERSION_SARIF_GROUP))) { (await util.codeQlVersionAbove(this, CODEQL_VERSION_SARIF_GROUP))) {
codeqlArgs.push("--sarif-category", automationDetailsId); codeqlArgs.push("--sarif-category", automationDetailsId);
} }
codeqlArgs.push(databasePath, ...querySuitePaths); codeqlArgs.push(databasePath);
if (!(await util.codeQlVersionAbove(this, CODEQL_VERSION_CONFIG_FILES))) {
codeqlArgs.push(...querySuitePaths);
}
// capture stdout, which contains analysis summaries // capture stdout, which contains analysis summaries
return await runTool(cmd, codeqlArgs); return await runTool(cmd, codeqlArgs);
}, },

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,3 @@
{ {
"bundleVersion": "codeql-bundle-20220214" "bundleVersion": "codeql-bundle-20220224"
} }

6
lib/init-action.js generated
View File

@@ -92,10 +92,6 @@ async function run() {
toolsVersion = initCodeQLResult.toolsVersion; toolsVersion = initCodeQLResult.toolsVersion;
await (0, util_1.enrichEnvironment)(util_1.Mode.actions, codeql); await (0, util_1.enrichEnvironment)(util_1.Mode.actions, codeql);
config = await (0, init_1.initConfig)((0, actions_util_1.getOptionalInput)("languages"), (0, actions_util_1.getOptionalInput)("queries"), (0, actions_util_1.getOptionalInput)("packs"), (0, actions_util_1.getOptionalInput)("config-file"), (0, actions_util_1.getOptionalInput)("db-location"), (0, actions_util_1.getOptionalInput)("debug") === "true", (0, actions_util_1.getOptionalInput)("debug-artifact-name") || util_1.DEFAULT_DEBUG_ARTIFACT_NAME, (0, actions_util_1.getOptionalInput)("debug-database-name") || util_1.DEFAULT_DEBUG_DATABASE_NAME, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), (0, util_1.getRequiredEnvParam)("RUNNER_TOOL_CACHE"), codeql, (0, util_1.getRequiredEnvParam)("GITHUB_WORKSPACE"), gitHubVersion, apiDetails, featureFlags, 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"), (0, actions_util_1.getOptionalInput)("config-file"), (0, actions_util_1.getOptionalInput)("db-location"), (0, actions_util_1.getOptionalInput)("debug") === "true", (0, actions_util_1.getOptionalInput)("debug-artifact-name") || util_1.DEFAULT_DEBUG_ARTIFACT_NAME, (0, actions_util_1.getOptionalInput)("debug-database-name") || util_1.DEFAULT_DEBUG_DATABASE_NAME, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), (0, util_1.getRequiredEnvParam)("RUNNER_TOOL_CACHE"), codeql, (0, util_1.getRequiredEnvParam)("GITHUB_WORKSPACE"), gitHubVersion, apiDetails, featureFlags, logger);
if (config.languages.some(languages_1.isTracedLanguage)) {
// We currently do not support tracing on Windows 11 and Windows Server 2022
(0, util_1.checkNotWindows11)();
}
if (config.languages.includes(languages_1.Language.python) && if (config.languages.includes(languages_1.Language.python) &&
(0, actions_util_1.getRequiredInput)("setup-python-dependencies") === "true") { (0, actions_util_1.getRequiredInput)("setup-python-dependencies") === "true") {
try { try {
@@ -145,7 +141,7 @@ async function run() {
catch (error) { catch (error) {
core.setFailed(String(error)); core.setFailed(String(error));
console.log(error); console.log(error);
await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("init", "failure", startedAt, String(error), error instanceof Error ? error.stack : undefined)); await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("init", (0, actions_util_1.getActionsStatus)(error), startedAt, String(error), error instanceof Error ? error.stack : undefined));
return; return;
} }
await sendSuccessStatusReport(startedAt, config, toolsVersion); await sendSuccessStatusReport(startedAt, config, toolsVersion);

File diff suppressed because one or more lines are too long

10
lib/init.js generated
View File

@@ -47,12 +47,12 @@ async function initConfig(languagesInput, queriesInput, packsInput, configFile,
} }
exports.initConfig = initConfig; exports.initConfig = initConfig;
async function runInit(codeql, config, sourceRoot, processName, processLevel) { async function runInit(codeql, config, sourceRoot, processName, processLevel) {
var _a; var _a, _b;
fs.mkdirSync(config.dbLocation, { recursive: true }); fs.mkdirSync(config.dbLocation, { recursive: true });
try { try {
if (await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING)) { if (await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING)) {
// Init a database cluster // Init a database cluster
await codeql.databaseInitCluster(config.dbLocation, config.languages, sourceRoot, processName, processLevel); await codeql.databaseInitCluster(config, sourceRoot, processName, processLevel);
} }
else { else {
for (const language of config.languages) { for (const language of config.languages) {
@@ -67,7 +67,11 @@ async function runInit(codeql, config, sourceRoot, processName, processLevel) {
if (e instanceof Error && if (e instanceof Error &&
((_a = e.message) === null || _a === void 0 ? void 0 : _a.includes("Refusing to create databases")) && ((_a = e.message) === null || _a === void 0 ? void 0 : _a.includes("Refusing to create databases")) &&
e.message.includes("exists and is not an empty directory.")) { e.message.includes("exists and is not an empty directory.")) {
throw new Error(`Is the "init" action called twice in the same job? ${e.message}`); throw new util.UserError(`Is the "init" action called twice in the same job? ${e.message}`);
}
else if (e instanceof Error &&
((_b = e.message) === null || _b === void 0 ? void 0 : _b.includes("is not compatible with this CodeQL CLI"))) {
throw new util.UserError(e.message);
} }
else { else {
throw e; throw e;

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,qCAA2E;AAC3E,4DAA8C;AAI9C,mDAAwE;AACxE,6CAA+B;AAC/B,iCAA4C;AAErC,KAAK,UAAU,UAAU,CAC9B,SAA6B,EAC7B,UAA4B,EAC5B,OAAe,EACf,YAAoB,EACpB,OAA2B,EAC3B,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,oBAAW,EAChD,SAAS,EACT,UAAU,EACV,OAAO,EACP,YAAY,EACZ,OAAO,EACP,MAAM,EACN,IAAI,CACL,CAAC;IACF,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;IAC5B,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AAClC,CAAC;AArBD,gCAqB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AI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;YAChC,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;gBAC/D,IAAI;gBACJ,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;gBAChC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;aAC/B,CAAC,CAAC,IAAI,EAAE,CAAC;SACX;aAAM;YACL,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,EAAE;gBAChE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;aAC/B,CAAC,CAAC,IAAI,EAAE,CAAC;SACX;KACF;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,OAAO,CACZ,gFAAgF,CAAC,IAAI;YACnF,qGAAqG;YACrG,oGAAoG;YACpG,iDAAiD,CACpD,CAAC;QACF,OAAO;KACR;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAtCD,8CAsCC"}

26
lib/tracer-config.js generated
View File

@@ -19,7 +19,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.getCombinedTracerConfig = exports.concatTracerConfigs = exports.getTracerConfigForLanguage = exports.getTracerConfigForCluster = void 0; exports.getCombinedTracerConfig = exports.concatTracerConfigs = exports.getTracerConfigForLanguage = exports.getTracerConfigForCluster = exports.endTracingForCluster = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const path = __importStar(require("path")); const path = __importStar(require("path"));
const codeql_1 = require("./codeql"); const codeql_1 = require("./codeql");
@@ -33,6 +33,30 @@ const CRITICAL_TRACER_VARS = new Set([
"SEMMLE_DEPTRACE_SOCKET", "SEMMLE_DEPTRACE_SOCKET",
"SEMMLE_JAVA_TOOL_OPTIONS", "SEMMLE_JAVA_TOOL_OPTIONS",
]); ]);
async function endTracingForCluster(config) {
// If there are no traced languages, we don't need to do anything.
if (!config.languages.some(languages_1.isTracedLanguage))
return;
const envVariablesFile = path.resolve(config.dbLocation, "temp/tracingEnvironment/end-tracing.json");
if (!fs.existsSync(envVariablesFile)) {
throw new Error(`Environment file for ending tracing not found: ${envVariablesFile}`);
}
try {
const endTracingEnvVariables = JSON.parse(fs.readFileSync(envVariablesFile, "utf8"));
for (const [key, value] of Object.entries(endTracingEnvVariables)) {
if (value !== null) {
process.env[key] = value;
}
else {
delete process.env[key];
}
}
}
catch (e) {
throw new Error(`Failed to parse file containing end tracing environment variables: ${e}`);
}
}
exports.endTracingForCluster = endTracingForCluster;
async function getTracerConfigForCluster(config) { async function getTracerConfigForCluster(config) {
const tracingEnvVariables = JSON.parse(fs.readFileSync(path.resolve(config.dbLocation, "temp/tracingEnvironment/start-tracing.json"), "utf8")); const tracingEnvVariables = JSON.parse(fs.readFileSync(path.resolve(config.dbLocation, "temp/tracingEnvironment/start-tracing.json"), "utf8"));
return { return {

File diff suppressed because one or more lines are too long

View File

@@ -59,7 +59,7 @@ async function run() {
const stack = error instanceof Error ? error.stack : String(error); const stack = error instanceof Error ? error.stack : String(error);
core.setFailed(message); core.setFailed(message);
console.log(error); console.log(error);
await actionsUtil.sendStatusReport(await actionsUtil.createStatusReportBase("upload-sarif", "failure", startedAt, message, stack)); await actionsUtil.sendStatusReport(await actionsUtil.createStatusReportBase("upload-sarif", actionsUtil.getActionsStatus(error), startedAt, message, stack));
return; return;
} }
} }

View File

@@ -1 +1 @@
{"version":3,"file":"upload-sarif-action.js","sourceRoot":"","sources":["../src/upload-sarif-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,4DAA8C;AAC9C,uCAA6C;AAC7C,6CAAkD;AAClD,y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EAAC,IAAA,0BAAmB,EAAC,mBAAmB,CAAC,CAAC,EAC5D,YAAY,CAAC,OAAO,EACpB,UAAU,EACV,IAAA,0BAAgB,GAAE,CACnB,CAAC;SACH;QACD,MAAM,uBAAuB,CAAC,SAAS,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;KACrE;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,MAAM,KAAK,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACnE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,WAAW,CAAC,gBAAgB,CAChC,MAAM,WAAW,CAAC,sBAAsB,CACtC,cAAc,EACd,WAAW,CAAC,gBAAgB,CAAC,KAAK,CAAC,EACnC,SAAS,EACT,OAAO,EACP,KAAK,CACN,CACF,CAAC;QACF,OAAO;KACR;AACH,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,GAAG,EAAE,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,sCAAsC,KAAK,EAAE,CAAC,CAAC;QAC9D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACpB;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}

18
lib/util.js generated
View File

@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getMlPoweredJsQueriesStatus = exports.ML_POWERED_JS_QUERIES_PACK = exports.checkNotWindows11 = exports.isGoodVersion = exports.delay = exports.bundleDb = exports.codeQlVersionAbove = exports.isHTTPError = exports.HTTPError = exports.getRequiredEnvParam = exports.isActions = exports.getMode = exports.enrichEnvironment = exports.initializeEnvironment = exports.Mode = exports.assertNever = exports.getGitHubAuth = exports.apiVersionInRange = exports.DisallowedAPIVersionReason = exports.checkGitHubVersionInRange = exports.getGitHubVersion = exports.GitHubVariant = exports.parseGitHubUrl = exports.getCodeQLDatabasePath = exports.getThreadsFlag = exports.getThreadsFlagValue = exports.getAddSnippetsFlag = exports.getMemoryFlag = exports.getMemoryFlagValue = exports.withTmpDir = exports.getToolNames = exports.getExtraOptionsEnvParam = exports.DEFAULT_DEBUG_DATABASE_NAME = exports.DEFAULT_DEBUG_ARTIFACT_NAME = exports.GITHUB_DOTCOM_URL = void 0; exports.getMlPoweredJsQueriesStatus = exports.ML_POWERED_JS_QUERIES_PACK = exports.isGoodVersion = exports.delay = exports.bundleDb = exports.codeQlVersionAbove = exports.isHTTPError = exports.UserError = exports.HTTPError = exports.getRequiredEnvParam = exports.isActions = exports.getMode = exports.enrichEnvironment = exports.initializeEnvironment = exports.Mode = exports.assertNever = exports.getGitHubAuth = exports.apiVersionInRange = exports.DisallowedAPIVersionReason = exports.checkGitHubVersionInRange = exports.getGitHubVersion = exports.GitHubVariant = exports.parseGitHubUrl = exports.getCodeQLDatabasePath = exports.getThreadsFlag = exports.getThreadsFlagValue = exports.getAddSnippetsFlag = exports.getMemoryFlag = exports.getMemoryFlagValue = 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"));
@@ -486,6 +486,16 @@ class HTTPError extends Error {
} }
} }
exports.HTTPError = HTTPError; exports.HTTPError = HTTPError;
/**
* An Error class that indicates an error that occurred due to
* a misconfiguration of the action or the CodeQL CLI.
*/
class UserError extends Error {
constructor(message) {
super(message);
}
}
exports.UserError = UserError;
function isHTTPError(arg) { function isHTTPError(arg) {
return (arg === null || arg === void 0 ? void 0 : arg.status) !== undefined && Number.isInteger(arg.status); return (arg === null || arg === void 0 ? void 0 : arg.status) !== undefined && Number.isInteger(arg.status);
} }
@@ -518,12 +528,6 @@ function isGoodVersion(versionSpec) {
return !BROKEN_VERSIONS.includes(versionSpec); return !BROKEN_VERSIONS.includes(versionSpec);
} }
exports.isGoodVersion = isGoodVersion; exports.isGoodVersion = isGoodVersion;
function checkNotWindows11() {
if (os.platform() === "win32" && semver.gte(os.release(), "10.0.20348")) {
throw new Error("Tracing builds with CodeQL is currently not supported on Windows 11 and Windows Server 2022. Please modify your Actions workflow to use an earlier version of Windows for this job, for example by setting `runs-on: windows-2019`.");
}
}
exports.checkNotWindows11 = checkNotWindows11;
/** /**
* The ML-powered JS query pack to add to the analysis if a repo is opted into the ML-powered * The ML-powered JS query pack to add to the analysis if a repo is opted into the ML-powered
* queries beta. * queries beta.

File diff suppressed because one or more lines are too long

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

@@ -1,19 +1,18 @@
{ {
"name": "codeql", "name": "codeql",
"version": "1.1.2", "version": "1.1.4",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"node_modules/@actions/artifact": { "node_modules/@actions/artifact": {
"version": "0.5.2", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-0.5.2.tgz", "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-1.0.0.tgz",
"integrity": "sha512-q/r8WSqyxBJ0ffLCRrtjCBTGnAYqP+ID4yG7f7YSlhrQ4thNg/d+Tq9f1YkLPKX46ZR97OWtGDY+oU/nxcqvLw==", "integrity": "sha512-oje+cCiM2maVwoiN+LT9kh2C6UqiTcS1tDKins+nRfckX+C8JJD2kAmzpD5fn/p5Dibjrqk1mtwreAzgNxHrDg==",
"dependencies": { "dependencies": {
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/http-client": "^1.0.11", "@actions/http-client": "^1.0.11",
"@types/tmp": "^0.1.0", "tmp": "^0.2.1",
"tmp": "^0.1.0", "tmp-promise": "^3.0.2"
"tmp-promise": "^2.0.2"
} }
}, },
"node_modules/@actions/core": { "node_modules/@actions/core": {
@@ -501,10 +500,6 @@
"@sinonjs/fake-timers": "^7.1.0" "@sinonjs/fake-timers": "^7.1.0"
} }
}, },
"node_modules/@types/tmp": {
"version": "0.1.0",
"integrity": "sha512-6IwZ9HzWbCq6XoQWhxLpDjuADodH/MKXRUIDFudvgjcVdjFknvmR+DNsoUeer4XPrEnrZs04Jj+kfV9pFsrhmA=="
},
"node_modules/@typescript-eslint/eslint-plugin": { "node_modules/@typescript-eslint/eslint-plugin": {
"version": "4.28.5", "version": "4.28.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.5.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.5.tgz",
@@ -4361,8 +4356,9 @@
} }
}, },
"node_modules/removeNPMAbsolutePaths": { "node_modules/removeNPMAbsolutePaths": {
"version": "2.0.0", "version": "3.0.0",
"integrity": "sha512-Hea7U6iJcD0NE/aqBqxBMPKeKaxjqMNyTTajmH2dH9hhafJ9Tem5r4UeJK8+BdE1MK9lqoOYqNM0Sq9rl1OIbQ==", "resolved": "https://registry.npmjs.org/removeNPMAbsolutePaths/-/removeNPMAbsolutePaths-3.0.0.tgz",
"integrity": "sha512-g4DIbk+xI8YC1RafmVKaPyMcuQlKZ8N7RQMUvRv+YLHNw1PhyFtjsC6WBaiTCfDKFGQhBaRSc0b0qUjPeCdIdQ==",
"dev": true, "dev": true,
"bin": { "bin": {
"removeNPMAbsolutePaths": "bin/removeNPMAbsolutePaths" "removeNPMAbsolutePaths": "bin/removeNPMAbsolutePaths"
@@ -4933,30 +4929,22 @@
} }
}, },
"node_modules/tmp": { "node_modules/tmp": {
"version": "0.1.0", "version": "0.2.1",
"integrity": "sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw==", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
"integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
"dependencies": { "dependencies": {
"rimraf": "^2.6.3" "rimraf": "^3.0.0"
}, },
"engines": { "engines": {
"node": ">=6" "node": ">=8.17.0"
} }
}, },
"node_modules/tmp-promise": { "node_modules/tmp-promise": {
"version": "2.1.1", "version": "3.0.3",
"integrity": "sha512-Z048AOz/w9b6lCbJUpevIJpRpUztENl8zdv1bmAKVHimfqRFl92ROkmT9rp7TVBnrEw2gtMTol/2Cp2S2kJa4Q==", "resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.3.tgz",
"integrity": "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==",
"dependencies": { "dependencies": {
"tmp": "0.1.0" "tmp": "^0.2.0"
}
},
"node_modules/tmp/node_modules/rimraf": {
"version": "2.7.1",
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
"dependencies": {
"glob": "^7.1.3"
},
"bin": {
"rimraf": "bin.js"
} }
}, },
"node_modules/to-regex-range": { "node_modules/to-regex-range": {

View File

@@ -1,5 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.create = void 0;
const artifact_client_1 = require("./internal/artifact-client"); const artifact_client_1 = require("./internal/artifact-client");
/** /**
* Constructs an ArtifactClient * Constructs an ArtifactClient

View File

@@ -1 +1 @@
{"version":3,"file":"artifact-client.js","sourceRoot":"","sources":["../src/artifact-client.ts"],"names":[],"mappings":";;AAIA,gEAAgF;AAUhF;;GAEG;AACH,SAAgB,MAAM;IACpB,OAAO,uCAAqB,CAAC,MAAM,EAAE,CAAA;AACvC,CAAC;AAFD,wBAEC"} {"version":3,"file":"artifact-client.js","sourceRoot":"","sources":["../src/artifact-client.ts"],"names":[],"mappings":";;;AAIA,gEAAgF;AAUhF;;GAEG;AACH,SAAgB,MAAM;IACpB,OAAO,uCAAqB,CAAC,MAAM,EAAE,CAAA;AACvC,CAAC;AAFD,wBAEC"}

View File

@@ -1,4 +1,23 @@
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,18 +27,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultArtifactClient = void 0;
const core = __importStar(require("@actions/core")); const core = __importStar(require("@actions/core"));
const upload_specification_1 = require("./upload-specification"); const upload_specification_1 = require("./upload-specification");
const upload_http_client_1 = require("./upload-http-client"); const upload_http_client_1 = require("./upload-http-client");
const utils_1 = require("./utils"); const utils_1 = require("./utils");
const path_and_artifact_name_validation_1 = require("./path-and-artifact-name-validation");
const download_http_client_1 = require("./download-http-client"); const download_http_client_1 = require("./download-http-client");
const download_specification_1 = require("./download-specification"); const download_specification_1 = require("./download-specification");
const config_variables_1 = require("./config-variables"); const config_variables_1 = require("./config-variables");
@@ -36,7 +50,9 @@ class DefaultArtifactClient {
*/ */
uploadArtifact(name, files, rootDirectory, options) { uploadArtifact(name, files, rootDirectory, options) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
utils_1.checkArtifactName(name); 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`);
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 = upload_specification_1.getUploadSpecification(name, rootDirectory, files);
const uploadResponse = { const uploadResponse = {
@@ -57,12 +73,24 @@ class DefaultArtifactClient {
throw new Error('No URL provided by the Artifact Service to upload an artifact to'); throw new Error('No URL provided by the Artifact Service to upload an artifact to');
} }
core.debug(`Upload Resource URL: ${response.fileContainerResourceUrl}`); core.debug(`Upload Resource URL: ${response.fileContainerResourceUrl}`);
core.info(`Container for artifact "${name}" successfully created. Starting upload of file(s)`);
// Upload each of the files that were found concurrently // Upload each of the files that were found concurrently
const uploadResult = yield uploadHttpClient.uploadArtifactToFileContainer(response.fileContainerResourceUrl, uploadSpecification, options); const uploadResult = yield uploadHttpClient.uploadArtifactToFileContainer(response.fileContainerResourceUrl, uploadSpecification, options);
// Update the size of the artifact to indicate we are done uploading // Update the size of the artifact to indicate we are done uploading
// The uncompressed size is used for display when downloading a zip of the artifact from the UI // The uncompressed size is used for display when downloading a zip of the artifact from the UI
core.info(`File upload process has finished. Finalizing the artifact upload`);
yield uploadHttpClient.patchArtifactSize(uploadResult.totalSize, name); yield uploadHttpClient.patchArtifactSize(uploadResult.totalSize, name);
core.info(`Finished uploading artifact ${name}. Reported size is ${uploadResult.uploadSize} bytes. There were ${uploadResult.failedItems.length} items that failed to upload`); if (uploadResult.failedItems.length > 0) {
core.info(`Upload finished. There were ${uploadResult.failedItems.length} items that failed to upload`);
}
else {
core.info(`Artifact has been finalized. All files have been successfully uploaded!`);
}
core.info(`
The raw size of all the files that were specified for upload is ${uploadResult.totalSize} bytes
The size of all the files that were uploaded is ${uploadResult.uploadSize} bytes. This takes into account any gzip compression used to reduce the upload size, time and storage
Note: The size of downloaded zips can differ significantly from the reported size. For more information see: https://github.com/actions/upload-artifact#zipped-artifact-downloads \r\n`);
uploadResponse.artifactItems = uploadSpecification.map(item => item.absoluteFilePath); uploadResponse.artifactItems = uploadSpecification.map(item => item.absoluteFilePath);
uploadResponse.size = uploadResult.uploadSize; uploadResponse.size = uploadResult.uploadSize;
uploadResponse.failedItems = uploadResult.failedItems; uploadResponse.failedItems = uploadResult.failedItems;
@@ -125,6 +153,7 @@ class DefaultArtifactClient {
while (downloadedArtifacts < artifacts.count) { while (downloadedArtifacts < artifacts.count) {
const currentArtifactToDownload = artifacts.value[downloadedArtifacts]; const currentArtifactToDownload = artifacts.value[downloadedArtifacts];
downloadedArtifacts += 1; downloadedArtifacts += 1;
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 = download_specification_1.getDownloadSpecification(currentArtifactToDownload.name, items.value, path, true);

View File

@@ -1 +1 @@
{"version":3,"file":"artifact-client.js","sourceRoot":"","sources":["../../src/internal/artifact-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oDAAqC;AACrC,iEAG+B;AAC/B,6DAAqD;AAKrD,mCAIgB;AAChB,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,yBAAiB,CAAC,IAAI,CAAC,CAAA;YAEvB,iDAAiD;YACjD,MAAM,mBAAmB,GAA0B,6CAAsB,CACvE,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,EA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AA;iBACF;qBAAM;oBACL,MAAM,oCAA4B,CAChC,qBAAqB,CAAC,kBAAkB,CACzC,CAAA;oBACD,MAAM,mCAA2B,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;AApMD,sDAoMC"} {"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,qDAAiB,CAAC,IAAI,CAAC,CAAA;YAEvB,iDAAiD;YACjD,MAAM,mBAAmB,GAA0B,6CAAsB,CACvE,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,mBA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,MAAM,mBAAmB,IAAI,SAAS,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,iDAAwB,CACpD,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,oCAA4B,CAChC,qBAAqB,CAAC,kBAAkB,CACzC,CAAA;oBACD,MAAM,mCAA2B,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"}

View File

@@ -1,5 +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;
// 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;

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,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"}

View File

@@ -25,8 +25,18 @@ export interface PatchArtifactSizeSuccessResponse {
uploadUrl: string; uploadUrl: string;
} }
export interface UploadResults { export interface UploadResults {
/**
* The size in bytes of data that was transferred during the upload process to the actions backend service. This takes into account possible
* gzip compression to reduce the amount of data that needs to be transferred
*/
uploadSize: number; uploadSize: number;
/**
* The raw size of the files that were specified for upload
*/
totalSize: number; totalSize: number;
/**
* An array of files that failed to upload
*/
failedItems: string[]; failedItems: string[];
} }
export interface ListArtifactsResponse { export interface ListArtifactsResponse {

View File

@@ -1,4 +1,23 @@
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,14 +27,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.DownloadHttpClient = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const core = __importStar(require("@actions/core")); const core = __importStar(require("@actions/core"));
const zlib = __importStar(require("zlib")); const zlib = __importStar(require("zlib"));
@@ -167,9 +180,6 @@ class DownloadHttpClient {
let response; let response;
try { try {
response = yield makeDownloadRequest(); response = yield makeDownloadRequest();
if (core.isDebug()) {
utils_1.displayHttpDiagnostics(response);
}
} }
catch (error) { catch (error) {
// if an error is caught, it is usually indicative of a timeout so retry the download // if an error is caught, it is usually indicative of a timeout so retry the download

File diff suppressed because one or more lines are too long

View File

@@ -1,12 +1,25 @@
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) { 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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
result["default"] = mod; __setModuleDefault(result, mod);
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getDownloadSpecification = void 0;
const path = __importStar(require("path")); const path = __importStar(require("path"));
/** /**
* Creates a specification for a set of files that will be downloaded * Creates a specification for a set of files that will be downloaded

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,oBAAoB;YACxC,CAAC,CAAC,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DD,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

@@ -1,5 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpManager = void 0;
const utils_1 = require("./utils"); const utils_1 = require("./utils");
/** /**
* Used for managing http clients during either upload or download * Used for managing http clients during either upload or download

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,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;SACrD;QACD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,wBAAgB,CAAC,SAAS,CAAC,CAAC,CAAA;IACzE,CAAC;IAED,SAAS,CAAC,KAAa;QACrB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC5B,CAAC;IAED,mGAAmG;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,wBAAgB,CAAC,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"} {"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,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;SACrD;QACD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,wBAAgB,CAAC,SAAS,CAAC,CAAC,CAAA;IACzE,CAAC;IAED,SAAS,CAAC,KAAa;QACrB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC5B,CAAC;IAED,mGAAmG;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,wBAAgB,CAAC,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

@@ -0,0 +1,8 @@
/**
* Scans the name of the artifact to make sure there are no illegal characters
*/
export declare function checkArtifactName(name: string): void;
/**
* Scans the name of the filePath used to make sure there are no illegal characters
*/
export declare function checkArtifactFilePath(path: string): void;

View File

@@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkArtifactFilePath = exports.checkArtifactName = void 0;
const core_1 = require("@actions/core");
/**
* Invalid characters that cannot be in the artifact name or an uploaded file. Will be rejected
* from the server if attempted to be sent over. These characters are not allowed due to limitations with certain
* file systems such as NTFS. To maintain platform-agnostic behavior, all characters that are not supported by an
* individual filesystem/platform will not be supported on all fileSystems/platforms
*
* FilePaths can include characters such as \ and / which are not permitted in the artifact name alone
*/
const invalidArtifactFilePathCharacters = new Map([
['"', ' Double quote "'],
[':', ' Colon :'],
['<', ' Less than <'],
['>', ' Greater than >'],
['|', ' Vertical bar |'],
['*', ' Asterisk *'],
['?', ' Question mark ?'],
['\r', ' Carriage return \\r'],
['\n', ' Line feed \\n']
]);
const invalidArtifactNameCharacters = new Map([
...invalidArtifactFilePathCharacters,
['\\', ' Backslash \\'],
['/', ' Forward slash /']
]);
/**
* Scans the name of the artifact to make sure there are no illegal characters
*/
function checkArtifactName(name) {
if (!name) {
throw new Error(`Artifact name: ${name}, is incorrectly provided`);
}
for (const [invalidCharacterKey, errorMessageForCharacter] of invalidArtifactNameCharacters) {
if (name.includes(invalidCharacterKey)) {
throw new Error(`Artifact name is not valid: ${name}. Contains the following character: ${errorMessageForCharacter}
Invalid characters include: ${Array.from(invalidArtifactNameCharacters.values()).toString()}
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!`);
}
exports.checkArtifactName = checkArtifactName;
/**
* Scans the name of the filePath used to make sure there are no illegal characters
*/
function checkArtifactFilePath(path) {
if (!path) {
throw new Error(`Artifact path: ${path}, is incorrectly provided`);
}
for (const [invalidCharacterKey, errorMessageForCharacter] of invalidArtifactFilePathCharacters) {
if (path.includes(invalidCharacterKey)) {
throw new Error(`Artifact path is not valid: ${path}. Contains the following character: ${errorMessageForCharacter}
Invalid characters include: ${Array.from(invalidArtifactFilePathCharacters.values()).toString()}
The following characters are not allowed in files that are uploaded 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.
`);
}
}
}
exports.checkArtifactFilePath = checkArtifactFilePath;
//# sourceMappingURL=path-and-artifact-name-validation.js.map

View File

@@ -0,0 +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;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,WAAI,CAAC,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,4 +1,23 @@
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,14 +27,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.retryHttpClientRequest = exports.retry = void 0;
const utils_1 = require("./utils"); const utils_1 = require("./utils");
const core = __importStar(require("@actions/core")); const core = __importStar(require("@actions/core"));
const config_variables_1 = require("./config-variables"); const config_variables_1 = require("./config-variables");

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,SAA6C,EAC7C,mBAAwC,EACxC,WAAmB;;QAEnB,IAAI,QAAQ,GAAoC,SAAS,CAAA;QACzD,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,I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A2B,CAAC,CAAA;gBAC7C,IAAI,QAAQ,EAAE;oBACZ,8BAAsB,CAAC,QAAQ,CAAC,CAAA;iBACjC;gBACD,MAAK;aACN;YAED,IAAI,CAAC,IAAI,CACP,GAAG,IAAI,cAAc,OAAO,OAAO,WAAW,uBAAuB,YAAY,EAAE,CACpF,CAAA;YAED,MAAM,aAAK,CAAC,6CAAqC,CAAC,OAAO,CAAC,CAAC,CAAA;YAC3D,OAAO,EAAE,CAAA;SACV;QAED,IAAI,QAAQ,EAAE;YACZ,8BAAsB,CAAC,QAAQ,CAAC,CAAA;SACjC;QAED,IAAI,sBAAsB,EAAE;YAC1B,MAAM,KAAK,CAAC,GAAG,IAAI,YAAY,sBAAsB,EAAE,CAAC,CAAA;SACzD;QACD,MAAM,KAAK,CAAC,GAAG,IAAI,YAAY,YAAY,EAAE,CAAC,CAAA;IAChD,CAAC;CAAA;AA1DD,sBA0DC;AAED,SAAsB,sBAAsB,CAC1C,IAAY,EACZ,MAA0C,EAC1C,sBAA2C,IAAI,GAAG,EAAE,EACpD,WAAW,GAAG,gCAAa,EAAE;;QAE7B,OAAO,MAAM,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,mBAAmB,EAAE,WAAW,CAAC,CAAA;IACpE,CAAC;CAAA;AAPD,wDAOC"}

View File

@@ -11,11 +11,10 @@ export declare class StatusReporter {
private displayFrequencyInMilliseconds; private displayFrequencyInMilliseconds;
private largeFiles; private largeFiles;
private totalFileStatus; private totalFileStatus;
private largeFileStatus;
constructor(displayFrequencyInMilliseconds: number); constructor(displayFrequencyInMilliseconds: number);
setTotalNumberOfFilesToProcess(fileTotal: number): void; setTotalNumberOfFilesToProcess(fileTotal: number): void;
start(): void; start(): void;
updateLargeFileStatus(fileName: string, numerator: number, denominator: number): void; updateLargeFileStatus(fileName: string, chunkStartIndex: number, chunkEndIndex: number, totalUploadFileSize: number): void;
stop(): void; stop(): void;
incrementProcessedCount(): void; incrementProcessedCount(): void;
private formatPercentage; private formatPercentage;

View File

@@ -1,5 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.StatusReporter = void 0;
const core_1 = require("@actions/core"); const core_1 = require("@actions/core");
/** /**
* Status Reporter that displays information about the progress/status of an artifact that is being uploaded or downloaded * Status Reporter that displays information about the progress/status of an artifact that is being uploaded or downloaded
@@ -14,11 +15,11 @@ class StatusReporter {
this.processedCount = 0; this.processedCount = 0;
this.largeFiles = new Map(); this.largeFiles = new Map();
this.totalFileStatus = undefined; this.totalFileStatus = undefined;
this.largeFileStatus = undefined;
this.displayFrequencyInMilliseconds = displayFrequencyInMilliseconds; this.displayFrequencyInMilliseconds = displayFrequencyInMilliseconds;
} }
setTotalNumberOfFilesToProcess(fileTotal) { setTotalNumberOfFilesToProcess(fileTotal) {
this.totalNumberOfFilesToProcess = fileTotal; this.totalNumberOfFilesToProcess = fileTotal;
this.processedCount = 0;
} }
start() { start() {
// displays information about the total upload/download status // displays information about the total upload/download status
@@ -27,30 +28,17 @@ class StatusReporter {
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)}%)`); core_1.info(`Total file count: ${this.totalNumberOfFilesToProcess} ---- Processed file #${this.processedCount} (${percentage.slice(0, percentage.indexOf('.') + 2)}%)`);
}, this.displayFrequencyInMilliseconds); }, this.displayFrequencyInMilliseconds);
// displays extra information about any large files that take a significant amount of time to upload or download every 1 second
this.largeFileStatus = setInterval(() => {
for (const value of Array.from(this.largeFiles.values())) {
core_1.info(value);
}
// delete all entries in the map after displaying the information so it will not be displayed again unless explicitly added
this.largeFiles.clear();
}, 1000);
} }
// 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, numerator, denominator) { updateLargeFileStatus(fileName, chunkStartIndex, chunkEndIndex, totalUploadFileSize) {
// display 1 decimal place without any rounding // display 1 decimal place without any rounding
const percentage = this.formatPercentage(numerator, denominator); const percentage = this.formatPercentage(chunkEndIndex, totalUploadFileSize);
const displayInformation = `Uploading ${fileName} (${percentage.slice(0, percentage.indexOf('.') + 2)}%)`; core_1.info(`Uploaded ${fileName} (${percentage.slice(0, percentage.indexOf('.') + 2)}%) bytes ${chunkStartIndex}:${chunkEndIndex}`);
// any previously added display information should be overwritten for the specific large file because a map is being used
this.largeFiles.set(fileName, displayInformation);
} }
stop() { stop() {
if (this.totalFileStatus) { if (this.totalFileStatus) {
clearInterval(this.totalFileStatus); clearInterval(this.totalFileStatus);
} }
if (this.largeFileStatus) {
clearInterval(this.largeFileStatus);
}
} }
incrementProcessedCount() { incrementProcessedCount() {
this.processedCount++; this.processedCount++;

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;IAQzB,YAAY,8BAAsC;QAP1C,gCAA2B,GAAG,CAAC,CAAA;QAC/B,mBAAc,GAAG,CAAC,CAAA;QAElB,eAAU,GAAG,IAAI,GAAG,EAAkB,CAAA;QAK5C,IAAI,CAAC,eAAe,GAAG,SAAS,CAAA;QAChC,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;IAC9C,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,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,EAChB,eAAuB,EACvB,aAAqB,EACrB,mBAA2B;QAE3B,+CAA+C;QAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAA;QAC5E,WAAI,CACF,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,4 +1,23 @@
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@@ -15,18 +34,25 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
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 = util_1.promisify(fs.stat);
/**
* 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).
* 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 = [
'.gzip',
'.zip',
'.tar.lz',
'.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
* @param {string} originalFilePath filepath of whatever will be compressed. The original file will be unmodified * @param {string} originalFilePath filepath of whatever will be compressed. The original file will be unmodified
@@ -35,6 +61,12 @@ const stat = util_1.promisify(fs.stat);
*/ */
function createGZipFileOnDisk(originalFilePath, tempFilePath) { function createGZipFileOnDisk(originalFilePath, tempFilePath) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
for (const gzipExemptExtension of gzipExemptFileExtensions) {
if (originalFilePath.endsWith(gzipExemptExtension)) {
// return a really large number so that the original file gets uploaded
return Number.MAX_SAFE_INTEGER;
}
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const inputStream = fs.createReadStream(originalFilePath); const inputStream = fs.createReadStream(originalFilePath);
const gzip = zlib.createGzip(); const gzip = zlib.createGzip();

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;;;;;GAKG;AACH,SAAsB,oBAAoB,CACxC,gBAAwB,EACxB,YAAoB;;QAEpB,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,CA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C,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,GAAG,EAAE,CAAA;;gBACjB,KAA0B,IAAA,SAAA,cAAA,IAAI,CAAA,UAAA;oBAAnB,MAAM,KAAK,iBAAA,CAAA;oBACpB,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,4 +1,23 @@
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,14 +27,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.UploadHttpClient = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const core = __importStar(require("@actions/core")); const core = __importStar(require("@actions/core"));
const tmp = __importStar(require("tmp-promise")); const tmp = __importStar(require("tmp-promise"));
@@ -161,27 +174,33 @@ class UploadHttpClient {
*/ */
uploadFileAsync(httpClientIndex, parameters) { uploadFileAsync(httpClientIndex, parameters) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const totalFileSize = (yield stat(parameters.file)).size; const fileStat = yield stat(parameters.file);
const totalFileSize = fileStat.size;
const isFIFO = fileStat.isFIFO();
let offset = 0; let offset = 0;
let isUploadSuccessful = true; let isUploadSuccessful = true;
let failedChunkSizes = 0; let failedChunkSizes = 0;
let uploadFileSize = 0; let uploadFileSize = 0;
let isGzip = true; let isGzip = true;
// the file that is being uploaded is less than 64k in size, to increase throughput and to minimize disk I/O // the file that is being uploaded is less than 64k in size to increase throughput and to minimize disk I/O
// for creating a new GZip file, an in-memory buffer is used for compression // for creating a new GZip file, an in-memory buffer is used for compression
if (totalFileSize < 65536) { // with named pipes the file size is reported as zero in that case don't read the file in memory
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`);
const buffer = yield upload_gzip_1.createGZipFileInBuffer(parameters.file); const buffer = yield 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;
if (totalFileSize < buffer.byteLength) { if (totalFileSize < buffer.byteLength) {
// compression did not help with reducing the size, use a readable stream from the original file for upload // compression did not help with reducing the size, use a readable stream from the original file for upload
core.debug(`The gzip file created for ${parameters.file} did not help with reducing the size of the file. The original file will be uploaded as-is`);
openUploadStream = () => fs.createReadStream(parameters.file); openUploadStream = () => fs.createReadStream(parameters.file);
isGzip = false; isGzip = false;
uploadFileSize = totalFileSize; uploadFileSize = totalFileSize;
} }
else { else {
// create a readable stream using a PassThrough stream that is both readable and writable // create a readable stream using a PassThrough stream that is both readable and writable
core.debug(`A gzip file created for ${parameters.file} helped with reducing the size of the original file. The file will be uploaded using gzip.`);
openUploadStream = () => { openUploadStream = () => {
const passThrough = new stream.PassThrough(); const passThrough = new stream.PassThrough();
passThrough.end(buffer); passThrough.end(buffer);
@@ -206,25 +225,27 @@ class UploadHttpClient {
// the file that is being uploaded is greater than 64k in size, a temporary file gets created on disk using the // the file that is being uploaded is greater than 64k in size, a temporary file gets created on disk using the
// npm tmp-promise package and this file gets used to create a GZipped file // npm tmp-promise package and this file gets used to create a GZipped file
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`);
// 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 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
if (totalFileSize < uploadFileSize) { // for named pipes totalFileSize is zero, this assumes compression did help
if (!isFIFO && totalFileSize < uploadFileSize) {
core.debug(`The gzip file created for ${parameters.file} did not help with reducing the size of the file. The original file will be uploaded as-is`);
uploadFileSize = totalFileSize; uploadFileSize = totalFileSize;
uploadFilePath = parameters.file; uploadFilePath = parameters.file;
isGzip = false; isGzip = false;
} }
else {
core.debug(`The gzip file created for ${parameters.file} is smaller than the original file. The file will be uploaded using gzip.`);
}
let abortFileUpload = false; let abortFileUpload = false;
// upload only a single chunk at a time // upload only a single chunk at a time
while (offset < uploadFileSize) { while (offset < uploadFileSize) {
const chunkSize = Math.min(uploadFileSize - offset, parameters.maxChunkSize); const chunkSize = Math.min(uploadFileSize - offset, parameters.maxChunkSize);
// if an individual file is greater than 100MB (1024*1024*100) in size, display extra information about the upload status const startChunkIndex = offset;
if (uploadFileSize > 104857600) { const endChunkIndex = offset + chunkSize - 1;
this.statusReporter.updateLargeFileStatus(parameters.file, offset, uploadFileSize);
}
const start = offset;
const end = offset + chunkSize - 1;
offset += parameters.maxChunkSize; offset += parameters.maxChunkSize;
if (abortFileUpload) { if (abortFileUpload) {
// if we don't want to continue in the event of an error, any pending upload chunks will be marked as failed // if we don't want to continue in the event of an error, any pending upload chunks will be marked as failed
@@ -232,10 +253,10 @@ class UploadHttpClient {
continue; continue;
} }
const result = yield this.uploadChunk(httpClientIndex, parameters.resourceUrl, () => fs.createReadStream(uploadFilePath, { const result = yield this.uploadChunk(httpClientIndex, parameters.resourceUrl, () => fs.createReadStream(uploadFilePath, {
start, start: startChunkIndex,
end, end: endChunkIndex,
autoClose: false autoClose: false
}), start, end, uploadFileSize, isGzip, totalFileSize); }), startChunkIndex, endChunkIndex, uploadFileSize, isGzip, totalFileSize);
if (!result) { if (!result) {
// Chunk failed to upload, report as failed and do not continue uploading any more chunks for the file. It is possible that part of a chunk was // Chunk failed to upload, report as failed and do not continue uploading any more chunks for the file. It is possible that part of a chunk was
// successfully uploaded so the server may report a different size for what was uploaded // successfully uploaded so the server may report a different size for what was uploaded
@@ -244,9 +265,16 @@ class UploadHttpClient {
core.warning(`Aborting upload for ${parameters.file} due to failure`); core.warning(`Aborting upload for ${parameters.file} due to failure`);
abortFileUpload = true; abortFileUpload = true;
} }
else {
// if an individual file is greater than 8MB (1024*1024*8) in size, display extra information about the upload status
if (uploadFileSize > 8388608) {
this.statusReporter.updateLargeFileStatus(parameters.file, startChunkIndex, endChunkIndex, uploadFileSize);
}
}
} }
// Delete the temporary file that was created as part of the upload. If the temp file does not get manually deleted by // Delete the temporary file that was created as part of the upload. If the temp file does not get manually deleted by
// calling cleanup, it gets removed when the node process exits. For more info see: https://www.npmjs.com/package/tmp-promise#about // calling cleanup, it gets removed when the node process exits. For more info see: https://www.npmjs.com/package/tmp-promise#about
core.debug(`deleting temporary gzip file ${tempFile.path}`);
yield tempFile.cleanup(); yield tempFile.cleanup();
return { return {
isSuccess: isUploadSuccessful, isSuccess: isUploadSuccessful,

File diff suppressed because one or more lines are too long

View File

@@ -1,16 +1,29 @@
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) { 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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
result["default"] = mod; __setModuleDefault(result, mod);
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getUploadSpecification = void 0;
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const core_1 = require("@actions/core"); const core_1 = require("@actions/core");
const path_1 = require("path"); const path_1 = require("path");
const utils_1 = require("./utils"); const path_and_artifact_name_validation_1 = require("./path-and-artifact-name-validation");
/** /**
* Creates a specification that describes how each file that is part of the artifact will be uploaded * Creates a specification that describes how each file that is part of the artifact will be uploaded
* @param artifactName the name of the artifact being uploaded. Used during upload to denote where the artifact is stored on the server * @param artifactName the name of the artifact being uploaded. Used during upload to denote where the artifact is stored on the server
@@ -18,7 +31,7 @@ const utils_1 = require("./utils");
* @param artifactFiles a list of absolute file paths that denote what should be uploaded as part of the artifact * @param artifactFiles a list of absolute file paths that denote what should be uploaded as part of the artifact
*/ */
function getUploadSpecification(artifactName, rootDirectory, artifactFiles) { function getUploadSpecification(artifactName, rootDirectory, artifactFiles) {
utils_1.checkArtifactName(artifactName); // artifact name was checked earlier on, no need to check again
const specifications = []; const specifications = [];
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`);
@@ -61,7 +74,7 @@ function getUploadSpecification(artifactName, rootDirectory, artifactFiles) {
} }
// 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, '');
utils_1.checkArtifactFilePath(uploadPath); 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

View File

@@ -1 +1 @@
{"version":3,"file":"upload-spec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M,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAA;YAClD,6BAAqB,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;AA9ED,wDA8EC"} {"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"}

View File

@@ -58,14 +58,6 @@ export declare function getArtifactUrl(): string;
* 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.
*/ */
export declare function displayHttpDiagnostics(response: IHttpClientResponse): void; export declare function displayHttpDiagnostics(response: IHttpClientResponse): void;
/**
* Scans the name of the artifact to make sure there are no illegal characters
*/
export declare function checkArtifactName(name: string): void;
/**
* Scans the name of the filePath used to make sure there are no illegal characters
*/
export declare function checkArtifactFilePath(path: string): void;
export declare function createDirectoriesForArtifact(directories: string[]): Promise<void>; export declare function createDirectoriesForArtifact(directories: string[]): Promise<void>;
export declare function createEmptyFilesForArtifact(emptyFilesToCreate: string[]): Promise<void>; export declare function createEmptyFilesForArtifact(emptyFilesToCreate: string[]): Promise<void>;
export declare function getFileSize(filePath: string): Promise<number>; export declare function getFileSize(filePath: string): Promise<number>;

View File

@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.sleep = exports.getProperRetention = exports.rmFile = exports.getFileSize = exports.createEmptyFilesForArtifact = exports.createDirectoriesForArtifact = exports.displayHttpDiagnostics = exports.getArtifactUrl = exports.createHttpClient = exports.getUploadHeaders = exports.getDownloadHeaders = exports.getContentRange = exports.tryGetRetryAfterValueTimeInMilliseconds = exports.isThrottledStatusCode = exports.isRetryableStatusCode = exports.isForbiddenStatusCode = exports.isSuccessStatusCode = exports.getApiVersion = exports.parseEnvNumber = exports.getExponentialRetryTimeInMilliseconds = void 0;
const core_1 = require("@actions/core"); const core_1 = require("@actions/core");
const fs_1 = require("fs"); const fs_1 = require("fs");
const http_client_1 = require("@actions/http-client"); const http_client_1 = require("@actions/http-client");
@@ -28,7 +29,7 @@ function getExponentialRetryTimeInMilliseconds(retryCount) {
const minTime = config_variables_1.getInitialRetryIntervalInMilliseconds() * config_variables_1.getRetryMultiplier() * retryCount; const minTime = config_variables_1.getInitialRetryIntervalInMilliseconds() * config_variables_1.getRetryMultiplier() * retryCount;
const maxTime = minTime * config_variables_1.getRetryMultiplier(); const maxTime = minTime * 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.random() * (maxTime - minTime) + minTime; return Math.trunc(Math.random() * (maxTime - minTime) + minTime);
} }
exports.getExponentialRetryTimeInMilliseconds = getExponentialRetryTimeInMilliseconds; exports.getExponentialRetryTimeInMilliseconds = getExponentialRetryTimeInMilliseconds;
/** /**
@@ -207,48 +208,6 @@ Header Information: ${JSON.stringify(response.message.headers, undefined, 2)}
###### End Diagnostic HTTP information ######`); ###### End Diagnostic HTTP information ######`);
} }
exports.displayHttpDiagnostics = displayHttpDiagnostics; exports.displayHttpDiagnostics = displayHttpDiagnostics;
/**
* Invalid characters that cannot be in the artifact name or an uploaded file. Will be rejected
* from the server if attempted to be sent over. These characters are not allowed due to limitations with certain
* file systems such as NTFS. To maintain platform-agnostic behavior, all characters that are not supported by an
* individual filesystem/platform will not be supported on all fileSystems/platforms
*
* FilePaths can include characters such as \ and / which are not permitted in the artifact name alone
*/
const invalidArtifactFilePathCharacters = ['"', ':', '<', '>', '|', '*', '?'];
const invalidArtifactNameCharacters = [
...invalidArtifactFilePathCharacters,
'\\',
'/'
];
/**
* Scans the name of the artifact to make sure there are no illegal characters
*/
function checkArtifactName(name) {
if (!name) {
throw new Error(`Artifact name: ${name}, is incorrectly provided`);
}
for (const invalidChar of invalidArtifactNameCharacters) {
if (name.includes(invalidChar)) {
throw new Error(`Artifact name is not valid: ${name}. Contains character: "${invalidChar}". Invalid artifact name characters include: ${invalidArtifactNameCharacters.toString()}.`);
}
}
}
exports.checkArtifactName = checkArtifactName;
/**
* Scans the name of the filePath used to make sure there are no illegal characters
*/
function checkArtifactFilePath(path) {
if (!path) {
throw new Error(`Artifact path: ${path}, is incorrectly provided`);
}
for (const invalidChar of invalidArtifactFilePathCharacters) {
if (path.includes(invalidChar)) {
throw new Error(`Artifact path is not valid: ${path}. Contains character: "${invalidChar}". Invalid characters include: ${invalidArtifactFilePathCharacters.toString()}.`);
}
}
}
exports.checkArtifactFilePath = checkArtifactFilePath;
function createDirectoriesForArtifact(directories) { function createDirectoriesForArtifact(directories) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
for (const directory of directories) { for (const directory of directories) {

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{ {
"name": "@actions/artifact", "name": "@actions/artifact",
"version": "0.5.2", "version": "1.0.0",
"preview": true, "preview": true,
"description": "Actions artifact lib", "description": "Actions artifact lib",
"keywords": [ "keywords": [
@@ -39,11 +39,11 @@
"dependencies": { "dependencies": {
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/http-client": "^1.0.11", "@actions/http-client": "^1.0.11",
"@types/tmp": "^0.1.0", "tmp": "^0.2.1",
"tmp": "^0.1.0", "tmp-promise": "^3.0.2"
"tmp-promise": "^2.0.2"
}, },
"devDependencies": { "devDependencies": {
"@types/tmp": "^0.2.1",
"typescript": "^3.8.3" "typescript": "^3.8.3"
} }
} }

21
node_modules/@types/tmp/LICENSE generated vendored
View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) Microsoft Corporation. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

16
node_modules/@types/tmp/README.md generated vendored
View File

@@ -1,16 +0,0 @@
# Installation
> `npm install --save @types/tmp`
# Summary
This package contains type definitions for tmp ( http://github.com/raszi/node-tmp ).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tmp
Additional Details
* Last updated: Mon, 01 Apr 2019 20:55:52 GMT
* Dependencies: none
* Global values: none
# Credits
These definitions were written by Jared Klopper <https://github.com/optical>, Gyusun Yeom <https://github.com/Perlmint>, Alan Plum <https://github.com/pluma>.

70
node_modules/@types/tmp/index.d.ts generated vendored
View File

@@ -1,70 +0,0 @@
// Type definitions for tmp 0.1
// Project: http://github.com/raszi/node-tmp
// Definitions by: Jared Klopper <https://github.com/optical>
// Gyusun Yeom <https://github.com/Perlmint>
// Alan Plum <https://github.com/pluma>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface TmpNameOptions {
prefix?: string;
postfix?: string;
template?: string;
dir?: string;
tries?: number;
}
export interface FileOptions extends TmpNameOptions {
mode?: number;
keep?: boolean;
discardDescriptor?: boolean;
detachDescriptor?: boolean;
}
export interface DirOptions extends TmpNameOptions {
mode?: number;
keep?: boolean;
unsafeCleanup?: boolean;
}
export interface FileResult {
name: string;
fd: number;
removeCallback: () => void;
}
export interface DirResult {
name: string;
removeCallback: () => void;
}
export type FileCallback = (
err: any,
name: string,
fd: number,
removeCallback: () => void
) => void;
export type DirCallback = (
err: any,
name: string,
removeCallback: () => void
) => void;
export type TmpNameCallback = (err: any, name: string) => void;
export function file(options: FileOptions, cb: FileCallback): void;
export function file(cb: FileCallback): void;
export function fileSync(options?: FileOptions): FileResult;
export function dir(options: DirOptions, cb: DirCallback): void;
export function dir(cb: DirCallback): void;
export function dirSync(options?: DirOptions): DirResult;
export function tmpName(options: TmpNameOptions, cb: TmpNameCallback): void;
export function tmpName(cb: TmpNameCallback): void;
export function tmpNameSync(options?: TmpNameOptions): string;
export function setGracefulCleanup(): void;

34
node_modules/@types/tmp/package.json generated vendored
View File

@@ -1,34 +0,0 @@
{
"name": "@types/tmp",
"version": "0.1.0",
"description": "TypeScript definitions for tmp",
"license": "MIT",
"contributors": [
{
"name": "Jared Klopper",
"url": "https://github.com/optical",
"githubUsername": "optical"
},
{
"name": "Gyusun Yeom",
"url": "https://github.com/Perlmint",
"githubUsername": "Perlmint"
},
{
"name": "Alan Plum",
"url": "https://github.com/pluma",
"githubUsername": "pluma"
}
],
"main": "",
"types": "index",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/tmp"
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "d148a6fe31794f2a5b222ae9d0f38d575acbb5e0fed205877913f4e52e33a357",
"typeScriptVersion": "2.0"
}

View File

@@ -1,11 +1,11 @@
[![NPM version][npm-image]][npm-url] [![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url] [![Node.js CI][ci-image]][ci-url]
[![Test coverage][coveralls-image]][coveralls-url] [![Test coverage][coveralls-image]][coveralls-url]
[![Downloads][downloads-image]][downloads-url] [![Downloads][downloads-image]][downloads-url]
# removeNPMAbsolutePaths # removeNPMAbsolutePaths
removeNPMAbsolutePaths is a small utility to remove the fields that npm adds to the modules in `node_modules` containing local aboslute paths. removeNPMAbsolutePaths is a small utility to remove the fields that npm adds to the modules in `node_modules` containing local absolute paths.
It has been noted that the `package.json` of modules in the `node_modules` folder contain some extra fields like `_args` and `where` which contain the absolute path of the module. According to NPM those fields are not even used. It has been noted that the `package.json` of modules in the `node_modules` folder contain some extra fields like `_args` and `where` which contain the absolute path of the module. According to NPM those fields are not even used.
@@ -26,15 +26,19 @@ $ removeNPMAbsolutePaths '<PROJECT_FOLDER>'
``` ```
or use it from whithin your code or use it from whithin your code
```javascript ```javascript
var removeNPMAbsolutePaths = require('removeNPMAbsolutePaths'); const removeNPMAbsolutePaths = require('removeNPMAbsolutePaths');
removeNPMAbsolutePaths('<PROJECT_FOLDER>')
.then(results => results.forEach(result => { try {
const results = await removeNPMAbsolutePaths('<PROJECT_FOLDER>');
results.forEach(result => {
// Print only information about files that couldn't be processed // Print only information about files that couldn't be processed
if (!result.success) { if (!result.success) {
console.log(result.err.message); console.log(result.err.message);
} }
})) });
.catch(err => console.log(err.message)); } catch(err) {
console.log(err.message);
}
``` ```
Using `removeNPMAbsolutePaths` from within Javascript returns a promise containing information about all the folders and files processed and whether they where successfully processed and rewritten or not. Using `removeNPMAbsolutePaths` from within Javascript returns a promise containing information about all the folders and files processed and whether they where successfully processed and rewritten or not.
@@ -61,8 +65,8 @@ MIT
[npm-image]: https://img.shields.io/npm/v/removeNPMAbsolutePaths.svg?style=flat-square [npm-image]: https://img.shields.io/npm/v/removeNPMAbsolutePaths.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/removeNPMAbsolutePaths [npm-url]: https://www.npmjs.com/package/removeNPMAbsolutePaths
[travis-image]: https://img.shields.io/travis/juanjoDiaz/removeNPMAbsolutePaths/master.svg?style=flat-square [ci-image]: https://github.com/juanjoDiaz/removeNPMAbsolutePaths/actions/workflows/on-push.yaml/badge.svg
[travis-url]: https://travis-ci.org/juanjoDiaz/removeNPMAbsolutePaths [ci-url]: https://github.com/juanjoDiaz/removeNPMAbsolutePaths/actions/workflows/on-push.yaml
[coveralls-image]: https://img.shields.io/coveralls/juanjoDiaz/removeNPMAbsolutePaths/master.svg?style=flat-square [coveralls-image]: https://img.shields.io/coveralls/juanjoDiaz/removeNPMAbsolutePaths/master.svg?style=flat-square
[coveralls-url]: https://coveralls.io/github/juanjoDiaz/removeNPMAbsolutePaths?branch=master [coveralls-url]: https://coveralls.io/github/juanjoDiaz/removeNPMAbsolutePaths?branch=master
[downloads-image]: https://img.shields.io/npm/dm/removeNPMAbsolutePaths.svg?style=flat-square [downloads-image]: https://img.shields.io/npm/dm/removeNPMAbsolutePaths.svg?style=flat-square

View File

@@ -1,6 +1,6 @@
{ {
"name": "removeNPMAbsolutePaths", "name": "removeNPMAbsolutePaths",
"version": "2.0.0", "version": "3.0.0",
"description": "Remove the fields containing local aboslute paths created by NPM", "description": "Remove the fields containing local aboslute paths created by NPM",
"keywords": [ "keywords": [
"npm", "npm",
@@ -10,9 +10,7 @@
"scripts": { "scripts": {
"lint": "eslint bin/removeNPMAbsolutePaths src test --ignore-pattern 'test/data/malformed/module/'", "lint": "eslint bin/removeNPMAbsolutePaths src test --ignore-pattern 'test/data/malformed/module/'",
"test": "mocha test", "test": "mocha test",
"test-with-coverage": "nyc --reporter=text mocha test", "test-with-coverage": "nyc --reporter=text --reporter=lcov mocha test"
"travis": "npm run lint && npm run test-with-coverage",
"coveralls": "nyc report --reporter=text-lcov | coveralls"
}, },
"author": "Juanjo Diaz <juanjo.diazmo@gmail.com>", "author": "Juanjo Diaz <juanjo.diazmo@gmail.com>",
"repository": { "repository": {
@@ -35,16 +33,16 @@
"src/" "src/"
], ],
"devDependencies": { "devDependencies": {
"chai": "^4.2.0", "chai": "^4.3.6",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
"coveralls": "^3.0.5", "coveralls": "^3.1.1",
"eslint": "^6.0.1", "eslint": "^8.9.0",
"eslint-config-airbnb-base": "^13.2.0", "eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.18.0", "eslint-plugin-import": "^2.25.4",
"mocha": "^6.1.4", "mocha": "^9.2.1",
"nyc": "^14.1.1", "nyc": "^15.1.0",
"sinon": "^7.3.2", "sinon": "^13.0.1",
"sinon-chai": "^3.3.0" "sinon-chai": "^3.7.0"
}, },
"engines": { "engines": {
"node": ">=4.0.0" "node": ">=4.0.0"

View File

@@ -303,8 +303,7 @@ const all = [
}, },
]; ];
module.exports = {}; module.exports = all.reduce((obj, error) => ({
...obj,
all.forEach((error) => { [error.errno]: error.description,
module.exports[error.errno] = error.description; }));
});

View File

@@ -3,14 +3,9 @@
const path = require('path'); const path = require('path');
const { const {
stat, readdir, readFile, writeFile, stat, readdir, readFile, writeFile,
} = require('fs'); } = require('fs').promises;
const { promisify } = require('util');
const errno = require('./errno');
const statAsync = promisify(stat); const errno = require('./errno');
const readdirAsync = promisify(readdir);
const readFileAsync = promisify(readFile);
const writeFileAsync = promisify(writeFile);
class ProcessingError extends Error { class ProcessingError extends Error {
constructor(message, err) { constructor(message, err) {
@@ -21,7 +16,7 @@ class ProcessingError extends Error {
async function getStats(filePath) { async function getStats(filePath) {
try { try {
return await statAsync(filePath); return await stat(filePath);
} catch (err) { } catch (err) {
throw new ProcessingError(`Can't read directory/file at "${filePath}"`, err); throw new ProcessingError(`Can't read directory/file at "${filePath}"`, err);
} }
@@ -31,7 +26,7 @@ async function processFile(filePath, opts) {
try { try {
let data; let data;
try { try {
data = await readFileAsync(filePath, 'utf8'); data = await readFile(filePath, 'utf8');
} catch (err) { } catch (err) {
throw new ProcessingError(`Can't read file at "${filePath}"`, err); throw new ProcessingError(`Can't read file at "${filePath}"`, err);
} }
@@ -54,7 +49,7 @@ async function processFile(filePath, opts) {
if (shouldWriteFile || opts.force) { if (shouldWriteFile || opts.force) {
try { try {
await writeFileAsync(filePath, JSON.stringify(obj, null, ' ')); await writeFile(filePath, `${JSON.stringify(obj, null, ' ')}${data.endsWith('\n') ? '\n' : ''}`);
} catch (err) { } catch (err) {
throw new ProcessingError(`Can't write processed file to "${filePath}"`, err); throw new ProcessingError(`Can't write processed file to "${filePath}"`, err);
} }
@@ -72,7 +67,7 @@ async function processDir(dirPath, opts) {
try { try {
let files; let files;
try { try {
files = await readdirAsync(dirPath); files = await readdir(dirPath);
} catch (err) { } catch (err) {
throw new ProcessingError(`Can't read directory at "${dirPath}"`, err); throw new ProcessingError(`Can't read directory at "${dirPath}"`, err);
} }
@@ -98,26 +93,23 @@ async function processDir(dirPath, opts) {
return arr; return arr;
} }
if (value.constructor === Array) { if (Array.isArray(value)) {
return arr.concat(value); return [...arr, ...value];
} }
arr.push(value); return [...arr, value];
return arr;
}, [{ dirPath, success: true }]); }, [{ dirPath, success: true }]);
} catch (err) { } catch (err) {
return [{ dirPath, err, success: false }]; return [{ dirPath, err, success: false }];
} }
} }
async function removeNPMAbsolutePaths(filePath, opts) { async function removeNPMAbsolutePaths(filePath, opts = {}) {
opts = opts || {}; // eslint-disable-line no-param-reassign
if (!filePath) { if (!filePath) {
throw new ProcessingError('Missing path.\nThe first argument should be the path to a directory or a package.json file.'); throw new ProcessingError('Missing path.\nThe first argument should be the path to a directory or a package.json file.');
} }
if (opts.fields && (opts.fields.constructor !== Array || opts.fields.length === 0)) { if (opts.fields && (!Array.isArray(opts.fields) || opts.fields.length === 0)) {
throw new ProcessingError('Invalid option: fields.\nThe fields option should be an array cotaining the names of the specific fields that should be removed.'); throw new ProcessingError('Invalid option: fields.\nThe fields option should be an array cotaining the names of the specific fields that should be removed.');
} }

View File

@@ -3,7 +3,7 @@ import { FileOptions, DirOptions, TmpNameOptions } from "tmp";
export interface DirectoryResult { export interface DirectoryResult {
path: string; path: string;
cleanup(): Promise<void>; cleanup: () => Promise<void>;
} }
export interface FileResult extends DirectoryResult { export interface FileResult extends DirectoryResult {

4
node_modules/tmp-promise/index.js generated vendored
View File

@@ -1,4 +1,6 @@
const {promisify} = require("util"); 'use strict';
const { promisify } = require("util");
const tmp = require("tmp"); const tmp = require("tmp");
// file // file

View File

@@ -1,13 +1,14 @@
{ {
"name": "tmp-promise", "name": "tmp-promise",
"version": "2.1.1", "version": "3.0.3",
"description": "The tmp package with promises support and disposers.", "description": "The tmp package with promises support and disposers.",
"main": "index.js", "main": "index.js",
"types": "index.d.ts", "types": "index.d.ts",
"scripts": { "scripts": {
"mocha": "mocha", "mocha": "mocha",
"check-types": "tsd", "check-types": "tsd",
"test": "npm run mocha && npm run check-types" "test": "npm run mocha && npm run check-types",
"publish": "node publish"
}, },
"keywords": [ "keywords": [
"tmp", "tmp",
@@ -16,18 +17,18 @@
"mkdtemp", "mkdtemp",
"mktemp" "mktemp"
], ],
"author": "Benjamin Gruenbaum and collaborators.", "author": "Benjamin Gruenbaum and Collaborators.",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/benjamingr/tmp-promise.git" "url": "git://github.com/benjamingr/tmp-promise.git"
}, },
"dependencies": { "dependencies": {
"tmp": "0.1.0" "tmp": "^0.2.0"
}, },
"devDependencies": { "devDependencies": {
"@types/tmp": "^0.1.0", "@types/tmp": "^0.2.0",
"mocha": "^6.1.4", "mocha": "7.1.2",
"tsd": "^0.7.2" "tsd": "0.11.0"
} }
} }

8
node_modules/tmp-promise/publish.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
'use strict';
const { execSync } = require('child_process');
const { version } = require('./package');
execSync('npm run test');
execSync(`git tag v${version}`);
execSync('npm publish');

5
node_modules/tmp-promise/test.js generated vendored
View File

@@ -1,7 +1,8 @@
'use strict';
const fs = require('fs') const fs = require('fs')
const {promisify} = require('util')
const assert = require('assert') const assert = require('assert')
const {extname} = require('path') const { extname } = require('path')
const tmp = require('.') const tmp = require('.')

288
node_modules/tmp/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,288 @@
## v0.2.1 (2020-04-28)
#### :rocket: Enhancement
* [#252](https://github.com/raszi/node-tmp/pull/252) Closes [#250](https://github.com/raszi/node-tmp/issues/250): introduce tmpdir option for overriding the system tmp dir ([@silkentrance](https://github.com/silkentrance))
#### :house: Internal
* [#253](https://github.com/raszi/node-tmp/pull/253) Closes [#191](https://github.com/raszi/node-tmp/issues/191): generate changelog from pull requests using lerna-changelog ([@silkentrance](https://github.com/silkentrance))
#### Committers: 1
- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
## v0.2.0 (2020-04-25)
#### :rocket: Enhancement
* [#234](https://github.com/raszi/node-tmp/pull/234) feat: stabilize tmp for v0.2.0 release ([@silkentrance](https://github.com/silkentrance))
#### :bug: Bug Fix
* [#231](https://github.com/raszi/node-tmp/pull/231) Closes [#230](https://github.com/raszi/node-tmp/issues/230): regression after fix for #197 ([@silkentrance](https://github.com/silkentrance))
* [#220](https://github.com/raszi/node-tmp/pull/220) Closes [#197](https://github.com/raszi/node-tmp/issues/197): return sync callback when using the sync interface, otherwise return the async callback ([@silkentrance](https://github.com/silkentrance))
* [#193](https://github.com/raszi/node-tmp/pull/193) Closes [#192](https://github.com/raszi/node-tmp/issues/192): tmp must not exit the process on its own ([@silkentrance](https://github.com/silkentrance))
#### :memo: Documentation
* [#221](https://github.com/raszi/node-tmp/pull/221) Gh 206 document name option ([@silkentrance](https://github.com/silkentrance))
#### :house: Internal
* [#226](https://github.com/raszi/node-tmp/pull/226) Closes [#212](https://github.com/raszi/node-tmp/issues/212): enable direct name option test ([@silkentrance](https://github.com/silkentrance))
* [#225](https://github.com/raszi/node-tmp/pull/225) Closes [#211](https://github.com/raszi/node-tmp/issues/211): existing tests must clean up after themselves ([@silkentrance](https://github.com/silkentrance))
* [#224](https://github.com/raszi/node-tmp/pull/224) Closes [#217](https://github.com/raszi/node-tmp/issues/217): name tests must use tmpName ([@silkentrance](https://github.com/silkentrance))
* [#223](https://github.com/raszi/node-tmp/pull/223) Closes [#214](https://github.com/raszi/node-tmp/issues/214): refactor tests and lib ([@silkentrance](https://github.com/silkentrance))
* [#198](https://github.com/raszi/node-tmp/pull/198) Update dependencies to latest versions ([@matsev](https://github.com/matsev))
#### Committers: 2
- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
- Mattias Severson ([@matsev](https://github.com/matsev))
## v0.1.0 (2019-03-20)
#### :rocket: Enhancement
* [#177](https://github.com/raszi/node-tmp/pull/177) fix: fail early if there is no tmp dir specified ([@silkentrance](https://github.com/silkentrance))
* [#159](https://github.com/raszi/node-tmp/pull/159) Closes [#121](https://github.com/raszi/node-tmp/issues/121) ([@silkentrance](https://github.com/silkentrance))
* [#161](https://github.com/raszi/node-tmp/pull/161) Closes [#155](https://github.com/raszi/node-tmp/issues/155) ([@silkentrance](https://github.com/silkentrance))
* [#166](https://github.com/raszi/node-tmp/pull/166) fix: avoid relying on Nodes internals ([@addaleax](https://github.com/addaleax))
* [#144](https://github.com/raszi/node-tmp/pull/144) prepend opts.dir || tmpDir to template if no path is given ([@silkentrance](https://github.com/silkentrance))
#### :bug: Bug Fix
* [#183](https://github.com/raszi/node-tmp/pull/183) Closes [#182](https://github.com/raszi/node-tmp/issues/182) fileSync takes empty string postfix option ([@gutte](https://github.com/gutte))
* [#130](https://github.com/raszi/node-tmp/pull/130) Closes [#129](https://github.com/raszi/node-tmp/issues/129) install process listeners safely ([@silkentrance](https://github.com/silkentrance))
#### :memo: Documentation
* [#188](https://github.com/raszi/node-tmp/pull/188) HOTCloses [#187](https://github.com/raszi/node-tmp/issues/187): restore behaviour for #182 ([@silkentrance](https://github.com/silkentrance))
* [#180](https://github.com/raszi/node-tmp/pull/180) fix gh-179: template no longer accepts arbitrary paths ([@silkentrance](https://github.com/silkentrance))
* [#175](https://github.com/raszi/node-tmp/pull/175) docs: add `unsafeCleanup` option to jsdoc ([@kerimdzhanov](https://github.com/kerimdzhanov))
* [#151](https://github.com/raszi/node-tmp/pull/151) docs: fix link to tmp-promise ([@silkentrance](https://github.com/silkentrance))
#### :house: Internal
* [#184](https://github.com/raszi/node-tmp/pull/184) test: add missing tests for #182 ([@silkentrance](https://github.com/silkentrance))
* [#171](https://github.com/raszi/node-tmp/pull/171) chore: drop old NodeJS support ([@poppinlp](https://github.com/poppinlp))
* [#170](https://github.com/raszi/node-tmp/pull/170) chore: update dependencies ([@raszi](https://github.com/raszi))
* [#165](https://github.com/raszi/node-tmp/pull/165) test: add missing tests ([@raszi](https://github.com/raszi))
* [#163](https://github.com/raszi/node-tmp/pull/163) chore: add lint npm task ([@raszi](https://github.com/raszi))
* [#107](https://github.com/raszi/node-tmp/pull/107) chore: add coverage report ([@raszi](https://github.com/raszi))
* [#141](https://github.com/raszi/node-tmp/pull/141) test: refactor tests for mocha ([@silkentrance](https://github.com/silkentrance))
* [#154](https://github.com/raszi/node-tmp/pull/154) chore: change Travis configuration ([@raszi](https://github.com/raszi))
* [#152](https://github.com/raszi/node-tmp/pull/152) fix: drop Node v0.6.0 ([@raszi](https://github.com/raszi))
#### Committers: 6
- Anna Henningsen ([@addaleax](https://github.com/addaleax))
- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
- Dan Kerimdzhanov ([@kerimdzhanov](https://github.com/kerimdzhanov))
- Gustav Klingstedt ([@gutte](https://github.com/gutte))
- KARASZI István ([@raszi](https://github.com/raszi))
- PoppinL ([@poppinlp](https://github.com/poppinlp))
## v0.0.33 (2017-08-12)
#### :rocket: Enhancement
* [#147](https://github.com/raszi/node-tmp/pull/147) fix: with name option try at most once to get a unique tmp name ([@silkentrance](https://github.com/silkentrance))
#### :bug: Bug Fix
* [#149](https://github.com/raszi/node-tmp/pull/149) fix(fileSync): must honor detachDescriptor and discardDescriptor options ([@silkentrance](https://github.com/silkentrance))
* [#119](https://github.com/raszi/node-tmp/pull/119) Closes [#115](https://github.com/raszi/node-tmp/issues/115) ([@silkentrance](https://github.com/silkentrance))
#### :memo: Documentation
* [#128](https://github.com/raszi/node-tmp/pull/128) Closes [#127](https://github.com/raszi/node-tmp/issues/127) add reference to tmp-promise ([@silkentrance](https://github.com/silkentrance))
#### :house: Internal
* [#135](https://github.com/raszi/node-tmp/pull/135) Closes [#133](https://github.com/raszi/node-tmp/issues/133), #134 ([@silkentrance](https://github.com/silkentrance))
* [#123](https://github.com/raszi/node-tmp/pull/123) docs: update tmp.js MIT license header to 2017 ([@madnight](https://github.com/madnight))
* [#122](https://github.com/raszi/node-tmp/pull/122) chore: add issue template ([@silkentrance](https://github.com/silkentrance))
#### Committers: 2
- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
- Fabian Beuke ([@madnight](https://github.com/madnight))
## v0.0.32 (2017-03-24)
#### :memo: Documentation
* [#106](https://github.com/raszi/node-tmp/pull/106) doc: add proper JSDoc documentation ([@raszi](https://github.com/raszi))
#### :house: Internal
* [#111](https://github.com/raszi/node-tmp/pull/111) test: add Windows tests ([@binki](https://github.com/binki))
* [#110](https://github.com/raszi/node-tmp/pull/110) chore: add AppVeyor ([@binki](https://github.com/binki))
* [#105](https://github.com/raszi/node-tmp/pull/105) chore: use const where possible ([@raszi](https://github.com/raszi))
* [#104](https://github.com/raszi/node-tmp/pull/104) style: fix various style issues ([@raszi](https://github.com/raszi))
#### Committers: 2
- KARASZI István ([@raszi](https://github.com/raszi))
- Nathan Phillip Brink ([@binki](https://github.com/binki))
## v0.0.31 (2016-11-21)
#### :rocket: Enhancement
* [#99](https://github.com/raszi/node-tmp/pull/99) feat: add next callback functionality ([@silkentrance](https://github.com/silkentrance))
* [#94](https://github.com/raszi/node-tmp/pull/94) feat: add options to control descriptor management ([@pabigot](https://github.com/pabigot))
#### :house: Internal
* [#101](https://github.com/raszi/node-tmp/pull/101) fix: Include files in the package.json ([@raszi](https://github.com/raszi))
#### Committers: 3
- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
- KARASZI István ([@raszi](https://github.com/raszi))
- Peter A. Bigot ([@pabigot](https://github.com/pabigot))
## v0.0.30 (2016-11-01)
#### :bug: Bug Fix
* [#96](https://github.com/raszi/node-tmp/pull/96) fix: constants for Node 6 ([@jnj16180340](https://github.com/jnj16180340))
* [#98](https://github.com/raszi/node-tmp/pull/98) fix: garbage collector ([@Ari-H](https://github.com/Ari-H))
#### Committers: 2
- Nate Johnson ([@jnj16180340](https://github.com/jnj16180340))
- [@Ari-H](https://github.com/Ari-H)
## v0.0.29 (2016-09-18)
#### :rocket: Enhancement
* [#87](https://github.com/raszi/node-tmp/pull/87) fix: replace calls to deprecated fs API functions ([@OlliV](https://github.com/OlliV))
#### :bug: Bug Fix
* [#70](https://github.com/raszi/node-tmp/pull/70) fix: prune `_removeObjects` correctly ([@joliss](https://github.com/joliss))
* [#71](https://github.com/raszi/node-tmp/pull/71) Fix typo ([@gcampax](https://github.com/gcampax))
#### :memo: Documentation
* [#77](https://github.com/raszi/node-tmp/pull/77) docs: change mkstemps to mkstemp ([@thefourtheye](https://github.com/thefourtheye))
#### :house: Internal
* [#92](https://github.com/raszi/node-tmp/pull/92) chore: add Travis CI support for Node 6 ([@amilajack](https://github.com/amilajack))
* [#79](https://github.com/raszi/node-tmp/pull/79) fix: remove unneeded require statement ([@whmountains](https://github.com/whmountains))
#### Committers: 6
- Amila Welihinda ([@amilajack](https://github.com/amilajack))
- Caleb Whiting ([@whmountains](https://github.com/whmountains))
- Giovanni Campagna ([@gcampax](https://github.com/gcampax))
- Jo Liss ([@joliss](https://github.com/joliss))
- Olli Vanhoja ([@OlliV](https://github.com/OlliV))
- Sakthipriyan Vairamani ([@thefourtheye](https://github.com/thefourtheye))
## v0.0.28 (2015-09-27)
#### :bug: Bug Fix
* [#63](https://github.com/raszi/node-tmp/pull/63) fix: delete for _rmdirRecursiveSync ([@voltrevo](https://github.com/voltrevo))
#### :memo: Documentation
* [#64](https://github.com/raszi/node-tmp/pull/64) docs: fix typo in the README ([@JTKnox91](https://github.com/JTKnox91))
#### :house: Internal
* [#67](https://github.com/raszi/node-tmp/pull/67) test: add node v4.0 v4.1 to travis config ([@raszi](https://github.com/raszi))
* [#66](https://github.com/raszi/node-tmp/pull/66) chore(deps): update deps ([@raszi](https://github.com/raszi))
#### Committers: 3
- Andrew Morris ([@voltrevo](https://github.com/voltrevo))
- John T. Knox ([@JTKnox91](https://github.com/JTKnox91))
- KARASZI István ([@raszi](https://github.com/raszi))
## v0.0.27 (2015-08-15)
#### :bug: Bug Fix
* [#60](https://github.com/raszi/node-tmp/pull/60) fix: unlinking when the file has been already removed ([@silkentrance](https://github.com/silkentrance))
#### :memo: Documentation
* [#55](https://github.com/raszi/node-tmp/pull/55) docs(README): update README ([@raszi](https://github.com/raszi))
#### :house: Internal
* [#56](https://github.com/raszi/node-tmp/pull/56) style(jshint): fix JSHint error ([@raszi](https://github.com/raszi))
* [#53](https://github.com/raszi/node-tmp/pull/53) chore: update license attribute ([@pdehaan](https://github.com/pdehaan))
#### Committers: 3
- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
- KARASZI István ([@raszi](https://github.com/raszi))
- Peter deHaan ([@pdehaan](https://github.com/pdehaan))
## v0.0.26 (2015-05-12)
#### :rocket: Enhancement
* [#40](https://github.com/raszi/node-tmp/pull/40) Fix for #39 ([@silkentrance](https://github.com/silkentrance))
* [#42](https://github.com/raszi/node-tmp/pull/42) Fix for #17 ([@silkentrance](https://github.com/silkentrance))
* [#41](https://github.com/raszi/node-tmp/pull/41) Fix for #37 ([@silkentrance](https://github.com/silkentrance))
* [#32](https://github.com/raszi/node-tmp/pull/32) add ability to customize file/dir names ([@shime](https://github.com/shime))
* [#29](https://github.com/raszi/node-tmp/pull/29) tmp.file have responsibility to close file, not only unlink file ([@vhain](https://github.com/vhain))
#### :bug: Bug Fix
* [#51](https://github.com/raszi/node-tmp/pull/51) fix(windows): fix tempDir on windows ([@raszi](https://github.com/raszi))
* [#49](https://github.com/raszi/node-tmp/pull/49) remove object from _removeObjects if cleanup fn is called Closes [#48](https://github.com/raszi/node-tmp/issues/48) ([@bmeck](https://github.com/bmeck))
#### :memo: Documentation
* [#45](https://github.com/raszi/node-tmp/pull/45) Fix for #44 ([@silkentrance](https://github.com/silkentrance))
#### :house: Internal
* [#34](https://github.com/raszi/node-tmp/pull/34) Create LICENSE ([@ScottWeinstein](https://github.com/ScottWeinstein))
#### Committers: 6
- Bradley Farias ([@bmeck](https://github.com/bmeck))
- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
- Hrvoje Šimić ([@shime](https://github.com/shime))
- Juwan Yoo ([@vhain](https://github.com/vhain))
- KARASZI István ([@raszi](https://github.com/raszi))
- Scott Weinstein ([@ScottWeinstein](https://github.com/ScottWeinstein))
## v0.0.24 (2014-07-11)
#### :rocket: Enhancement
* [#25](https://github.com/raszi/node-tmp/pull/25) Added removeCallback passing ([@foxel](https://github.com/foxel))
#### Committers: 1
- Andrey Kupreychik ([@foxel](https://github.com/foxel))
## v0.0.23 (2013-12-03)
#### :rocket: Enhancement
* [#21](https://github.com/raszi/node-tmp/pull/21) If we are not on node 0.8, don't register an uncaughtException handler ([@wibblymat](https://github.com/wibblymat))
#### Committers: 1
- Mat Scales ([@wibblymat](https://github.com/wibblymat))
## v0.0.22 (2013-11-29)
#### :rocket: Enhancement
* [#19](https://github.com/raszi/node-tmp/pull/19) Rethrow only on node v0.8. ([@mcollina](https://github.com/mcollina))
#### Committers: 1
- Matteo Collina ([@mcollina](https://github.com/mcollina))
## v0.0.21 (2013-08-07)
#### :bug: Bug Fix
* [#16](https://github.com/raszi/node-tmp/pull/16) Fix bug where we delete contents of symlinks ([@lightsofapollo](https://github.com/lightsofapollo))
#### Committers: 1
- James Lal ([@lightsofapollo](https://github.com/lightsofapollo))
## v0.0.17 (2013-04-09)
#### :rocket: Enhancement
* [#9](https://github.com/raszi/node-tmp/pull/9) add recursive remove option ([@oscar-broman](https://github.com/oscar-broman))
#### Committers: 1
- [@oscar-broman](https://github.com/oscar-broman)
## v0.0.14 (2012-08-26)
#### :rocket: Enhancement
* [#5](https://github.com/raszi/node-tmp/pull/5) Export _getTmpName for temporary file name creation ([@joscha](https://github.com/joscha))
#### Committers: 1
- Joscha Feth ([@joscha](https://github.com/joscha))
## Previous Releases < v0.0.14
- no information available

95
node_modules/tmp/README.md generated vendored
View File

@@ -29,6 +29,8 @@ standard OS temporary directory, then you are free to override that as well.
## An Important Note on Compatibility ## An Important Note on Compatibility
See the [CHANGELOG](./CHANGELOG.md) for more information.
### Version 0.1.0 ### Version 0.1.0
Since version 0.1.0, all support for node versions < 0.10.0 has been dropped. Since version 0.1.0, all support for node versions < 0.10.0 has been dropped.
@@ -48,15 +50,6 @@ dependency to version 0.0.33.
For node versions < 0.8 you must limit your node-tmp dependency to For node versions < 0.8 you must limit your node-tmp dependency to
versions < 0.0.33. versions < 0.0.33.
### Node Versions < 8.12.0
The SIGINT handler will not work correctly with versions of NodeJS < 8.12.0.
### Windows
Signal handlers for SIGINT will not work. Pressing CTRL-C will leave behind
temporary files and directories.
## How to install ## How to install
```bash ```bash
@@ -72,7 +65,7 @@ Please also check [API docs][4].
Simple temporary file creation, the file will be closed and unlinked on process exit. Simple temporary file creation, the file will be closed and unlinked on process exit.
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
tmp.file(function _tempFileCreated(err, path, fd, cleanupCallback) { tmp.file(function _tempFileCreated(err, path, fd, cleanupCallback) {
if (err) throw err; if (err) throw err;
@@ -92,9 +85,9 @@ tmp.file(function _tempFileCreated(err, path, fd, cleanupCallback) {
A synchronous version of the above. A synchronous version of the above.
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
var tmpobj = tmp.fileSync(); const tmpobj = tmp.fileSync();
console.log('File: ', tmpobj.name); console.log('File: ', tmpobj.name);
console.log('Filedescriptor: ', tmpobj.fd); console.log('Filedescriptor: ', tmpobj.fd);
@@ -115,7 +108,7 @@ Simple temporary directory creation, it will be removed on process exit.
If the directory still contains items on process exit, then it won't be removed. If the directory still contains items on process exit, then it won't be removed.
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
tmp.dir(function _tempDirCreated(err, path, cleanupCallback) { tmp.dir(function _tempDirCreated(err, path, cleanupCallback) {
if (err) throw err; if (err) throw err;
@@ -135,9 +128,9 @@ you can pass the `unsafeCleanup` option when creating it.
A synchronous version of the above. A synchronous version of the above.
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
var tmpobj = tmp.dirSync(); const tmpobj = tmp.dirSync();
console.log('Dir: ', tmpobj.name); console.log('Dir: ', tmpobj.name);
// Manual cleanup // Manual cleanup
tmpobj.removeCallback(); tmpobj.removeCallback();
@@ -153,7 +146,7 @@ It is possible with this library to generate a unique filename in the specified
directory. directory.
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
tmp.tmpName(function _tempNameGenerated(err, path) { tmp.tmpName(function _tempNameGenerated(err, path) {
if (err) throw err; if (err) throw err;
@@ -167,9 +160,9 @@ tmp.tmpName(function _tempNameGenerated(err, path) {
A synchronous version of the above. A synchronous version of the above.
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
var name = tmp.tmpNameSync(); const name = tmp.tmpNameSync();
console.log('Created temporary filename: ', name); console.log('Created temporary filename: ', name);
``` ```
@@ -180,9 +173,9 @@ console.log('Created temporary filename: ', name);
Creates a file with mode `0644`, prefix will be `prefix-` and postfix will be `.txt`. Creates a file with mode `0644`, prefix will be `prefix-` and postfix will be `.txt`.
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
tmp.file({ mode: 0644, prefix: 'prefix-', postfix: '.txt' }, function _tempFileCreated(err, path, fd) { tmp.file({ mode: 0o644, prefix: 'prefix-', postfix: '.txt' }, function _tempFileCreated(err, path, fd) {
if (err) throw err; if (err) throw err;
console.log('File: ', path); console.log('File: ', path);
@@ -195,9 +188,9 @@ tmp.file({ mode: 0644, prefix: 'prefix-', postfix: '.txt' }, function _tempFileC
A synchronous version of the above. A synchronous version of the above.
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
var tmpobj = tmp.fileSync({ mode: 0644, prefix: 'prefix-', postfix: '.txt' }); const tmpobj = tmp.fileSync({ mode: 0o644, prefix: 'prefix-', postfix: '.txt' });
console.log('File: ', tmpobj.name); console.log('File: ', tmpobj.name);
console.log('Filedescriptor: ', tmpobj.fd); console.log('Filedescriptor: ', tmpobj.fd);
``` ```
@@ -219,7 +212,7 @@ descriptor. Two options control how the descriptor is managed:
longer needed. longer needed.
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
tmp.file({ discardDescriptor: true }, function _tempFileCreated(err, path, fd, cleanupCallback) { tmp.file({ discardDescriptor: true }, function _tempFileCreated(err, path, fd, cleanupCallback) {
if (err) throw err; if (err) throw err;
@@ -229,7 +222,7 @@ tmp.file({ discardDescriptor: true }, function _tempFileCreated(err, path, fd, c
``` ```
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
tmp.file({ detachDescriptor: true }, function _tempFileCreated(err, path, fd, cleanupCallback) { tmp.file({ detachDescriptor: true }, function _tempFileCreated(err, path, fd, cleanupCallback) {
if (err) throw err; if (err) throw err;
@@ -246,9 +239,9 @@ tmp.file({ detachDescriptor: true }, function _tempFileCreated(err, path, fd, cl
Creates a directory with mode `0755`, prefix will be `myTmpDir_`. Creates a directory with mode `0755`, prefix will be `myTmpDir_`.
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
tmp.dir({ mode: 0750, prefix: 'myTmpDir_' }, function _tempDirCreated(err, path) { tmp.dir({ mode: 0o750, prefix: 'myTmpDir_' }, function _tempDirCreated(err, path) {
if (err) throw err; if (err) throw err;
console.log('Dir: ', path); console.log('Dir: ', path);
@@ -260,9 +253,9 @@ tmp.dir({ mode: 0750, prefix: 'myTmpDir_' }, function _tempDirCreated(err, path)
Again, a synchronous version of the above. Again, a synchronous version of the above.
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
var tmpobj = tmp.dirSync({ mode: 0750, prefix: 'myTmpDir_' }); const tmpobj = tmp.dirSync({ mode: 0750, prefix: 'myTmpDir_' });
console.log('Dir: ', tmpobj.name); console.log('Dir: ', tmpobj.name);
``` ```
@@ -275,7 +268,7 @@ require tmp to create your temporary filesystem object in a different place than
default `tmp.tmpdir`. default `tmp.tmpdir`.
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
tmp.dir({ template: 'tmp-XXXXXX' }, function _tempDirCreated(err, path) { tmp.dir({ template: 'tmp-XXXXXX' }, function _tempDirCreated(err, path) {
if (err) throw err; if (err) throw err;
@@ -289,9 +282,9 @@ tmp.dir({ template: 'tmp-XXXXXX' }, function _tempDirCreated(err, path) {
This will behave similarly to the asynchronous version. This will behave similarly to the asynchronous version.
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
var tmpobj = tmp.dirSync({ template: 'tmp-XXXXXX' }); const tmpobj = tmp.dirSync({ template: 'tmp-XXXXXX' });
console.log('Dir: ', tmpobj.name); console.log('Dir: ', tmpobj.name);
``` ```
@@ -303,9 +296,9 @@ The function accepts all standard options, e.g. `prefix`, `postfix`, `dir`, and
You can also leave out the options altogether and just call the function with a callback as first parameter. You can also leave out the options altogether and just call the function with a callback as first parameter.
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
var options = {}; const options = {};
tmp.tmpName(options, function _tempNameGenerated(err, path) { tmp.tmpName(options, function _tempNameGenerated(err, path) {
if (err) throw err; if (err) throw err;
@@ -320,19 +313,22 @@ The `tmpNameSync()` function works similarly to `tmpName()`.
Again, you can leave out the options altogether and just invoke the function without any parameters. Again, you can leave out the options altogether and just invoke the function without any parameters.
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
var options = {}; const options = {};
var tmpname = tmp.tmpNameSync(options); const tmpname = tmp.tmpNameSync(options);
console.log('Created temporary filename: ', tmpname); console.log('Created temporary filename: ', tmpname);
``` ```
## Graceful cleanup ## Graceful cleanup
One may want to cleanup the temporary files even when an uncaught exception If graceful cleanup is set, tmp will remove all controlled temporary objects on process exit, otherwise the
occurs. To enforce this, you can call the `setGracefulCleanup()` method: temporary objects will remain in place, waiting to be cleaned up on system restart or otherwise scheduled temporary
object removal.
To enforce this, you can call the `setGracefulCleanup()` method:
```javascript ```javascript
var tmp = require('tmp'); const tmp = require('tmp');
tmp.setGracefulCleanup(); tmp.setGracefulCleanup();
``` ```
@@ -341,15 +337,26 @@ tmp.setGracefulCleanup();
All options are optional :) All options are optional :)
* `mode`: the file mode to create with, it fallbacks to `0600` on file creation and `0700` on directory creation * `name`: a fixed name that overrides random name generation, the name must be relative and must not contain path segments
* `prefix`: the optional prefix, fallbacks to `tmp-` if not provided * `mode`: the file mode to create with, falls back to `0o600` on file creation and `0o700` on directory creation
* `postfix`: the optional postfix, fallbacks to `.tmp` on file creation * `prefix`: the optional prefix, defaults to `tmp`
* `template`: [`mkstemp`][3] like filename template, no default * `postfix`: the optional postfix
* `dir`: the optional temporary directory, fallbacks to system default (guesses from environment) * `template`: [`mkstemp`][3] like filename template, no default, can be either an absolute or a relative path that resolves
to a relative path of the system's default temporary directory, must include `XXXXXX` once for random name generation, e.g.
'foo/bar/XXXXXX'. Absolute paths are also fine as long as they are relative to os.tmpdir().
Any directories along the so specified path must exist, otherwise a ENOENT error will be thrown upon access,
as tmp will not check the availability of the path, nor will it establish the requested path for you.
* `dir`: the optional temporary directory that must be relative to the system's default temporary directory.
absolute paths are fine as long as they point to a location under the system's default temporary directory.
Any directories along the so specified path must exist, otherwise a ENOENT error will be thrown upon access,
as tmp will not check the availability of the path, nor will it establish the requested path for you.
* `tmpdir`: allows you to override the system's root tmp directory
* `tries`: how many times should the function try to get a unique filename before giving up, default `3` * `tries`: how many times should the function try to get a unique filename before giving up, default `3`
* `keep`: signals that the temporary file or directory should not be deleted on exit, default is `false` * `keep`: signals that the temporary file or directory should not be deleted on exit, default is `false`
* In order to clean up, you will have to call the provided `cleanupCallback` function manually. * In order to clean up, you will have to call the provided `cleanupCallback` function manually.
* `unsafeCleanup`: recursively removes the created temporary directory, even when it's not empty. default is `false` * `unsafeCleanup`: recursively removes the created temporary directory, even when it's not empty. default is `false`
* `detachDescriptor`: detaches the file descriptor, caller is responsible for closing the file, tmp will no longer try closing the file during garbage collection
* `discardDescriptor`: discards the file descriptor (closes file, fd is -1), tmp will no longer try closing the file during garbage collection
[1]: http://nodejs.org/ [1]: http://nodejs.org/
[2]: https://www.npmjs.com/browse/depended/tmp [2]: https://www.npmjs.com/browse/depended/tmp

730
node_modules/tmp/lib/tmp.js generated vendored
View File

@@ -13,9 +13,7 @@ const fs = require('fs');
const os = require('os'); const os = require('os');
const path = require('path'); const path = require('path');
const crypto = require('crypto'); const crypto = require('crypto');
const _c = fs.constants && os.constants ? const _c = { fs: fs.constants, os: os.constants };
{ fs: fs.constants, os: os.constants } :
process.binding('constants');
const rimraf = require('rimraf'); const rimraf = require('rimraf');
/* /*
@@ -31,128 +29,26 @@ const
CREATE_FLAGS = (_c.O_CREAT || _c.fs.O_CREAT) | (_c.O_EXCL || _c.fs.O_EXCL) | (_c.O_RDWR || _c.fs.O_RDWR), CREATE_FLAGS = (_c.O_CREAT || _c.fs.O_CREAT) | (_c.O_EXCL || _c.fs.O_EXCL) | (_c.O_RDWR || _c.fs.O_RDWR),
// constants are off on the windows platform and will not match the actual errno codes
IS_WIN32 = os.platform() === 'win32',
EBADF = _c.EBADF || _c.os.errno.EBADF, EBADF = _c.EBADF || _c.os.errno.EBADF,
ENOENT = _c.ENOENT || _c.os.errno.ENOENT, ENOENT = _c.ENOENT || _c.os.errno.ENOENT,
DIR_MODE = 448 /* 0o700 */, DIR_MODE = 0o700 /* 448 */,
FILE_MODE = 384 /* 0o600 */, FILE_MODE = 0o600 /* 384 */,
EXIT = 'exit', EXIT = 'exit',
SIGINT = 'SIGINT',
// this will hold the objects need to be removed on exit // this will hold the objects need to be removed on exit
_removeObjects = []; _removeObjects = [],
var // API change in fs.rmdirSync leads to error when passing in a second parameter, e.g. the callback
FN_RMDIR_SYNC = fs.rmdirSync.bind(fs),
FN_RIMRAF_SYNC = rimraf.sync;
let
_gracefulCleanup = false; _gracefulCleanup = false;
/**
* Random name generator based on crypto.
* Adapted from http://blog.tompawlak.org/how-to-generate-random-values-nodejs-javascript
*
* @param {number} howMany
* @returns {string} the generated random name
* @private
*/
function _randomChars(howMany) {
var
value = [],
rnd = null;
// make sure that we do not fail because we ran out of entropy
try {
rnd = crypto.randomBytes(howMany);
} catch (e) {
rnd = crypto.pseudoRandomBytes(howMany);
}
for (var i = 0; i < howMany; i++) {
value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]);
}
return value.join('');
}
/**
* Checks whether the `obj` parameter is defined or not.
*
* @param {Object} obj
* @returns {boolean} true if the object is undefined
* @private
*/
function _isUndefined(obj) {
return typeof obj === 'undefined';
}
/**
* Parses the function arguments.
*
* This function helps to have optional arguments.
*
* @param {(Options|Function)} options
* @param {Function} callback
* @returns {Array} parsed arguments
* @private
*/
function _parseArguments(options, callback) {
/* istanbul ignore else */
if (typeof options === 'function') {
return [{}, options];
}
/* istanbul ignore else */
if (_isUndefined(options)) {
return [{}, callback];
}
return [options, callback];
}
/**
* Generates a new temporary name.
*
* @param {Object} opts
* @returns {string} the new random name according to opts
* @private
*/
function _generateTmpName(opts) {
const tmpDir = _getTmpDir();
// fail early on missing tmp dir
if (isBlank(opts.dir) && isBlank(tmpDir)) {
throw new Error('No tmp dir specified');
}
/* istanbul ignore else */
if (!isBlank(opts.name)) {
return path.join(opts.dir || tmpDir, opts.name);
}
// mkstemps like template
// opts.template has already been guarded in tmpName() below
/* istanbul ignore else */
if (opts.template) {
var template = opts.template;
// make sure that we prepend the tmp path if none was given
/* istanbul ignore else */
if (path.basename(template) === template)
template = path.join(opts.dir || tmpDir, template);
return template.replace(TEMPLATE_PATTERN, _randomChars(6));
}
// prefix and postfix
const name = [
(isBlank(opts.prefix) ? 'tmp-' : opts.prefix),
process.pid,
_randomChars(12),
(opts.postfix ? opts.postfix : '')
].join('');
return path.join(opts.dir || tmpDir, name);
}
/** /**
* Gets a temporary file name. * Gets a temporary file name.
* *
@@ -160,20 +56,18 @@ function _generateTmpName(opts) {
* @param {?tmpNameCallback} callback the callback function * @param {?tmpNameCallback} callback the callback function
*/ */
function tmpName(options, callback) { function tmpName(options, callback) {
var const
args = _parseArguments(options, callback), args = _parseArguments(options, callback),
opts = args[0], opts = args[0],
cb = args[1], cb = args[1];
tries = !isBlank(opts.name) ? 1 : opts.tries || DEFAULT_TRIES;
/* istanbul ignore else */ try {
if (isNaN(tries) || tries < 0) _assertAndSanitizeOptions(opts);
return cb(new Error('Invalid tries')); } catch (err) {
return cb(err);
/* istanbul ignore else */ }
if (opts.template && !opts.template.match(TEMPLATE_PATTERN))
return cb(new Error('Invalid template provided'));
let tries = opts.tries;
(function _getUniqueName() { (function _getUniqueName() {
try { try {
const name = _generateTmpName(opts); const name = _generateTmpName(opts);
@@ -204,19 +98,13 @@ function tmpName(options, callback) {
* @throws {Error} if the options are invalid or could not generate a filename * @throws {Error} if the options are invalid or could not generate a filename
*/ */
function tmpNameSync(options) { function tmpNameSync(options) {
var const
args = _parseArguments(options), args = _parseArguments(options),
opts = args[0], opts = args[0];
tries = !isBlank(opts.name) ? 1 : opts.tries || DEFAULT_TRIES;
/* istanbul ignore else */ _assertAndSanitizeOptions(opts);
if (isNaN(tries) || tries < 0)
throw new Error('Invalid tries');
/* istanbul ignore else */
if (opts.template && !opts.template.match(TEMPLATE_PATTERN))
throw new Error('Invalid template provided');
let tries = opts.tries;
do { do {
const name = _generateTmpName(opts); const name = _generateTmpName(opts);
try { try {
@@ -232,11 +120,11 @@ function tmpNameSync(options) {
/** /**
* Creates and opens a temporary file. * Creates and opens a temporary file.
* *
* @param {(Options|fileCallback)} options the config options or the callback function * @param {(Options|null|undefined|fileCallback)} options the config options or the callback function or null or undefined
* @param {?fileCallback} callback * @param {?fileCallback} callback
*/ */
function file(options, callback) { function file(options, callback) {
var const
args = _parseArguments(options, callback), args = _parseArguments(options, callback),
opts = args[0], opts = args[0],
cb = args[1]; cb = args[1];
@@ -248,34 +136,20 @@ function file(options, callback) {
// create and open the file // create and open the file
fs.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err, fd) { fs.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err, fd) {
/* istanbul ignore else */ /* istanbu ignore else */
if (err) return cb(err); if (err) return cb(err);
if (opts.discardDescriptor) { if (opts.discardDescriptor) {
return fs.close(fd, function _discardCallback(err) { return fs.close(fd, function _discardCallback(possibleErr) {
/* istanbul ignore else */ // the chance of getting an error on close here is rather low and might occur in the most edgiest cases only
if (err) { return cb(possibleErr, name, undefined, _prepareTmpFileRemoveCallback(name, -1, opts, false));
// Low probability, and the file exists, so this could be
// ignored. If it isn't we certainly need to unlink the
// file, and if that fails too its error is more
// important.
try {
fs.unlinkSync(name);
} catch (e) {
if (!isENOENT(e)) {
err = e;
}
}
return cb(err);
}
cb(null, name, undefined, _prepareTmpFileRemoveCallback(name, -1, opts));
}); });
} else {
// detachDescriptor passes the descriptor whereas discardDescriptor closes it, either way, we no longer care
// about the descriptor
const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;
cb(null, name, fd, _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts, false));
} }
/* istanbul ignore else */
if (opts.detachDescriptor) {
return cb(null, name, fd, _prepareTmpFileRemoveCallback(name, -1, opts));
}
cb(null, name, fd, _prepareTmpFileRemoveCallback(name, fd, opts));
}); });
}); });
} }
@@ -288,7 +162,7 @@ function file(options, callback) {
* @throws {Error} if cannot create a file * @throws {Error} if cannot create a file
*/ */
function fileSync(options) { function fileSync(options) {
var const
args = _parseArguments(options), args = _parseArguments(options),
opts = args[0]; opts = args[0];
@@ -304,7 +178,7 @@ function fileSync(options) {
return { return {
name: name, name: name,
fd: fd, fd: fd,
removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts) removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts, true)
}; };
} }
@@ -315,7 +189,7 @@ function fileSync(options) {
* @param {?dirCallback} callback * @param {?dirCallback} callback
*/ */
function dir(options, callback) { function dir(options, callback) {
var const
args = _parseArguments(options, callback), args = _parseArguments(options, callback),
opts = args[0], opts = args[0],
cb = args[1]; cb = args[1];
@@ -330,7 +204,7 @@ function dir(options, callback) {
/* istanbul ignore else */ /* istanbul ignore else */
if (err) return cb(err); if (err) return cb(err);
cb(null, name, _prepareTmpDirRemoveCallback(name, opts)); cb(null, name, _prepareTmpDirRemoveCallback(name, opts, false));
}); });
}); });
} }
@@ -343,7 +217,7 @@ function dir(options, callback) {
* @throws {Error} if it cannot create a directory * @throws {Error} if it cannot create a directory
*/ */
function dirSync(options) { function dirSync(options) {
var const
args = _parseArguments(options), args = _parseArguments(options),
opts = args[0]; opts = args[0];
@@ -352,7 +226,7 @@ function dirSync(options) {
return { return {
name: name, name: name,
removeCallback: _prepareTmpDirRemoveCallback(name, opts) removeCallback: _prepareTmpDirRemoveCallback(name, opts, true)
}; };
} }
@@ -365,15 +239,15 @@ function dirSync(options) {
*/ */
function _removeFileAsync(fdPath, next) { function _removeFileAsync(fdPath, next) {
const _handler = function (err) { const _handler = function (err) {
if (err && !isENOENT(err)) { if (err && !_isENOENT(err)) {
// reraise any unanticipated error // reraise any unanticipated error
return next(err); return next(err);
} }
next(); next();
} };
if (0 <= fdPath[0]) if (0 <= fdPath[0])
fs.close(fdPath[0], function (err) { fs.close(fdPath[0], function () {
fs.unlink(fdPath[1], _handler); fs.unlink(fdPath[1], _handler);
}); });
else fs.unlink(fdPath[1], _handler); else fs.unlink(fdPath[1], _handler);
@@ -386,117 +260,104 @@ function _removeFileAsync(fdPath, next) {
* @private * @private
*/ */
function _removeFileSync(fdPath) { function _removeFileSync(fdPath) {
let rethrownException = null;
try { try {
if (0 <= fdPath[0]) fs.closeSync(fdPath[0]); if (0 <= fdPath[0]) fs.closeSync(fdPath[0]);
} catch (e) { } catch (e) {
// reraise any unanticipated error // reraise any unanticipated error
if (!isEBADF(e) && !isENOENT(e)) throw e; if (!_isEBADF(e) && !_isENOENT(e)) throw e;
} finally { } finally {
try { try {
fs.unlinkSync(fdPath[1]); fs.unlinkSync(fdPath[1]);
} }
catch (e) { catch (e) {
// reraise any unanticipated error // reraise any unanticipated error
if (!isENOENT(e)) throw e; if (!_isENOENT(e)) rethrownException = e;
} }
} }
if (rethrownException !== null) {
throw rethrownException;
}
} }
/** /**
* Prepares the callback for removal of the temporary file. * Prepares the callback for removal of the temporary file.
* *
* Returns either a sync callback or a async callback depending on whether
* fileSync or file was called, which is expressed by the sync parameter.
*
* @param {string} name the path of the file * @param {string} name the path of the file
* @param {number} fd file descriptor * @param {number} fd file descriptor
* @param {Object} opts * @param {Object} opts
* @returns {fileCallback} * @param {boolean} sync
* @returns {fileCallback | fileCallbackSync}
* @private * @private
*/ */
function _prepareTmpFileRemoveCallback(name, fd, opts) { function _prepareTmpFileRemoveCallback(name, fd, opts, sync) {
const removeCallbackSync = _prepareRemoveCallback(_removeFileSync, [fd, name]); const removeCallbackSync = _prepareRemoveCallback(_removeFileSync, [fd, name], sync);
const removeCallback = _prepareRemoveCallback(_removeFileAsync, [fd, name], removeCallbackSync); const removeCallback = _prepareRemoveCallback(_removeFileAsync, [fd, name], sync, removeCallbackSync);
if (!opts.keep) _removeObjects.unshift(removeCallbackSync); if (!opts.keep) _removeObjects.unshift(removeCallbackSync);
return removeCallback; return sync ? removeCallbackSync : removeCallback;
}
/**
* Simple wrapper for rimraf.
*
* @param {string} dirPath
* @param {Function} next
* @private
*/
function _rimrafRemoveDirWrapper(dirPath, next) {
rimraf(dirPath, next);
}
/**
* Simple wrapper for rimraf.sync.
*
* @param {string} dirPath
* @private
*/
function _rimrafRemoveDirSyncWrapper(dirPath, next) {
try {
return next(null, rimraf.sync(dirPath));
} catch (err) {
return next(err);
}
} }
/** /**
* Prepares the callback for removal of the temporary directory. * Prepares the callback for removal of the temporary directory.
* *
* Returns either a sync callback or a async callback depending on whether
* tmpFileSync or tmpFile was called, which is expressed by the sync parameter.
*
* @param {string} name * @param {string} name
* @param {Object} opts * @param {Object} opts
* @param {boolean} sync
* @returns {Function} the callback * @returns {Function} the callback
* @private * @private
*/ */
function _prepareTmpDirRemoveCallback(name, opts) { function _prepareTmpDirRemoveCallback(name, opts, sync) {
const removeFunction = opts.unsafeCleanup ? _rimrafRemoveDirWrapper : fs.rmdir.bind(fs); const removeFunction = opts.unsafeCleanup ? rimraf : fs.rmdir.bind(fs);
const removeFunctionSync = opts.unsafeCleanup ? _rimrafRemoveDirSyncWrapper : fs.rmdirSync.bind(fs); const removeFunctionSync = opts.unsafeCleanup ? FN_RIMRAF_SYNC : FN_RMDIR_SYNC;
const removeCallbackSync = _prepareRemoveCallback(removeFunctionSync, name); const removeCallbackSync = _prepareRemoveCallback(removeFunctionSync, name, sync);
const removeCallback = _prepareRemoveCallback(removeFunction, name, removeCallbackSync); const removeCallback = _prepareRemoveCallback(removeFunction, name, sync, removeCallbackSync);
if (!opts.keep) _removeObjects.unshift(removeCallbackSync); if (!opts.keep) _removeObjects.unshift(removeCallbackSync);
return removeCallback; return sync ? removeCallbackSync : removeCallback;
} }
/** /**
* Creates a guarded function wrapping the removeFunction call. * Creates a guarded function wrapping the removeFunction call.
* *
* The cleanup callback is save to be called multiple times.
* Subsequent invocations will be ignored.
*
* @param {Function} removeFunction * @param {Function} removeFunction
* @param {Object} arg * @param {string} fileOrDirName
* @returns {Function} * @param {boolean} sync
* @param {cleanupCallbackSync?} cleanupCallbackSync
* @returns {cleanupCallback | cleanupCallbackSync}
* @private * @private
*/ */
function _prepareRemoveCallback(removeFunction, arg, cleanupCallbackSync) { function _prepareRemoveCallback(removeFunction, fileOrDirName, sync, cleanupCallbackSync) {
var called = false; let called = false;
// if sync is true, the next parameter will be ignored
return function _cleanupCallback(next) { return function _cleanupCallback(next) {
next = next || function () {};
/* istanbul ignore else */
if (!called) { if (!called) {
// remove cleanupCallback from cache
const toRemove = cleanupCallbackSync || _cleanupCallback; const toRemove = cleanupCallbackSync || _cleanupCallback;
const index = _removeObjects.indexOf(toRemove); const index = _removeObjects.indexOf(toRemove);
/* istanbul ignore else */ /* istanbul ignore else */
if (index >= 0) _removeObjects.splice(index, 1); if (index >= 0) _removeObjects.splice(index, 1);
called = true; called = true;
// sync? if (sync || removeFunction === FN_RMDIR_SYNC || removeFunction === FN_RIMRAF_SYNC) {
if (removeFunction.length === 1) { return removeFunction(fileOrDirName);
try { } else {
removeFunction(arg); return removeFunction(fileOrDirName, next || function() {});
return next(null);
} }
catch (err) {
// if no next is provided and since we are
// in silent cleanup mode on process exit,
// we will ignore the error
return next(err);
} }
} else return removeFunction(arg, next);
} else return next(new Error('cleanup callback has already been called'));
}; };
} }
@@ -521,41 +382,30 @@ function _garbageCollector() {
} }
/** /**
* Helper for testing against EBADF to compensate changes made to Node 7.x under Windows. * Random name generator based on crypto.
* Adapted from http://blog.tompawlak.org/how-to-generate-random-values-nodejs-javascript
*
* @param {number} howMany
* @returns {string} the generated random name
* @private
*/ */
function isEBADF(error) { function _randomChars(howMany) {
return isExpectedError(error, -EBADF, 'EBADF'); let
} value = [],
rnd = null;
/** // make sure that we do not fail because we ran out of entropy
* Helper for testing against ENOENT to compensate changes made to Node 7.x under Windows. try {
*/ rnd = crypto.randomBytes(howMany);
function isENOENT(error) { } catch (e) {
return isExpectedError(error, -ENOENT, 'ENOENT'); rnd = crypto.pseudoRandomBytes(howMany);
} }
/** for (var i = 0; i < howMany; i++) {
* Helper to determine whether the expected error code matches the actual code and errno, value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]);
* which will differ between the supported node versions. }
*
* - Node >= 7.0: return value.join('');
* error.code {string}
* error.errno {string|number} any numerical value will be negated
*
* - Node >= 6.0 < 7.0:
* error.code {string}
* error.errno {number} negated
*
* - Node >= 4.0 < 6.0: introduces SystemError
* error.code {string}
* error.errno {number} negated
*
* - Node >= 0.10 < 4.0:
* error.code {number} negated
* error.errno n/a
*/
function isExpectedError(error, code, errno) {
return error.code === code || error.code === errno;
} }
/** /**
@@ -565,12 +415,241 @@ function isExpectedError(error, code, errno) {
* @param {string} s * @param {string} s
* @returns {Boolean} true whether the string s is blank, false otherwise * @returns {Boolean} true whether the string s is blank, false otherwise
*/ */
function isBlank(s) { function _isBlank(s) {
return s === null || s === undefined || !s.trim(); return s === null || _isUndefined(s) || !s.trim();
}
/**
* Checks whether the `obj` parameter is defined or not.
*
* @param {Object} obj
* @returns {boolean} true if the object is undefined
* @private
*/
function _isUndefined(obj) {
return typeof obj === 'undefined';
}
/**
* Parses the function arguments.
*
* This function helps to have optional arguments.
*
* @param {(Options|null|undefined|Function)} options
* @param {?Function} callback
* @returns {Array} parsed arguments
* @private
*/
function _parseArguments(options, callback) {
/* istanbul ignore else */
if (typeof options === 'function') {
return [{}, options];
}
/* istanbul ignore else */
if (_isUndefined(options)) {
return [{}, callback];
}
// copy options so we do not leak the changes we make internally
const actualOptions = {};
for (const key of Object.getOwnPropertyNames(options)) {
actualOptions[key] = options[key];
}
return [actualOptions, callback];
}
/**
* Generates a new temporary name.
*
* @param {Object} opts
* @returns {string} the new random name according to opts
* @private
*/
function _generateTmpName(opts) {
const tmpDir = opts.tmpdir;
/* istanbul ignore else */
if (!_isUndefined(opts.name))
return path.join(tmpDir, opts.dir, opts.name);
/* istanbul ignore else */
if (!_isUndefined(opts.template))
return path.join(tmpDir, opts.dir, opts.template).replace(TEMPLATE_PATTERN, _randomChars(6));
// prefix and postfix
const name = [
opts.prefix ? opts.prefix : 'tmp',
'-',
process.pid,
'-',
_randomChars(12),
opts.postfix ? '-' + opts.postfix : ''
].join('');
return path.join(tmpDir, opts.dir, name);
}
/**
* Asserts whether the specified options are valid, also sanitizes options and provides sane defaults for missing
* options.
*
* @param {Options} options
* @private
*/
function _assertAndSanitizeOptions(options) {
options.tmpdir = _getTmpDir(options);
const tmpDir = options.tmpdir;
/* istanbul ignore else */
if (!_isUndefined(options.name))
_assertIsRelative(options.name, 'name', tmpDir);
/* istanbul ignore else */
if (!_isUndefined(options.dir))
_assertIsRelative(options.dir, 'dir', tmpDir);
/* istanbul ignore else */
if (!_isUndefined(options.template)) {
_assertIsRelative(options.template, 'template', tmpDir);
if (!options.template.match(TEMPLATE_PATTERN))
throw new Error(`Invalid template, found "${options.template}".`);
}
/* istanbul ignore else */
if (!_isUndefined(options.tries) && isNaN(options.tries) || options.tries < 0)
throw new Error(`Invalid tries, found "${options.tries}".`);
// if a name was specified we will try once
options.tries = _isUndefined(options.name) ? options.tries || DEFAULT_TRIES : 1;
options.keep = !!options.keep;
options.detachDescriptor = !!options.detachDescriptor;
options.discardDescriptor = !!options.discardDescriptor;
options.unsafeCleanup = !!options.unsafeCleanup;
// sanitize dir, also keep (multiple) blanks if the user, purportedly sane, requests us to
options.dir = _isUndefined(options.dir) ? '' : path.relative(tmpDir, _resolvePath(options.dir, tmpDir));
options.template = _isUndefined(options.template) ? undefined : path.relative(tmpDir, _resolvePath(options.template, tmpDir));
// sanitize further if template is relative to options.dir
options.template = _isBlank(options.template) ? undefined : path.relative(options.dir, options.template);
// for completeness' sake only, also keep (multiple) blanks if the user, purportedly sane, requests us to
options.name = _isUndefined(options.name) ? undefined : _sanitizeName(options.name);
options.prefix = _isUndefined(options.prefix) ? '' : options.prefix;
options.postfix = _isUndefined(options.postfix) ? '' : options.postfix;
}
/**
* Resolve the specified path name in respect to tmpDir.
*
* The specified name might include relative path components, e.g. ../
* so we need to resolve in order to be sure that is is located inside tmpDir
*
* @param name
* @param tmpDir
* @returns {string}
* @private
*/
function _resolvePath(name, tmpDir) {
const sanitizedName = _sanitizeName(name);
if (sanitizedName.startsWith(tmpDir)) {
return path.resolve(sanitizedName);
} else {
return path.resolve(path.join(tmpDir, sanitizedName));
}
}
/**
* Sanitize the specified path name by removing all quote characters.
*
* @param name
* @returns {string}
* @private
*/
function _sanitizeName(name) {
if (_isBlank(name)) {
return name;
}
return name.replace(/["']/g, '');
}
/**
* Asserts whether specified name is relative to the specified tmpDir.
*
* @param {string} name
* @param {string} option
* @param {string} tmpDir
* @throws {Error}
* @private
*/
function _assertIsRelative(name, option, tmpDir) {
if (option === 'name') {
// assert that name is not absolute and does not contain a path
if (path.isAbsolute(name))
throw new Error(`${option} option must not contain an absolute path, found "${name}".`);
// must not fail on valid .<name> or ..<name> or similar such constructs
let basename = path.basename(name);
if (basename === '..' || basename === '.' || basename !== name)
throw new Error(`${option} option must not contain a path, found "${name}".`);
}
else { // if (option === 'dir' || option === 'template') {
// assert that dir or template are relative to tmpDir
if (path.isAbsolute(name) && !name.startsWith(tmpDir)) {
throw new Error(`${option} option must be relative to "${tmpDir}", found "${name}".`);
}
let resolvedPath = _resolvePath(name, tmpDir);
if (!resolvedPath.startsWith(tmpDir))
throw new Error(`${option} option must be relative to "${tmpDir}", found "${resolvedPath}".`);
}
}
/**
* Helper for testing against EBADF to compensate changes made to Node 7.x under Windows.
*
* @private
*/
function _isEBADF(error) {
return _isExpectedError(error, -EBADF, 'EBADF');
}
/**
* Helper for testing against ENOENT to compensate changes made to Node 7.x under Windows.
*
* @private
*/
function _isENOENT(error) {
return _isExpectedError(error, -ENOENT, 'ENOENT');
}
/**
* Helper to determine whether the expected error code matches the actual code and errno,
* which will differ between the supported node versions.
*
* - Node >= 7.0:
* error.code {string}
* error.errno {number} any numerical value will be negated
*
* CAVEAT
*
* On windows, the errno for EBADF is -4083 but os.constants.errno.EBADF is different and we must assume that ENOENT
* is no different here.
*
* @param {SystemError} error
* @param {number} errno
* @param {string} code
* @private
*/
function _isExpectedError(error, errno, code) {
return IS_WIN32 ? error.code === code : error.code === code && error.errno === errno;
} }
/** /**
* Sets the graceful cleanup. * Sets the graceful cleanup.
*
* If graceful cleanup is set, tmp will remove all controlled temporary objects on process exit, otherwise the
* temporary objects will remain in place, waiting to be cleaned up on system restart or otherwise scheduled temporary
* object removals.
*/ */
function setGracefulCleanup() { function setGracefulCleanup() {
_gracefulCleanup = true; _gracefulCleanup = true;
@@ -580,120 +659,38 @@ function setGracefulCleanup() {
* Returns the currently configured tmp dir from os.tmpdir(). * Returns the currently configured tmp dir from os.tmpdir().
* *
* @private * @private
* @param {?Options} options
* @returns {string} the currently configured tmp dir * @returns {string} the currently configured tmp dir
*/ */
function _getTmpDir() { function _getTmpDir(options) {
return os.tmpdir(); return path.resolve(_sanitizeName(options && options.tmpdir || os.tmpdir()));
} }
/** // Install process exit listener
* If there are multiple different versions of tmp in place, make sure that process.addListener(EXIT, _garbageCollector);
* we recognize the old listeners.
*
* @param {Function} listener
* @private
* @returns {Boolean} true whether listener is a legacy listener
*/
function _is_legacy_listener(listener) {
return (listener.name === '_exit' || listener.name === '_uncaughtExceptionThrown')
&& listener.toString().indexOf('_garbageCollector();') > -1;
}
/**
* Safely install SIGINT listener.
*
* NOTE: this will only work on OSX and Linux.
*
* @private
*/
function _safely_install_sigint_listener() {
const listeners = process.listeners(SIGINT);
const existingListeners = [];
for (let i = 0, length = listeners.length; i < length; i++) {
const lstnr = listeners[i];
/* istanbul ignore else */
if (lstnr.name === '_tmp$sigint_listener') {
existingListeners.push(lstnr);
process.removeListener(SIGINT, lstnr);
}
}
process.on(SIGINT, function _tmp$sigint_listener(doExit) {
for (let i = 0, length = existingListeners.length; i < length; i++) {
// let the existing listener do the garbage collection (e.g. jest sandbox)
try {
existingListeners[i](false);
} catch (err) {
// ignore
}
}
try {
// force the garbage collector even it is called again in the exit listener
_garbageCollector();
} finally {
if (!!doExit) {
process.exit(0);
}
}
});
}
/**
* Safely install process exit listener.
*
* @private
*/
function _safely_install_exit_listener() {
const listeners = process.listeners(EXIT);
// collect any existing listeners
const existingListeners = [];
for (let i = 0, length = listeners.length; i < length; i++) {
const lstnr = listeners[i];
/* istanbul ignore else */
// TODO: remove support for legacy listeners once release 1.0.0 is out
if (lstnr.name === '_tmp$safe_listener' || _is_legacy_listener(lstnr)) {
// we must forget about the uncaughtException listener, hopefully it is ours
if (lstnr.name !== '_uncaughtExceptionThrown') {
existingListeners.push(lstnr);
}
process.removeListener(EXIT, lstnr);
}
}
// TODO: what was the data parameter good for?
process.addListener(EXIT, function _tmp$safe_listener(data) {
for (let i = 0, length = existingListeners.length; i < length; i++) {
// let the existing listener do the garbage collection (e.g. jest sandbox)
try {
existingListeners[i](data);
} catch (err) {
// ignore
}
}
_garbageCollector();
});
}
_safely_install_exit_listener();
_safely_install_sigint_listener();
/** /**
* Configuration options. * Configuration options.
* *
* @typedef {Object} Options * @typedef {Object} Options
* @property {?boolean} keep the temporary object (file or dir) will not be garbage collected
* @property {?number} tries the number of tries before give up the name generation * @property {?number} tries the number of tries before give up the name generation
* @property (?int) mode the access mode, defaults are 0o700 for directories and 0o600 for files
* @property {?string} template the "mkstemp" like filename template * @property {?string} template the "mkstemp" like filename template
* @property {?string} name fix name * @property {?string} name fixed name relative to tmpdir or the specified dir option
* @property {?string} dir the tmp directory to use * @property {?string} dir tmp directory relative to the root tmp directory in use
* @property {?string} prefix prefix for the generated name * @property {?string} prefix prefix for the generated name
* @property {?string} postfix postfix for the generated name * @property {?string} postfix postfix for the generated name
* @property {?string} tmpdir the root tmp directory which overrides the os tmpdir
* @property {?boolean} unsafeCleanup recursively removes the created temporary directory, even when it's not empty * @property {?boolean} unsafeCleanup recursively removes the created temporary directory, even when it's not empty
* @property {?boolean} detachDescriptor detaches the file descriptor, caller is responsible for closing the file, tmp will no longer try closing the file during garbage collection
* @property {?boolean} discardDescriptor discards the file descriptor (closes file, fd is -1), tmp will no longer try closing the file during garbage collection
*/ */
/** /**
* @typedef {Object} FileSyncObject * @typedef {Object} FileSyncObject
* @property {string} name the name of the file * @property {string} name the name of the file
* @property {string} fd the file descriptor * @property {string} fd the file descriptor or -1 if the fd has been discarded
* @property {fileCallback} removeCallback the callback function to remove the file * @property {fileCallback} removeCallback the callback function to remove the file
*/ */
@@ -713,10 +710,18 @@ _safely_install_sigint_listener();
* @callback fileCallback * @callback fileCallback
* @param {?Error} err the error object if anything goes wrong * @param {?Error} err the error object if anything goes wrong
* @param {string} name the temporary file name * @param {string} name the temporary file name
* @param {number} fd the file descriptor * @param {number} fd the file descriptor or -1 if the fd had been discarded
* @param {cleanupCallback} fn the cleanup callback function * @param {cleanupCallback} fn the cleanup callback function
*/ */
/**
* @callback fileCallbackSync
* @param {?Error} err the error object if anything goes wrong
* @param {string} name the temporary file name
* @param {number} fd the file descriptor or -1 if the fd had been discarded
* @param {cleanupCallbackSync} fn the cleanup callback function
*/
/** /**
* @callback dirCallback * @callback dirCallback
* @param {?Error} err the error object if anything goes wrong * @param {?Error} err the error object if anything goes wrong
@@ -724,11 +729,24 @@ _safely_install_sigint_listener();
* @param {cleanupCallback} fn the cleanup callback function * @param {cleanupCallback} fn the cleanup callback function
*/ */
/**
* @callback dirCallbackSync
* @param {?Error} err the error object if anything goes wrong
* @param {string} name the temporary file name
* @param {cleanupCallbackSync} fn the cleanup callback function
*/
/** /**
* Removes the temporary created file or directory. * Removes the temporary created file or directory.
* *
* @callback cleanupCallback * @callback cleanupCallback
* @param {simpleCallback} [next] function to call after entry was removed * @param {simpleCallback} [next] function to call whenever the tmp object needs to be removed
*/
/**
* Removes the temporary created file or directory.
*
* @callback cleanupCallbackSync
*/ */
/** /**
@@ -740,7 +758,7 @@ _safely_install_sigint_listener();
// exporting all the needed methods // exporting all the needed methods
// evaluate os.tmpdir() lazily, mainly for simplifying testing but it also will // evaluate _getTmpDir() lazily, mainly for simplifying testing but it also will
// allow users to reconfigure the temporary directory // allow users to reconfigure the temporary directory
Object.defineProperty(module.exports, 'tmpdir', { Object.defineProperty(module.exports, 'tmpdir', {
enumerable: true, enumerable: true,

View File

@@ -1 +0,0 @@
../rimraf/bin.js

View File

@@ -1,15 +0,0 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -1,101 +0,0 @@
[![Build Status](https://travis-ci.org/isaacs/rimraf.svg?branch=master)](https://travis-ci.org/isaacs/rimraf) [![Dependency Status](https://david-dm.org/isaacs/rimraf.svg)](https://david-dm.org/isaacs/rimraf) [![devDependency Status](https://david-dm.org/isaacs/rimraf/dev-status.svg)](https://david-dm.org/isaacs/rimraf#info=devDependencies)
The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node.
Install with `npm install rimraf`, or just drop rimraf.js somewhere.
## API
`rimraf(f, [opts], callback)`
The first parameter will be interpreted as a globbing pattern for files. If you
want to disable globbing you can do so with `opts.disableGlob` (defaults to
`false`). This might be handy, for instance, if you have filenames that contain
globbing wildcard characters.
The callback will be called with an error if there is one. Certain
errors are handled for you:
* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of
`opts.maxBusyTries` times before giving up, adding 100ms of wait
between each attempt. The default `maxBusyTries` is 3.
* `ENOENT` - If the file doesn't exist, rimraf will return
successfully, since your desired outcome is already the case.
* `EMFILE` - Since `readdir` requires opening a file descriptor, it's
possible to hit `EMFILE` if too many file descriptors are in use.
In the sync case, there's nothing to be done for this. But in the
async case, rimraf will gradually back off with timeouts up to
`opts.emfileWait` ms, which defaults to 1000.
## options
* unlink, chmod, stat, lstat, rmdir, readdir,
unlinkSync, chmodSync, statSync, lstatSync, rmdirSync, readdirSync
In order to use a custom file system library, you can override
specific fs functions on the options object.
If any of these functions are present on the options object, then
the supplied function will be used instead of the default fs
method.
Sync methods are only relevant for `rimraf.sync()`, of course.
For example:
```javascript
var myCustomFS = require('some-custom-fs')
rimraf('some-thing', myCustomFS, callback)
```
* maxBusyTries
If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error code is encountered
on Windows systems, then rimraf will retry with a linear backoff
wait of 100ms longer on each try. The default maxBusyTries is 3.
Only relevant for async usage.
* emfileWait
If an `EMFILE` error is encountered, then rimraf will retry
repeatedly with a linear backoff of 1ms longer on each try, until
the timeout counter hits this max. The default limit is 1000.
If you repeatedly encounter `EMFILE` errors, then consider using
[graceful-fs](http://npm.im/graceful-fs) in your program.
Only relevant for async usage.
* glob
Set to `false` to disable [glob](http://npm.im/glob) pattern
matching.
Set to an object to pass options to the glob module. The default
glob options are `{ nosort: true, silent: true }`.
Glob version 6 is used in this module.
Relevant for both sync and async usage.
* disableGlob
Set to any non-falsey value to disable globbing entirely.
(Equivalent to setting `glob: false`.)
## rimraf.sync
It can remove stuff synchronously, too. But that's not so good. Use
the async API. It's better.
## CLI
If installed with `npm install rimraf -g` it can be used as a global
command `rimraf <path> [<path> ...]` which is useful for cross platform support.
## mkdirp
If you need to create a directory recursively, check out
[mkdirp](https://github.com/substack/node-mkdirp).

View File

@@ -1,50 +0,0 @@
#!/usr/bin/env node
var rimraf = require('./')
var help = false
var dashdash = false
var noglob = false
var args = process.argv.slice(2).filter(function(arg) {
if (dashdash)
return !!arg
else if (arg === '--')
dashdash = true
else if (arg === '--no-glob' || arg === '-G')
noglob = true
else if (arg === '--glob' || arg === '-g')
noglob = false
else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/))
help = true
else
return !!arg
})
if (help || args.length === 0) {
// If they didn't ask for help, then this is not a "success"
var log = help ? console.log : console.error
log('Usage: rimraf <path> [<path> ...]')
log('')
log(' Deletes all files and folders at "path" recursively.')
log('')
log('Options:')
log('')
log(' -h, --help Display this usage info')
log(' -G, --no-glob Do not expand glob patterns in arguments')
log(' -g, --glob Expand glob patterns in arguments (default)')
process.exit(help ? 0 : 1)
} else
go(0)
function go (n) {
if (n >= args.length)
return
var options = {}
if (noglob)
options = { glob: false }
rimraf(args[n], options, function (er) {
if (er)
throw er
go(n+1)
})
}

View File

@@ -1,29 +0,0 @@
{
"name": "rimraf",
"version": "2.7.1",
"main": "rimraf.js",
"description": "A deep deletion module for node (like `rm -rf`)",
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"license": "ISC",
"repository": "git://github.com/isaacs/rimraf.git",
"scripts": {
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --all; git push origin --tags",
"test": "tap test/*.js"
},
"bin": "./bin.js",
"dependencies": {
"glob": "^7.1.3"
},
"files": [
"LICENSE",
"README.md",
"bin.js",
"rimraf.js"
],
"devDependencies": {
"mkdirp": "^0.5.1",
"tap": "^12.1.1"
}
}

View File

@@ -1,372 +0,0 @@
module.exports = rimraf
rimraf.sync = rimrafSync
var assert = require("assert")
var path = require("path")
var fs = require("fs")
var glob = undefined
try {
glob = require("glob")
} catch (_err) {
// treat glob as optional.
}
var _0666 = parseInt('666', 8)
var defaultGlobOpts = {
nosort: true,
silent: true
}
// for EMFILE handling
var timeout = 0
var isWindows = (process.platform === "win32")
function defaults (options) {
var methods = [
'unlink',
'chmod',
'stat',
'lstat',
'rmdir',
'readdir'
]
methods.forEach(function(m) {
options[m] = options[m] || fs[m]
m = m + 'Sync'
options[m] = options[m] || fs[m]
})
options.maxBusyTries = options.maxBusyTries || 3
options.emfileWait = options.emfileWait || 1000
if (options.glob === false) {
options.disableGlob = true
}
if (options.disableGlob !== true && glob === undefined) {
throw Error('glob dependency not found, set `options.disableGlob = true` if intentional')
}
options.disableGlob = options.disableGlob || false
options.glob = options.glob || defaultGlobOpts
}
function rimraf (p, options, cb) {
if (typeof options === 'function') {
cb = options
options = {}
}
assert(p, 'rimraf: missing path')
assert.equal(typeof p, 'string', 'rimraf: path should be a string')
assert.equal(typeof cb, 'function', 'rimraf: callback function required')
assert(options, 'rimraf: invalid options argument provided')
assert.equal(typeof options, 'object', 'rimraf: options should be object')
defaults(options)
var busyTries = 0
var errState = null
var n = 0
if (options.disableGlob || !glob.hasMagic(p))
return afterGlob(null, [p])
options.lstat(p, function (er, stat) {
if (!er)
return afterGlob(null, [p])
glob(p, options.glob, afterGlob)
})
function next (er) {
errState = errState || er
if (--n === 0)
cb(errState)
}
function afterGlob (er, results) {
if (er)
return cb(er)
n = results.length
if (n === 0)
return cb()
results.forEach(function (p) {
rimraf_(p, options, function CB (er) {
if (er) {
if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") &&
busyTries < options.maxBusyTries) {
busyTries ++
var time = busyTries * 100
// try again, with the same exact callback as this one.
return setTimeout(function () {
rimraf_(p, options, CB)
}, time)
}
// this one won't happen if graceful-fs is used.
if (er.code === "EMFILE" && timeout < options.emfileWait) {
return setTimeout(function () {
rimraf_(p, options, CB)
}, timeout ++)
}
// already gone
if (er.code === "ENOENT") er = null
}
timeout = 0
next(er)
})
})
}
}
// Two possible strategies.
// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR
// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR
//
// Both result in an extra syscall when you guess wrong. However, there
// are likely far more normal files in the world than directories. This
// is based on the assumption that a the average number of files per
// directory is >= 1.
//
// If anyone ever complains about this, then I guess the strategy could
// be made configurable somehow. But until then, YAGNI.
function rimraf_ (p, options, cb) {
assert(p)
assert(options)
assert(typeof cb === 'function')
// sunos lets the root user unlink directories, which is... weird.
// so we have to lstat here and make sure it's not a dir.
options.lstat(p, function (er, st) {
if (er && er.code === "ENOENT")
return cb(null)
// Windows can EPERM on stat. Life is suffering.
if (er && er.code === "EPERM" && isWindows)
fixWinEPERM(p, options, er, cb)
if (st && st.isDirectory())
return rmdir(p, options, er, cb)
options.unlink(p, function (er) {
if (er) {
if (er.code === "ENOENT")
return cb(null)
if (er.code === "EPERM")
return (isWindows)
? fixWinEPERM(p, options, er, cb)
: rmdir(p, options, er, cb)
if (er.code === "EISDIR")
return rmdir(p, options, er, cb)
}
return cb(er)
})
})
}
function fixWinEPERM (p, options, er, cb) {
assert(p)
assert(options)
assert(typeof cb === 'function')
if (er)
assert(er instanceof Error)
options.chmod(p, _0666, function (er2) {
if (er2)
cb(er2.code === "ENOENT" ? null : er)
else
options.stat(p, function(er3, stats) {
if (er3)
cb(er3.code === "ENOENT" ? null : er)
else if (stats.isDirectory())
rmdir(p, options, er, cb)
else
options.unlink(p, cb)
})
})
}
function fixWinEPERMSync (p, options, er) {
assert(p)
assert(options)
if (er)
assert(er instanceof Error)
try {
options.chmodSync(p, _0666)
} catch (er2) {
if (er2.code === "ENOENT")
return
else
throw er
}
try {
var stats = options.statSync(p)
} catch (er3) {
if (er3.code === "ENOENT")
return
else
throw er
}
if (stats.isDirectory())
rmdirSync(p, options, er)
else
options.unlinkSync(p)
}
function rmdir (p, options, originalEr, cb) {
assert(p)
assert(options)
if (originalEr)
assert(originalEr instanceof Error)
assert(typeof cb === 'function')
// try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
// if we guessed wrong, and it's not a directory, then
// raise the original error.
options.rmdir(p, function (er) {
if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
rmkids(p, options, cb)
else if (er && er.code === "ENOTDIR")
cb(originalEr)
else
cb(er)
})
}
function rmkids(p, options, cb) {
assert(p)
assert(options)
assert(typeof cb === 'function')
options.readdir(p, function (er, files) {
if (er)
return cb(er)
var n = files.length
if (n === 0)
return options.rmdir(p, cb)
var errState
files.forEach(function (f) {
rimraf(path.join(p, f), options, function (er) {
if (errState)
return
if (er)
return cb(errState = er)
if (--n === 0)
options.rmdir(p, cb)
})
})
})
}
// this looks simpler, and is strictly *faster*, but will
// tie up the JavaScript thread and fail on excessively
// deep directory trees.
function rimrafSync (p, options) {
options = options || {}
defaults(options)
assert(p, 'rimraf: missing path')
assert.equal(typeof p, 'string', 'rimraf: path should be a string')
assert(options, 'rimraf: missing options')
assert.equal(typeof options, 'object', 'rimraf: options should be object')
var results
if (options.disableGlob || !glob.hasMagic(p)) {
results = [p]
} else {
try {
options.lstatSync(p)
results = [p]
} catch (er) {
results = glob.sync(p, options.glob)
}
}
if (!results.length)
return
for (var i = 0; i < results.length; i++) {
var p = results[i]
try {
var st = options.lstatSync(p)
} catch (er) {
if (er.code === "ENOENT")
return
// Windows can EPERM on stat. Life is suffering.
if (er.code === "EPERM" && isWindows)
fixWinEPERMSync(p, options, er)
}
try {
// sunos lets the root user unlink directories, which is... weird.
if (st && st.isDirectory())
rmdirSync(p, options, null)
else
options.unlinkSync(p)
} catch (er) {
if (er.code === "ENOENT")
return
if (er.code === "EPERM")
return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
if (er.code !== "EISDIR")
throw er
rmdirSync(p, options, er)
}
}
}
function rmdirSync (p, options, originalEr) {
assert(p)
assert(options)
if (originalEr)
assert(originalEr instanceof Error)
try {
options.rmdirSync(p)
} catch (er) {
if (er.code === "ENOENT")
return
if (er.code === "ENOTDIR")
throw originalEr
if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
rmkidsSync(p, options)
}
}
function rmkidsSync (p, options) {
assert(p)
assert(options)
options.readdirSync(p).forEach(function (f) {
rimrafSync(path.join(p, f), options)
})
// We only end up here once we got ENOTEMPTY at least once, and
// at this point, we are guaranteed to have removed all the kids.
// So, we know that it won't be ENOENT or ENOTDIR or anything else.
// try really hard to delete stuff on windows, because it has a
// PROFOUNDLY annoying habit of not closing handles promptly when
// files are deleted, resulting in spurious ENOTEMPTY errors.
var retries = isWindows ? 100 : 1
var i = 0
do {
var threw = true
try {
var ret = options.rmdirSync(p, options)
threw = false
return ret
} finally {
if (++i < retries && threw)
continue
}
} while (true)
}

29
node_modules/tmp/package.json generated vendored
View File

@@ -1,8 +1,11 @@
{ {
"name": "tmp", "name": "tmp",
"version": "0.1.0", "version": "0.2.1",
"description": "Temporary file and directory creator", "description": "Temporary file and directory creator",
"author": "KARASZI István <github@spam.raszi.hu> (http://raszi.hu/)", "author": "KARASZI István <github@spam.raszi.hu> (http://raszi.hu/)",
"contributors": [
"Carsten Klein <trancesilken@gmail.com> (https://github.com/silkentrance)"
],
"keywords": [ "keywords": [
"temporary", "temporary",
"tmp", "tmp",
@@ -13,28 +16,40 @@
"tmpfile" "tmpfile"
], ],
"license": "MIT", "license": "MIT",
"repository": "raszi/node-tmp", "repository": "https://github.com/raszi/node-tmp.git",
"homepage": "http://github.com/raszi/node-tmp", "homepage": "http://github.com/raszi/node-tmp",
"bugs": { "bugs": {
"url": "http://github.com/raszi/node-tmp/issues" "url": "http://github.com/raszi/node-tmp/issues"
}, },
"engines": { "engines": {
"node": ">=6" "node": ">=8.17.0"
}, },
"dependencies": { "dependencies": {
"rimraf": "^2.6.3" "rimraf": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^4.19.1", "eslint": "^6.3.0",
"eslint-plugin-mocha": "^5.0.0", "eslint-plugin-mocha": "^6.1.1",
"istanbul": "^0.4.5", "istanbul": "^0.4.5",
"mocha": "^5.1.1" "lerna-changelog": "^1.0.1",
"mocha": "^6.2.0"
}, },
"main": "lib/tmp.js", "main": "lib/tmp.js",
"files": [ "files": [
"lib/" "lib/"
], ],
"changelog": {
"labels": {
"breaking": ":boom: Breaking Change",
"enhancement": ":rocket: Enhancement",
"bug": ":bug: Bug Fix",
"documentation": ":memo: Documentation",
"internal": ":house: Internal"
},
"cacheDir": ".changelog"
},
"scripts": { "scripts": {
"changelog": "lerna-changelog",
"lint": "eslint lib --env mocha test", "lint": "eslint lib --env mocha test",
"clean": "rm -Rf ./coverage", "clean": "rm -Rf ./coverage",
"test": "npm run clean && istanbul cover ./node_modules/mocha/bin/_mocha --report none --print none --dir ./coverage/json -u exports -R test/*-test.js && istanbul report --root ./coverage/json html && istanbul report text-summary", "test": "npm run clean && istanbul cover ./node_modules/mocha/bin/_mocha --report none --print none --dir ./coverage/json -u exports -R test/*-test.js && istanbul report --root ./coverage/json html && istanbul report text-summary",

97
package-lock.json generated
View File

@@ -1,15 +1,15 @@
{ {
"name": "codeql", "name": "codeql",
"version": "1.1.2", "version": "1.1.4",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "codeql", "name": "codeql",
"version": "1.1.2", "version": "1.1.4",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/artifact": "^0.5.2", "@actions/artifact": "^1.0.0",
"@actions/core": "^1.4.0", "@actions/core": "^1.4.0",
"@actions/exec": "^1.1.0", "@actions/exec": "^1.1.0",
"@actions/github": "^4.0.0", "@actions/github": "^4.0.0",
@@ -52,21 +52,20 @@
"eslint-plugin-no-async-foreach": "^0.1.1", "eslint-plugin-no-async-foreach": "^0.1.1",
"micromatch": "4.0.4", "micromatch": "4.0.4",
"nock": "^13.1.1", "nock": "^13.1.1",
"removeNPMAbsolutePaths": "2.0.0", "removeNPMAbsolutePaths": "3.0.0",
"sinon": "^13.0.0", "sinon": "^13.0.0",
"typescript": "^4.4.2" "typescript": "^4.4.2"
} }
}, },
"node_modules/@actions/artifact": { "node_modules/@actions/artifact": {
"version": "0.5.2", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-0.5.2.tgz", "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-1.0.0.tgz",
"integrity": "sha512-q/r8WSqyxBJ0ffLCRrtjCBTGnAYqP+ID4yG7f7YSlhrQ4thNg/d+Tq9f1YkLPKX46ZR97OWtGDY+oU/nxcqvLw==", "integrity": "sha512-oje+cCiM2maVwoiN+LT9kh2C6UqiTcS1tDKins+nRfckX+C8JJD2kAmzpD5fn/p5Dibjrqk1mtwreAzgNxHrDg==",
"dependencies": { "dependencies": {
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/http-client": "^1.0.11", "@actions/http-client": "^1.0.11",
"@types/tmp": "^0.1.0", "tmp": "^0.2.1",
"tmp": "^0.1.0", "tmp-promise": "^3.0.2"
"tmp-promise": "^2.0.2"
} }
}, },
"node_modules/@actions/core": { "node_modules/@actions/core": {
@@ -554,10 +553,6 @@
"@sinonjs/fake-timers": "^7.1.0" "@sinonjs/fake-timers": "^7.1.0"
} }
}, },
"node_modules/@types/tmp": {
"version": "0.1.0",
"integrity": "sha512-6IwZ9HzWbCq6XoQWhxLpDjuADodH/MKXRUIDFudvgjcVdjFknvmR+DNsoUeer4XPrEnrZs04Jj+kfV9pFsrhmA=="
},
"node_modules/@typescript-eslint/eslint-plugin": { "node_modules/@typescript-eslint/eslint-plugin": {
"version": "4.28.5", "version": "4.28.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.5.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.5.tgz",
@@ -4414,8 +4409,9 @@
} }
}, },
"node_modules/removeNPMAbsolutePaths": { "node_modules/removeNPMAbsolutePaths": {
"version": "2.0.0", "version": "3.0.0",
"integrity": "sha512-Hea7U6iJcD0NE/aqBqxBMPKeKaxjqMNyTTajmH2dH9hhafJ9Tem5r4UeJK8+BdE1MK9lqoOYqNM0Sq9rl1OIbQ==", "resolved": "https://registry.npmjs.org/removeNPMAbsolutePaths/-/removeNPMAbsolutePaths-3.0.0.tgz",
"integrity": "sha512-g4DIbk+xI8YC1RafmVKaPyMcuQlKZ8N7RQMUvRv+YLHNw1PhyFtjsC6WBaiTCfDKFGQhBaRSc0b0qUjPeCdIdQ==",
"dev": true, "dev": true,
"bin": { "bin": {
"removeNPMAbsolutePaths": "bin/removeNPMAbsolutePaths" "removeNPMAbsolutePaths": "bin/removeNPMAbsolutePaths"
@@ -4986,30 +4982,22 @@
} }
}, },
"node_modules/tmp": { "node_modules/tmp": {
"version": "0.1.0", "version": "0.2.1",
"integrity": "sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw==", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
"integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
"dependencies": { "dependencies": {
"rimraf": "^2.6.3" "rimraf": "^3.0.0"
}, },
"engines": { "engines": {
"node": ">=6" "node": ">=8.17.0"
} }
}, },
"node_modules/tmp-promise": { "node_modules/tmp-promise": {
"version": "2.1.1", "version": "3.0.3",
"integrity": "sha512-Z048AOz/w9b6lCbJUpevIJpRpUztENl8zdv1bmAKVHimfqRFl92ROkmT9rp7TVBnrEw2gtMTol/2Cp2S2kJa4Q==", "resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.3.tgz",
"integrity": "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==",
"dependencies": { "dependencies": {
"tmp": "0.1.0" "tmp": "^0.2.0"
}
},
"node_modules/tmp/node_modules/rimraf": {
"version": "2.7.1",
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
"dependencies": {
"glob": "^7.1.3"
},
"bin": {
"rimraf": "bin.js"
} }
}, },
"node_modules/to-regex-range": { "node_modules/to-regex-range": {
@@ -5368,15 +5356,14 @@
}, },
"dependencies": { "dependencies": {
"@actions/artifact": { "@actions/artifact": {
"version": "0.5.2", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-0.5.2.tgz", "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-1.0.0.tgz",
"integrity": "sha512-q/r8WSqyxBJ0ffLCRrtjCBTGnAYqP+ID4yG7f7YSlhrQ4thNg/d+Tq9f1YkLPKX46ZR97OWtGDY+oU/nxcqvLw==", "integrity": "sha512-oje+cCiM2maVwoiN+LT9kh2C6UqiTcS1tDKins+nRfckX+C8JJD2kAmzpD5fn/p5Dibjrqk1mtwreAzgNxHrDg==",
"requires": { "requires": {
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/http-client": "^1.0.11", "@actions/http-client": "^1.0.11",
"@types/tmp": "^0.1.0", "tmp": "^0.2.1",
"tmp": "^0.1.0", "tmp-promise": "^3.0.2"
"tmp-promise": "^2.0.2"
} }
}, },
"@actions/core": { "@actions/core": {
@@ -5833,10 +5820,6 @@
"@sinonjs/fake-timers": "^7.1.0" "@sinonjs/fake-timers": "^7.1.0"
} }
}, },
"@types/tmp": {
"version": "0.1.0",
"integrity": "sha512-6IwZ9HzWbCq6XoQWhxLpDjuADodH/MKXRUIDFudvgjcVdjFknvmR+DNsoUeer4XPrEnrZs04Jj+kfV9pFsrhmA=="
},
"@typescript-eslint/eslint-plugin": { "@typescript-eslint/eslint-plugin": {
"version": "4.28.5", "version": "4.28.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.5.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.5.tgz",
@@ -8556,8 +8539,9 @@
"dev": true "dev": true
}, },
"removeNPMAbsolutePaths": { "removeNPMAbsolutePaths": {
"version": "2.0.0", "version": "3.0.0",
"integrity": "sha512-Hea7U6iJcD0NE/aqBqxBMPKeKaxjqMNyTTajmH2dH9hhafJ9Tem5r4UeJK8+BdE1MK9lqoOYqNM0Sq9rl1OIbQ==", "resolved": "https://registry.npmjs.org/removeNPMAbsolutePaths/-/removeNPMAbsolutePaths-3.0.0.tgz",
"integrity": "sha512-g4DIbk+xI8YC1RafmVKaPyMcuQlKZ8N7RQMUvRv+YLHNw1PhyFtjsC6WBaiTCfDKFGQhBaRSc0b0qUjPeCdIdQ==",
"dev": true "dev": true
}, },
"require-directory": { "require-directory": {
@@ -8977,26 +8961,19 @@
"dev": true "dev": true
}, },
"tmp": { "tmp": {
"version": "0.1.0", "version": "0.2.1",
"integrity": "sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw==", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",
"integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==",
"requires": { "requires": {
"rimraf": "^2.6.3" "rimraf": "^3.0.0"
},
"dependencies": {
"rimraf": {
"version": "2.7.1",
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
"requires": {
"glob": "^7.1.3"
}
}
} }
}, },
"tmp-promise": { "tmp-promise": {
"version": "2.1.1", "version": "3.0.3",
"integrity": "sha512-Z048AOz/w9b6lCbJUpevIJpRpUztENl8zdv1bmAKVHimfqRFl92ROkmT9rp7TVBnrEw2gtMTol/2Cp2S2kJa4Q==", "resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.3.tgz",
"integrity": "sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==",
"requires": { "requires": {
"tmp": "0.1.0" "tmp": "^0.2.0"
} }
}, },
"to-regex-range": { "to-regex-range": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "codeql", "name": "codeql",
"version": "1.1.2", "version": "1.1.4",
"private": true, "private": true,
"description": "CodeQL action", "description": "CodeQL action",
"scripts": { "scripts": {
@@ -22,7 +22,7 @@
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/artifact": "^0.5.2", "@actions/artifact": "^1.0.0",
"@actions/core": "^1.4.0", "@actions/core": "^1.4.0",
"@actions/exec": "^1.1.0", "@actions/exec": "^1.1.0",
"@actions/github": "^4.0.0", "@actions/github": "^4.0.0",
@@ -68,7 +68,7 @@
"eslint-plugin-no-async-foreach": "^0.1.1", "eslint-plugin-no-async-foreach": "^0.1.1",
"micromatch": "4.0.4", "micromatch": "4.0.4",
"nock": "^13.1.1", "nock": "^13.1.1",
"removeNPMAbsolutePaths": "2.0.0", "removeNPMAbsolutePaths": "3.0.0",
"sinon": "^13.0.0", "sinon": "^13.0.0",
"typescript": "^4.4.2" "typescript": "^4.4.2"
}, },

View File

@@ -1,8 +1,5 @@
name: "Analyze: 'ref' and 'sha' from inputs" name: "Analyze: 'ref' and 'sha' from inputs"
description: "Checks that specifying 'ref' and 'sha' as inputs works" description: "Checks that specifying 'ref' and 'sha' as inputs works"
# Build tracing currently does not support Windows 2022, so use `windows-2019` instead of
# `windows-latest`.
os: [ubuntu-latest, macos-latest, windows-2019]
steps: steps:
- uses: ./../action/init - uses: ./../action/init
with: with:

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