Compare commits

..

4 Commits

Author SHA1 Message Date
Oliver King 078bac016f Add node modules and compiled JavaScript from main 2022-11-11 18:53:50 +00:00
Oliver King 4912b34152 Merge branch 'releases/v3' into tmp 2022-11-11 18:53:26 +00:00
github-actions[bot] 8128997447 v3 new release (#57)
* fix broken build - switch to ncc build (#56)

* switch to ncc build

* update

* bump ncc

* Add node modules and compiled JavaScript from main

Co-authored-by: David Gamero <david340804@gmail.com>
Co-authored-by: Oliver King <oking3@uncc.edu>
2022-06-30 17:56:12 -04:00
github-actions[bot] 52d71d28bd Add node modules and compiled JavaScript from main (#54)
Co-authored-by: Oliver King <oking3@uncc.edu>
2022-06-29 15:41:55 -04:00
11 changed files with 9172 additions and 11414 deletions
-18
View File
@@ -1,18 +0,0 @@
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
groups:
actions:
patterns:
- '*'
- package-ecosystem: github-actions
directory: .github/workflows
schedule:
interval: weekly
groups:
actions:
patterns:
- '*'
+8 -12
View File
@@ -1,18 +1,14 @@
name: Release Project
name: Create release PR
on:
push:
branches:
- main
paths:
- CHANGELOG.md
workflow_dispatch:
inputs:
release:
description: 'Define release version (ex: v1, v2, v3)'
required: true
jobs:
release:
permissions:
actions: read
contents: write
uses: Azure/action-release-workflows/.github/workflows/release_js_project.yaml@v1
release-pr:
uses: OliverMKing/javascript-release-workflow/.github/workflows/release-pr.yml@main
with:
changelogPath: ./CHANGELOG.md
release: ${{ github.event.inputs.release }}
-10
View File
@@ -1,10 +0,0 @@
# Change Log
## [4.0.1] - 2024-09-06
- #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
+4 -4
View File
@@ -19,7 +19,7 @@ Refer to the [action metadata file](./action.yml) for details about inputs. Note
### Kubeconfig approach
```yaml
- uses: azure/k8s-set-context@v4
- uses: azure/k8s-set-context@v2
with:
method: kubeconfig
kubeconfig: <your kubeconfig>
@@ -50,7 +50,7 @@ Please refer to documentation on fetching [kubeconfig for any generic K8s cluste
### Service account approach
```yaml
- uses: azure/k8s-set-context@v4
- uses: azure/k8s-set-context@v2
with:
method: service-account
k8s-url: <URL of the cluster's API server>
@@ -74,7 +74,7 @@ kubectl get secret <service-account-secret-name> -n <namespace> -o yaml
### Service account approach for arc cluster
```yaml
- uses: azure/k8s-set-context@v4
- uses: azure/k8s-set-context@v2
with:
method: service-account
cluster-type: arc
@@ -86,7 +86,7 @@ kubectl get secret <service-account-secret-name> -n <namespace> -o yaml
### Service principal approach for arc cluster
```yaml
- uses: azure/k8s-set-context@v4
- uses: azure/k8s-set-context@v2
with:
method: service-principal
cluster-type: arc
+1 -1
View File
@@ -35,5 +35,5 @@ inputs:
branding:
color: 'blue'
runs:
using: 'node20'
using: 'node16'
main: 'lib/index.js'
+7353 -8945
View File
File diff suppressed because it is too large Load Diff
+1765 -2380
View File
File diff suppressed because it is too large Load Diff
+8 -9
View File
@@ -1,10 +1,9 @@
{
"name": "k8s-set-context-action",
"version": "4.0.0",
"version": "1.0.0",
"private": true,
"main": "lib/index.js",
"scripts": {
"prebuild": "npm i @vercel/ncc",
"build": "ncc build src/run.ts -o lib",
"test": "jest",
"test-coverage": "jest --coverage",
@@ -26,13 +25,13 @@
"js-yaml": "^4.1.0"
},
"devDependencies": {
"@types/jest": "^29.5.11",
"@types/jest": "^28.1.2",
"@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"
"@types/node": "^16.0.0",
"@vercel/ncc": "^0.34.0",
"jest": "^28.1.1",
"prettier": "2.7.1",
"ts-jest": "^28.0.5",
"typescript": "4.7.4"
}
}
-33
View File
@@ -1,33 +0,0 @@
import * as core from '@actions/core'
import * as path from 'path'
import * as fs from 'fs'
import {Cluster, parseCluster} from './types/cluster'
import {setContext, getKubeconfig} from './utils'
/**
* Sets the Kubernetes context based on supplied action inputs
*/
export async function run() {
// get inputs
const clusterType: Cluster | undefined = parseCluster(
core.getInput('cluster-type', {
required: true
})
)
const runnerTempDirectory: string = process.env['RUNNER_TEMP']
const kubeconfigPath: string = path.join(
runnerTempDirectory,
`kubeconfig_${Date.now()}`
)
// get kubeconfig and update context
const kubeconfig: string = await getKubeconfig(clusterType)
const kubeconfigWithContext: string = setContext(kubeconfig)
// output kubeconfig
core.debug(`Writing kubeconfig contents to ${kubeconfigPath}`)
fs.writeFileSync(kubeconfigPath, kubeconfigWithContext)
fs.chmodSync(kubeconfigPath, '600')
core.debug('Setting KUBECONFIG environment variable')
core.exportVariable('KUBECONFIG', kubeconfigPath)
}
+1 -1
View File
@@ -1,5 +1,5 @@
import {getRequiredInputError} from '../tests/util'
import {run} from './action'
import {run} from './run'
import fs from 'fs'
import * as utils from './utils'
+32 -1
View File
@@ -1,5 +1,36 @@
import {run} from './action'
import * as core from '@actions/core'
import * as path from 'path'
import * as fs from 'fs'
import {Cluster, parseCluster} from './types/cluster'
import {setContext, getKubeconfig} from './utils'
/**
* Sets the Kubernetes context based on supplied action inputs
*/
export async function run() {
// get inputs
const clusterType: Cluster | undefined = parseCluster(
core.getInput('cluster-type', {
required: true
})
)
const runnerTempDirectory: string = process.env['RUNNER_TEMP']
const kubeconfigPath: string = path.join(
runnerTempDirectory,
`kubeconfig_${Date.now()}`
)
// get kubeconfig and update context
const kubeconfig: string = await getKubeconfig(clusterType)
const kubeconfigWithContext: string = setContext(kubeconfig)
// output kubeconfig
core.debug(`Writing kubeconfig contents to ${kubeconfigPath}`)
fs.writeFileSync(kubeconfigPath, kubeconfigWithContext)
fs.chmodSync(kubeconfigPath, '600')
core.debug('Setting KUBECONFIG environment variable')
core.exportVariable('KUBECONFIG', kubeconfigPath)
}
// Run the application
run().catch(core.setFailed)