changed action for arc cluster to use az connectedk8s proxy
This commit is contained in:
24
node_modules/actions-secret-parser/index.d.ts
generated
vendored
Normal file
24
node_modules/actions-secret-parser/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
export declare enum FormatType {
|
||||
"JSON" = 0,
|
||||
"XML" = 1
|
||||
}
|
||||
/**
|
||||
* Takes content as string and format type (xml, json).
|
||||
* Exposes getSecret method to get value of specific secret in object and set it as secret.
|
||||
*/
|
||||
export declare class SecretParser {
|
||||
private dom;
|
||||
private contentType;
|
||||
constructor(content: string, contentType: FormatType);
|
||||
/**
|
||||
*
|
||||
* @param key jsonpath or xpath depending on content type
|
||||
* @param isSecret should the value parsed be a secret. Deafult: true
|
||||
* @param variableName optional. If provided value will be exported with this variable name
|
||||
* @returns a string value or empty string if key not found
|
||||
*/
|
||||
getSecret(key: string, isSecret?: boolean, variableName?: string): string;
|
||||
private extractJsonPath;
|
||||
private extractXmlPath;
|
||||
private handleSecret;
|
||||
}
|
91
node_modules/actions-secret-parser/index.js
generated
vendored
Normal file
91
node_modules/actions-secret-parser/index.js
generated
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var core = require('@actions/core');
|
||||
var jp = require('jsonpath');
|
||||
var xpath = require('xpath');
|
||||
var domParser = require('xmldom').DOMParser;
|
||||
var FormatType;
|
||||
(function (FormatType) {
|
||||
FormatType[FormatType["JSON"] = 0] = "JSON";
|
||||
FormatType[FormatType["XML"] = 1] = "XML";
|
||||
})(FormatType = exports.FormatType || (exports.FormatType = {}));
|
||||
/**
|
||||
* Takes content as string and format type (xml, json).
|
||||
* Exposes getSecret method to get value of specific secret in object and set it as secret.
|
||||
*/
|
||||
class SecretParser {
|
||||
constructor(content, contentType) {
|
||||
switch (contentType) {
|
||||
case FormatType.JSON:
|
||||
try {
|
||||
this.dom = JSON.parse(content);
|
||||
}
|
||||
catch (ex) {
|
||||
throw new Error('Content is not a valid JSON object');
|
||||
}
|
||||
break;
|
||||
case FormatType.XML:
|
||||
try {
|
||||
this.dom = new domParser().parseFromString(content);
|
||||
}
|
||||
catch (ex) {
|
||||
throw new Error('Content is not a valid XML object');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Given format: ${contentType} is not supported. Valid options are JSON, XML.`);
|
||||
}
|
||||
this.contentType = contentType;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param key jsonpath or xpath depending on content type
|
||||
* @param isSecret should the value parsed be a secret. Deafult: true
|
||||
* @param variableName optional. If provided value will be exported with this variable name
|
||||
* @returns a string value or empty string if key not found
|
||||
*/
|
||||
getSecret(key, isSecret = true, variableName) {
|
||||
let value = "";
|
||||
switch (this.contentType) {
|
||||
case FormatType.JSON:
|
||||
value = this.extractJsonPath(key, isSecret, variableName);
|
||||
break;
|
||||
case FormatType.XML:
|
||||
value = this.extractXmlPath(key, isSecret, variableName);
|
||||
break;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
extractJsonPath(key, isSecret = false, variableName) {
|
||||
let value = jp.query(this.dom, key);
|
||||
if (value.length == 0) {
|
||||
core.debug("Cannot find key: " + key);
|
||||
return "";
|
||||
}
|
||||
else if (value.length > 1) {
|
||||
core.debug("Multiple values found for key: " + key + ". Please give jsonPath which points to a single value.");
|
||||
return "";
|
||||
}
|
||||
return this.handleSecret(key, value[0], isSecret, variableName);
|
||||
}
|
||||
extractXmlPath(key, isSecret = false, variableName) {
|
||||
let value = xpath.select("string(" + key + ")", this.dom);
|
||||
return this.handleSecret(key, value, isSecret, variableName);
|
||||
}
|
||||
handleSecret(key, value, isSecret, variableName) {
|
||||
if (!!value) {
|
||||
if (isSecret) {
|
||||
core.setSecret(value);
|
||||
}
|
||||
if (!!variableName) {
|
||||
core.exportVariable(variableName, value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
else {
|
||||
core.debug("Cannot find key: " + key);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.SecretParser = SecretParser;
|
63
node_modules/actions-secret-parser/package.json
generated
vendored
Normal file
63
node_modules/actions-secret-parser/package.json
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"_from": "actions-secret-parser",
|
||||
"_id": "actions-secret-parser@1.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-+iGlMSsE/cbxDaEZlqR0NUjn35DckMYsdYFwVeZ7JRbtyO/AiBKnaScKkzkHSoiZ4nEPTdIHtMpRGVgoeVYX+A==",
|
||||
"_location": "/actions-secret-parser",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "actions-secret-parser",
|
||||
"name": "actions-secret-parser",
|
||||
"escapedName": "actions-secret-parser",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/actions-secret-parser/-/actions-secret-parser-1.0.3.tgz",
|
||||
"_shasum": "2574adaab76103ed0b3579546d85e0928c354034",
|
||||
"_spec": "actions-secret-parser",
|
||||
"_where": "C:\\Users\\atharvam\\repos-main\\k8s-set-context\\node_modules",
|
||||
"author": {
|
||||
"name": "Sumiran Aggarwal",
|
||||
"email": "suaggar@microsoft.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/pipelines-appservice-lib/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.1.3",
|
||||
"jsonpath": "^1.0.2",
|
||||
"xmldom": "^0.1.27",
|
||||
"xpath": "0.0.27"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Parse and set repository secrets",
|
||||
"devDependencies": {
|
||||
"typescript": "^3.6.3"
|
||||
},
|
||||
"homepage": "https://github.com/Microsoft/pipelines-appservice-lib/tree/master/packages/utility",
|
||||
"keywords": [
|
||||
"secret",
|
||||
"actions"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "actions-secret-parser",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Microsoft/pipelines-appservice-lib.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"copypackage": "copy package.json lib",
|
||||
"dist": "npm run build && npm run copypackage && cd lib && npm publish"
|
||||
},
|
||||
"version": "1.0.3"
|
||||
}
|
Reference in New Issue
Block a user