mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-04-14 02:22:19 +08:00
Optional force flag added
This commit is contained in:
parent
b9a4b99a0c
commit
75d14cf7f6
@ -41,6 +41,10 @@ inputs:
|
|||||||
description: 'deploy/promote/reject'
|
description: 'deploy/promote/reject'
|
||||||
required: true
|
required: true
|
||||||
default: 'deploy'
|
default: 'deploy'
|
||||||
|
force:
|
||||||
|
description: 'Deploy when a previous deployment already exists'
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
color: 'green' # optional, decorates the entry in the GitHub Marketplace
|
color: 'green' # optional, decorates the entry in the GitHub Marketplace
|
||||||
|
|||||||
@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.promote = void 0;
|
||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
const deploymentHelper = require("../utilities/strategy-helpers/deployment-helper");
|
const deploymentHelper = require("../utilities/strategy-helpers/deployment-helper");
|
||||||
const canaryDeploymentHelper = require("../utilities/strategy-helpers/canary-deployment-helper");
|
const canaryDeploymentHelper = require("../utilities/strategy-helpers/canary-deployment-helper");
|
||||||
|
|||||||
@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.reject = void 0;
|
||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
const canaryDeploymentHelper = require("../utilities/strategy-helpers/canary-deployment-helper");
|
const canaryDeploymentHelper = require("../utilities/strategy-helpers/canary-deployment-helper");
|
||||||
const SMICanaryDeploymentHelper = require("../utilities/strategy-helpers/smi-canary-deployment-helper");
|
const SMICanaryDeploymentHelper = require("../utilities/strategy-helpers/smi-canary-deployment-helper");
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.workloadTypesWithRolloutStatus = exports.workloadTypes = exports.deploymentTypes = exports.ServiceTypes = exports.DiscoveryAndLoadBalancerResource = exports.KubernetesWorkload = void 0;
|
||||||
class KubernetesWorkload {
|
class KubernetesWorkload {
|
||||||
}
|
}
|
||||||
exports.KubernetesWorkload = KubernetesWorkload;
|
exports.KubernetesWorkload = KubernetesWorkload;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.forceDeployment = 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");
|
const core = require("@actions/core");
|
||||||
exports.namespace = core.getInput('namespace');
|
exports.namespace = core.getInput('namespace');
|
||||||
exports.containers = core.getInput('images').split('\n');
|
exports.containers = core.getInput('images').split('\n');
|
||||||
@ -10,6 +11,7 @@ exports.deploymentStrategy = core.getInput('strategy');
|
|||||||
exports.trafficSplitMethod = core.getInput('traffic-split-method');
|
exports.trafficSplitMethod = core.getInput('traffic-split-method');
|
||||||
exports.baselineAndCanaryReplicas = core.getInput('baseline-and-canary-replicas');
|
exports.baselineAndCanaryReplicas = core.getInput('baseline-and-canary-replicas');
|
||||||
exports.args = core.getInput('arguments');
|
exports.args = core.getInput('arguments');
|
||||||
|
exports.forceDeployment = core.getInput('force').toLowerCase() === 'true';
|
||||||
if (!exports.namespace) {
|
if (!exports.namespace) {
|
||||||
core.debug('Namespace was not supplied; using "default" namespace instead.');
|
core.debug('Namespace was not supplied; using "default" namespace instead.');
|
||||||
exports.namespace = 'default';
|
exports.namespace = 'default';
|
||||||
|
|||||||
@ -9,7 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.Kubectl = void 0;
|
||||||
const tool_runner_1 = require("./utilities/tool-runner");
|
const tool_runner_1 = require("./utilities/tool-runner");
|
||||||
|
const TaskInputParameters = require("./input-parameters");
|
||||||
class Kubectl {
|
class Kubectl {
|
||||||
constructor(kubectlPath, namespace, ignoreSSLErrors) {
|
constructor(kubectlPath, namespace, ignoreSSLErrors) {
|
||||||
this.kubectlPath = kubectlPath;
|
this.kubectlPath = kubectlPath;
|
||||||
@ -22,7 +24,12 @@ class Kubectl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
apply(configurationPaths) {
|
apply(configurationPaths) {
|
||||||
return this.execute(['apply', '-f', this.createInlineArray(configurationPaths)]);
|
let applyArgs = ['apply', '-f', this.createInlineArray(configurationPaths)];
|
||||||
|
if (TaskInputParameters.forceDeployment) {
|
||||||
|
console.log("force flag is on, deployment will continue even if previous deployment already exists");
|
||||||
|
applyArgs.push('--force');
|
||||||
|
}
|
||||||
|
return this.execute(applyArgs);
|
||||||
}
|
}
|
||||||
describe(resourceType, resourceName, silent) {
|
describe(resourceType, resourceName, silent) {
|
||||||
return this.execute(['describe', resourceType, resourceName], silent);
|
return this.execute(['describe', resourceType, resourceName], silent);
|
||||||
|
|||||||
@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.run = void 0;
|
||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
const io = require("@actions/io");
|
const io = require("@actions/io");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
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 fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
|
|||||||
@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.getTrafficSplitAPIVersion = exports.downloadKubectl = exports.getStableKubectlVersion = exports.getkubectlDownloadURL = void 0;
|
||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const os = require("os");
|
const os = require("os");
|
||||||
|
|||||||
@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.checkPodStatus = exports.checkManifestStability = void 0;
|
||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
const utils = require("./utility");
|
const utils = require("./utility");
|
||||||
const KubernetesConstants = require("../constants");
|
const KubernetesConstants = require("../constants");
|
||||||
|
|||||||
@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
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 core = require("@actions/core");
|
||||||
const kubectlutility = require("./kubectl-util");
|
const kubectlutility = require("./kubectl-util");
|
||||||
const io = require("@actions/io");
|
const io = require("@actions/io");
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
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 fs = require("fs");
|
||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
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 fs = require("fs");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
|
|||||||
@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.deploy = void 0;
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.deployPodCanary = void 0;
|
||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.redirectTrafficToStableDeployment = exports.redirectTrafficToCanaryDeployment = exports.deploySMICanary = void 0;
|
||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.isEqual = exports.StringComparer = void 0;
|
||||||
var StringComparer;
|
var StringComparer;
|
||||||
(function (StringComparer) {
|
(function (StringComparer) {
|
||||||
StringComparer[StringComparer["Ordinal"] = 0] = "Ordinal";
|
StringComparer[StringComparer["Ordinal"] = 0] = "Ordinal";
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.ToolRunner = void 0;
|
||||||
const os = require("os");
|
const os = require("os");
|
||||||
const events = require("events");
|
const events = require("events");
|
||||||
const child = require("child_process");
|
const child = require("child_process");
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
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 os = require("os");
|
||||||
const core = require("@actions/core");
|
const core = require("@actions/core");
|
||||||
function getExecutableExtension() {
|
function getExecutableExtension() {
|
||||||
|
|||||||
@ -11,6 +11,7 @@ export const deploymentStrategy: string = core.getInput('strategy');
|
|||||||
export const trafficSplitMethod: string = core.getInput('traffic-split-method');
|
export const trafficSplitMethod: string = core.getInput('traffic-split-method');
|
||||||
export const baselineAndCanaryReplicas: string = core.getInput('baseline-and-canary-replicas');
|
export const baselineAndCanaryReplicas: string = core.getInput('baseline-and-canary-replicas');
|
||||||
export const args: string = core.getInput('arguments');
|
export const args: string = core.getInput('arguments');
|
||||||
|
export const forceDeployment: boolean = core.getInput('force').toLowerCase() === 'true';
|
||||||
|
|
||||||
if (!namespace) {
|
if (!namespace) {
|
||||||
core.debug('Namespace was not supplied; using "default" namespace instead.');
|
core.debug('Namespace was not supplied; using "default" namespace instead.');
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import { ToolRunner, IExecOptions } from "./utilities/tool-runner";
|
import { ToolRunner, IExecOptions } from "./utilities/tool-runner";
|
||||||
|
import * as TaskInputParameters from './input-parameters';
|
||||||
|
|
||||||
export interface Resource {
|
export interface Resource {
|
||||||
name: string;
|
name: string;
|
||||||
@ -21,7 +22,14 @@ export class Kubectl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public apply(configurationPaths: string | string[]) {
|
public apply(configurationPaths: string | string[]) {
|
||||||
return this.execute(['apply', '-f', this.createInlineArray(configurationPaths)]);
|
let applyArgs: string[] = ['apply', '-f', this.createInlineArray(configurationPaths)];
|
||||||
|
|
||||||
|
if (TaskInputParameters.forceDeployment) {
|
||||||
|
console.log("force flag is on, deployment will continue even if previous deployment already exists");
|
||||||
|
applyArgs.push('--force');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.execute(applyArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public describe(resourceType: string, resourceName: string, silent?: boolean) {
|
public describe(resourceType: string, resourceName: string, silent?: boolean) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user