Compare commits
1 Commits
v4
...
releases/v
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c5e050edf |
4
.github/workflows/codeql.yml
vendored
4
.github/workflows/codeql.yml
vendored
@@ -59,7 +59,7 @@ jobs:
|
|||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
|
uses: github/codeql-action/init@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
build-mode: ${{ matrix.build-mode }}
|
build-mode: ${{ matrix.build-mode }}
|
||||||
@@ -86,6 +86,6 @@ jobs:
|
|||||||
echo ' make release'
|
echo ' make release'
|
||||||
exit 1
|
exit 1
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
|
uses: github/codeql-action/analyze@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6
|
||||||
with:
|
with:
|
||||||
category: '/language:${{matrix.language}}'
|
category: '/language:${{matrix.language}}'
|
||||||
|
|||||||
2
.github/workflows/integration-tests.yml
vendored
2
.github/workflows/integration-tests.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
|||||||
npm run build
|
npm run build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
|
||||||
name: Install Python
|
name: Install Python
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
|
|||||||
2
.github/workflows/prettify-code.yml
vendored
2
.github/workflows/prettify-code.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
|
||||||
with:
|
with:
|
||||||
node-version: 'lts/*'
|
node-version: 'lts/*'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## [4.0.1] - 2025-06-17
|
## [v4.0.0] - 2024-01-30
|
||||||
|
|
||||||
- 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
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|||||||
5229
package-lock.json
generated
5229
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -24,12 +24,12 @@
|
|||||||
"ncc": "^0.3.6"
|
"ncc": "^0.3.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^30.0.0",
|
"@types/jest": "^29.5.14",
|
||||||
"@types/node": "^24.0.2",
|
"@types/node": "^22.10.10",
|
||||||
"@vercel/ncc": "^0.38.3",
|
"@vercel/ncc": "^0.38.3",
|
||||||
"jest": "^30.0.0",
|
"jest": "^29.7.0",
|
||||||
"prettier": "3.5.3",
|
"prettier": "3.4.2",
|
||||||
"ts-jest": "^29.4.0",
|
"ts-jest": "^29.2.5",
|
||||||
"typescript": "5.8.3"
|
"typescript": "5.7.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ describe('Testing all functions in run file.', () => {
|
|||||||
test('getExecutableExtension() - return .exe when os is Windows', () => {
|
test('getExecutableExtension() - return .exe when os is Windows', () => {
|
||||||
jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
|
jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
|
||||||
expect(getExecutableExtension()).toBe('.exe')
|
expect(getExecutableExtension()).toBe('.exe')
|
||||||
expect(os.type).toHaveBeenCalled()
|
expect(os.type).toBeCalled()
|
||||||
})
|
})
|
||||||
test('getExecutableExtension() - return empty string for non-windows OS', () => {
|
test('getExecutableExtension() - return empty string for non-windows OS', () => {
|
||||||
jest.spyOn(os, 'type').mockReturnValue('Darwin')
|
jest.spyOn(os, 'type').mockReturnValue('Darwin')
|
||||||
expect(getExecutableExtension()).toBe('')
|
expect(getExecutableExtension()).toBe('')
|
||||||
expect(os.type).toHaveBeenCalled()
|
expect(os.type).toBeCalled()
|
||||||
})
|
})
|
||||||
test.each([
|
test.each([
|
||||||
['arm', 'arm'],
|
['arm', 'arm'],
|
||||||
@@ -29,9 +29,9 @@ describe('Testing all functions in run file.', () => {
|
|||||||
])(
|
])(
|
||||||
'getKubectlArch() - return on %s os arch %s kubectl arch',
|
'getKubectlArch() - return on %s os arch %s kubectl arch',
|
||||||
(osArch, kubectlArch) => {
|
(osArch, kubectlArch) => {
|
||||||
jest.spyOn(os, 'arch').mockReturnValue(osArch as NodeJS.Architecture)
|
jest.spyOn(os, 'arch').mockReturnValue(osArch)
|
||||||
expect(getKubectlArch()).toBe(kubectlArch)
|
expect(getKubectlArch()).toBe(kubectlArch)
|
||||||
expect(os.arch).toHaveBeenCalled()
|
expect(os.arch).toBeCalled()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
test.each([['arm'], ['arm64'], ['amd64']])(
|
test.each([['arm'], ['arm64'], ['amd64']])(
|
||||||
@@ -43,7 +43,7 @@ describe('Testing all functions in run file.', () => {
|
|||||||
arch
|
arch
|
||||||
)
|
)
|
||||||
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlLinuxUrl)
|
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlLinuxUrl)
|
||||||
expect(os.type).toHaveBeenCalled()
|
expect(os.type).toBeCalled()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
test.each([['arm'], ['arm64'], ['amd64']])(
|
test.each([['arm'], ['arm64'], ['amd64']])(
|
||||||
@@ -55,7 +55,7 @@ describe('Testing all functions in run file.', () => {
|
|||||||
arch
|
arch
|
||||||
)
|
)
|
||||||
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlDarwinUrl)
|
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlDarwinUrl)
|
||||||
expect(os.type).toHaveBeenCalled()
|
expect(os.type).toBeCalled()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
test.each([['arm'], ['arm64'], ['amd64']])(
|
test.each([['arm'], ['arm64'], ['amd64']])(
|
||||||
@@ -67,7 +67,7 @@ describe('Testing all functions in run file.', () => {
|
|||||||
arch
|
arch
|
||||||
)
|
)
|
||||||
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlWindowsUrl)
|
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 () => {
|
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'))
|
.mockReturnValue(Promise.resolve('pathToTool'))
|
||||||
jest.spyOn(fs, 'readFileSync').mockReturnValue('v1.20.4')
|
jest.spyOn(fs, 'readFileSync').mockReturnValue('v1.20.4')
|
||||||
expect(await run.getStableKubectlVersion()).toBe('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')
|
expect(fs.readFileSync).toHaveBeenCalledWith('pathToTool', 'utf8')
|
||||||
})
|
})
|
||||||
test('getStableKubectlVersion() - return default v1.15.0 if version read is empty', async () => {
|
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'))
|
.mockReturnValue(Promise.resolve('pathToTool'))
|
||||||
jest.spyOn(fs, 'readFileSync').mockReturnValue('')
|
jest.spyOn(fs, 'readFileSync').mockReturnValue('')
|
||||||
expect(await run.getStableKubectlVersion()).toBe('v1.15.0')
|
expect(await run.getStableKubectlVersion()).toBe('v1.15.0')
|
||||||
expect(toolCache.downloadTool).toHaveBeenCalled()
|
expect(toolCache.downloadTool).toBeCalled()
|
||||||
expect(fs.readFileSync).toHaveBeenCalledWith('pathToTool', 'utf8')
|
expect(fs.readFileSync).toHaveBeenCalledWith('pathToTool', 'utf8')
|
||||||
})
|
})
|
||||||
test('getStableKubectlVersion() - return default v1.15.0 if unable to download file', async () => {
|
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')
|
.spyOn(toolCache, 'downloadTool')
|
||||||
.mockRejectedValue('Unable to download.')
|
.mockRejectedValue('Unable to download.')
|
||||||
expect(await run.getStableKubectlVersion()).toBe('v1.15.0')
|
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 () => {
|
test('downloadKubectl() - download kubectl, add it to toolCache and return path to it', async () => {
|
||||||
jest.spyOn(toolCache, 'find').mockReturnValue('')
|
jest.spyOn(toolCache, 'find').mockReturnValue('')
|
||||||
@@ -109,9 +109,9 @@ describe('Testing all functions in run file.', () => {
|
|||||||
path.join('pathToCachedTool', 'kubectl.exe')
|
path.join('pathToCachedTool', 'kubectl.exe')
|
||||||
)
|
)
|
||||||
expect(toolCache.find).toHaveBeenCalledWith('kubectl', 'v1.15.0')
|
expect(toolCache.find).toHaveBeenCalledWith('kubectl', 'v1.15.0')
|
||||||
expect(toolCache.downloadTool).toHaveBeenCalled()
|
expect(toolCache.downloadTool).toBeCalled()
|
||||||
expect(toolCache.cacheFile).toHaveBeenCalled()
|
expect(toolCache.cacheFile).toBeCalled()
|
||||||
expect(os.type).toHaveBeenCalled()
|
expect(os.type).toBeCalled()
|
||||||
expect(fs.chmodSync).toHaveBeenCalledWith(
|
expect(fs.chmodSync).toHaveBeenCalledWith(
|
||||||
path.join('pathToCachedTool', 'kubectl.exe'),
|
path.join('pathToCachedTool', 'kubectl.exe'),
|
||||||
'775'
|
'775'
|
||||||
@@ -126,12 +126,12 @@ describe('Testing all functions in run file.', () => {
|
|||||||
'DownloadKubectlFailed'
|
'DownloadKubectlFailed'
|
||||||
)
|
)
|
||||||
expect(toolCache.find).toHaveBeenCalledWith('kubectl', 'v1.15.0')
|
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 () => {
|
test('downloadKubectl() - throw kubectl not found error when receive 404 response', async () => {
|
||||||
const kubectlVersion = 'v1.15.0'
|
const kubectlVersion = 'v1.15.0'
|
||||||
const arch = 'arm128'
|
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, 'find').mockReturnValue('')
|
||||||
jest.spyOn(toolCache, 'downloadTool').mockImplementation((_) => {
|
jest.spyOn(toolCache, 'downloadTool').mockImplementation((_) => {
|
||||||
throw new toolCache.HTTPError(404)
|
throw new toolCache.HTTPError(404)
|
||||||
@@ -143,9 +143,9 @@ describe('Testing all functions in run file.', () => {
|
|||||||
arch
|
arch
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
expect(os.arch).toHaveBeenCalled()
|
expect(os.arch).toBeCalled()
|
||||||
expect(toolCache.find).toHaveBeenCalledWith('kubectl', kubectlVersion)
|
expect(toolCache.find).toHaveBeenCalledWith('kubectl', kubectlVersion)
|
||||||
expect(toolCache.downloadTool).toHaveBeenCalled()
|
expect(toolCache.downloadTool).toBeCalled()
|
||||||
})
|
})
|
||||||
test('downloadKubectl() - return path to existing cache of kubectl', async () => {
|
test('downloadKubectl() - return path to existing cache of kubectl', async () => {
|
||||||
jest.spyOn(core, 'getInput').mockImplementation(() => 'v1.15.5')
|
jest.spyOn(core, 'getInput').mockImplementation(() => 'v1.15.5')
|
||||||
@@ -157,12 +157,12 @@ describe('Testing all functions in run file.', () => {
|
|||||||
path.join('pathToCachedTool', 'kubectl.exe')
|
path.join('pathToCachedTool', 'kubectl.exe')
|
||||||
)
|
)
|
||||||
expect(toolCache.find).toHaveBeenCalledWith('kubectl', 'v1.15.0')
|
expect(toolCache.find).toHaveBeenCalledWith('kubectl', 'v1.15.0')
|
||||||
expect(os.type).toHaveBeenCalled()
|
expect(os.type).toBeCalled()
|
||||||
expect(fs.chmodSync).toHaveBeenCalledWith(
|
expect(fs.chmodSync).toHaveBeenCalledWith(
|
||||||
path.join('pathToCachedTool', 'kubectl.exe'),
|
path.join('pathToCachedTool', 'kubectl.exe'),
|
||||||
'775'
|
'775'
|
||||||
)
|
)
|
||||||
expect(toolCache.downloadTool).not.toHaveBeenCalled()
|
expect(toolCache.downloadTool).not.toBeCalled()
|
||||||
})
|
})
|
||||||
test('run() - download specified version and set output', async () => {
|
test('run() - download specified version and set output', async () => {
|
||||||
jest.spyOn(core, 'getInput').mockReturnValue('v1.15.5')
|
jest.spyOn(core, 'getInput').mockReturnValue('v1.15.5')
|
||||||
|
|||||||
Reference in New Issue
Block a user