mirror of
https://github.com/azure/setup-helm.git
synced 2026-12-04 11:11:54 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f5e7bc67f | |||
| 206711cbe5 | |||
| b14f4022d8 | |||
| bd99bd231d | |||
| 4339b0e932 |
@@ -10,26 +10,24 @@ jobs:
|
||||
build:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
- uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 #v11.0.0
|
||||
name: Setting issue as idle
|
||||
name: Mark idle issues and PRs and close inactive ones
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is idle because it has been open for 14 days with no activity.'
|
||||
stale-issue-message: 'This issue is idle after 60 days with no activity. It will be closed in 14 days if there is no further activity.'
|
||||
stale-issue-label: 'idle'
|
||||
days-before-stale: 14
|
||||
days-before-close: -1
|
||||
close-issue-message: 'Closing this issue after 14 more days with no activity since it was marked idle.'
|
||||
stale-pr-message: 'This PR is idle after 60 days with no activity. It will be closed in 14 days if there is no further activity.'
|
||||
stale-pr-label: 'idle'
|
||||
close-pr-message: 'Closing this PR after 14 more days with no activity since it was marked idle.'
|
||||
days-before-stale: 60
|
||||
days-before-close: 14
|
||||
remove-stale-when-updated: true
|
||||
operations-per-run: 100
|
||||
exempt-issue-labels: 'backlog'
|
||||
|
||||
- uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 #v11.0.0
|
||||
name: Setting PR as idle
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-pr-message: 'This PR is idle because it has been open for 14 days with no activity.'
|
||||
stale-pr-label: 'idle'
|
||||
days-before-stale: 14
|
||||
days-before-close: -1
|
||||
operations-per-run: 100
|
||||
|
||||
@@ -11,8 +11,6 @@ pids
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
@@ -64,7 +62,6 @@ node_modules
|
||||
coverage
|
||||
|
||||
# Transpiled JS
|
||||
lib/
|
||||
|
||||
# Planning docs
|
||||
docs/
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
# Change Log
|
||||
|
||||
## [5.1.0] - 2026-11-09
|
||||
|
||||
### Added
|
||||
|
||||
- #281 [Read the Helm version from a .tool-versions file with the version-file input](https://github.com/Azure/setup-helm/pull/281)
|
||||
- #293 [Resolve the latest patch for a major.minor version](https://github.com/Azure/setup-helm/pull/293)
|
||||
- #315 [Add configurable checksum verification and fallback download mirrors](https://github.com/Azure/setup-helm/pull/315)
|
||||
|
||||
### Fixed
|
||||
|
||||
- #292 [Preserve subpath base URLs when constructing Helm download URLs](https://github.com/Azure/setup-helm/pull/292)
|
||||
- #303 [Retry latest-version lookups and add the latest-fallback opt-out](https://github.com/Azure/setup-helm/pull/303)
|
||||
|
||||
### Security
|
||||
|
||||
- #313 [Update Undici security fixes](https://github.com/Azure/setup-helm/pull/313)
|
||||
- #307 [Update Undici](https://github.com/Azure/setup-helm/pull/307)
|
||||
- #298 [Update Undici](https://github.com/Azure/setup-helm/pull/298)
|
||||
|
||||
### Changed
|
||||
|
||||
- #314 [Update the built-in Helm fallback from v3.18.4 to v4.3.1](https://github.com/Azure/setup-helm/pull/314)
|
||||
- #311 [Enable stale cleanup after 74 inactive days](https://github.com/Azure/setup-helm/pull/311)
|
||||
- #306 [Update the shared release workflow](https://github.com/Azure/setup-helm/pull/306)
|
||||
- Update remaining dependency groups, development tools, and workflow actions (#290, #291, #294, #295, #297, #299, #301, #305, #308, #309, #316)
|
||||
|
||||
## [5.0.1] - 2026-06-23
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -42,6 +42,31 @@ If both `version` and `version-file` are set, an explicitly requested `version`
|
||||
>
|
||||
> If you rely on a certain version, you should explicitly request that version instead of `latest`.
|
||||
|
||||
Freshly downloaded Helm archives are verified against the SHA-256 checksum published beside the archive before extraction. With the default `checksum-policy: auto`, the action verifies a matching checksum when one is available as a bare 64-character hexadecimal digest at `<archive-url>.sha256`; when the checksum is not found, the action warns and continues downloading. Existing tool-cache entries continue to be reused without downloading or re-verifying the archive.
|
||||
|
||||
Set `checksum-policy` to control this behavior:
|
||||
|
||||
- `auto` (default): verify checksums when available and warn when they are absent.
|
||||
- `required`: require a valid matching checksum from every download location.
|
||||
- `if-available`: explicitly select the same verify-or-warn behavior as `auto`.
|
||||
- `disabled`: skip checksum verification and emit a warning.
|
||||
|
||||
Malformed or mismatched checksums always fail unless verification is explicitly `disabled`. In `if-available` and `auto` modes, only a checksum response of HTTP 404 or 410 is treated as absent; other download errors fail closed.
|
||||
|
||||
Because each checksum is retrieved from the same mirror as its archive, verification detects corruption or an incomplete mirror sync; it does not protect against a mirror that has been compromised together with its checksum files.
|
||||
|
||||
An optional fallback mirror can be used when version resolution, archive download, or checksum verification fails against the primary location:
|
||||
|
||||
```yaml
|
||||
- uses: azure/setup-helm@v5
|
||||
with:
|
||||
version: 'v4.3.1'
|
||||
downloadBaseURL: 'https://primary.example/helm'
|
||||
downloadBaseURLFallback: 'https://fallback.example/helm'
|
||||
```
|
||||
|
||||
The fallback archive follows the same checksum policy as the primary mirror. This capability follows the use case proposed by @mvtavares in [#227](https://github.com/Azure/setup-helm/pull/227).
|
||||
|
||||
The cached helm binary path is prepended to the PATH environment variable as well as stored in the helm-path output variable.
|
||||
Refer to the action metadata file for details about all the inputs https://github.com/Azure/setup-helm/blob/master/action.yml
|
||||
|
||||
|
||||
@@ -17,6 +17,14 @@ inputs:
|
||||
description: 'Set the download base URL'
|
||||
required: false
|
||||
default: 'https://get.helm.sh'
|
||||
downloadBaseURLFallback:
|
||||
description: 'Fallback base URL used when version resolution, download, or checksum verification fails against downloadBaseURL'
|
||||
required: false
|
||||
default: ''
|
||||
checksum-policy:
|
||||
description: "Checksum verification policy: 'auto' verifies checksums when available and warns when absent; 'required' always requires them; 'if-available' is an explicit alias for auto behavior; 'disabled' skips verification"
|
||||
required: false
|
||||
default: 'auto'
|
||||
latest-fallback:
|
||||
description: "When 'version' is 'latest' and the latest version cannot be determined after retrying, install the built-in default version instead of failing. Set to 'false' to fail the step instead, since the built-in default can be a major version behind what 'latest' resolves to."
|
||||
required: false
|
||||
|
||||
+24185
File diff suppressed because one or more lines are too long
Generated
+108
-108
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "setuphelm",
|
||||
"version": "5.0.1",
|
||||
"version": "5.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "setuphelm",
|
||||
"version": "5.0.1",
|
||||
"version": "5.1.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^3.0.1",
|
||||
@@ -14,10 +14,10 @@
|
||||
"@actions/io": "^3.0.2",
|
||||
"@actions/tool-cache": "4.0.0",
|
||||
"@octokit/action": "^8.0.4",
|
||||
"semver": "^7.8.5"
|
||||
"semver": "^7.8.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^26.6.5",
|
||||
"@types/node": "^26.6.6",
|
||||
"esbuild": "^0.28",
|
||||
"husky": "^9.1.7",
|
||||
"prettier": "^3.9.10",
|
||||
@@ -710,9 +710,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@oxc-project/types": {
|
||||
"version": "0.154.0",
|
||||
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.154.0.tgz",
|
||||
"integrity": "sha512-KYOUGQFlLWR+s4QMV2Q9ko38TZm7EdO87Qm7rvZLqk/webse/cDjtyxKhg/47l0byCbs/k46LT8qc4PKjAikzA==",
|
||||
"version": "0.156.0",
|
||||
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz",
|
||||
"integrity": "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
@@ -721,9 +721,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-android-arm-eabi": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.14.tgz",
|
||||
"integrity": "sha512-aWR+XKH9+rW7m5fWq/5360J3mHycrx/o6xZM2DQFdJnTMdyP7/WzxPjhtLbVWdKo2y612/4U1bWqb3HQhiF7vg==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.16.tgz",
|
||||
"integrity": "sha512-ia3DwAs0OsMGS7+IConptSiyk9pEXkOx/AbJ2n/lAGxH3QkWQus1t8d7gnAT38FCU2sQu8lUbeR6AiZFv4JxaA==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@@ -739,9 +739,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-android-arm64": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.14.tgz",
|
||||
"integrity": "sha512-QiVxHofl6A8lQU7WAtOUY4QMVZXohxwz7WJJoeh8NBEUyKfIkMRKhYyq8az/1RypNiIXzNTtiS6KwHz0erxYRQ==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.16.tgz",
|
||||
"integrity": "sha512-kx5wBiMB6E7TEvpl2B9gjLU004BkvEm2Dr941BFjx/SontPwSzNuQUIoVKxHHoSjpFIfHMmcguyLOtyn0hObRg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -757,9 +757,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-darwin-arm64": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.14.tgz",
|
||||
"integrity": "sha512-lTQOzHuBIooh3jIr5XINQkjPGEuGy+Dsy0meXDr6Sjty0b99kYgGh4uBC/8mJX1T0kC8d6S0aPP1Y+bHkh6aBw==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.16.tgz",
|
||||
"integrity": "sha512-qslZrXnKJU4cUpjoAmtAo/KQM9e2IRMlmpig6Zpwj+8KWxW8v+nkAf9216Bsek9lOC1jvg2yCjygCFo2f83msQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -775,9 +775,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-darwin-x64": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.14.tgz",
|
||||
"integrity": "sha512-hyMKEGatjmBYCs/Q4sbIcL/GqpFEqsX3wc+HYVQ/85A4rxc1o7rPm4DUI4GV4k/h0ITddwFSGpqQunI14GXjTA==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.16.tgz",
|
||||
"integrity": "sha512-FdF+y48ND13eAyM2mQn+85kvAqNlvRWROy2rhgA463X/0Gv4vGtazZtfaF1mRBLscYvtOlh4QnLjOWiFzX69OQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -793,9 +793,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-freebsd-x64": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.14.tgz",
|
||||
"integrity": "sha512-u371GbXoVXrEgP20PwzoGNOdAOqAMhzo19JzzY+V4YmmnC+DTOoqdbMu+O+54emM59Mik/UdrtWgcuEDKWRPKA==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.16.tgz",
|
||||
"integrity": "sha512-ddjqFM5e95AgLbUPtKIS7V1KTVlA0RUgCVr5mn+/IEhsdy3pr+Vuj/HZ7nlMN2FyxIwUktOH1LEPIQXO1v9y1Q==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -811,9 +811,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-arm-gnueabihf": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.14.tgz",
|
||||
"integrity": "sha512-BqwKsdZQf6EqVWr8fv2MrDYzAvOZ7+NYFSJESRGs87fkseEhs0TU9TXgRJTkZoRRkxTizyEg1LKUXfU3/78uqg==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.16.tgz",
|
||||
"integrity": "sha512-tHdKWbFkFBI687iim3LIyIvyL7j66VvQYkDPss5Stn/qyE2tWkR1YD0dXmXPFKKqT/o5ZEJVsaRsWS2meQwGOA==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@@ -829,9 +829,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-arm64-gnu": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.14.tgz",
|
||||
"integrity": "sha512-SD9kY8M009x/7s57Z1dgUVlP5+uYBgKQK0Tkr1WIWngrtUJmRCW1RJFMY7QDla2khXhmg2i5Io7MUjcmZNZ/KQ==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.16.tgz",
|
||||
"integrity": "sha512-FJiLGAblPBMlBEdbOqw6kW6QcXDWAf/oJu7gYs9ZJZwmg+K+/zjFLxPTIY9izJUzxzc24FHvmseyA0IvJSl17w==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -850,9 +850,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-arm64-musl": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.14.tgz",
|
||||
"integrity": "sha512-BJ2CL19M6uuWesMgnqJzgxoI+N+eV7b0A9O9vLV42y+gitC41fNa8KElau1tHVzuLWX5GzEuxMPhAO0tQXQMkg==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.16.tgz",
|
||||
"integrity": "sha512-hrJpblMsrQ58U9veWpbXzkhV5zStunds6HWLprqq1qauvgBr1E6P+24kLj6lSLI9vjRn/RYpjprhkHQPKGWpNg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -871,9 +871,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-ppc64-gnu": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.14.tgz",
|
||||
"integrity": "sha512-4+Kl8daPV8NDHaD7mfCcc1pRM+Qg7ab8DyMm5FG5WoZgv4h2i3KFN1CybYBNbQqmuYm7ftJLvmMI1eHYJ22S/Q==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.16.tgz",
|
||||
"integrity": "sha512-qJd/dC6j6CwLG9/s/RP2nb1RZ0GIgj7Ioj7x/SYa3RzjVrlzrmH0fhIOpfvqQDeIsdP0loi+kHaMhJzY1PBIaA==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
@@ -892,9 +892,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-s390x-gnu": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.14.tgz",
|
||||
"integrity": "sha512-V/h8ePq1fKDrmtFMz6xcCN3DKvuvMRrwwD1q0PkBeeo4DpK64biaKvqWGVxqCeYKqeRk7gE7/iKPxLCn08O97A==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.16.tgz",
|
||||
"integrity": "sha512-Vx7Xg5uUJuNcujJjI70OICaH0EYj80BtOLZTSN7uOYg8QOLlyKnaG0IW7Fn/J0IpJsaKzmDKMhOQv1JBM9m9vg==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
@@ -913,9 +913,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-x64-gnu": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.14.tgz",
|
||||
"integrity": "sha512-WxalXzgrLVpKC93xfpaJ3gCXUWzeCr+FRCbDVD2mUAy4L6Vo3lNVz0epUEUpxPWJkLNYUwM4OSIikv36OJ9mLg==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.16.tgz",
|
||||
"integrity": "sha512-TNKhgE3uJTsTzatUSSYt0Kgo+Oa2uSlSjz4r1aEIea7HX6ULBym4fAlYUhG1i6pjNf2njfCUAfKwr6C3E9Xg1w==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -934,9 +934,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-x64-musl": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.14.tgz",
|
||||
"integrity": "sha512-3G3tnAmTpdk9jO3GQtyHXqeFD2SlecfTws/Y3M2mmj9nMBwwuLT4kur8sZKeu7ENUHSpVO3cIsm5A52LEWWwlg==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.16.tgz",
|
||||
"integrity": "sha512-7chXdpjXZ8qG0+mIxECN3cT9kvhZ3/oZhMX6Pp876P7CDrIy8nJswva6Mq357JR7eYXfuskwZxMeV1SzoZdHrA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -955,9 +955,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-openharmony-arm64": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.14.tgz",
|
||||
"integrity": "sha512-qyr5XiNGxm2ytx17vvtcJ9nXn6v1gENETi503bJx3OGwZ1tSonj7BosxbMa/xeAfSl5iS9X6KjEWYXLu6v1L7Q==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.16.tgz",
|
||||
"integrity": "sha512-Kwjt+7uNTJK5/MDkGWGVO2KQPnj8yAV75dMpfwyHZrJSXWHrniOB0aUEWlVYf3H1hOqFLIStLdM5QXq6bnKmOQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -973,9 +973,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-win32-arm64-msvc": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.14.tgz",
|
||||
"integrity": "sha512-oA4o5o0S2yB199YyYXDzKUv1Z56Rc+mgOjwm7Z/vJ9Z8igiDPYvoOuDyo6g7AK/ZaF09nPhDKVnGBcYHO11GXA==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.16.tgz",
|
||||
"integrity": "sha512-/LH6WfjDRXXJz/p5xl4TmU+jpcnwcxbKEQBW/GZE0JHfN0lGIyTtsUEGaQ/q/GikkGJ2yLKe6pwm7AnEWO8pdw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -991,9 +991,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-win32-x64-msvc": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.14.tgz",
|
||||
"integrity": "sha512-9mE94bf2GZUaR/fUSXCMpBoWkctu421Mi0ORpm4zqfbkjKep7RxzPFa5etcGs5h+2KApoWBOA/hAJa/7saGgEQ==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.16.tgz",
|
||||
"integrity": "sha512-1lv1KvX0Z871zfk7vw+dnXMMnHNyDwMzWG8Kv3HxDXMOhzCX4SHc7HK319fInP0i+0p9D8brkfzL7pJOaGl+tw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1035,16 +1035,16 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/estree": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",
|
||||
"integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz",
|
||||
"integrity": "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "26.6.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.5.tgz",
|
||||
"integrity": "sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg==",
|
||||
"version": "26.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.6.tgz",
|
||||
"integrity": "sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -1392,14 +1392,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vitest/mocker": {
|
||||
"version": "5.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.5.tgz",
|
||||
"integrity": "sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg==",
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.1.0.tgz",
|
||||
"integrity": "sha512-5umB9/jlWcqVS6fsrFmv5Gdnpu6wAUio/lEOwAmvB7v+lFo/IW2B9FhAD0p19GCULTgMzLCdUmuCDCnAzWgppQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "0.3.31",
|
||||
"@vitest/spy": "5.0.5",
|
||||
"@vitest/spy": "5.1.0",
|
||||
"estree-walker": "^3.0.3",
|
||||
"magic-string": "^1.4.3"
|
||||
},
|
||||
@@ -1420,9 +1420,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vitest/spy": {
|
||||
"version": "5.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.5.tgz",
|
||||
"integrity": "sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw==",
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.0.tgz",
|
||||
"integrity": "sha512-2DPO5OMHWKrBngC+fCmTQqemNF0gidRhp3lxbBmRhW+M1XJrfgPpqNqWVevXtn2f2ufD5ZaR1B6B641aAlcX5A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
@@ -1887,9 +1887,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/magic-string": {
|
||||
"version": "1.4.3",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.3.tgz",
|
||||
"integrity": "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==",
|
||||
"version": "1.4.5",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz",
|
||||
"integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -1952,9 +1952,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.5.30",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.30.tgz",
|
||||
"integrity": "sha512-zkd+e9S1AQHhmaBKye9zlFHWjOwVgqXl1q3ECYy8561K7qxR2cREf/STLskulBFd78k6AOFeA+ff1TtEzk9bAA==",
|
||||
"version": "8.5.32",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz",
|
||||
"integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
@@ -1998,14 +1998,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rolldown": {
|
||||
"version": "1.2.14",
|
||||
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.14.tgz",
|
||||
"integrity": "sha512-eTBTTqMR6uHKLgcUqpJP8ntzDI6V4LYA8negAMBEI7gkgVvOdrx6VsvS2Ym+83KhOPdLCHWJu0w7UQFJZhHKNw==",
|
||||
"version": "1.2.16",
|
||||
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.16.tgz",
|
||||
"integrity": "sha512-bWvlMpFKiTfDKfnK7FC2MPgPeWCf/Kpwsq49ApdW+FQaBZb6O6dZ4MAPbPUjp7hYQrw/RobqCzn64BRrQecGHw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@oxc-project/types": "=0.154.0",
|
||||
"@oxc-project/types": "=0.156.0",
|
||||
"@rolldown/pluginutils": "^1.0.0"
|
||||
},
|
||||
"bin": {
|
||||
@@ -2015,27 +2015,27 @@
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rolldown/binding-android-arm-eabi": "1.2.14",
|
||||
"@rolldown/binding-android-arm64": "1.2.14",
|
||||
"@rolldown/binding-darwin-arm64": "1.2.14",
|
||||
"@rolldown/binding-darwin-x64": "1.2.14",
|
||||
"@rolldown/binding-freebsd-x64": "1.2.14",
|
||||
"@rolldown/binding-linux-arm-gnueabihf": "1.2.14",
|
||||
"@rolldown/binding-linux-arm64-gnu": "1.2.14",
|
||||
"@rolldown/binding-linux-arm64-musl": "1.2.14",
|
||||
"@rolldown/binding-linux-ppc64-gnu": "1.2.14",
|
||||
"@rolldown/binding-linux-s390x-gnu": "1.2.14",
|
||||
"@rolldown/binding-linux-x64-gnu": "1.2.14",
|
||||
"@rolldown/binding-linux-x64-musl": "1.2.14",
|
||||
"@rolldown/binding-openharmony-arm64": "1.2.14",
|
||||
"@rolldown/binding-win32-arm64-msvc": "1.2.14",
|
||||
"@rolldown/binding-win32-x64-msvc": "1.2.14"
|
||||
"@rolldown/binding-android-arm-eabi": "1.2.16",
|
||||
"@rolldown/binding-android-arm64": "1.2.16",
|
||||
"@rolldown/binding-darwin-arm64": "1.2.16",
|
||||
"@rolldown/binding-darwin-x64": "1.2.16",
|
||||
"@rolldown/binding-freebsd-x64": "1.2.16",
|
||||
"@rolldown/binding-linux-arm-gnueabihf": "1.2.16",
|
||||
"@rolldown/binding-linux-arm64-gnu": "1.2.16",
|
||||
"@rolldown/binding-linux-arm64-musl": "1.2.16",
|
||||
"@rolldown/binding-linux-ppc64-gnu": "1.2.16",
|
||||
"@rolldown/binding-linux-s390x-gnu": "1.2.16",
|
||||
"@rolldown/binding-linux-x64-gnu": "1.2.16",
|
||||
"@rolldown/binding-linux-x64-musl": "1.2.16",
|
||||
"@rolldown/binding-openharmony-arm64": "1.2.16",
|
||||
"@rolldown/binding-win32-arm64-msvc": "1.2.16",
|
||||
"@rolldown/binding-win32-x64-msvc": "1.2.16"
|
||||
}
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.8.5",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
|
||||
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
|
||||
"version": "7.8.6",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.6.tgz",
|
||||
"integrity": "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==",
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
@@ -2166,17 +2166,17 @@
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "8.3.4",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-8.3.4.tgz",
|
||||
"integrity": "sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ==",
|
||||
"version": "8.3.6",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-8.3.6.tgz",
|
||||
"integrity": "sha512-UI7dK29NnS54Fk+mmo7o+jI6U8Fp7hDl+X5Q1k45WH+d4dSlbLVUETGQ+hfkNgvLQGyoElPj837nZyv4MBc0VA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"lightningcss": "^1.33.0",
|
||||
"picomatch": "^4.0.7",
|
||||
"postcss": "^8.5.29",
|
||||
"rolldown": "~1.2.12",
|
||||
"postcss": "^8.5.32",
|
||||
"rolldown": "~1.2.16",
|
||||
"tinyglobby": "^0.2.17"
|
||||
},
|
||||
"bin": {
|
||||
@@ -2193,7 +2193,7 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": "^20.19.0 || >=22.12.0",
|
||||
"@vitejs/devtools": "^0.7.1",
|
||||
"@vitejs/devtools": "^0.7.1 || ^0.8.0",
|
||||
"esbuild": "^0.27.0 || ^0.28.0",
|
||||
"jiti": ">=1.21.0",
|
||||
"less": "^4.0.0",
|
||||
@@ -2245,14 +2245,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/vitest": {
|
||||
"version": "5.0.5",
|
||||
"resolved": "https://registry.npmjs.org/vitest/-/vitest-5.0.5.tgz",
|
||||
"integrity": "sha512-cPODOMF8YnkiiYtDdHo6n4wWmBrOBBbOIYH2d33M4l3CdNn72h+qMmO6uXffUN6A5AZFXNND/d+krS9mgkXRfg==",
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/vitest/-/vitest-5.1.0.tgz",
|
||||
"integrity": "sha512-MzmNFnrwa8v8lF1bLxw3UJ4EREwVOVb75VqJZmUDRjJ6EluK/x9th7qTbaeDk41WxE1GxWqmTXcdsfobfH5sOA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/chai": "^5.2.2",
|
||||
"@vitest/mocker": "5.0.5",
|
||||
"@vitest/mocker": "5.1.0",
|
||||
"chai": "^6.3.0",
|
||||
"es-module-lexer": "^2.3.2",
|
||||
"expect-type": "^1.4.0",
|
||||
@@ -2278,12 +2278,12 @@
|
||||
"@edge-runtime/vm": "*",
|
||||
"@opentelemetry/api": "^1.9.0",
|
||||
"@types/node": "^22.0.0 || >=24.0.0",
|
||||
"@vitest/browser-playwright": "5.0.5",
|
||||
"@vitest/browser-preview": "5.0.5",
|
||||
"@vitest/browser-playwright": "5.1.0",
|
||||
"@vitest/browser-preview": "5.1.0",
|
||||
"@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0",
|
||||
"@vitest/coverage-istanbul": "5.0.5",
|
||||
"@vitest/coverage-v8": "5.0.5",
|
||||
"@vitest/ui": "5.0.5",
|
||||
"@vitest/coverage-istanbul": "5.1.0",
|
||||
"@vitest/coverage-v8": "5.1.0",
|
||||
"@vitest/ui": "5.1.0",
|
||||
"happy-dom": "*",
|
||||
"jsdom": "*",
|
||||
"vite": "^6.4.0 || ^7.0.0 || ^8.0.0"
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setuphelm",
|
||||
"version": "5.0.1",
|
||||
"version": "5.1.0",
|
||||
"private": true,
|
||||
"description": "Setup helm",
|
||||
"author": "Anumita Shenoy",
|
||||
@@ -12,7 +12,7 @@
|
||||
"@actions/io": "^3.0.2",
|
||||
"@actions/tool-cache": "4.0.0",
|
||||
"@octokit/action": "^8.0.4",
|
||||
"semver": "^7.8.5"
|
||||
"semver": "^7.8.6"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
@@ -25,7 +25,7 @@
|
||||
"prepare": "husky"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^26.6.5",
|
||||
"@types/node": "^26.6.6",
|
||||
"esbuild": "^0.28",
|
||||
"husky": "^9.1.7",
|
||||
"prettier": "^3.9.10",
|
||||
|
||||
+244
-9
@@ -1,5 +1,7 @@
|
||||
import {vi, describe, test, expect, afterEach} from 'vitest'
|
||||
import * as path from 'path'
|
||||
import {createHash} from 'crypto'
|
||||
import {Readable} from 'stream'
|
||||
|
||||
// Mock os module
|
||||
vi.mock('os', async (importOriginal) => {
|
||||
@@ -20,6 +22,7 @@ vi.mock('fs', async (importOriginal) => {
|
||||
statSync: vi.fn(),
|
||||
chmodSync: vi.fn(),
|
||||
readFileSync: vi.fn(),
|
||||
createReadStream: vi.fn(),
|
||||
existsSync: vi.fn()
|
||||
}
|
||||
})
|
||||
@@ -62,6 +65,18 @@ import * as core from '@actions/core'
|
||||
|
||||
describe('run.ts', () => {
|
||||
const downloadBaseURL = 'https://test.tld'
|
||||
const archive = Buffer.from('helm archive')
|
||||
const archiveChecksum = createHash('sha256').update(archive).digest('hex')
|
||||
|
||||
const mockVerifiedDownload = () => {
|
||||
vi.mocked(toolCache.downloadTool)
|
||||
.mockResolvedValueOnce('pathToChecksum')
|
||||
.mockResolvedValueOnce('pathToTool')
|
||||
vi.mocked(fs.readFileSync).mockReturnValue(archiveChecksum)
|
||||
vi.mocked(fs.createReadStream).mockReturnValue(
|
||||
Readable.from([archive]) as fs.ReadStream
|
||||
)
|
||||
}
|
||||
|
||||
// Cleanup mocks after each test to ensure that subsequent tests are not affected by the mocks.
|
||||
afterEach(() => {
|
||||
@@ -83,6 +98,19 @@ describe('run.ts', () => {
|
||||
expect(os.platform).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('getChecksumPolicy() - default to auto and reject invalid values', () => {
|
||||
expect(run.getChecksumPolicy('')).toBe('auto')
|
||||
expect(run.getChecksumPolicy(' REQUIRED ')).toBe('required')
|
||||
expect(() => run.getChecksumPolicy('warn')).toThrow(
|
||||
"Invalid checksum-policy 'warn'"
|
||||
)
|
||||
})
|
||||
|
||||
test('resolveChecksumPolicy() - auto verifies checksums when available', () => {
|
||||
expect(run.resolveChecksumPolicy('auto')).toBe('if-available')
|
||||
expect(run.resolveChecksumPolicy('required')).toBe('required')
|
||||
})
|
||||
|
||||
test('getHelmDownloadURL() - return the URL to download helm for Linux amd64', () => {
|
||||
vi.mocked(os.platform).mockReturnValue('linux')
|
||||
vi.mocked(os.arch).mockReturnValue('x64')
|
||||
@@ -365,12 +393,14 @@ describe('run.ts', () => {
|
||||
const inputs = (
|
||||
version: string,
|
||||
versionFile: string,
|
||||
latestFallback: string = ''
|
||||
latestFallback: string = '',
|
||||
downloadFallback: string = ''
|
||||
) =>
|
||||
vi.mocked(core.getInput).mockImplementation((name: string) => {
|
||||
if (name === 'version') return version
|
||||
if (name === 'version-file') return versionFile
|
||||
if (name === 'downloadBaseURL') return downloadBaseURL
|
||||
if (name === 'downloadBaseURLFallback') return downloadFallback
|
||||
if (name === 'latest-fallback') return latestFallback
|
||||
return ''
|
||||
})
|
||||
@@ -630,6 +660,29 @@ describe('run.ts', () => {
|
||||
expect(toolCache.find).toHaveBeenCalledWith('helm', 'v3.14.4')
|
||||
})
|
||||
|
||||
test('run() - resolve a major.minor version from the fallback mirror', async () => {
|
||||
stubDownloadChain()
|
||||
inputs('3.14', '', '', 'https://fallback.tld')
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
const url = String(input)
|
||||
if (url.startsWith(downloadBaseURL)) {
|
||||
throw new Error('Primary unavailable')
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
text: async () =>
|
||||
'<EnumerationResults><Blob><Name>helm-v3.14.4-linux-amd64.tar.gz</Name></Blob></EnumerationResults>'
|
||||
} as Response
|
||||
})
|
||||
|
||||
await run.run()
|
||||
|
||||
expect(toolCache.find).toHaveBeenCalledWith('helm', 'v3.14.4')
|
||||
expect(core.warning).toHaveBeenCalledWith(
|
||||
expect.stringContaining("Trying fallback 'https://fallback.tld'")
|
||||
)
|
||||
})
|
||||
|
||||
test('run() - resolve the latest patch for a wildcard patch version input', async () => {
|
||||
stubDownloadChain()
|
||||
inputs('v3.12.x', '')
|
||||
@@ -755,9 +808,7 @@ describe('run.ts', () => {
|
||||
|
||||
test('downloadHelm() - download helm and return path to it', async () => {
|
||||
vi.mocked(toolCache.find).mockReturnValue('')
|
||||
vi.mocked(toolCache.downloadTool).mockResolvedValue('pathToTool')
|
||||
const response = JSON.stringify([{tag_name: 'v4.0.0'}])
|
||||
vi.mocked(fs.readFileSync).mockReturnValue(response)
|
||||
mockVerifiedDownload()
|
||||
vi.mocked(os.platform).mockReturnValue('win32')
|
||||
vi.mocked(os.arch).mockReturnValue('x64')
|
||||
vi.mocked(fs.chmodSync).mockImplementation(() => {})
|
||||
@@ -776,7 +827,12 @@ describe('run.ts', () => {
|
||||
path.join('pathToCachedDir', 'helm.exe')
|
||||
)
|
||||
expect(toolCache.find).toHaveBeenCalledWith('helm', 'v4.0.0')
|
||||
expect(toolCache.downloadTool).toHaveBeenCalledWith(
|
||||
expect(toolCache.downloadTool).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
'https://test.tld/helm-v4.0.0-windows-amd64.zip.sha256'
|
||||
)
|
||||
expect(toolCache.downloadTool).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
'https://test.tld/helm-v4.0.0-windows-amd64.zip'
|
||||
)
|
||||
expect(fs.chmodSync).toHaveBeenCalledWith('pathToTool', '755')
|
||||
@@ -797,10 +853,12 @@ describe('run.ts', () => {
|
||||
|
||||
const downloadUrl = 'https://test.tld/helm-v3.2.1-windows-amd64.zip'
|
||||
await expect(run.downloadHelm(downloadBaseURL, 'v3.2.1')).rejects.toThrow(
|
||||
`Failed to download Helm from location ${downloadUrl}`
|
||||
`Failed to download and verify Helm from location ${downloadUrl}`
|
||||
)
|
||||
expect(toolCache.find).toHaveBeenCalledWith('helm', 'v3.2.1')
|
||||
expect(toolCache.downloadTool).toHaveBeenCalledWith(`${downloadUrl}`)
|
||||
expect(toolCache.downloadTool).toHaveBeenCalledWith(
|
||||
`${downloadUrl}.sha256`
|
||||
)
|
||||
})
|
||||
|
||||
test('downloadHelm() - return path to helm tool with same version from toolCache', async () => {
|
||||
@@ -832,9 +890,8 @@ describe('run.ts', () => {
|
||||
|
||||
test('downloadHelm() - throw error is helm is not found in path', async () => {
|
||||
vi.mocked(toolCache.find).mockReturnValue('')
|
||||
vi.mocked(toolCache.downloadTool).mockResolvedValue('pathToTool')
|
||||
mockVerifiedDownload()
|
||||
vi.mocked(toolCache.cacheDir).mockResolvedValue('pathToCachedDir')
|
||||
vi.mocked(toolCache.downloadTool).mockResolvedValue('pathToTool')
|
||||
vi.mocked(toolCache.extractZip).mockResolvedValue('extractedPath')
|
||||
vi.mocked(os.platform).mockReturnValue('win32')
|
||||
vi.mocked(os.arch).mockReturnValue('x64')
|
||||
@@ -856,4 +913,182 @@ describe('run.ts', () => {
|
||||
expect(fs.chmodSync).toHaveBeenCalledWith('pathToTool', '755')
|
||||
expect(toolCache.extractZip).toHaveBeenCalledWith('pathToTool')
|
||||
})
|
||||
|
||||
test('downloadAndVerifyHelm() - reject a checksum mismatch', async () => {
|
||||
vi.mocked(os.platform).mockReturnValue('linux')
|
||||
vi.mocked(os.arch).mockReturnValue('x64')
|
||||
vi.mocked(toolCache.downloadTool)
|
||||
.mockResolvedValueOnce('pathToChecksum')
|
||||
.mockResolvedValueOnce('pathToTool')
|
||||
vi.mocked(fs.readFileSync).mockReturnValue('0'.repeat(64))
|
||||
vi.mocked(fs.createReadStream).mockReturnValue(
|
||||
Readable.from([archive]) as fs.ReadStream
|
||||
)
|
||||
|
||||
await expect(
|
||||
run.downloadAndVerifyHelm(downloadBaseURL, 'v3.18.4')
|
||||
).rejects.toThrow('SHA-256 checksum mismatch')
|
||||
})
|
||||
|
||||
test('downloadAndVerifyHelm() - reject an invalid checksum file', async () => {
|
||||
vi.mocked(os.platform).mockReturnValue('linux')
|
||||
vi.mocked(os.arch).mockReturnValue('x64')
|
||||
vi.mocked(toolCache.downloadTool).mockResolvedValueOnce('pathToChecksum')
|
||||
vi.mocked(fs.readFileSync).mockReturnValue('not-a-checksum')
|
||||
|
||||
await expect(
|
||||
run.downloadAndVerifyHelm(downloadBaseURL, 'v3.18.4')
|
||||
).rejects.toThrow('Invalid SHA-256 checksum')
|
||||
})
|
||||
|
||||
test('downloadAndVerifyHelm() - auto mode warns and continues when a custom mirror has no checksum', async () => {
|
||||
vi.mocked(os.platform).mockReturnValue('linux')
|
||||
vi.mocked(os.arch).mockReturnValue('x64')
|
||||
vi.mocked(toolCache.downloadTool)
|
||||
.mockRejectedValueOnce(new toolCache.HTTPError(404))
|
||||
.mockResolvedValueOnce('pathToTool')
|
||||
|
||||
await expect(
|
||||
run.downloadAndVerifyHelm(downloadBaseURL, 'v3.18.4')
|
||||
).resolves.toBe('pathToTool')
|
||||
expect(toolCache.downloadTool).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
'https://test.tld/helm-v3.18.4-linux-amd64.tar.gz.sha256'
|
||||
)
|
||||
expect(toolCache.downloadTool).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
'https://test.tld/helm-v3.18.4-linux-amd64.tar.gz'
|
||||
)
|
||||
expect(core.warning).toHaveBeenCalledWith(
|
||||
expect.stringContaining('continuing without verification')
|
||||
)
|
||||
})
|
||||
|
||||
test('downloadAndVerifyHelm() - auto mode warns when get.helm.sh has no checksum', async () => {
|
||||
vi.mocked(os.platform).mockReturnValue('linux')
|
||||
vi.mocked(os.arch).mockReturnValue('x64')
|
||||
vi.mocked(toolCache.downloadTool)
|
||||
.mockRejectedValueOnce(new toolCache.HTTPError(404))
|
||||
.mockResolvedValueOnce('pathToTool')
|
||||
|
||||
await expect(
|
||||
run.downloadAndVerifyHelm('https://get.helm.sh', 'v3.18.4')
|
||||
).resolves.toBe('pathToTool')
|
||||
expect(toolCache.downloadTool).toHaveBeenCalledTimes(2)
|
||||
expect(core.warning).toHaveBeenCalledWith(
|
||||
expect.stringContaining('continuing without verification')
|
||||
)
|
||||
})
|
||||
|
||||
test('downloadAndVerifyHelm() - required mode blocks a missing checksum', async () => {
|
||||
vi.mocked(os.platform).mockReturnValue('linux')
|
||||
vi.mocked(os.arch).mockReturnValue('x64')
|
||||
vi.mocked(toolCache.downloadTool).mockRejectedValueOnce(
|
||||
new toolCache.HTTPError(404)
|
||||
)
|
||||
|
||||
await expect(
|
||||
run.downloadAndVerifyHelm(downloadBaseURL, 'v3.18.4', 'required')
|
||||
).rejects.toThrow('Unexpected HTTP response: 404')
|
||||
expect(toolCache.downloadTool).toHaveBeenCalledTimes(1)
|
||||
expect(core.warning).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('downloadAndVerifyHelm() - if-available mode does not ignore checksum server errors', async () => {
|
||||
vi.mocked(os.platform).mockReturnValue('linux')
|
||||
vi.mocked(os.arch).mockReturnValue('x64')
|
||||
vi.mocked(toolCache.downloadTool).mockRejectedValueOnce(
|
||||
new toolCache.HTTPError(503)
|
||||
)
|
||||
|
||||
await expect(
|
||||
run.downloadAndVerifyHelm(downloadBaseURL, 'v3.18.4', 'if-available')
|
||||
).rejects.toThrow('Unexpected HTTP response: 503')
|
||||
expect(toolCache.downloadTool).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
test('downloadAndVerifyHelm() - disabled mode downloads without requesting a checksum', async () => {
|
||||
vi.mocked(os.platform).mockReturnValue('linux')
|
||||
vi.mocked(os.arch).mockReturnValue('x64')
|
||||
vi.mocked(toolCache.downloadTool).mockResolvedValueOnce('pathToTool')
|
||||
|
||||
await expect(
|
||||
run.downloadAndVerifyHelm(downloadBaseURL, 'v3.18.4', 'disabled')
|
||||
).resolves.toBe('pathToTool')
|
||||
expect(toolCache.downloadTool).toHaveBeenCalledWith(
|
||||
'https://test.tld/helm-v3.18.4-linux-amd64.tar.gz'
|
||||
)
|
||||
expect(toolCache.downloadTool).toHaveBeenCalledTimes(1)
|
||||
expect(core.warning).toHaveBeenCalledWith(
|
||||
expect.stringContaining('Checksum verification is disabled')
|
||||
)
|
||||
})
|
||||
|
||||
test('downloadHelm() - use a verified fallback after a primary checksum mismatch', async () => {
|
||||
vi.mocked(toolCache.find).mockReturnValue('')
|
||||
vi.mocked(os.platform).mockReturnValue('win32')
|
||||
vi.mocked(os.arch).mockReturnValue('x64')
|
||||
vi.mocked(toolCache.downloadTool)
|
||||
.mockResolvedValueOnce('primaryChecksum')
|
||||
.mockResolvedValueOnce('primaryTool')
|
||||
.mockResolvedValueOnce('fallbackChecksum')
|
||||
.mockResolvedValueOnce('fallbackTool')
|
||||
vi.mocked(fs.readFileSync).mockImplementation((file) =>
|
||||
file === 'primaryChecksum' ? '0'.repeat(64) : archiveChecksum
|
||||
)
|
||||
vi.mocked(fs.createReadStream).mockImplementation(
|
||||
() => Readable.from([archive]) as fs.ReadStream
|
||||
)
|
||||
vi.mocked(fs.chmodSync).mockImplementation(() => {})
|
||||
vi.mocked(toolCache.extractZip).mockResolvedValue('extractedPath')
|
||||
vi.mocked(toolCache.cacheDir).mockResolvedValue('pathToCachedDir')
|
||||
vi.mocked(fs.readdirSync).mockReturnValue([
|
||||
'helm.exe' as unknown as fs.Dirent<NonSharedBuffer>
|
||||
])
|
||||
vi.mocked(fs.statSync).mockReturnValue({
|
||||
isDirectory: () => false
|
||||
} as fs.Stats)
|
||||
|
||||
expect(
|
||||
await run.downloadHelm(
|
||||
downloadBaseURL,
|
||||
'v3.18.4',
|
||||
'https://fallback.tld'
|
||||
)
|
||||
).toBe(path.join('pathToCachedDir', 'helm.exe'))
|
||||
expect(toolCache.downloadTool).toHaveBeenNthCalledWith(
|
||||
3,
|
||||
'https://fallback.tld/helm-v3.18.4-windows-amd64.zip.sha256'
|
||||
)
|
||||
expect(toolCache.downloadTool).toHaveBeenNthCalledWith(
|
||||
4,
|
||||
'https://fallback.tld/helm-v3.18.4-windows-amd64.zip'
|
||||
)
|
||||
expect(toolCache.extractZip).toHaveBeenCalledWith('fallbackTool')
|
||||
expect(core.warning).toHaveBeenCalledWith(
|
||||
expect.stringContaining('Trying fallback')
|
||||
)
|
||||
})
|
||||
|
||||
test('downloadHelm() - fail when primary and fallback verification fail', async () => {
|
||||
vi.mocked(toolCache.find).mockReturnValue('')
|
||||
vi.mocked(os.platform).mockReturnValue('linux')
|
||||
vi.mocked(os.arch).mockReturnValue('x64')
|
||||
vi.mocked(toolCache.downloadTool)
|
||||
.mockResolvedValueOnce('primaryChecksum')
|
||||
.mockResolvedValueOnce('primaryTool')
|
||||
.mockResolvedValueOnce('fallbackChecksum')
|
||||
.mockResolvedValueOnce('fallbackTool')
|
||||
vi.mocked(fs.readFileSync).mockReturnValue('0'.repeat(64))
|
||||
vi.mocked(fs.createReadStream).mockImplementation(
|
||||
() => Readable.from([archive]) as fs.ReadStream
|
||||
)
|
||||
|
||||
await expect(
|
||||
run.downloadHelm(downloadBaseURL, 'v3.18.4', 'https://fallback.tld')
|
||||
).rejects.toThrow(
|
||||
"Failed to download and verify Helm from 'https://test.tld' and fallback 'https://fallback.tld'"
|
||||
)
|
||||
expect(toolCache.extractTar).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
+144
-10
@@ -5,6 +5,7 @@ import * as os from 'os'
|
||||
import * as path from 'path'
|
||||
import * as util from 'util'
|
||||
import * as fs from 'fs'
|
||||
import {createHash} from 'crypto'
|
||||
|
||||
import * as toolCache from '@actions/tool-cache'
|
||||
import * as core from '@actions/core'
|
||||
@@ -12,6 +13,8 @@ import * as core from '@actions/core'
|
||||
const helmToolName = 'helm'
|
||||
export const stableHelmVersion = 'v4.3.1'
|
||||
|
||||
export type ChecksumPolicy = 'auto' | 'required' | 'if-available' | 'disabled'
|
||||
|
||||
export async function run() {
|
||||
let version = core.getInput('version')
|
||||
const versionFile = core.getInput('version-file')
|
||||
@@ -32,6 +35,12 @@ export async function run() {
|
||||
}
|
||||
|
||||
const downloadBaseURL = core.getInput('downloadBaseURL', {required: false})
|
||||
const downloadBaseURLFallback = core.getInput('downloadBaseURLFallback', {
|
||||
required: false
|
||||
})
|
||||
const checksumPolicy = getChecksumPolicy(
|
||||
core.getInput('checksum-policy', {required: false})
|
||||
)
|
||||
|
||||
if (version.toLocaleLowerCase() === 'latest') {
|
||||
// Only an explicit 'false' turns the fallback off, matching the
|
||||
@@ -40,7 +49,20 @@ export async function run() {
|
||||
core.getInput('latest-fallback').toLowerCase() !== 'false'
|
||||
version = await getLatestHelmVersion(fallbackToDefault)
|
||||
} else if (isMajorMinorShaped(version)) {
|
||||
version = await resolveLatestPatchVersion(downloadBaseURL, version)
|
||||
try {
|
||||
version = await resolveLatestPatchVersion(downloadBaseURL, version)
|
||||
} catch (error) {
|
||||
if (!downloadBaseURLFallback) {
|
||||
throw error
|
||||
}
|
||||
core.warning(
|
||||
`Unable to resolve the latest Helm patch from '${downloadBaseURL}': ${error instanceof Error ? error.message : String(error)}. Trying fallback '${downloadBaseURLFallback}'`
|
||||
)
|
||||
version = await resolveLatestPatchVersion(
|
||||
downloadBaseURLFallback,
|
||||
version
|
||||
)
|
||||
}
|
||||
core.info(`Resolved latest patch Helm version to '${version}'`)
|
||||
} else if (version[0] !== 'v') {
|
||||
version = getValidVersion(version)
|
||||
@@ -48,7 +70,12 @@ export async function run() {
|
||||
}
|
||||
|
||||
core.startGroup(`Installing ${version}`)
|
||||
const cachedPath = await downloadHelm(downloadBaseURL, version)
|
||||
const cachedPath = await downloadHelm(
|
||||
downloadBaseURL,
|
||||
version,
|
||||
downloadBaseURLFallback,
|
||||
checksumPolicy
|
||||
)
|
||||
core.endGroup()
|
||||
|
||||
try {
|
||||
@@ -68,6 +95,21 @@ export function getValidVersion(version: string): string {
|
||||
return 'v' + version
|
||||
}
|
||||
|
||||
export function getChecksumPolicy(value: string): ChecksumPolicy {
|
||||
const policy = value.trim().toLowerCase() || 'auto'
|
||||
if (
|
||||
policy !== 'auto' &&
|
||||
policy !== 'required' &&
|
||||
policy !== 'if-available' &&
|
||||
policy !== 'disabled'
|
||||
) {
|
||||
throw new Error(
|
||||
`Invalid checksum-policy '${value}'. Expected auto, required, if-available, or disabled`
|
||||
)
|
||||
}
|
||||
return policy
|
||||
}
|
||||
|
||||
// Matches a complete semantic version (major.minor.patch with optional
|
||||
// pre-release / build metadata). This is the official regex suggested at
|
||||
// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
|
||||
@@ -336,9 +378,76 @@ export function getHelmDownloadURL(baseURL: string, version: string): string {
|
||||
return url.toString()
|
||||
}
|
||||
|
||||
export async function downloadAndVerifyHelm(
|
||||
baseURL: string,
|
||||
version: string,
|
||||
policy: ChecksumPolicy = 'auto'
|
||||
): Promise<string> {
|
||||
const downloadURL = getHelmDownloadURL(baseURL, version)
|
||||
const effectivePolicy = resolveChecksumPolicy(policy)
|
||||
|
||||
if (effectivePolicy === 'disabled') {
|
||||
core.warning(
|
||||
`Checksum verification is disabled for Helm downloads from '${baseURL}'`
|
||||
)
|
||||
return toolCache.downloadTool(downloadURL)
|
||||
}
|
||||
|
||||
let checksum: string | undefined
|
||||
try {
|
||||
const checksumPath = await toolCache.downloadTool(`${downloadURL}.sha256`)
|
||||
checksum = fs.readFileSync(checksumPath, 'utf8').trim()
|
||||
} catch (error) {
|
||||
if (
|
||||
effectivePolicy === 'if-available' &&
|
||||
isChecksumNotFoundError(error)
|
||||
) {
|
||||
core.warning(
|
||||
`No SHA-256 checksum is available for ${downloadURL}; continuing without verification. Set checksum-policy to 'required' to fail instead.`
|
||||
)
|
||||
return toolCache.downloadTool(downloadURL)
|
||||
}
|
||||
throw error
|
||||
}
|
||||
|
||||
if (!/^[a-fA-F0-9]{64}$/.test(checksum)) {
|
||||
throw new Error(`Invalid SHA-256 checksum from ${downloadURL}.sha256`)
|
||||
}
|
||||
|
||||
const archivePath = await toolCache.downloadTool(downloadURL)
|
||||
const hash = createHash('sha256')
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const archive = fs.createReadStream(archivePath)
|
||||
archive.on('data', (chunk) => hash.update(chunk))
|
||||
archive.on('error', reject)
|
||||
archive.on('end', resolve)
|
||||
})
|
||||
const actual = hash.digest('hex')
|
||||
if (actual.toLowerCase() !== checksum.toLowerCase()) {
|
||||
throw new Error(`SHA-256 checksum mismatch for ${downloadURL}`)
|
||||
}
|
||||
|
||||
return archivePath
|
||||
}
|
||||
|
||||
export function resolveChecksumPolicy(
|
||||
policy: ChecksumPolicy
|
||||
): Exclude<ChecksumPolicy, 'auto'> {
|
||||
return policy === 'auto' ? 'if-available' : policy
|
||||
}
|
||||
|
||||
function isChecksumNotFoundError(error: unknown): boolean {
|
||||
return (
|
||||
error instanceof toolCache.HTTPError &&
|
||||
(error.httpStatusCode === 404 || error.httpStatusCode === 410)
|
||||
)
|
||||
}
|
||||
|
||||
export async function downloadHelm(
|
||||
baseURL: string,
|
||||
version: string
|
||||
version: string,
|
||||
fallbackBaseURL?: string,
|
||||
checksumPolicy: ChecksumPolicy = 'auto'
|
||||
): Promise<string> {
|
||||
let cachedToolpath = toolCache.find(helmToolName, version)
|
||||
if (cachedToolpath) {
|
||||
@@ -347,15 +456,40 @@ export async function downloadHelm(
|
||||
core.info(`Downloading '${version}' from '${baseURL}'`)
|
||||
let helmDownloadPath
|
||||
try {
|
||||
helmDownloadPath = await toolCache.downloadTool(
|
||||
getHelmDownloadURL(baseURL, version)
|
||||
helmDownloadPath = await downloadAndVerifyHelm(
|
||||
baseURL,
|
||||
version,
|
||||
checksumPolicy
|
||||
)
|
||||
} catch (exception) {
|
||||
} catch (error) {
|
||||
if (fallbackBaseURL) {
|
||||
core.warning(
|
||||
`Unable to download and verify Helm from '${baseURL}': ${error instanceof Error ? error.message : String(error)}. Trying fallback '${fallbackBaseURL}'`
|
||||
)
|
||||
try {
|
||||
helmDownloadPath = await downloadAndVerifyHelm(
|
||||
fallbackBaseURL,
|
||||
version,
|
||||
checksumPolicy
|
||||
)
|
||||
} catch (fallbackError) {
|
||||
throw new Error(
|
||||
`Failed to download and verify Helm from '${baseURL}' and fallback '${fallbackBaseURL}': ${fallbackError instanceof Error ? fallbackError.message : String(fallbackError)}`
|
||||
)
|
||||
}
|
||||
} else {
|
||||
throw new Error(
|
||||
`Failed to download and verify Helm from location ${getHelmDownloadURL(
|
||||
baseURL,
|
||||
version
|
||||
)}: ${error instanceof Error ? error.message : String(error)}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (!helmDownloadPath) {
|
||||
throw new Error(
|
||||
`Failed to download Helm from location ${getHelmDownloadURL(
|
||||
baseURL,
|
||||
version
|
||||
)}`
|
||||
`Failed to download and verify Helm version '${version}'`
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user