added exports for all functions

This commit is contained in:
Atharva Mulmuley
2021-06-03 11:45:03 +05:30
parent ec4658ba67
commit 69db96d47b
4 changed files with 11 additions and 4 deletions

View File

@ -79,6 +79,7 @@ exports.getArcKubeconfig = getArcKubeconfig;
function sleep(ms) { function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
} }
exports.sleep = sleep;
function executeAzCliCommand(command, silent, execOptions = {}, args = []) { function executeAzCliCommand(command, silent, execOptions = {}, args = []) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
execOptions.silent = !!silent; execOptions.silent = !!silent;
@ -90,3 +91,4 @@ function executeAzCliCommand(command, silent, execOptions = {}, args = []) {
} }
}); });
} }
exports.executeAzCliCommand = executeAzCliCommand;

View File

@ -71,12 +71,14 @@ function getKubeconfig() {
throw Error("Invalid method specified. Acceptable values are kubeconfig and service-account."); throw Error("Invalid method specified. Acceptable values are kubeconfig and service-account.");
} }
} }
exports.getKubeconfig = getKubeconfig;
function getExecutableExtension() { function getExecutableExtension() {
if (os.type().match(/^Win/)) { if (os.type().match(/^Win/)) {
return '.exe'; return '.exe';
} }
return ''; return '';
} }
exports.getExecutableExtension = getExecutableExtension;
function getKubectlPath() { function getKubectlPath() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let kubectlPath = yield io.which('kubectl', false); let kubectlPath = yield io.which('kubectl', false);
@ -91,6 +93,7 @@ function getKubectlPath() {
return kubectlPath; return kubectlPath;
}); });
} }
exports.getKubectlPath = getKubectlPath;
function setContext(kubeconfigPath) { function setContext(kubeconfigPath) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let context = core.getInput('context'); let context = core.getInput('context');
@ -105,6 +108,7 @@ function setContext(kubeconfigPath) {
} }
}); });
} }
exports.setContext = setContext;
function run() { function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
@ -132,4 +136,5 @@ function run() {
} }
}); });
} }
exports.run = run;
run().catch(core.setFailed); run().catch(core.setFailed);

View File

@ -64,11 +64,11 @@ export async function getArcKubeconfig(): Promise<string> {
} }
} }
function sleep(ms) { export function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
} }
async function executeAzCliCommand( export async function executeAzCliCommand(
command: string, command: string,
silent?: boolean, silent?: boolean,
execOptions: any = {}, execOptions: any = {},

View File

@ -21,7 +21,7 @@ export function getKubeconfig(): string {
core.debug("Found clusterUrl, creating kubeconfig using certificate and token"); core.debug("Found clusterUrl, creating kubeconfig using certificate and token");
let k8sSecret = core.getInput('k8s-secret', { required: true }); let k8sSecret = core.getInput('k8s-secret', { required: true });
var parsedk8sSecret = jsyaml.safeLoad(k8sSecret); var parsedk8sSecret = jsyaml.safeLoad(k8sSecret);
let kubernetesServiceAccountSecretFieldNotPresent = 'The service account secret yaml does not contain %s; field. Make sure that its present and try again.'; let kubernetesServiceAccountSecretFieldNotPresent = 'The service acount secret yaml does not contain %s; field. Make sure that its present and try again.';
if (!parsedk8sSecret) { if (!parsedk8sSecret) {
throw Error("The service account secret yaml specified is invalid. Make sure that its a valid yaml and try again."); throw Error("The service account secret yaml specified is invalid. Make sure that its a valid yaml and try again.");
} }
@ -127,4 +127,4 @@ export async function run() {
} }
} }
run().catch(core.setFailed); run().catch(core.setFailed);