@codefresh-io/kube-integration 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dockerfile +1 -1
- package/infra/eventbus.js +40 -56
- package/package.json +2 -2
- package/service.yaml +1 -1
package/Dockerfile
CHANGED
|
@@ -16,7 +16,7 @@ RUN yarn install --production --frozen-lockfile
|
|
|
16
16
|
RUN mkdir /logs
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
FROM octopusdeploy/dhi-node:${DHI_NODE_TAG}_${DHI_NODE_CUSTOMIZATION}@sha256:
|
|
19
|
+
FROM octopusdeploy/dhi-node:${DHI_NODE_TAG}_${DHI_NODE_CUSTOMIZATION}@sha256:aceef001165f4e8079d8a1c872b08c91435dbd06ca0cd8c287ed963cda57999b AS prod
|
|
20
20
|
WORKDIR /kube-integration
|
|
21
21
|
COPY --chown=node:node --chmod=755 --from=prod-deps /kube-integration/ /kube-integration/
|
|
22
22
|
COPY --chown=node:node --chmod=755 --from=prod-deps /logs/ /logs/
|
package/infra/eventbus.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const Promise = require('bluebird');
|
|
4
3
|
const eventBus = require('@codefresh-io/eventbus');
|
|
5
4
|
const { Logger } = require('@codefresh-io/cf-telemetry/logs');
|
|
6
5
|
const config = require('./../config');
|
|
@@ -18,48 +17,43 @@ class Eventbus {
|
|
|
18
17
|
* @returns {*}
|
|
19
18
|
*/
|
|
20
19
|
init(config) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return deferred.promise;
|
|
59
|
-
})
|
|
60
|
-
.then(() => {
|
|
61
|
-
return this._start();
|
|
62
|
-
});
|
|
20
|
+
this.config = config;
|
|
21
|
+
|
|
22
|
+
/** @type {PromiseWithResolvers<void>} */
|
|
23
|
+
const deferred = Promise.withResolvers();
|
|
24
|
+
|
|
25
|
+
//TODO a fallback for case where rabbitmq is not up. should be removed once rabbitmq is fully used
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
deferred.resolve();
|
|
28
|
+
}, 30000);
|
|
29
|
+
|
|
30
|
+
eventBus.init({
|
|
31
|
+
bus: {
|
|
32
|
+
url: this.config.eventbus.uri,
|
|
33
|
+
reconnectInterval: 5
|
|
34
|
+
},
|
|
35
|
+
store: {
|
|
36
|
+
host: this.config.postgres.host,
|
|
37
|
+
database: this.config.postgres.database,
|
|
38
|
+
user: this.config.postgres.user,
|
|
39
|
+
password: this.config.postgres.password,
|
|
40
|
+
port: this.config.postgres.port,
|
|
41
|
+
},
|
|
42
|
+
microServiceName: this.config.eventbus.serviceName
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
eventBus.on('ready', () => {
|
|
46
|
+
logger.info('Eventbus ready');
|
|
47
|
+
this.eventbusInitialized = true;
|
|
48
|
+
deferred.resolve();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
eventBus.on('error', (err) => {
|
|
52
|
+
// monitor.noticeError(error); // Used earlier to report an error to New Relic
|
|
53
|
+
logger.error(`Eventbus error`, err);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return deferred.promise.then(() => this._start());
|
|
63
57
|
}
|
|
64
58
|
|
|
65
59
|
|
|
@@ -71,17 +65,8 @@ class Eventbus {
|
|
|
71
65
|
if (!this.eventbusInitialized) {
|
|
72
66
|
return Promise.resolve();
|
|
73
67
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
eventBus.on('close', () => {
|
|
78
|
-
logger.info('Eventbus client closed');
|
|
79
|
-
deferred.resolve();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
eventBus.quit();
|
|
83
|
-
|
|
84
|
-
return deferred.promise;
|
|
68
|
+
logger.info('Eventbus client closed');
|
|
69
|
+
return eventBus.quit();
|
|
85
70
|
}
|
|
86
71
|
|
|
87
72
|
_start() {}
|
|
@@ -93,8 +78,7 @@ class Eventbus {
|
|
|
93
78
|
.catch((err) => {
|
|
94
79
|
// monitor.noticeError(err); // Used earlier to report an error to New Relic
|
|
95
80
|
logger.error(`Failed to publish event: ${name}`, err);
|
|
96
|
-
})
|
|
97
|
-
.done();
|
|
81
|
+
});
|
|
98
82
|
}
|
|
99
83
|
|
|
100
84
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.1.
|
|
2
|
+
"version": "2.1.2",
|
|
3
3
|
"name": "@codefresh-io/kube-integration",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description": "",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@codefresh-io/cf-telemetry": "^4.2.1",
|
|
40
40
|
"@codefresh-io/docker-reference": "^0.1.0",
|
|
41
|
-
"@codefresh-io/eventbus": "^
|
|
41
|
+
"@codefresh-io/eventbus": "^4.0.1",
|
|
42
42
|
"@codefresh-io/http-infra": "^1.8.15",
|
|
43
43
|
"bluebird": "^3.7.2",
|
|
44
44
|
"cf-errors": "^0.1.17",
|
package/service.yaml
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
version: 2.1.
|
|
1
|
+
version: 2.1.2
|