From b9a4b99a0ca0c55c334ac48eb4ab44612ae1d4e1 Mon Sep 17 00:00:00 2001 From: rgsubh <64013610+rgsubh@users.noreply.github.com> Date: Mon, 8 Jun 2020 09:10:25 +0530 Subject: [PATCH] Reverting typescript export changes in previour PR (#39) --- .gitignore | 3 +- __tests__/run.test.ts | 2 +- lib/actions/promote.js | 1 - lib/actions/reject.js | 1 - lib/constants.js | 46 ++++++++----------- lib/input-parameters.js | 1 - lib/kubectl-object-model.js | 1 - lib/run.js | 4 +- lib/utilities/files-helper.js | 1 - lib/utilities/kubectl-util.js | 1 - lib/utilities/manifest-stability-utility.js | 1 - lib/utilities/manifest-utilities.js | 1 - lib/utilities/resource-object-utility.js | 1 - .../canary-deployment-helper.js | 1 - .../strategy-helpers/deployment-helper.js | 1 - .../pod-canary-deployment-helper.js | 1 - .../smi-canary-deployment-helper.js | 1 - lib/utilities/string-comparison.js | 1 - lib/utilities/tool-runner.js | 1 - lib/utilities/utility.js | 1 - src/run.ts | 3 +- 21 files changed, 24 insertions(+), 50 deletions(-) diff --git a/.gitignore b/.gitignore index d109d827..0d4440f3 100644 --- a/.gitignore +++ b/.gitignore @@ -326,5 +326,4 @@ ASALocalRun/ *.nvuser # MFractors (Xamarin productivity tool) working folder -.mfractor/ -node_modules +.mfractor/ \ No newline at end of file diff --git a/__tests__/run.test.ts b/__tests__/run.test.ts index fcd2633b..339501d2 100644 --- a/__tests__/run.test.ts +++ b/__tests__/run.test.ts @@ -137,7 +137,7 @@ test("run() - deploy - Manifiest not provided", async () => { fileUtility.chmodSync = jest.fn(); //Invoke and assert - await expect(action.run()).rejects.toThrowError(); + await expect(action.run()).resolves.not.toThrow(); expect(coreMock.setFailed).toBeCalledWith('No manifests supplied to deploy'); }); diff --git a/lib/actions/promote.js b/lib/actions/promote.js index 50e3fd05..2bdf58c9 100644 --- a/lib/actions/promote.js +++ b/lib/actions/promote.js @@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.promote = void 0; const core = require("@actions/core"); const deploymentHelper = require("../utilities/strategy-helpers/deployment-helper"); const canaryDeploymentHelper = require("../utilities/strategy-helpers/canary-deployment-helper"); diff --git a/lib/actions/reject.js b/lib/actions/reject.js index cb0d73ee..d3177ef6 100644 --- a/lib/actions/reject.js +++ b/lib/actions/reject.js @@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.reject = void 0; const core = require("@actions/core"); const canaryDeploymentHelper = require("../utilities/strategy-helpers/canary-deployment-helper"); const SMICanaryDeploymentHelper = require("../utilities/strategy-helpers/smi-canary-deployment-helper"); diff --git a/lib/constants.js b/lib/constants.js index 31ea7d3d..50919389 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -1,36 +1,26 @@ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); -exports.workloadTypesWithRolloutStatus = exports.workloadTypes = exports.deploymentTypes = exports.ServiceTypes = exports.DiscoveryAndLoadBalancerResource = exports.KubernetesWorkload = void 0; -let KubernetesWorkload = /** @class */ (() => { - class KubernetesWorkload { - } - KubernetesWorkload.pod = 'Pod'; - KubernetesWorkload.replicaset = 'Replicaset'; - KubernetesWorkload.deployment = 'Deployment'; - KubernetesWorkload.statefulSet = 'StatefulSet'; - KubernetesWorkload.daemonSet = 'DaemonSet'; - KubernetesWorkload.job = 'job'; - KubernetesWorkload.cronjob = 'cronjob'; - return KubernetesWorkload; -})(); +class KubernetesWorkload { +} exports.KubernetesWorkload = KubernetesWorkload; -let DiscoveryAndLoadBalancerResource = /** @class */ (() => { - class DiscoveryAndLoadBalancerResource { - } - DiscoveryAndLoadBalancerResource.service = 'service'; - DiscoveryAndLoadBalancerResource.ingress = 'ingress'; - return DiscoveryAndLoadBalancerResource; -})(); +KubernetesWorkload.pod = 'Pod'; +KubernetesWorkload.replicaset = 'Replicaset'; +KubernetesWorkload.deployment = 'Deployment'; +KubernetesWorkload.statefulSet = 'StatefulSet'; +KubernetesWorkload.daemonSet = 'DaemonSet'; +KubernetesWorkload.job = 'job'; +KubernetesWorkload.cronjob = 'cronjob'; +class DiscoveryAndLoadBalancerResource { +} exports.DiscoveryAndLoadBalancerResource = DiscoveryAndLoadBalancerResource; -let ServiceTypes = /** @class */ (() => { - class ServiceTypes { - } - ServiceTypes.loadBalancer = 'LoadBalancer'; - ServiceTypes.nodePort = 'NodePort'; - ServiceTypes.clusterIP = 'ClusterIP'; - return ServiceTypes; -})(); +DiscoveryAndLoadBalancerResource.service = 'service'; +DiscoveryAndLoadBalancerResource.ingress = 'ingress'; +class ServiceTypes { +} exports.ServiceTypes = ServiceTypes; +ServiceTypes.loadBalancer = 'LoadBalancer'; +ServiceTypes.nodePort = 'NodePort'; +ServiceTypes.clusterIP = 'ClusterIP'; exports.deploymentTypes = ['deployment', 'replicaset', 'daemonset', 'pod', 'statefulset']; exports.workloadTypes = ['deployment', 'replicaset', 'daemonset', 'pod', 'statefulset', 'job', 'cronjob']; exports.workloadTypesWithRolloutStatus = ['deployment', 'daemonset', 'statefulset']; diff --git a/lib/input-parameters.js b/lib/input-parameters.js index c4903363..63869312 100644 --- a/lib/input-parameters.js +++ b/lib/input-parameters.js @@ -1,6 +1,5 @@ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); -exports.args = exports.baselineAndCanaryReplicas = exports.trafficSplitMethod = exports.deploymentStrategy = exports.canaryPercentage = exports.manifests = exports.imagePullSecrets = exports.containers = exports.namespace = void 0; const core = require("@actions/core"); exports.namespace = core.getInput('namespace'); exports.containers = core.getInput('images').split('\n'); diff --git a/lib/kubectl-object-model.js b/lib/kubectl-object-model.js index e8687466..9effab10 100644 --- a/lib/kubectl-object-model.js +++ b/lib/kubectl-object-model.js @@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.Kubectl = void 0; const tool_runner_1 = require("./utilities/tool-runner"); class Kubectl { constructor(kubectlPath, namespace, ignoreSSLErrors) { diff --git a/lib/run.js b/lib/run.js index ebcb91e7..369a0efd 100644 --- a/lib/run.js +++ b/lib/run.js @@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.run = void 0; const core = require("@actions/core"); const io = require("@actions/io"); const path = require("path"); @@ -63,13 +62,14 @@ function run() { let manifestsInput = core.getInput('manifests'); if (!manifestsInput) { core.setFailed('No manifests supplied to deploy'); + return; } let namespace = core.getInput('namespace'); if (!namespace) { namespace = 'default'; } let action = core.getInput('action'); - let manifests = manifestsInput ? manifestsInput.split('\n') : undefined; + let manifests = manifestsInput.split('\n'); if (action === 'deploy') { let strategy = core.getInput('strategy'); console.log("strategy: ", strategy); diff --git a/lib/utilities/files-helper.js b/lib/utilities/files-helper.js index 4b9ecc81..b7cd2754 100644 --- a/lib/utilities/files-helper.js +++ b/lib/utilities/files-helper.js @@ -1,6 +1,5 @@ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); -exports.writeManifestToFile = exports.writeObjectsToFile = exports.assertFileExists = exports.ensureDirExists = exports.getNewUserDirPath = exports.getTempDirectory = void 0; const fs = require("fs"); const path = require("path"); const core = require("@actions/core"); diff --git a/lib/utilities/kubectl-util.js b/lib/utilities/kubectl-util.js index a5bbcb63..464e088e 100644 --- a/lib/utilities/kubectl-util.js +++ b/lib/utilities/kubectl-util.js @@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getTrafficSplitAPIVersion = exports.downloadKubectl = exports.getStableKubectlVersion = exports.getkubectlDownloadURL = void 0; const core = require("@actions/core"); const fs = require("fs"); const os = require("os"); diff --git a/lib/utilities/manifest-stability-utility.js b/lib/utilities/manifest-stability-utility.js index 778219a7..c5cd5013 100644 --- a/lib/utilities/manifest-stability-utility.js +++ b/lib/utilities/manifest-stability-utility.js @@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.checkPodStatus = exports.checkManifestStability = void 0; const core = require("@actions/core"); const utils = require("./utility"); const KubernetesConstants = require("../constants"); diff --git a/lib/utilities/manifest-utilities.js b/lib/utilities/manifest-utilities.js index 0237cdc4..04f29ff8 100644 --- a/lib/utilities/manifest-utilities.js +++ b/lib/utilities/manifest-utilities.js @@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.isWorkloadEntity = exports.updateImagePullSecrets = exports.updateContainerImagesInManifestFiles = exports.substituteImageNameInSpecFile = exports.getDeleteCmdArgs = exports.createKubectlArgs = exports.getKubectl = exports.getManifestFiles = void 0; const core = require("@actions/core"); const kubectlutility = require("./kubectl-util"); const io = require("@actions/io"); diff --git a/lib/utilities/resource-object-utility.js b/lib/utilities/resource-object-utility.js index ebb7e564..14c7f740 100644 --- a/lib/utilities/resource-object-utility.js +++ b/lib/utilities/resource-object-utility.js @@ -1,6 +1,5 @@ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getResources = exports.updateSelectorLabels = exports.updateSpecLabels = exports.updateImageDetails = exports.updateImagePullSecrets = exports.updateObjectLabels = exports.getReplicaCount = exports.isServiceEntity = exports.isWorkloadEntity = exports.isDeploymentEntity = void 0; const fs = require("fs"); const core = require("@actions/core"); const yaml = require("js-yaml"); diff --git a/lib/utilities/strategy-helpers/canary-deployment-helper.js b/lib/utilities/strategy-helpers/canary-deployment-helper.js index 7df15ce1..d8c5cb91 100644 --- a/lib/utilities/strategy-helpers/canary-deployment-helper.js +++ b/lib/utilities/strategy-helpers/canary-deployment-helper.js @@ -1,6 +1,5 @@ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getStableResourceName = exports.getBaselineResourceName = exports.getCanaryResourceName = exports.isSMICanaryStrategy = exports.isCanaryDeploymentStrategy = exports.fetchResource = exports.fetchCanaryResource = exports.getNewCanaryResource = exports.getNewBaselineResource = exports.getStableResource = exports.isResourceMarkedAsStable = exports.markResourceAsStable = exports.deleteCanaryDeployment = exports.STABLE_LABEL_VALUE = exports.STABLE_SUFFIX = exports.CANARY_LABEL_VALUE = exports.BASELINE_LABEL_VALUE = exports.CANARY_VERSION_LABEL = exports.TRAFFIC_SPLIT_STRATEGY = exports.CANARY_DEPLOYMENT_STRATEGY = void 0; const fs = require("fs"); const yaml = require("js-yaml"); const core = require("@actions/core"); diff --git a/lib/utilities/strategy-helpers/deployment-helper.js b/lib/utilities/strategy-helpers/deployment-helper.js index a2e242cd..a880bd9c 100644 --- a/lib/utilities/strategy-helpers/deployment-helper.js +++ b/lib/utilities/strategy-helpers/deployment-helper.js @@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.deploy = void 0; const fs = require("fs"); const core = require("@actions/core"); const yaml = require("js-yaml"); diff --git a/lib/utilities/strategy-helpers/pod-canary-deployment-helper.js b/lib/utilities/strategy-helpers/pod-canary-deployment-helper.js index 4e0ae883..3a66581a 100644 --- a/lib/utilities/strategy-helpers/pod-canary-deployment-helper.js +++ b/lib/utilities/strategy-helpers/pod-canary-deployment-helper.js @@ -1,6 +1,5 @@ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); -exports.deployPodCanary = void 0; const core = require("@actions/core"); const fs = require("fs"); const yaml = require("js-yaml"); diff --git a/lib/utilities/strategy-helpers/smi-canary-deployment-helper.js b/lib/utilities/strategy-helpers/smi-canary-deployment-helper.js index fd90abcb..4a871824 100644 --- a/lib/utilities/strategy-helpers/smi-canary-deployment-helper.js +++ b/lib/utilities/strategy-helpers/smi-canary-deployment-helper.js @@ -1,6 +1,5 @@ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); -exports.redirectTrafficToStableDeployment = exports.redirectTrafficToCanaryDeployment = exports.deploySMICanary = void 0; const core = require("@actions/core"); const fs = require("fs"); const yaml = require("js-yaml"); diff --git a/lib/utilities/string-comparison.js b/lib/utilities/string-comparison.js index 9dd1b0a1..5edaa9aa 100644 --- a/lib/utilities/string-comparison.js +++ b/lib/utilities/string-comparison.js @@ -1,6 +1,5 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.isEqual = exports.StringComparer = void 0; var StringComparer; (function (StringComparer) { StringComparer[StringComparer["Ordinal"] = 0] = "Ordinal"; diff --git a/lib/utilities/tool-runner.js b/lib/utilities/tool-runner.js index e1ea302e..cd46a5f5 100644 --- a/lib/utilities/tool-runner.js +++ b/lib/utilities/tool-runner.js @@ -1,6 +1,5 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.ToolRunner = void 0; const os = require("os"); const events = require("events"); const child = require("child_process"); diff --git a/lib/utilities/utility.js b/lib/utilities/utility.js index db0543a5..35b79737 100644 --- a/lib/utilities/utility.js +++ b/lib/utilities/utility.js @@ -1,6 +1,5 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getCurrentTime = exports.getRandomInt = exports.sleep = exports.checkForErrors = exports.isEqual = exports.getExecutableExtension = void 0; const os = require("os"); const core = require("@actions/core"); function getExecutableExtension() { diff --git a/src/run.ts b/src/run.ts index c36e5ba0..72b4ce1d 100644 --- a/src/run.ts +++ b/src/run.ts @@ -52,13 +52,14 @@ export async function run() { let manifestsInput = core.getInput('manifests'); if (!manifestsInput) { core.setFailed('No manifests supplied to deploy'); + return; } let namespace = core.getInput('namespace'); if (!namespace) { namespace = 'default'; } let action = core.getInput('action'); - let manifests = manifestsInput ? manifestsInput.split('\n') : undefined; + let manifests = manifestsInput.split('\n'); if (action === 'deploy') { let strategy = core.getInput('strategy');