mirror of
https://github.com/imranismail/setup-kustomize.git
synced 2026-05-19 05:02:16 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ba527d4d0 | ||
|
|
a76db1c641 | ||
|
|
6691bdeb1b | ||
|
|
86a0af5aa8 | ||
|
|
8757bab9d6 | ||
|
|
32e634d4e0 | ||
|
|
5f57b3222d | ||
|
|
9e8cf604e6 | ||
|
|
da3f4f22f0 | ||
|
|
841007459d |
@@ -44,7 +44,8 @@
|
||||
"semi": "off",
|
||||
"@typescript-eslint/semi": ["error", "never"],
|
||||
"@typescript-eslint/type-annotation-spacing": "error",
|
||||
"@typescript-eslint/unbound-method": "error"
|
||||
"@typescript-eslint/unbound-method": "error",
|
||||
"i18n-text/no-en": "off"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
|
||||
@@ -1 +1 @@
|
||||
nodejs 17.7.1
|
||||
nodejs 20.8.1
|
||||
42
CHANGELOG.MD
42
CHANGELOG.MD
@@ -1,42 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
## v1.5.2
|
||||
|
||||
### Security
|
||||
|
||||
- Bump @actions/core to v1.2.6 to address deprecations raised in #30
|
||||
|
||||
## v1.5.1
|
||||
|
||||
### Changed
|
||||
|
||||
- Cache kustomize by requested version spec as key
|
||||
|
||||
## v1.5.0
|
||||
|
||||
### Changed
|
||||
|
||||
- Simplified asset look up
|
||||
|
||||
## v1.4.0
|
||||
|
||||
### Added
|
||||
|
||||
- Adds support for semver version ranges. Example: 3.x, 3.2.x
|
||||
- Add a step in the workflow to test the action with default value
|
||||
|
||||
## v1.2.0
|
||||
|
||||
N/A
|
||||
|
||||
## v1.1.0
|
||||
|
||||
### Fixed
|
||||
|
||||
- Support for new download path for kustomize
|
||||
|
||||
## v1.0.0
|
||||
|
||||
### Changed
|
||||
|
||||
- Update metadata
|
||||
@@ -12,7 +12,7 @@ Every argument is optional.
|
||||
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `github-token` | PAT (Personal Access Token) for authorizing the repository.<br>_Defaults to **\${{ github.token }}**_ |
|
||||
| `kustomize-version` | Semver of kustomize to use. Examples: `10.x`, `10.15.1`, `>=10.15.0`<br>_Defaults to **\***_ |
|
||||
| `fail-fast` | When github rate limits us, fail immediately or retry after the timeout that github wishes from us? Note: When setting this to `false` (which is the default!), a github workflow might accrue a long (and possibly expensive) runtime. |
|
||||
| `fail-fast` | When github rate limits us, fail immediately or retry after the timeout that github wishes from us? <br>Note: When this is set to `false`, a github workflow might accrue a long (and possibly expensive) runtime.<br>_Defaults to **true**_ |
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
needs:
|
||||
- publish-image
|
||||
steps:
|
||||
- uses: imranismail/setup-kustomize@v1
|
||||
- uses: imranismail/setup-kustomize@v2
|
||||
- run: |
|
||||
kustomize edit set image app:${GITHUB_SHA}
|
||||
git add .
|
||||
|
||||
@@ -8,6 +8,7 @@ const tempDir = path.join(__dirname, 'runner', 'temp')
|
||||
|
||||
process.env['RUNNER_TOOL_CACHE'] = toolDir
|
||||
process.env['RUNNER_TEMP'] = tempDir
|
||||
process.env['INPUT_FAIL-FAST'] = 'true'
|
||||
|
||||
import * as installer from '../src/installer'
|
||||
|
||||
@@ -34,6 +35,22 @@ describe('installer tests', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('Acquires kustomize version 5.2.1', async () => {
|
||||
await installer.getKustomize('5.2.1')
|
||||
const kustomizeDir = path.join(toolDir, 'kustomize', '5.2.1', os.arch())
|
||||
|
||||
expect(fs.existsSync(`${kustomizeDir}.complete`)).toBe(true)
|
||||
|
||||
if (IS_WINDOWS) {
|
||||
expect(fs.existsSync(path.join(kustomizeDir, 'kustomize.exe'))).toBe(true)
|
||||
} else {
|
||||
expect(fs.existsSync(path.join(kustomizeDir, 'kustomize'))).toBe(true)
|
||||
expect(() =>
|
||||
fs.accessSync(path.join(kustomizeDir, 'kustomize'), fs.constants.X_OK)
|
||||
).not.toThrow()
|
||||
}
|
||||
})
|
||||
|
||||
it('Acquires kustomize version 3.2.0', async () => {
|
||||
await installer.getKustomize('3.2.0')
|
||||
const kustomizeDir = path.join(toolDir, 'kustomize', '3.2.0', os.arch())
|
||||
|
||||
@@ -16,7 +16,7 @@ inputs:
|
||||
fail-fast:
|
||||
description: 'Fail quickly on github rate limit. "false" or "true".'
|
||||
required: false
|
||||
default: 'false'
|
||||
default: 'true'
|
||||
runs:
|
||||
using: 'node12'
|
||||
using: 'node20'
|
||||
main: 'dist/index.js'
|
||||
|
||||
40260
dist/index.js
vendored
40260
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
135
dist/licenses.txt
vendored
135
dist/licenses.txt
vendored
@@ -12,9 +12,27 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
@actions/exec
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
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.
|
||||
|
||||
@actions/github
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
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.
|
||||
|
||||
@actions/http-client
|
||||
MIT
|
||||
@@ -65,6 +83,28 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
|
||||
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.
|
||||
|
||||
@fastify/busboy
|
||||
MIT
|
||||
Copyright Brian White. 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.
|
||||
|
||||
@octokit/auth-token
|
||||
MIT
|
||||
The MIT License
|
||||
@@ -262,16 +302,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
@vercel/ncc
|
||||
MIT
|
||||
Copyright 2018 ZEIT, Inc.
|
||||
|
||||
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.
|
||||
|
||||
before-after-hook
|
||||
Apache-2.0
|
||||
Apache License
|
||||
@@ -564,32 +594,6 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
node-fetch
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 David Frank
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
once
|
||||
ISC
|
||||
The ISC License
|
||||
@@ -628,9 +632,6 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
tr46
|
||||
MIT
|
||||
|
||||
tunnel
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
@@ -656,22 +657,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
universal-user-agent
|
||||
ISC
|
||||
# [ISC License](https://spdx.org/licenses/ISC)
|
||||
|
||||
Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m)
|
||||
|
||||
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.
|
||||
|
||||
|
||||
uuid
|
||||
undici
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2010-2016 Robert Kieffer and other contributors
|
||||
Copyright (c) Matteo Collina and Undici contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -692,45 +682,28 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
webidl-conversions
|
||||
BSD-2-Clause
|
||||
# The BSD 2-Clause License
|
||||
universal-user-agent
|
||||
ISC
|
||||
# [ISC License](https://spdx.org/licenses/ISC)
|
||||
|
||||
Copyright (c) 2014, Domenic Denicola
|
||||
All rights reserved.
|
||||
Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
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.
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
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.
|
||||
|
||||
|
||||
whatwg-url
|
||||
uuid
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015–2016 Sebastian Mayr
|
||||
Copyright (c) 2010-2020 Robert Kieffer and other contributors
|
||||
|
||||
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:
|
||||
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 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.
|
||||
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.
|
||||
|
||||
|
||||
wrappy
|
||||
|
||||
2
dist/sourcemap-register.js
vendored
2
dist/sourcemap-register.js
vendored
File diff suppressed because one or more lines are too long
15741
package-lock.json
generated
15741
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
34
package.json
34
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-kustomize",
|
||||
"version": "1.6.1",
|
||||
"version": "2.1.0",
|
||||
"private": true,
|
||||
"description": "Github action to setup-kustomize",
|
||||
"main": "lib/main.js",
|
||||
@@ -26,26 +26,26 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/github": "^4.0.0",
|
||||
"@actions/github": "^6.0.0",
|
||||
"@actions/io": "^1.1.1",
|
||||
"@actions/tool-cache": "^1.7.1",
|
||||
"@octokit/plugin-throttling": "^3.4.1",
|
||||
"semver": "^7.3.2"
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"@octokit/plugin-throttling": "^8.0.1",
|
||||
"semver": "^7.5.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/node": "~17.0",
|
||||
"@types/jest": "^29.5.6",
|
||||
"@types/node": "^20.8.8",
|
||||
"@types/semver": "^7.3.9",
|
||||
"@typescript-eslint/parser": "^4.8.1",
|
||||
"@vercel/ncc": "^0.33.3",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-github": "^4.1.1",
|
||||
"eslint-plugin-jest": "^24.1.3",
|
||||
"jest": "^26.6.3",
|
||||
"jest-circus": "^26.6.3",
|
||||
"@typescript-eslint/parser": "^6.9.0",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.52.0",
|
||||
"eslint-plugin-github": "^4.10.1",
|
||||
"eslint-plugin-jest": "^27.4.3",
|
||||
"jest": "^29.7.0",
|
||||
"jest-circus": "^29.7.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"prettier": "2.5.1",
|
||||
"ts-jest": "^26.4.4",
|
||||
"typescript": "^4.1.3"
|
||||
"prettier": "^3.0.3",
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {GitHub, getOctokitOptions} from '@actions/github/lib/utils'
|
||||
import {OctokitOptions} from '@octokit/core/dist-types/types'
|
||||
import {OctokitOptions} from '@octokit/core/dist-types/types.d'
|
||||
import {throttling} from '@octokit/plugin-throttling'
|
||||
import * as core from '@actions/core'
|
||||
import * as cache from '@actions/tool-cache'
|
||||
@@ -11,7 +11,7 @@ let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || ''
|
||||
const EnhancedOctokit = GitHub.plugin(throttling)
|
||||
|
||||
const githubToken = core.getInput('github-token')
|
||||
const failFast = core.getInput('fail-fast') === 'true' ? true : false
|
||||
const failFast = core.getBooleanInput('fail-fast')
|
||||
|
||||
let options: OctokitOptions = {
|
||||
throttle: {
|
||||
@@ -24,7 +24,7 @@ let options: OctokitOptions = {
|
||||
}
|
||||
return !failFast
|
||||
},
|
||||
onAbuseLimit: (retryAfter: Number, opts: OctokitOptions) => {
|
||||
onSecondaryRateLimit: (retryAfter: Number, opts: OctokitOptions) => {
|
||||
core.warning(`Abuse detected for request ${opts.method} ${opts.url}`)
|
||||
if (!failFast) {
|
||||
core.warning(`Retrying after ${retryAfter} seconds!`)
|
||||
@@ -65,10 +65,14 @@ export async function getKustomize(targetVersion: string): Promise<void> {
|
||||
if (!semver.validRange(targetVersion))
|
||||
throw new Error(`invalid semver requested: ${targetVersion}`)
|
||||
|
||||
const resolver = semver.valid(targetVersion)
|
||||
? getPinnedVersion
|
||||
: getMaxSatisfyingVersion
|
||||
|
||||
let kustomizePath = cache.find('kustomize', targetVersion)
|
||||
|
||||
if (!kustomizePath) {
|
||||
const version = await getMaxSatisfyingVersion(targetVersion)
|
||||
const version = await resolver(targetVersion)
|
||||
kustomizePath = await acquireVersion(version)
|
||||
}
|
||||
|
||||
@@ -81,6 +85,55 @@ interface Version {
|
||||
url: string
|
||||
}
|
||||
|
||||
async function getPinnedVersion(targetVersion: string): Promise<Version> {
|
||||
const prefix = semver.gt(targetVersion, '3.2.0') ? 'kustomize/v' : 'v'
|
||||
|
||||
try {
|
||||
const response = await octokit.rest.repos.getReleaseByTag({
|
||||
owner: 'kubernetes-sigs',
|
||||
repo: 'kustomize',
|
||||
tag: prefix + targetVersion
|
||||
})
|
||||
|
||||
if (response.status !== 200) {
|
||||
throw new Error(`Invalid response status ${response.status}`)
|
||||
}
|
||||
|
||||
const release = response.data
|
||||
|
||||
const matchingAsset = release.assets.find(
|
||||
asset =>
|
||||
asset.name.includes('kustomize') &&
|
||||
asset.name.includes(platform) &&
|
||||
asset.name.includes(arch)
|
||||
)
|
||||
|
||||
if (matchingAsset) {
|
||||
const kustomizeVersion = (
|
||||
versionRegex.exec(release.tag_name) || []
|
||||
).shift()
|
||||
|
||||
if (kustomizeVersion != null) {
|
||||
return {
|
||||
target: targetVersion,
|
||||
resolved: kustomizeVersion,
|
||||
url: matchingAsset.browser_download_url
|
||||
}
|
||||
} else {
|
||||
throw new Error(
|
||||
`Could not find version in release tag ${release.tag_name}`
|
||||
)
|
||||
}
|
||||
} else {
|
||||
throw new Error(
|
||||
`Could not find asset for platform '${platform}' and '${arch}'.`
|
||||
)
|
||||
}
|
||||
} catch (err) {
|
||||
throw new Error(`Could not satisfy version range ${targetVersion}: ${err}`)
|
||||
}
|
||||
}
|
||||
|
||||
async function getMaxSatisfyingVersion(
|
||||
targetVersion: string
|
||||
): Promise<Version> {
|
||||
@@ -88,10 +141,11 @@ async function getMaxSatisfyingVersion(
|
||||
const availableVersions: Map<string, string> = new Map()
|
||||
|
||||
for await (const response of octokit.paginate.iterator(
|
||||
octokit.repos.listReleases,
|
||||
octokit.rest.repos.listReleases,
|
||||
{
|
||||
owner: 'kubernetes-sigs',
|
||||
repo: 'kustomize'
|
||||
repo: 'kustomize',
|
||||
per_page: 100
|
||||
}
|
||||
)) {
|
||||
for (const release of response.data) {
|
||||
@@ -124,7 +178,8 @@ async function getMaxSatisfyingVersion(
|
||||
|
||||
if (!resolved) {
|
||||
throw new Error(
|
||||
`Unable to find Kustomize version '${version.target}' for platform '${platform}' and architecture ${arch}.`
|
||||
`Could not satisfy version '${version.target}': Could not find asset for platform '${platform}' and
|
||||
${arch}'.`
|
||||
)
|
||||
}
|
||||
|
||||
@@ -141,7 +196,6 @@ async function acquireVersion(version: Version): Promise<string> {
|
||||
try {
|
||||
toolPath = await cache.downloadTool(version.url)
|
||||
} catch (err) {
|
||||
core.debug(err)
|
||||
throw new Error(`Failed to download version ${version.target}: ${err}`)
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ async function run(): Promise<void> {
|
||||
await installer.getKustomize(version)
|
||||
}
|
||||
} catch (error) {
|
||||
core.setFailed(error.message)
|
||||
core.setFailed(`${error}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user