1 Commits

Author SHA1 Message Date
GitHub Action
0c5e050edf build 2025-02-07 20:01:06 +00:00
7 changed files with 1968 additions and 3326 deletions

View File

@@ -59,7 +59,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
uses: github/codeql-action/init@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
@@ -86,6 +86,6 @@ jobs:
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
uses: github/codeql-action/analyze@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6
with:
category: '/language:${{matrix.language}}'

View File

@@ -29,7 +29,7 @@ jobs:
npm run build
fi
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
name: Install Python
with:
python-version: '3.x'

View File

@@ -13,7 +13,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: 'lts/*'
cache: 'npm'

View File

@@ -1,11 +1,6 @@
# Changelog
## [4.0.1] - 2025-06-17
- Remove erronious 'v' prefix on previous changelog for v4.0.0 that led to "vv4.0.0" tag issue
- Dependabot fixes
## [4.0.0] - 2024-01-30
## [v4.0.0] - 2024-01-30
### Changed

5229
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -24,12 +24,12 @@
"ncc": "^0.3.6"
},
"devDependencies": {
"@types/jest": "^30.0.0",
"@types/node": "^24.0.2",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.10",
"@vercel/ncc": "^0.38.3",
"jest": "^30.0.0",
"prettier": "3.5.3",
"ts-jest": "^29.4.0",
"typescript": "5.8.3"
"jest": "^29.7.0",
"prettier": "3.4.2",
"ts-jest": "^29.2.5",
"typescript": "5.7.3"
}
}

View File

@@ -15,12 +15,12 @@ describe('Testing all functions in run file.', () => {
test('getExecutableExtension() - return .exe when os is Windows', () => {
jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
expect(getExecutableExtension()).toBe('.exe')
expect(os.type).toHaveBeenCalled()
expect(os.type).toBeCalled()
})
test('getExecutableExtension() - return empty string for non-windows OS', () => {
jest.spyOn(os, 'type').mockReturnValue('Darwin')
expect(getExecutableExtension()).toBe('')
expect(os.type).toHaveBeenCalled()
expect(os.type).toBeCalled()
})
test.each([
['arm', 'arm'],
@@ -29,9 +29,9 @@ describe('Testing all functions in run file.', () => {
])(
'getKubectlArch() - return on %s os arch %s kubectl arch',
(osArch, kubectlArch) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch as NodeJS.Architecture)
jest.spyOn(os, 'arch').mockReturnValue(osArch)
expect(getKubectlArch()).toBe(kubectlArch)
expect(os.arch).toHaveBeenCalled()
expect(os.arch).toBeCalled()
}
)
test.each([['arm'], ['arm64'], ['amd64']])(
@@ -43,7 +43,7 @@ describe('Testing all functions in run file.', () => {
arch
)
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlLinuxUrl)
expect(os.type).toHaveBeenCalled()
expect(os.type).toBeCalled()
}
)
test.each([['arm'], ['arm64'], ['amd64']])(
@@ -55,7 +55,7 @@ describe('Testing all functions in run file.', () => {
arch
)
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlDarwinUrl)
expect(os.type).toHaveBeenCalled()
expect(os.type).toBeCalled()
}
)
test.each([['arm'], ['arm64'], ['amd64']])(
@@ -67,7 +67,7 @@ describe('Testing all functions in run file.', () => {
arch
)
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlWindowsUrl)
expect(os.type).toHaveBeenCalled()
expect(os.type).toBeCalled()
}
)
test('getStableKubectlVersion() - download stable version file, read version and return it', async () => {
@@ -76,7 +76,7 @@ describe('Testing all functions in run file.', () => {
.mockReturnValue(Promise.resolve('pathToTool'))
jest.spyOn(fs, 'readFileSync').mockReturnValue('v1.20.4')
expect(await run.getStableKubectlVersion()).toBe('v1.20.4')
expect(toolCache.downloadTool).toHaveBeenCalled()
expect(toolCache.downloadTool).toBeCalled()
expect(fs.readFileSync).toHaveBeenCalledWith('pathToTool', 'utf8')
})
test('getStableKubectlVersion() - return default v1.15.0 if version read is empty', async () => {
@@ -85,7 +85,7 @@ describe('Testing all functions in run file.', () => {
.mockReturnValue(Promise.resolve('pathToTool'))
jest.spyOn(fs, 'readFileSync').mockReturnValue('')
expect(await run.getStableKubectlVersion()).toBe('v1.15.0')
expect(toolCache.downloadTool).toHaveBeenCalled()
expect(toolCache.downloadTool).toBeCalled()
expect(fs.readFileSync).toHaveBeenCalledWith('pathToTool', 'utf8')
})
test('getStableKubectlVersion() - return default v1.15.0 if unable to download file', async () => {
@@ -93,7 +93,7 @@ describe('Testing all functions in run file.', () => {
.spyOn(toolCache, 'downloadTool')
.mockRejectedValue('Unable to download.')
expect(await run.getStableKubectlVersion()).toBe('v1.15.0')
expect(toolCache.downloadTool).toHaveBeenCalled()
expect(toolCache.downloadTool).toBeCalled()
})
test('downloadKubectl() - download kubectl, add it to toolCache and return path to it', async () => {
jest.spyOn(toolCache, 'find').mockReturnValue('')
@@ -109,9 +109,9 @@ describe('Testing all functions in run file.', () => {
path.join('pathToCachedTool', 'kubectl.exe')
)
expect(toolCache.find).toHaveBeenCalledWith('kubectl', 'v1.15.0')
expect(toolCache.downloadTool).toHaveBeenCalled()
expect(toolCache.cacheFile).toHaveBeenCalled()
expect(os.type).toHaveBeenCalled()
expect(toolCache.downloadTool).toBeCalled()
expect(toolCache.cacheFile).toBeCalled()
expect(os.type).toBeCalled()
expect(fs.chmodSync).toHaveBeenCalledWith(
path.join('pathToCachedTool', 'kubectl.exe'),
'775'
@@ -126,12 +126,12 @@ describe('Testing all functions in run file.', () => {
'DownloadKubectlFailed'
)
expect(toolCache.find).toHaveBeenCalledWith('kubectl', 'v1.15.0')
expect(toolCache.downloadTool).toHaveBeenCalled()
expect(toolCache.downloadTool).toBeCalled()
})
test('downloadKubectl() - throw kubectl not found error when receive 404 response', async () => {
const kubectlVersion = 'v1.15.0'
const arch = 'arm128'
jest.spyOn(os, 'arch').mockReturnValue(arch as any)
jest.spyOn(os, 'arch').mockReturnValue(arch)
jest.spyOn(toolCache, 'find').mockReturnValue('')
jest.spyOn(toolCache, 'downloadTool').mockImplementation((_) => {
throw new toolCache.HTTPError(404)
@@ -143,9 +143,9 @@ describe('Testing all functions in run file.', () => {
arch
)
)
expect(os.arch).toHaveBeenCalled()
expect(os.arch).toBeCalled()
expect(toolCache.find).toHaveBeenCalledWith('kubectl', kubectlVersion)
expect(toolCache.downloadTool).toHaveBeenCalled()
expect(toolCache.downloadTool).toBeCalled()
})
test('downloadKubectl() - return path to existing cache of kubectl', async () => {
jest.spyOn(core, 'getInput').mockImplementation(() => 'v1.15.5')
@@ -157,12 +157,12 @@ describe('Testing all functions in run file.', () => {
path.join('pathToCachedTool', 'kubectl.exe')
)
expect(toolCache.find).toHaveBeenCalledWith('kubectl', 'v1.15.0')
expect(os.type).toHaveBeenCalled()
expect(os.type).toBeCalled()
expect(fs.chmodSync).toHaveBeenCalledWith(
path.join('pathToCachedTool', 'kubectl.exe'),
'775'
)
expect(toolCache.downloadTool).not.toHaveBeenCalled()
expect(toolCache.downloadTool).not.toBeCalled()
})
test('run() - download specified version and set output', async () => {
jest.spyOn(core, 'getInput').mockReturnValue('v1.15.5')