mirror of
https://github.com/Azure/k8s-set-context.git
synced 2026-06-22 23:09:31 +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:
|
||||
- uses: actions/stale@v3
|
||||
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
|
||||
name: Setting Issue as Idle
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
operations-per-run: 100
|
||||
exempt-issue-labels: 'backlog'
|
||||
|
||||
- uses: actions/stale@v3
|
||||
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
|
||||
name: Setting PR as Idle
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout Source Code
|
||||
id: checkout-code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Npm Install and Build
|
||||
id: npm-build
|
||||
run: |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: 'Run prettify'
|
||||
name: 'Run Prettify'
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
@@ -10,9 +10,16 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
|
||||
- name: Enforce Prettier
|
||||
uses: actionsx/prettier@v2
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
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:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Run Unit Tests
|
||||
run: |
|
||||
npm install
|
||||
|
||||
@@ -331,3 +331,4 @@ node_modules
|
||||
coverage
|
||||
|
||||
# Transpiled JS
|
||||
lib/
|
||||
|
||||
@@ -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
|
||||
|
||||
- #90 update dev dependencies with Typescript to 5
|
||||
- #89 Adding dependabot
|
||||
- #90 update dev dependencies with Typescript to 5
|
||||
- #89 Adding dependabot
|
||||
|
||||
## [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:
|
||||
|
||||
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
|
||||
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
||||
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
|
||||
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
|
||||
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
||||
- 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:
|
||||
|
||||
- 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 principal approach (only applicable for arc cluster) where service principal provided with 'creds' is used as input to 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 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/).
|
||||
|
||||
|
||||
+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:
|
||||
|
||||
- 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
|
||||
- The location of the affected source code (tag/branch/commit or direct URL)
|
||||
- Any special configuration required to reproduce the issue
|
||||
- Step-by-step instructions to reproduce the issue
|
||||
- Proof-of-concept or exploit code (if possible)
|
||||
- Impact of the issue, including how an attacker might exploit the issue
|
||||
- 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
|
||||
- The location of the affected source code (tag/branch/commit or direct URL)
|
||||
- Any special configuration required to reproduce the issue
|
||||
- Step-by-step instructions to reproduce the issue
|
||||
- Proof-of-concept or exploit code (if possible)
|
||||
- Impact of the issue, including how an attacker might exploit the issue
|
||||
|
||||
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,
|
||||
clearMocks: true,
|
||||
resetMocks: true,
|
||||
@@ -6,8 +6,16 @@ module.exports = {
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/*.test.ts'],
|
||||
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,
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
if (require.main !== module) {
|
||||
throw new Error('This file should not be required');
|
||||
}
|
||||
|
||||
var childProcess = require('child_process');
|
||||
var fs = require('fs');
|
||||
|
||||
var paramFilePath = process.argv[2];
|
||||
|
||||
var serializedParams = fs.readFileSync(paramFilePath, 'utf8');
|
||||
var params = JSON.parse(serializedParams);
|
||||
|
||||
var cmd = params.command;
|
||||
var execOptions = params.execOptions;
|
||||
var pipe = params.pipe;
|
||||
var stdoutFile = params.stdoutFile;
|
||||
var stderrFile = params.stderrFile;
|
||||
|
||||
var c = childProcess.exec(cmd, execOptions, function (err) {
|
||||
if (!err) {
|
||||
process.exitCode = 0;
|
||||
} else if (err.code === undefined) {
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
process.exitCode = err.code;
|
||||
}
|
||||
});
|
||||
|
||||
var stdoutStream = fs.createWriteStream(stdoutFile);
|
||||
var stderrStream = fs.createWriteStream(stderrFile);
|
||||
|
||||
c.stdout.pipe(stdoutStream);
|
||||
c.stderr.pipe(stderrStream);
|
||||
c.stdout.pipe(process.stdout);
|
||||
c.stderr.pipe(process.stderr);
|
||||
|
||||
if (pipe) {
|
||||
c.stdin.end(pipe);
|
||||
}
|
||||
-193597
File diff suppressed because one or more lines are too long
Generated
+6328
-3686
File diff suppressed because it is too large
Load Diff
+19
-13
@@ -3,13 +3,15 @@
|
||||
"version": "4.0.0",
|
||||
"private": true,
|
||||
"main": "lib/index.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"prebuild": "npm i @vercel/ncc",
|
||||
"build": "ncc build src/run.ts -o lib",
|
||||
"test": "jest",
|
||||
"test-coverage": "jest --coverage",
|
||||
"format": "prettier --write .",
|
||||
"format-check": "prettier --check ."
|
||||
"format-check": "prettier --check .",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"keywords": [
|
||||
"actions",
|
||||
@@ -19,20 +21,24 @@
|
||||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/exec": "^1.0.0",
|
||||
"@actions/io": "^1.1.2",
|
||||
"@kubernetes/client-node": "^0.16.0",
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/io": "^1.1.3",
|
||||
"@kubernetes/client-node": "^1.3.0",
|
||||
"husky": "^9.1.7",
|
||||
"js-yaml": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.11",
|
||||
"@types/js-yaml": "^4.0.4",
|
||||
"@types/node": "^20.11.8",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"jest": "^29.7.0",
|
||||
"prettier": "^3.2.5",
|
||||
"ts-jest": "^29.2.5",
|
||||
"typescript": "^5.3.3"
|
||||
"@babel/preset-env": "^7.28.0",
|
||||
"@babel/preset-typescript": "^7.27.1",
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/node": "^24.0.13",
|
||||
"@vercel/ncc": "^0.38.3",
|
||||
"babel-jest": "^30.0.4",
|
||||
"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)
|
||||
|
||||
expect(await runAzCliCommand(path, args))
|
||||
expect(actions.exec).toBeCalledWith(path, args, {})
|
||||
expect(actions.exec).toHaveBeenCalledWith(path, args, {})
|
||||
})
|
||||
})
|
||||
|
||||
+10
-3
@@ -1,8 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES6",
|
||||
"module": "commonjs",
|
||||
"esModuleInterop": true
|
||||
"baseUrl": ".",
|
||||
"module": "ESNext", // or "NodeNext" depending on your setup
|
||||
"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"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user