mirror of
https://github.com/Azure/k8s-set-context.git
synced 2026-06-24 15:59:27 +08:00
Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d647bdf47 | |||
| f76da0c3d8 | |||
| 8440376895 | |||
| 73c851170f | |||
| 71a74a51a0 | |||
| c8c2ee9d3e | |||
| 692b57e472 | |||
| 3ac66a3029 | |||
| 79824a32e9 | |||
| 910f9259f7 | |||
| f7d748aa83 | |||
| 6381c85c74 | |||
| 454a244870 | |||
| 6851e67f4a | |||
| c11aaa17fe | |||
| 1aa4d89457 | |||
| 14ede2518b | |||
| 99bf174624 | |||
| 6d041f335a | |||
| 97a27df14f | |||
| 0ea2a4278a | |||
| 9538f1a33d | |||
| 28ef1bdfc0 | |||
| 1ab2e2c9aa | |||
| ef02e01573 | |||
| b969c2d317 | |||
| 37ab0bfac4 | |||
| 71218192d2 | |||
| 99d4c42f16 | |||
| 06e58873bc | |||
| 452870641e | |||
| e4c918cc16 | |||
| 959bbfb69a | |||
| 5374e54fdc | |||
| a52253b63a | |||
| 4654abedbc | |||
| f23a9ab176 | |||
| d0f3e049ae | |||
| e3ab0d3c82 | |||
| 886043f755 | |||
| 6e733fcb67 | |||
| 3c029a39d9 | |||
| 2beb148ddc | |||
| 2b56913365 | |||
| a517c9dfcc |
+1
-1
@@ -1 +1 @@
|
|||||||
* @Azure/aks-atlanta
|
* @Azure/cloud-native-github-action-owners
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
# For most projects, this workflow file will not need changing; you simply need
|
||||||
|
# to commit it to your repository.
|
||||||
|
#
|
||||||
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
|
# or to provide custom queries or build logic.
|
||||||
|
#
|
||||||
|
# ******** NOTE ********
|
||||||
|
# We have attempted to detect the languages in your repository. Please check
|
||||||
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
|
# supported CodeQL languages.
|
||||||
|
#
|
||||||
|
name: 'CodeQL Advanced'
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ['main']
|
||||||
|
pull_request:
|
||||||
|
branches: ['main']
|
||||||
|
schedule:
|
||||||
|
- cron: '15 9 * * 0'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze (${{ matrix.language }})
|
||||||
|
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
||||||
|
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
||||||
|
# - https://gh.io/supported-runners-and-hardware-resources
|
||||||
|
# - https://gh.io/using-larger-runners (GitHub.com only)
|
||||||
|
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
|
||||||
|
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
||||||
|
permissions:
|
||||||
|
# required for all workflows
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
# required to fetch internal or private CodeQL packs
|
||||||
|
packages: read
|
||||||
|
|
||||||
|
# only required for workflows in private repositories
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- language: javascript-typescript
|
||||||
|
build-mode: none
|
||||||
|
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
|
||||||
|
# Use `c-cpp` to analyze code written in C, C++ or both
|
||||||
|
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
|
||||||
|
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
|
||||||
|
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
|
||||||
|
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
|
||||||
|
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
|
||||||
|
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
build-mode: ${{ matrix.build-mode }}
|
||||||
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
# By default, queries listed here will override any specified in a config file.
|
||||||
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
|
||||||
|
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||||||
|
# queries: security-extended,security-and-quality
|
||||||
|
|
||||||
|
# If the analyze step fails for one of the languages you are analyzing with
|
||||||
|
# "We were unable to automatically build your code", modify the matrix above
|
||||||
|
# to set the build mode to "manual" for that language. Then modify this step
|
||||||
|
# to build your code.
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||||
|
- if: matrix.build-mode == 'manual'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo 'If you are using a "manual" build mode for one or more of the' \
|
||||||
|
'languages you are analyzing, replace this with the commands to build' \
|
||||||
|
'your code, for example:'
|
||||||
|
echo ' make bootstrap'
|
||||||
|
echo ' make release'
|
||||||
|
exit 1
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
|
||||||
|
with:
|
||||||
|
category: '/language:${{matrix.language}}'
|
||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
|
|
||||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v3
|
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
|
||||||
name: Setting Issue as Idle
|
name: Setting Issue as Idle
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -24,7 +24,7 @@ jobs:
|
|||||||
operations-per-run: 100
|
operations-per-run: 100
|
||||||
exempt-issue-labels: 'backlog'
|
exempt-issue-labels: 'backlog'
|
||||||
|
|
||||||
- uses: actions/stale@v3
|
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
|
||||||
name: Setting PR as Idle
|
name: Setting PR as Idle
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout Source Code
|
- name: Checkout Source Code
|
||||||
id: checkout-code
|
id: checkout-code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: Npm Install and Build
|
- name: Npm Install and Build
|
||||||
id: npm-build
|
id: npm-build
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: 'Run prettify'
|
name: 'Run Prettify'
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
@@ -10,9 +10,16 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Enforce Prettier
|
- name: Setup Node.js
|
||||||
uses: actionsx/prettier@v2
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||||
with:
|
with:
|
||||||
args: --check .
|
node-version: 'lts/*'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Run Prettier Check
|
||||||
|
run: npx prettier --check .
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
unit-test:
|
unit-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
- name: Run Unit Tests
|
- name: Run Unit Tests
|
||||||
run: |
|
run: |
|
||||||
npm install
|
npm install
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
+3
-3
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
## [4.0.1] - 2024-09-06
|
## [4.0.1] - 2024-09-06
|
||||||
|
|
||||||
- #90 update dev dependencies with Typescript to 5
|
- #90 update dev dependencies with Typescript to 5
|
||||||
- #89 Adding dependabot
|
- #89 Adding dependabot
|
||||||
|
|
||||||
## [4.0.0] - 2024-02-13
|
## [4.0.0] - 2024-02-13
|
||||||
|
|
||||||
- #83 update to node20 as node16 is deprecated
|
- #83 update to node20 as node16 is deprecated
|
||||||
|
|||||||
+3
-3
@@ -4,6 +4,6 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
|
|||||||
|
|
||||||
Resources:
|
Resources:
|
||||||
|
|
||||||
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
|
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
|
||||||
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
||||||
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
|
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ It is a requirement to use [`azure/login`](https://github.com/Azure/login/tree/m
|
|||||||
|
|
||||||
There are three approaches for specifying the deployment target:
|
There are three approaches for specifying the deployment target:
|
||||||
|
|
||||||
- Kubeconfig file provided as input to the action
|
- Kubeconfig file provided as input to the action
|
||||||
- Service account approach where the secret associated with the service account is provided as input to the action
|
- Service account approach where the secret associated with the service account is provided as input to the action
|
||||||
- Service principal approach (only applicable for arc cluster) where service principal provided with 'creds' is used as input to action
|
- Service principal approach (only applicable for arc cluster) where service principal provided with 'creds' is used as input to action
|
||||||
|
|
||||||
In all these approaches it is recommended to store these contents (kubeconfig file content or secret content) in a [secret](https://docs.github.com/en/actions/security-guides/encrypted-secrets/).
|
In all these approaches it is recommended to store these contents (kubeconfig file content or secret content) in a [secret](https://docs.github.com/en/actions/security-guides/encrypted-secrets/).
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -14,13 +14,13 @@ You should receive a response within 24 hours. If for some reason you do not, pl
|
|||||||
|
|
||||||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||||
|
|
||||||
- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
||||||
- Full paths of source file(s) related to the manifestation of the issue
|
- Full paths of source file(s) related to the manifestation of the issue
|
||||||
- The location of the affected source code (tag/branch/commit or direct URL)
|
- The location of the affected source code (tag/branch/commit or direct URL)
|
||||||
- Any special configuration required to reproduce the issue
|
- Any special configuration required to reproduce the issue
|
||||||
- Step-by-step instructions to reproduce the issue
|
- Step-by-step instructions to reproduce the issue
|
||||||
- Proof-of-concept or exploit code (if possible)
|
- Proof-of-concept or exploit code (if possible)
|
||||||
- Impact of the issue, including how an attacker might exploit the issue
|
- Impact of the issue, including how an attacker might exploit the issue
|
||||||
|
|
||||||
This information will help us triage your report more quickly.
|
This information will help us triage your report more quickly.
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
// babel.config.js
|
||||||
|
export default {
|
||||||
|
presets: [
|
||||||
|
'@babel/preset-env', // For handling ES modules
|
||||||
|
'@babel/preset-typescript' // For handling TypeScript
|
||||||
|
]
|
||||||
|
}
|
||||||
+10
-2
@@ -1,4 +1,4 @@
|
|||||||
module.exports = {
|
export default {
|
||||||
restoreMocks: true,
|
restoreMocks: true,
|
||||||
clearMocks: true,
|
clearMocks: true,
|
||||||
resetMocks: true,
|
resetMocks: true,
|
||||||
@@ -6,8 +6,16 @@ module.exports = {
|
|||||||
testEnvironment: 'node',
|
testEnvironment: 'node',
|
||||||
testMatch: ['**/*.test.ts'],
|
testMatch: ['**/*.test.ts'],
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.ts$': 'ts-jest'
|
'^.+\\.ts$': 'ts-jest', // Use ts-jest for TypeScript files
|
||||||
|
'^.+\\.js$': 'babel-jest' // Transform TypeScript files
|
||||||
},
|
},
|
||||||
|
transformIgnorePatterns: [
|
||||||
|
'/node_modules/(?!@kubernetes/client-node)/' // Make sure to transform the Kubernetes client module
|
||||||
|
],
|
||||||
|
moduleNameMapper: {
|
||||||
|
'^.+\\.css$': 'jest-transform-stub' // Handle CSS imports (if any)
|
||||||
|
},
|
||||||
|
extensionsToTreatAsEsm: ['.ts', '.tsx'], // Treat TypeScript files as ESM
|
||||||
verbose: true,
|
verbose: true,
|
||||||
coverageThreshold: {
|
coverageThreshold: {
|
||||||
global: {
|
global: {
|
||||||
|
|||||||
Generated
+6326
-3685
File diff suppressed because it is too large
Load Diff
+19
-13
@@ -3,13 +3,15 @@
|
|||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "npm i @vercel/ncc",
|
"prebuild": "npm i @vercel/ncc",
|
||||||
"build": "ncc build src/run.ts -o lib",
|
"build": "ncc build src/run.ts -o lib",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test-coverage": "jest --coverage",
|
"test-coverage": "jest --coverage",
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
"format-check": "prettier --check ."
|
"format-check": "prettier --check .",
|
||||||
|
"prepare": "husky"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"actions",
|
"actions",
|
||||||
@@ -19,20 +21,24 @@
|
|||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.11.1",
|
||||||
"@actions/exec": "^1.0.0",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.2",
|
"@actions/io": "^1.1.3",
|
||||||
"@kubernetes/client-node": "^0.16.0",
|
"@kubernetes/client-node": "^1.3.0",
|
||||||
|
"husky": "^9.1.7",
|
||||||
"js-yaml": "^4.1.0"
|
"js-yaml": "^4.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^29.5.11",
|
"@babel/preset-env": "^7.28.0",
|
||||||
"@types/js-yaml": "^4.0.4",
|
"@babel/preset-typescript": "^7.27.1",
|
||||||
"@types/node": "^20.11.8",
|
"@types/jest": "^30.0.0",
|
||||||
"@vercel/ncc": "^0.38.1",
|
"@types/js-yaml": "^4.0.9",
|
||||||
"jest": "^29.7.0",
|
"@types/node": "^24.0.13",
|
||||||
"prettier": "^3.2.5",
|
"@vercel/ncc": "^0.38.3",
|
||||||
"ts-jest": "^29.2.5",
|
"babel-jest": "^30.0.4",
|
||||||
"typescript": "^5.3.3"
|
"jest": "^30.0.4",
|
||||||
|
"prettier": "^3.6.2",
|
||||||
|
"ts-jest": "^29.4.0",
|
||||||
|
"typescript": "^5.8.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ describe('Az commands', () => {
|
|||||||
jest.spyOn(actions, 'exec').mockImplementation(async () => 0)
|
jest.spyOn(actions, 'exec').mockImplementation(async () => 0)
|
||||||
|
|
||||||
expect(await runAzCliCommand(path, args))
|
expect(await runAzCliCommand(path, args))
|
||||||
expect(actions.exec).toBeCalledWith(path, args, {})
|
expect(actions.exec).toHaveBeenCalledWith(path, args, {})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
+10
-3
@@ -1,8 +1,15 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES6",
|
"baseUrl": ".",
|
||||||
"module": "commonjs",
|
"module": "ESNext", // or "NodeNext" depending on your setup
|
||||||
"esModuleInterop": true
|
"moduleResolution": "node",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"paths": {
|
||||||
|
"@actions/core": ["node_modules/@actions/core"],
|
||||||
|
"@kubernetes/client-node": ["node_modules/@kubernetes/client-node"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "tests", "src/**/*.test.ts"]
|
"exclude": ["node_modules", "tests", "src/**/*.test.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user