mirror of
https://github.com/Azure/setup-helm.git
synced 2025-11-07 13:06:56 +00:00
Merge branch 'main' into default-version
This commit is contained in:
commit
deb4c049e1
8 changed files with 1002 additions and 3819 deletions
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
|
@ -1 +1 @@
|
|||
* @Azure/aks-atlanta
|
||||
* @Azure/cloud-native-github-action-owners
|
||||
|
|
|
|||
3
.github/workflows/integration-tests.yml
vendored
3
.github/workflows/integration-tests.yml
vendored
|
|
@ -76,7 +76,8 @@ jobs:
|
|||
--repo helm/helm \
|
||||
--exclude-drafts \
|
||||
--exclude-pre-releases \
|
||||
--limit 1 | awk '{print $4}')
|
||||
--json name,isLatest \
|
||||
--jq '.[] | select(.isLatest)|.name' | awk '{print $2}')
|
||||
|
||||
if [[ $(helm version) != *$HELM_LATEST* ]]; then
|
||||
echo "HELM VERSION INCORRECT: HELM VERSION DOES NOT CONTAIN $HELM_LATEST"
|
||||
|
|
|
|||
2
.github/workflows/release-pr.yml
vendored
2
.github/workflows/release-pr.yml
vendored
|
|
@ -13,6 +13,6 @@ jobs:
|
|||
permissions:
|
||||
actions: read
|
||||
contents: write
|
||||
uses: Azure/action-release-workflows/.github/workflows/release_js_project.yaml@1b199cc979febcb43526d33853f2d71183091cdb # v1.0.2
|
||||
uses: Azure/action-release-workflows/.github/workflows/release_js_project.yaml@3c677ba5ab58f5c5c1a6f0cfb176b333b1f27405 # v1.0.3
|
||||
with:
|
||||
changelogPath: ./CHANGELOG.md
|
||||
|
|
|
|||
7
.husky/pre-commit
Normal file
7
.husky/pre-commit
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
npm test
|
||||
npm run format-check || {
|
||||
echo ""
|
||||
echo "❌ Formatting check failed."
|
||||
echo "💡 Run 'npm run format' or 'prettier --write .' to fix formatting issues."
|
||||
exit 1
|
||||
}
|
||||
4773
package-lock.json
generated
4773
package-lock.json
generated
File diff suppressed because it is too large
Load diff
15
package.json
15
package.json
|
|
@ -15,20 +15,21 @@
|
|||
},
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"prebuild": "npm i ncc",
|
||||
"build": "ncc build src/index.ts -o lib",
|
||||
"test": "jest",
|
||||
"test-coverage": "jest --coverage",
|
||||
"format": "prettier --write .",
|
||||
"format-check": "prettier --check ."
|
||||
"format-check": "prettier --check .",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/node": "^24.0.1",
|
||||
"@types/node": "^24.1.0",
|
||||
"@vercel/ncc": "^0.38.3",
|
||||
"jest": "^30.0.0",
|
||||
"prettier": "^3.5.3",
|
||||
"ts-jest": "^29.4.0",
|
||||
"typescript": "^5.8.3"
|
||||
"husky": "^9.1.7",
|
||||
"jest": "^30.0.5",
|
||||
"prettier": "^3.6.2",
|
||||
"ts-jest": "^29.4.1",
|
||||
"typescript": "^5.9.2"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ describe('run.ts', () => {
|
|||
expect(os.arch).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('getHelmDownloadURL() - return the URL to download helm for Windows', () => {
|
||||
test('getHelmDownloadURL() - return the URL to download helm for Windows x64', () => {
|
||||
jest.spyOn(os, 'platform').mockReturnValue('win32')
|
||||
jest.spyOn(os, 'arch').mockReturnValue('x64')
|
||||
|
||||
|
|
@ -76,6 +76,15 @@ describe('run.ts', () => {
|
|||
expect(os.platform).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('getHelmDownloadURL() - return the URL to download helm for Windows arm64', () => {
|
||||
jest.spyOn(os, 'platform').mockReturnValue('win32')
|
||||
jest.spyOn(os, 'arch').mockReturnValue('arm64')
|
||||
|
||||
const expected = 'https://test.tld/helm-v3.8.0-windows-arm64.zip'
|
||||
expect(run.getHelmDownloadURL(downloadBaseURL, 'v3.8.0')).toBe(expected)
|
||||
expect(os.platform).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('getLatestHelmVersion() - return the latest version of HELM', async () => {
|
||||
const res = {
|
||||
status: 200,
|
||||
|
|
@ -88,7 +97,7 @@ describe('run.ts', () => {
|
|||
test('getLatestHelmVersion() - return the stable version of HELM when simulating a network error', async () => {
|
||||
const errorMessage: string = 'Network Error'
|
||||
global.fetch = jest.fn().mockRejectedValueOnce(new Error(errorMessage))
|
||||
expect(await run.getLatestHelmVersion()).toBe('v3.18.3')
|
||||
expect(await run.getLatestHelmVersion()).toBe(run.stableHelmVersion)
|
||||
})
|
||||
|
||||
test('getValidVersion() - return version with v prepended', () => {
|
||||
|
|
@ -204,6 +213,7 @@ describe('run.ts', () => {
|
|||
const response = JSON.stringify([{tag_name: 'v4.0.0'}])
|
||||
jest.spyOn(fs, 'readFileSync').mockReturnValue(response)
|
||||
jest.spyOn(os, 'platform').mockReturnValue('win32')
|
||||
jest.spyOn(os, 'arch').mockReturnValue('x64')
|
||||
jest.spyOn(fs, 'chmodSync').mockImplementation(() => {})
|
||||
jest.spyOn(toolCache, 'extractZip').mockResolvedValue('extractedPath')
|
||||
jest.spyOn(toolCache, 'cacheDir').mockResolvedValue('pathToCachedDir')
|
||||
|
|
@ -239,6 +249,7 @@ describe('run.ts', () => {
|
|||
throw 'Unable to download'
|
||||
})
|
||||
jest.spyOn(os, 'platform').mockReturnValue('win32')
|
||||
jest.spyOn(os, 'arch').mockReturnValue('x64')
|
||||
|
||||
const downloadUrl = 'https://test.tld/helm-v3.2.1-windows-amd64.zip'
|
||||
await expect(run.downloadHelm(downloadBaseURL, 'v3.2.1')).rejects.toThrow(
|
||||
|
|
@ -254,6 +265,7 @@ describe('run.ts', () => {
|
|||
jest.spyOn(toolCache, 'downloadTool').mockResolvedValue('pathToTool')
|
||||
jest.spyOn(toolCache, 'extractZip').mockResolvedValue('extractedPath')
|
||||
jest.spyOn(os, 'platform').mockReturnValue('win32')
|
||||
jest.spyOn(os, 'arch').mockReturnValue('x64')
|
||||
jest.spyOn(fs, 'chmodSync').mockImplementation(() => {})
|
||||
jest
|
||||
.spyOn(fs, 'readdirSync')
|
||||
|
|
@ -283,6 +295,7 @@ describe('run.ts', () => {
|
|||
jest.spyOn(toolCache, 'downloadTool').mockResolvedValue('pathToTool')
|
||||
jest.spyOn(toolCache, 'extractZip').mockResolvedValue('extractedPath')
|
||||
jest.spyOn(os, 'platform').mockReturnValue('win32')
|
||||
jest.spyOn(os, 'arch').mockReturnValue('x64')
|
||||
jest.spyOn(fs, 'chmodSync').mockImplementation()
|
||||
jest.spyOn(fs, 'readdirSync').mockImplementation((file, _) => [])
|
||||
jest.spyOn(fs, 'statSync').mockImplementation((file) => {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import * as toolCache from '@actions/tool-cache'
|
|||
import * as core from '@actions/core'
|
||||
|
||||
const helmToolName = 'helm'
|
||||
const stableHelmVersion = 'v3.18.3'
|
||||
export const stableHelmVersion = 'v3.18.3'
|
||||
|
||||
export async function run() {
|
||||
let version = core.getInput('version', {required: true})
|
||||
|
|
|
|||
Loading…
Reference in a new issue