Added L2 tests and compiled src. (#23)
This commit is contained in:
@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.run = void 0;
|
||||
exports.run = exports.setContext = exports.getKubectlPath = exports.getExecutableExtension = exports.getKubeconfig = void 0;
|
||||
const core = require("@actions/core");
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
@ -31,7 +31,7 @@ function getKubeconfig() {
|
||||
core.debug("Found clusterUrl, creating kubeconfig using certificate and token");
|
||||
let k8sSecret = core.getInput('k8s-secret', { required: true });
|
||||
var parsedk8sSecret = jsyaml.safeLoad(k8sSecret);
|
||||
let kubernetesServiceAccountSecretFieldNotPresent = 'The service acount secret yaml does not contain %s; field. Make sure that its present and try again.';
|
||||
let kubernetesServiceAccountSecretFieldNotPresent = 'The service account secret yaml does not contain %s; field. Make sure that its present and try again.';
|
||||
if (!parsedk8sSecret) {
|
||||
throw Error("The service account secret yaml specified is invalid. Make sure that its a valid yaml and try again.");
|
||||
}
|
||||
@ -71,12 +71,14 @@ function getKubeconfig() {
|
||||
throw Error("Invalid method specified. Acceptable values are kubeconfig and service-account.");
|
||||
}
|
||||
}
|
||||
exports.getKubeconfig = getKubeconfig;
|
||||
function getExecutableExtension() {
|
||||
if (os.type().match(/^Win/)) {
|
||||
return '.exe';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
exports.getExecutableExtension = getExecutableExtension;
|
||||
function getKubectlPath() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let kubectlPath = yield io.which('kubectl', false);
|
||||
@ -91,6 +93,7 @@ function getKubectlPath() {
|
||||
return kubectlPath;
|
||||
});
|
||||
}
|
||||
exports.getKubectlPath = getKubectlPath;
|
||||
function setContext(kubeconfigPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let context = core.getInput('context');
|
||||
@ -105,6 +108,7 @@ function setContext(kubeconfigPath) {
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.setContext = setContext;
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let kubeconfig = getKubeconfig();
|
||||
|
Reference in New Issue
Block a user