mirror of
https://github.com/Azure/k8s-set-context.git
synced 2026-06-23 23:39:28 +08:00
Compare commits
2 Commits
create-release
..
v3
| Author | SHA1 | Date | |
|---|---|---|---|
| 38d6bc72e5 | |||
| d1462f8502 |
@@ -19,7 +19,7 @@ Refer to the [action metadata file](./action.yml) for details about inputs. Note
|
|||||||
### Kubeconfig approach
|
### Kubeconfig approach
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: azure/k8s-set-context@v2
|
- uses: azure/k8s-set-context@v3
|
||||||
with:
|
with:
|
||||||
method: kubeconfig
|
method: kubeconfig
|
||||||
kubeconfig: <your kubeconfig>
|
kubeconfig: <your kubeconfig>
|
||||||
@@ -50,7 +50,7 @@ Please refer to documentation on fetching [kubeconfig for any generic K8s cluste
|
|||||||
### Service account approach
|
### Service account approach
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: azure/k8s-set-context@v2
|
- uses: azure/k8s-set-context@v3
|
||||||
with:
|
with:
|
||||||
method: service-account
|
method: service-account
|
||||||
k8s-url: <URL of the cluster's API server>
|
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
|
### Service account approach for arc cluster
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: azure/k8s-set-context@v2
|
- uses: azure/k8s-set-context@v3
|
||||||
with:
|
with:
|
||||||
method: service-account
|
method: service-account
|
||||||
cluster-type: arc
|
cluster-type: arc
|
||||||
@@ -86,7 +86,7 @@ kubectl get secret <service-account-secret-name> -n <namespace> -o yaml
|
|||||||
### Service principal approach for arc cluster
|
### Service principal approach for arc cluster
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: azure/k8s-set-context@v2
|
- uses: azure/k8s-set-context@v3
|
||||||
with:
|
with:
|
||||||
method: service-principal
|
method: service-principal
|
||||||
cluster-type: arc
|
cluster-type: arc
|
||||||
|
|||||||
+201
-132
@@ -148478,10 +148478,10 @@ module.exports = (fromStream, toStream) => {
|
|||||||
module.exports = minimatch
|
module.exports = minimatch
|
||||||
minimatch.Minimatch = Minimatch
|
minimatch.Minimatch = Minimatch
|
||||||
|
|
||||||
var path = { sep: '/' }
|
var path = (function () { try { return __nccwpck_require__(71017) } catch (e) {}}()) || {
|
||||||
try {
|
sep: '/'
|
||||||
path = __nccwpck_require__(71017)
|
}
|
||||||
} catch (er) {}
|
minimatch.sep = path.sep
|
||||||
|
|
||||||
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
|
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
|
||||||
var expand = __nccwpck_require__(90308)
|
var expand = __nccwpck_require__(90308)
|
||||||
@@ -148533,43 +148533,64 @@ function filter (pattern, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ext (a, b) {
|
function ext (a, b) {
|
||||||
a = a || {}
|
|
||||||
b = b || {}
|
b = b || {}
|
||||||
var t = {}
|
var t = {}
|
||||||
Object.keys(b).forEach(function (k) {
|
|
||||||
t[k] = b[k]
|
|
||||||
})
|
|
||||||
Object.keys(a).forEach(function (k) {
|
Object.keys(a).forEach(function (k) {
|
||||||
t[k] = a[k]
|
t[k] = a[k]
|
||||||
})
|
})
|
||||||
|
Object.keys(b).forEach(function (k) {
|
||||||
|
t[k] = b[k]
|
||||||
|
})
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
minimatch.defaults = function (def) {
|
minimatch.defaults = function (def) {
|
||||||
if (!def || !Object.keys(def).length) return minimatch
|
if (!def || typeof def !== 'object' || !Object.keys(def).length) {
|
||||||
|
return minimatch
|
||||||
|
}
|
||||||
|
|
||||||
var orig = minimatch
|
var orig = minimatch
|
||||||
|
|
||||||
var m = function minimatch (p, pattern, options) {
|
var m = function minimatch (p, pattern, options) {
|
||||||
return orig.minimatch(p, pattern, ext(def, options))
|
return orig(p, pattern, ext(def, options))
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Minimatch = function Minimatch (pattern, options) {
|
m.Minimatch = function Minimatch (pattern, options) {
|
||||||
return new orig.Minimatch(pattern, ext(def, options))
|
return new orig.Minimatch(pattern, ext(def, options))
|
||||||
}
|
}
|
||||||
|
m.Minimatch.defaults = function defaults (options) {
|
||||||
|
return orig.defaults(ext(def, options)).Minimatch
|
||||||
|
}
|
||||||
|
|
||||||
|
m.filter = function filter (pattern, options) {
|
||||||
|
return orig.filter(pattern, ext(def, options))
|
||||||
|
}
|
||||||
|
|
||||||
|
m.defaults = function defaults (options) {
|
||||||
|
return orig.defaults(ext(def, options))
|
||||||
|
}
|
||||||
|
|
||||||
|
m.makeRe = function makeRe (pattern, options) {
|
||||||
|
return orig.makeRe(pattern, ext(def, options))
|
||||||
|
}
|
||||||
|
|
||||||
|
m.braceExpand = function braceExpand (pattern, options) {
|
||||||
|
return orig.braceExpand(pattern, ext(def, options))
|
||||||
|
}
|
||||||
|
|
||||||
|
m.match = function (list, pattern, options) {
|
||||||
|
return orig.match(list, pattern, ext(def, options))
|
||||||
|
}
|
||||||
|
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
Minimatch.defaults = function (def) {
|
Minimatch.defaults = function (def) {
|
||||||
if (!def || !Object.keys(def).length) return Minimatch
|
|
||||||
return minimatch.defaults(def).Minimatch
|
return minimatch.defaults(def).Minimatch
|
||||||
}
|
}
|
||||||
|
|
||||||
function minimatch (p, pattern, options) {
|
function minimatch (p, pattern, options) {
|
||||||
if (typeof pattern !== 'string') {
|
assertValidPattern(pattern)
|
||||||
throw new TypeError('glob pattern string required')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!options) options = {}
|
if (!options) options = {}
|
||||||
|
|
||||||
@@ -148578,9 +148599,6 @@ function minimatch (p, pattern, options) {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// "" only matches ""
|
|
||||||
if (pattern.trim() === '') return p === ''
|
|
||||||
|
|
||||||
return new Minimatch(pattern, options).match(p)
|
return new Minimatch(pattern, options).match(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148589,15 +148607,14 @@ function Minimatch (pattern, options) {
|
|||||||
return new Minimatch(pattern, options)
|
return new Minimatch(pattern, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof pattern !== 'string') {
|
assertValidPattern(pattern)
|
||||||
throw new TypeError('glob pattern string required')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!options) options = {}
|
if (!options) options = {}
|
||||||
|
|
||||||
pattern = pattern.trim()
|
pattern = pattern.trim()
|
||||||
|
|
||||||
// windows support: need to use /, not \
|
// windows support: need to use /, not \
|
||||||
if (path.sep !== '/') {
|
if (!options.allowWindowsEscape && path.sep !== '/') {
|
||||||
pattern = pattern.split(path.sep).join('/')
|
pattern = pattern.split(path.sep).join('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148608,6 +148625,7 @@ function Minimatch (pattern, options) {
|
|||||||
this.negate = false
|
this.negate = false
|
||||||
this.comment = false
|
this.comment = false
|
||||||
this.empty = false
|
this.empty = false
|
||||||
|
this.partial = !!options.partial
|
||||||
|
|
||||||
// make the set of regexps etc.
|
// make the set of regexps etc.
|
||||||
this.make()
|
this.make()
|
||||||
@@ -148617,9 +148635,6 @@ Minimatch.prototype.debug = function () {}
|
|||||||
|
|
||||||
Minimatch.prototype.make = make
|
Minimatch.prototype.make = make
|
||||||
function make () {
|
function make () {
|
||||||
// don't do it more than once.
|
|
||||||
if (this._made) return
|
|
||||||
|
|
||||||
var pattern = this.pattern
|
var pattern = this.pattern
|
||||||
var options = this.options
|
var options = this.options
|
||||||
|
|
||||||
@@ -148639,7 +148654,7 @@ function make () {
|
|||||||
// step 2: expand braces
|
// step 2: expand braces
|
||||||
var set = this.globSet = this.braceExpand()
|
var set = this.globSet = this.braceExpand()
|
||||||
|
|
||||||
if (options.debug) this.debug = console.error
|
if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) }
|
||||||
|
|
||||||
this.debug(this.pattern, set)
|
this.debug(this.pattern, set)
|
||||||
|
|
||||||
@@ -148719,12 +148734,11 @@ function braceExpand (pattern, options) {
|
|||||||
pattern = typeof pattern === 'undefined'
|
pattern = typeof pattern === 'undefined'
|
||||||
? this.pattern : pattern
|
? this.pattern : pattern
|
||||||
|
|
||||||
if (typeof pattern === 'undefined') {
|
assertValidPattern(pattern)
|
||||||
throw new TypeError('undefined pattern')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.nobrace ||
|
// Thanks to Yeting Li <https://github.com/yetingli> for
|
||||||
!pattern.match(/\{.*\}/)) {
|
// improving this regexp to avoid a ReDOS vulnerability.
|
||||||
|
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
||||||
// shortcut. no need to expand.
|
// shortcut. no need to expand.
|
||||||
return [pattern]
|
return [pattern]
|
||||||
}
|
}
|
||||||
@@ -148732,6 +148746,17 @@ function braceExpand (pattern, options) {
|
|||||||
return expand(pattern)
|
return expand(pattern)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var MAX_PATTERN_LENGTH = 1024 * 64
|
||||||
|
var assertValidPattern = function (pattern) {
|
||||||
|
if (typeof pattern !== 'string') {
|
||||||
|
throw new TypeError('invalid pattern')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pattern.length > MAX_PATTERN_LENGTH) {
|
||||||
|
throw new TypeError('pattern is too long')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// parse a component of the expanded set.
|
// parse a component of the expanded set.
|
||||||
// At this point, no pattern may contain "/" in it
|
// At this point, no pattern may contain "/" in it
|
||||||
// so we're going to return a 2d array, where each entry is the full
|
// so we're going to return a 2d array, where each entry is the full
|
||||||
@@ -148746,14 +148771,17 @@ function braceExpand (pattern, options) {
|
|||||||
Minimatch.prototype.parse = parse
|
Minimatch.prototype.parse = parse
|
||||||
var SUBPARSE = {}
|
var SUBPARSE = {}
|
||||||
function parse (pattern, isSub) {
|
function parse (pattern, isSub) {
|
||||||
if (pattern.length > 1024 * 64) {
|
assertValidPattern(pattern)
|
||||||
throw new TypeError('pattern is too long')
|
|
||||||
}
|
|
||||||
|
|
||||||
var options = this.options
|
var options = this.options
|
||||||
|
|
||||||
// shortcuts
|
// shortcuts
|
||||||
if (!options.noglobstar && pattern === '**') return GLOBSTAR
|
if (pattern === '**') {
|
||||||
|
if (!options.noglobstar)
|
||||||
|
return GLOBSTAR
|
||||||
|
else
|
||||||
|
pattern = '*'
|
||||||
|
}
|
||||||
if (pattern === '') return ''
|
if (pattern === '') return ''
|
||||||
|
|
||||||
var re = ''
|
var re = ''
|
||||||
@@ -148809,10 +148837,12 @@ function parse (pattern, isSub) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '/':
|
/* istanbul ignore next */
|
||||||
|
case '/': {
|
||||||
// completely not allowed, even escaped.
|
// completely not allowed, even escaped.
|
||||||
// Should already be path-split by now.
|
// Should already be path-split by now.
|
||||||
return false
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
case '\\':
|
case '\\':
|
||||||
clearStateChar()
|
clearStateChar()
|
||||||
@@ -148931,25 +148961,23 @@ function parse (pattern, isSub) {
|
|||||||
|
|
||||||
// handle the case where we left a class open.
|
// handle the case where we left a class open.
|
||||||
// "[z-a]" is valid, equivalent to "\[z-a\]"
|
// "[z-a]" is valid, equivalent to "\[z-a\]"
|
||||||
if (inClass) {
|
// split where the last [ was, make sure we don't have
|
||||||
// split where the last [ was, make sure we don't have
|
// an invalid re. if so, re-walk the contents of the
|
||||||
// an invalid re. if so, re-walk the contents of the
|
// would-be class to re-translate any characters that
|
||||||
// would-be class to re-translate any characters that
|
// were passed through as-is
|
||||||
// were passed through as-is
|
// TODO: It would probably be faster to determine this
|
||||||
// TODO: It would probably be faster to determine this
|
// without a try/catch and a new RegExp, but it's tricky
|
||||||
// without a try/catch and a new RegExp, but it's tricky
|
// to do safely. For now, this is safe and works.
|
||||||
// to do safely. For now, this is safe and works.
|
var cs = pattern.substring(classStart + 1, i)
|
||||||
var cs = pattern.substring(classStart + 1, i)
|
try {
|
||||||
try {
|
RegExp('[' + cs + ']')
|
||||||
RegExp('[' + cs + ']')
|
} catch (er) {
|
||||||
} catch (er) {
|
// not a valid class!
|
||||||
// not a valid class!
|
var sp = this.parse(cs, SUBPARSE)
|
||||||
var sp = this.parse(cs, SUBPARSE)
|
re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
|
||||||
re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
|
hasMagic = hasMagic || sp[1]
|
||||||
hasMagic = hasMagic || sp[1]
|
inClass = false
|
||||||
inClass = false
|
continue
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// finish up the class.
|
// finish up the class.
|
||||||
@@ -149033,9 +149061,7 @@ function parse (pattern, isSub) {
|
|||||||
// something that could conceivably capture a dot
|
// something that could conceivably capture a dot
|
||||||
var addPatternStart = false
|
var addPatternStart = false
|
||||||
switch (re.charAt(0)) {
|
switch (re.charAt(0)) {
|
||||||
case '.':
|
case '[': case '.': case '(': addPatternStart = true
|
||||||
case '[':
|
|
||||||
case '(': addPatternStart = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hack to work around lack of negative lookbehind in JS
|
// Hack to work around lack of negative lookbehind in JS
|
||||||
@@ -149097,7 +149123,7 @@ function parse (pattern, isSub) {
|
|||||||
var flags = options.nocase ? 'i' : ''
|
var flags = options.nocase ? 'i' : ''
|
||||||
try {
|
try {
|
||||||
var regExp = new RegExp('^' + re + '$', flags)
|
var regExp = new RegExp('^' + re + '$', flags)
|
||||||
} catch (er) {
|
} catch (er) /* istanbul ignore next - should be impossible */ {
|
||||||
// If it was an invalid regular expression, then it can't match
|
// If it was an invalid regular expression, then it can't match
|
||||||
// anything. This trick looks for a character after the end of
|
// anything. This trick looks for a character after the end of
|
||||||
// the string, which is of course impossible, except in multi-line
|
// the string, which is of course impossible, except in multi-line
|
||||||
@@ -149155,7 +149181,7 @@ function makeRe () {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
this.regexp = new RegExp(re, flags)
|
this.regexp = new RegExp(re, flags)
|
||||||
} catch (ex) {
|
} catch (ex) /* istanbul ignore next - should be impossible */ {
|
||||||
this.regexp = false
|
this.regexp = false
|
||||||
}
|
}
|
||||||
return this.regexp
|
return this.regexp
|
||||||
@@ -149173,8 +149199,8 @@ minimatch.match = function (list, pattern, options) {
|
|||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
Minimatch.prototype.match = match
|
Minimatch.prototype.match = function match (f, partial) {
|
||||||
function match (f, partial) {
|
if (typeof partial === 'undefined') partial = this.partial
|
||||||
this.debug('match', f, this.pattern)
|
this.debug('match', f, this.pattern)
|
||||||
// short-circuit in the case of busted things.
|
// short-circuit in the case of busted things.
|
||||||
// comments, etc.
|
// comments, etc.
|
||||||
@@ -149256,6 +149282,7 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
|
|||||||
|
|
||||||
// should be impossible.
|
// should be impossible.
|
||||||
// some invalid regexp stuff in the set.
|
// some invalid regexp stuff in the set.
|
||||||
|
/* istanbul ignore if */
|
||||||
if (p === false) return false
|
if (p === false) return false
|
||||||
|
|
||||||
if (p === GLOBSTAR) {
|
if (p === GLOBSTAR) {
|
||||||
@@ -149329,6 +149356,7 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
|
|||||||
// no match was found.
|
// no match was found.
|
||||||
// However, in partial mode, we can't say this is necessarily over.
|
// However, in partial mode, we can't say this is necessarily over.
|
||||||
// If there's more *pattern* left, then
|
// If there's more *pattern* left, then
|
||||||
|
/* istanbul ignore if */
|
||||||
if (partial) {
|
if (partial) {
|
||||||
// ran out of file
|
// ran out of file
|
||||||
this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
|
this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
|
||||||
@@ -149342,11 +149370,7 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
|
|||||||
// patterns with magic have been turned into regexps.
|
// patterns with magic have been turned into regexps.
|
||||||
var hit
|
var hit
|
||||||
if (typeof p === 'string') {
|
if (typeof p === 'string') {
|
||||||
if (options.nocase) {
|
hit = f === p
|
||||||
hit = f.toLowerCase() === p.toLowerCase()
|
|
||||||
} else {
|
|
||||||
hit = f === p
|
|
||||||
}
|
|
||||||
this.debug('string match', p, f, hit)
|
this.debug('string match', p, f, hit)
|
||||||
} else {
|
} else {
|
||||||
hit = f.match(p)
|
hit = f.match(p)
|
||||||
@@ -149377,16 +149401,16 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
|
|||||||
// this is ok if we're doing the match as part of
|
// this is ok if we're doing the match as part of
|
||||||
// a glob fs traversal.
|
// a glob fs traversal.
|
||||||
return partial
|
return partial
|
||||||
} else if (pi === pl) {
|
} else /* istanbul ignore else */ if (pi === pl) {
|
||||||
// ran out of pattern, still have file left.
|
// ran out of pattern, still have file left.
|
||||||
// this is only acceptable if we're on the very last
|
// this is only acceptable if we're on the very last
|
||||||
// empty segment of a file with a trailing slash.
|
// empty segment of a file with a trailing slash.
|
||||||
// a/* should match a/b/
|
// a/* should match a/b/
|
||||||
var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
|
return (fi === fl - 1) && (file[fi] === '')
|
||||||
return emptyFileEnd
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// should be unreachable.
|
// should be unreachable.
|
||||||
|
/* istanbul ignore next */
|
||||||
throw new Error('wtf?')
|
throw new Error('wtf?')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155347,7 +155371,7 @@ module.exports = {
|
|||||||
return replace.call(value, percentTwenties, '+');
|
return replace.call(value, percentTwenties, '+');
|
||||||
},
|
},
|
||||||
RFC3986: function (value) {
|
RFC3986: function (value) {
|
||||||
return value;
|
return String(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
RFC1738: 'RFC1738',
|
RFC1738: 'RFC1738',
|
||||||
@@ -155435,14 +155459,15 @@ var parseObject = function (chain, val, options) {
|
|||||||
var obj;
|
var obj;
|
||||||
var root = chain[i];
|
var root = chain[i];
|
||||||
|
|
||||||
if (root === '[]') {
|
if (root === '[]' && options.parseArrays) {
|
||||||
obj = [];
|
obj = [].concat(leaf);
|
||||||
obj = obj.concat(leaf);
|
|
||||||
} else {
|
} else {
|
||||||
obj = options.plainObjects ? Object.create(null) : {};
|
obj = options.plainObjects ? Object.create(null) : {};
|
||||||
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
|
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
|
||||||
var index = parseInt(cleanRoot, 10);
|
var index = parseInt(cleanRoot, 10);
|
||||||
if (
|
if (!options.parseArrays && cleanRoot === '') {
|
||||||
|
obj = { 0: leaf };
|
||||||
|
} else if (
|
||||||
!isNaN(index)
|
!isNaN(index)
|
||||||
&& root !== cleanRoot
|
&& root !== cleanRoot
|
||||||
&& String(index) === cleanRoot
|
&& String(index) === cleanRoot
|
||||||
@@ -155451,7 +155476,7 @@ var parseObject = function (chain, val, options) {
|
|||||||
) {
|
) {
|
||||||
obj = [];
|
obj = [];
|
||||||
obj[index] = leaf;
|
obj[index] = leaf;
|
||||||
} else {
|
} else if (cleanRoot !== '__proto__') {
|
||||||
obj[cleanRoot] = leaf;
|
obj[cleanRoot] = leaf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155568,17 +155593,23 @@ var utils = __nccwpck_require__(63763);
|
|||||||
var formats = __nccwpck_require__(11466);
|
var formats = __nccwpck_require__(11466);
|
||||||
|
|
||||||
var arrayPrefixGenerators = {
|
var arrayPrefixGenerators = {
|
||||||
brackets: function brackets(prefix) { // eslint-disable-line func-name-matching
|
brackets: function brackets(prefix) {
|
||||||
return prefix + '[]';
|
return prefix + '[]';
|
||||||
},
|
},
|
||||||
indices: function indices(prefix, key) { // eslint-disable-line func-name-matching
|
indices: function indices(prefix, key) {
|
||||||
return prefix + '[' + key + ']';
|
return prefix + '[' + key + ']';
|
||||||
},
|
},
|
||||||
repeat: function repeat(prefix) { // eslint-disable-line func-name-matching
|
repeat: function repeat(prefix) {
|
||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var isArray = Array.isArray;
|
||||||
|
var push = Array.prototype.push;
|
||||||
|
var pushToArray = function (arr, valueOrArray) {
|
||||||
|
push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
||||||
|
};
|
||||||
|
|
||||||
var toISO = Date.prototype.toISOString;
|
var toISO = Date.prototype.toISOString;
|
||||||
|
|
||||||
var defaults = {
|
var defaults = {
|
||||||
@@ -155586,14 +155617,14 @@ var defaults = {
|
|||||||
encode: true,
|
encode: true,
|
||||||
encoder: utils.encode,
|
encoder: utils.encode,
|
||||||
encodeValuesOnly: false,
|
encodeValuesOnly: false,
|
||||||
serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching
|
serializeDate: function serializeDate(date) {
|
||||||
return toISO.call(date);
|
return toISO.call(date);
|
||||||
},
|
},
|
||||||
skipNulls: false,
|
skipNulls: false,
|
||||||
strictNullHandling: false
|
strictNullHandling: false
|
||||||
};
|
};
|
||||||
|
|
||||||
var stringify = function stringify( // eslint-disable-line func-name-matching
|
var stringify = function stringify(
|
||||||
object,
|
object,
|
||||||
prefix,
|
prefix,
|
||||||
generateArrayPrefix,
|
generateArrayPrefix,
|
||||||
@@ -155612,7 +155643,9 @@ var stringify = function stringify( // eslint-disable-line func-name-matching
|
|||||||
obj = filter(prefix, obj);
|
obj = filter(prefix, obj);
|
||||||
} else if (obj instanceof Date) {
|
} else if (obj instanceof Date) {
|
||||||
obj = serializeDate(obj);
|
obj = serializeDate(obj);
|
||||||
} else if (obj === null) {
|
}
|
||||||
|
|
||||||
|
if (obj === null) {
|
||||||
if (strictNullHandling) {
|
if (strictNullHandling) {
|
||||||
return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder) : prefix;
|
return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder) : prefix;
|
||||||
}
|
}
|
||||||
@@ -155635,7 +155668,7 @@ var stringify = function stringify( // eslint-disable-line func-name-matching
|
|||||||
}
|
}
|
||||||
|
|
||||||
var objKeys;
|
var objKeys;
|
||||||
if (Array.isArray(filter)) {
|
if (isArray(filter)) {
|
||||||
objKeys = filter;
|
objKeys = filter;
|
||||||
} else {
|
} else {
|
||||||
var keys = Object.keys(obj);
|
var keys = Object.keys(obj);
|
||||||
@@ -155649,8 +155682,8 @@ var stringify = function stringify( // eslint-disable-line func-name-matching
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(obj)) {
|
if (isArray(obj)) {
|
||||||
values = values.concat(stringify(
|
pushToArray(values, stringify(
|
||||||
obj[key],
|
obj[key],
|
||||||
generateArrayPrefix(prefix, key),
|
generateArrayPrefix(prefix, key),
|
||||||
generateArrayPrefix,
|
generateArrayPrefix,
|
||||||
@@ -155665,7 +155698,7 @@ var stringify = function stringify( // eslint-disable-line func-name-matching
|
|||||||
encodeValuesOnly
|
encodeValuesOnly
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
values = values.concat(stringify(
|
pushToArray(values, stringify(
|
||||||
obj[key],
|
obj[key],
|
||||||
prefix + (allowDots ? '.' + key : '[' + key + ']'),
|
prefix + (allowDots ? '.' + key : '[' + key + ']'),
|
||||||
generateArrayPrefix,
|
generateArrayPrefix,
|
||||||
@@ -155689,7 +155722,7 @@ module.exports = function (object, opts) {
|
|||||||
var obj = object;
|
var obj = object;
|
||||||
var options = opts ? utils.assign({}, opts) : {};
|
var options = opts ? utils.assign({}, opts) : {};
|
||||||
|
|
||||||
if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {
|
if (options.encoder !== null && typeof options.encoder !== 'undefined' && typeof options.encoder !== 'function') {
|
||||||
throw new TypeError('Encoder has to be a function.');
|
throw new TypeError('Encoder has to be a function.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155714,7 +155747,7 @@ module.exports = function (object, opts) {
|
|||||||
if (typeof options.filter === 'function') {
|
if (typeof options.filter === 'function') {
|
||||||
filter = options.filter;
|
filter = options.filter;
|
||||||
obj = filter('', obj);
|
obj = filter('', obj);
|
||||||
} else if (Array.isArray(options.filter)) {
|
} else if (isArray(options.filter)) {
|
||||||
filter = options.filter;
|
filter = options.filter;
|
||||||
objKeys = filter;
|
objKeys = filter;
|
||||||
}
|
}
|
||||||
@@ -155750,8 +155783,7 @@ module.exports = function (object, opts) {
|
|||||||
if (skipNulls && obj[key] === null) {
|
if (skipNulls && obj[key] === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
pushToArray(keys, stringify(
|
||||||
keys = keys.concat(stringify(
|
|
||||||
obj[key],
|
obj[key],
|
||||||
key,
|
key,
|
||||||
generateArrayPrefix,
|
generateArrayPrefix,
|
||||||
@@ -155835,8 +155867,8 @@ var merge = function merge(target, source, options) {
|
|||||||
if (typeof source !== 'object') {
|
if (typeof source !== 'object') {
|
||||||
if (Array.isArray(target)) {
|
if (Array.isArray(target)) {
|
||||||
target.push(source);
|
target.push(source);
|
||||||
} else if (typeof target === 'object') {
|
} else if (target && typeof target === 'object') {
|
||||||
if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) {
|
if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) {
|
||||||
target[source] = true;
|
target[source] = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -155846,7 +155878,7 @@ var merge = function merge(target, source, options) {
|
|||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof target !== 'object') {
|
if (!target || typeof target !== 'object') {
|
||||||
return [target].concat(source);
|
return [target].concat(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155858,8 +155890,9 @@ var merge = function merge(target, source, options) {
|
|||||||
if (Array.isArray(target) && Array.isArray(source)) {
|
if (Array.isArray(target) && Array.isArray(source)) {
|
||||||
source.forEach(function (item, i) {
|
source.forEach(function (item, i) {
|
||||||
if (has.call(target, i)) {
|
if (has.call(target, i)) {
|
||||||
if (target[i] && typeof target[i] === 'object') {
|
var targetItem = target[i];
|
||||||
target[i] = merge(target[i], item, options);
|
if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
|
||||||
|
target[i] = merge(targetItem, item, options);
|
||||||
} else {
|
} else {
|
||||||
target.push(item);
|
target.push(item);
|
||||||
}
|
}
|
||||||
@@ -155940,6 +155973,7 @@ var encode = function encode(str) {
|
|||||||
|
|
||||||
i += 1;
|
i += 1;
|
||||||
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
||||||
|
/* eslint operator-linebreak: [2, "before"] */
|
||||||
out += hexTable[0xF0 | (c >> 18)]
|
out += hexTable[0xF0 | (c >> 18)]
|
||||||
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
||||||
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
||||||
@@ -188840,6 +188874,77 @@ try {
|
|||||||
} catch (er) {}
|
} catch (er) {}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 27289:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.run = void 0;
|
||||||
|
const core = __importStar(__nccwpck_require__(26024));
|
||||||
|
const path = __importStar(__nccwpck_require__(71017));
|
||||||
|
const fs = __importStar(__nccwpck_require__(57147));
|
||||||
|
const cluster_1 = __nccwpck_require__(68077);
|
||||||
|
const utils_1 = __nccwpck_require__(76077);
|
||||||
|
/**
|
||||||
|
* Sets the Kubernetes context based on supplied action inputs
|
||||||
|
*/
|
||||||
|
function run() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// get inputs
|
||||||
|
const clusterType = (0, cluster_1.parseCluster)(core.getInput('cluster-type', {
|
||||||
|
required: true
|
||||||
|
}));
|
||||||
|
const runnerTempDirectory = process.env['RUNNER_TEMP'];
|
||||||
|
const kubeconfigPath = path.join(runnerTempDirectory, `kubeconfig_${Date.now()}`);
|
||||||
|
// get kubeconfig and update context
|
||||||
|
const kubeconfig = yield (0, utils_1.getKubeconfig)(clusterType);
|
||||||
|
const kubeconfigWithContext = (0, utils_1.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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.run = run;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 63297:
|
/***/ 63297:
|
||||||
@@ -189136,47 +189241,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.run = void 0;
|
const action_1 = __nccwpck_require__(27289);
|
||||||
const core = __importStar(__nccwpck_require__(26024));
|
const core = __importStar(__nccwpck_require__(26024));
|
||||||
const path = __importStar(__nccwpck_require__(71017));
|
|
||||||
const fs = __importStar(__nccwpck_require__(57147));
|
|
||||||
const cluster_1 = __nccwpck_require__(68077);
|
|
||||||
const utils_1 = __nccwpck_require__(76077);
|
|
||||||
/**
|
|
||||||
* Sets the Kubernetes context based on supplied action inputs
|
|
||||||
*/
|
|
||||||
function run() {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// get inputs
|
|
||||||
const clusterType = (0, cluster_1.parseCluster)(core.getInput('cluster-type', {
|
|
||||||
required: true
|
|
||||||
}));
|
|
||||||
const runnerTempDirectory = process.env['RUNNER_TEMP'];
|
|
||||||
const kubeconfigPath = path.join(runnerTempDirectory, `kubeconfig_${Date.now()}`);
|
|
||||||
// get kubeconfig and update context
|
|
||||||
const kubeconfig = yield (0, utils_1.getKubeconfig)(clusterType);
|
|
||||||
const kubeconfigWithContext = (0, utils_1.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);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.run = run;
|
|
||||||
// Run the application
|
// Run the application
|
||||||
run().catch(core.setFailed);
|
(0, action_1.run)().catch(core.setFailed);
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|||||||
Generated
+18
-18
@@ -3233,9 +3233,9 @@
|
|||||||
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
|
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
|
||||||
},
|
},
|
||||||
"node_modules/json5": {
|
"node_modules/json5": {
|
||||||
"version": "2.2.1",
|
"version": "2.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
|
||||||
"integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",
|
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"json5": "lib/cli.js"
|
"json5": "lib/cli.js"
|
||||||
@@ -3418,9 +3418,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/minimatch": {
|
"node_modules/minimatch": {
|
||||||
"version": "3.0.4",
|
"version": "3.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
},
|
},
|
||||||
@@ -3786,9 +3786,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/qs": {
|
"node_modules/qs": {
|
||||||
"version": "6.5.2",
|
"version": "6.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz",
|
||||||
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
|
"integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.6"
|
"node": ">=0.6"
|
||||||
}
|
}
|
||||||
@@ -7095,9 +7095,9 @@
|
|||||||
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
|
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
|
||||||
},
|
},
|
||||||
"json5": {
|
"json5": {
|
||||||
"version": "2.2.1",
|
"version": "2.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
|
||||||
"integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",
|
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"jsonpath-plus": {
|
"jsonpath-plus": {
|
||||||
@@ -7232,9 +7232,9 @@
|
|||||||
"integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ=="
|
"integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ=="
|
||||||
},
|
},
|
||||||
"minimatch": {
|
"minimatch": {
|
||||||
"version": "3.0.4",
|
"version": "3.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
}
|
}
|
||||||
@@ -7494,9 +7494,9 @@
|
|||||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
||||||
},
|
},
|
||||||
"qs": {
|
"qs": {
|
||||||
"version": "6.5.2",
|
"version": "6.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz",
|
||||||
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
|
"integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA=="
|
||||||
},
|
},
|
||||||
"quick-lru": {
|
"quick-lru": {
|
||||||
"version": "5.1.1",
|
"version": "5.1.1",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {getRequiredInputError} from '../tests/util'
|
import {getRequiredInputError} from '../tests/util'
|
||||||
import {run} from './run'
|
import {run} from './action'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import * as utils from './utils'
|
import * as utils from './utils'
|
||||||
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
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
-32
@@ -1,36 +1,5 @@
|
|||||||
|
import {run} from './action'
|
||||||
import * as core from '@actions/core'
|
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 the application
|
||||||
run().catch(core.setFailed)
|
run().catch(core.setFailed)
|
||||||
|
|||||||
Reference in New Issue
Block a user