Compare commits

..

1 Commits

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

View File

@ -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@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17 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@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17 uses: github/codeql-action/analyze@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6
with: with:
category: '/language:${{matrix.language}}' category: '/language:${{matrix.language}}'

View File

@ -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'

View File

@ -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'

3
.gitignore vendored
View File

@ -3,8 +3,6 @@
## ##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
yarn.lock
# User-specific files # User-specific files
*.suo *.suo
*.user *.user
@ -332,4 +330,3 @@ ASALocalRun/
node_modules node_modules
# Transpiled JS # Transpiled JS
lib/

View File

@ -5,10 +5,9 @@
Acceptable values are latest or any semantic version string like `v1.15.0`. Use this action in workflow to define which version of kubectl will be used. Acceptable values are latest or any semantic version string like `v1.15.0`. Use this action in workflow to define which version of kubectl will be used.
```yaml ```yaml
- uses: action/setup-kubectl-cn@v4.1 - uses: azure/setup-kubectl@v4
with: with:
version: '<version>' # default is latest stable version: '<version>' # default is latest stable
url: https://dl.k8s.io/release/${version}/bin/linux/${arch}/kubectl # custom download url
id: install id: install
``` ```

View File

@ -5,10 +5,6 @@ inputs:
description: 'Version of kubectl' description: 'Version of kubectl'
required: true required: true
default: 'latest' default: 'latest'
url:
description: 'Url of kubectl'
required: false
default: ''
outputs: outputs:
kubectl-path: kubectl-path:
description: 'Path to the cached kubectl binary' description: 'Path to the cached kubectl binary'

6280
lib/index.js Normal file

File diff suppressed because it is too large Load Diff

592
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,15 +20,16 @@
"dependencies": { "dependencies": {
"@actions/core": "^1.11.1", "@actions/core": "^1.11.1",
"@actions/exec": "^1.0.0", "@actions/exec": "^1.0.0",
"@actions/tool-cache": "^2.0.2" "@actions/tool-cache": "^2.0.2",
"ncc": "^0.3.6"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"@types/node": "^22.15.17", "@types/node": "^22.10.10",
"@vercel/ncc": "^0.38.3", "@vercel/ncc": "^0.38.3",
"jest": "^29.7.0", "jest": "^29.7.0",
"prettier": "3.5.3", "prettier": "3.4.2",
"ts-jest": "^29.3.2", "ts-jest": "^29.2.5",
"typescript": "5.8.3" "typescript": "5.7.3"
} }
} }

View File

@ -9,10 +9,7 @@ export function getKubectlArch(): string {
return arch return arch
} }
export function getkubectlDownloadURL(version: string, arch: string, url: string = ''): string { export function getkubectlDownloadURL(version: string, arch: string): string {
if (url != '') {
return url.replace('${version}', version).replace('${arch}', arch)
}
switch (os.type()) { switch (os.type()) {
case 'Linux': case 'Linux':
return `https://dl.k8s.io/release/${version}/bin/linux/${arch}/kubectl` return `https://dl.k8s.io/release/${version}/bin/linux/${arch}/kubectl`

View File

@ -18,11 +18,10 @@ const stableVersionUrl =
export async function run() { export async function run() {
let version = core.getInput('version', {required: true}) let version = core.getInput('version', {required: true})
let toolurl = core.getInput('url', {required: false})
if (version.toLocaleLowerCase() === 'latest') { if (version.toLocaleLowerCase() === 'latest') {
version = await getStableKubectlVersion() version = await getStableKubectlVersion()
} }
const cachedPath = await downloadKubectl(version, toolurl) const cachedPath = await downloadKubectl(version)
core.addPath(path.dirname(cachedPath)) core.addPath(path.dirname(cachedPath))
@ -49,14 +48,14 @@ export async function getStableKubectlVersion(): Promise<string> {
) )
} }
export async function downloadKubectl(version: string, toolurl: string = ''): Promise<string> { export async function downloadKubectl(version: string): Promise<string> {
let cachedToolpath = toolCache.find(kubectlToolName, version) let cachedToolpath = toolCache.find(kubectlToolName, version)
let kubectlDownloadPath = '' let kubectlDownloadPath = ''
const arch = getKubectlArch() const arch = getKubectlArch()
if (!cachedToolpath) { if (!cachedToolpath) {
try { try {
kubectlDownloadPath = await toolCache.downloadTool( kubectlDownloadPath = await toolCache.downloadTool(
getkubectlDownloadURL(version, arch, toolurl) getkubectlDownloadURL(version, arch)
) )
} catch (exception) { } catch (exception) {
if ( if (