kit-deployer
Advanced tools
Comparing version 7.6.0 to 7.7.0
{ | ||
"name": "kit-deployer", | ||
"version": "7.6.0", | ||
"version": "7.7.0", | ||
"description": "Use to deploy files to multiple kubernetes clusters.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -76,2 +76,5 @@ <p align="center"> | ||
}); | ||
deployer.on("progress", function(progress) { | ||
console.log(progress); | ||
}); | ||
@@ -87,2 +90,31 @@ deployer | ||
## Progress | ||
The progress event emits whenever a cluster was successfully deployed to or failed deploying. It will tell you how many clusters are left, how many had issues being deployed to and what these clusters were. This is what the object looks like. Information is purposely made redundant for easier logging where needed. | ||
```json | ||
{ | ||
"percent": 0.5, | ||
"clusters": { | ||
"total": 4, | ||
"completed": 2, | ||
"found": [ | ||
"cluster-1", | ||
"cluster-2", | ||
"cluster-3", | ||
"cluster-4" | ||
], | ||
"remaining": [ | ||
"cluster-2", | ||
"cluster-3" | ||
], | ||
"successful": [ | ||
"cluster-1", | ||
"cluster-2" | ||
], | ||
"failed": [] | ||
} | ||
} | ||
``` | ||
## Namespaces | ||
@@ -89,0 +121,0 @@ |
@@ -12,2 +12,3 @@ "use strict"; | ||
const Namespaces = require("./namespaces"); | ||
const Progress = require("./progress"); | ||
const Webhook = require("./webhook"); | ||
@@ -61,2 +62,7 @@ const readFileAsync = Promise.promisify(fs.readFile); | ||
return new Promise(function(resolve, reject) { | ||
const progress = new Progress(); | ||
progress.on("progress", (msg) => { | ||
self.emit("progress", msg); | ||
}); | ||
glob(configPattern, (globErr, configFiles) => { | ||
@@ -125,2 +131,5 @@ if (globErr) { | ||
// Add each cluster so we know the total number of clusters that need to be processed | ||
progress.add(config.metadata.name); | ||
var kubectl = new Kubectl({ | ||
@@ -162,2 +171,4 @@ kubeconfig: configFile, | ||
try { | ||
// Add the progress to the status before sending webhook | ||
status.progress = progress.status(); | ||
webhook.change(status); | ||
@@ -178,2 +189,10 @@ } catch (err) { | ||
return manifests.deploy(); | ||
}) | ||
.then((res) => { | ||
progress.success(config.metadata.name); | ||
return res; | ||
}) | ||
.catch((err) => { | ||
progress.fail(config.metadata.name); | ||
throw err; | ||
})); | ||
@@ -180,0 +199,0 @@ })); |
@@ -39,3 +39,3 @@ "use strict"; | ||
send(name, phase, status, reason) { | ||
send(name, phase, status, reason, progress) { | ||
const payload = { | ||
@@ -53,2 +53,3 @@ // TODO: dynamic name for payload? | ||
reason: reason, | ||
progress: progress, | ||
url: undefined, | ||
@@ -133,3 +134,3 @@ scm: { | ||
const name = this.getManifestName(manifestStatus); | ||
promises.push(this.send(name, manifestStatus.phase, manifestStatus.status, manifestStatus.reason)); | ||
promises.push(this.send(name, manifestStatus.phase, manifestStatus.status, manifestStatus.reason, status.progress)); | ||
}); | ||
@@ -151,3 +152,3 @@ Promise | ||
this.send(name, status.phase, status.status, status.reason); | ||
this.send(name, status.phase, status.status, status.reason, status.progress); | ||
} else if (this.manifests[name].status !== "FAILURE") { | ||
@@ -154,0 +155,0 @@ // If the status is failure for any cluster, we consider the deployment as a whole a failure, so keep failure status |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56602092
26
2062
216