@leverege/build-tools 1.12.6 → 1.12.8

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.
@@ -375,7 +375,7 @@ jobs:
375
375
 
376
376
  - run:
377
377
  name: Check if coverage meets at least 70%
378
- command: ./node_modules/.bin/nyc check-coverage --branches 70 --functions 70 --lines 70 --statements 70
378
+ command: ./node_modules/.bin/nyc check-coverage --functions 70 --lines 70 --statements 70
379
379
 
380
380
  - run:
381
381
  name: Generate docs
@@ -38,7 +38,7 @@ strip_undefined() {
38
38
  }
39
39
 
40
40
  # Useful links with information regarding k8s/docker/nodejs and PID 1
41
- # No PID 1 for NodeJS => https://bit.ly/2Txi9Jq
41
+ # No PID 1 for NodeJS => https://bit.ly/2r4gHkZ
42
42
  # What tini is all about => https://bit.ly/2HsSxqP
43
43
  # Graceful kills with k8s => https://bit.ly/2NONEJG
44
44
  #
@@ -104,7 +104,6 @@ create_bashrc() {
104
104
  #
105
105
  # Version $1 @ `date`
106
106
 
107
- alias golog='cd /var/log/levlog;ls -l'
108
107
  alias h=history
109
108
 
110
109
  alias ls='ls -CF --color=auto'
@@ -113,18 +112,15 @@ alias lla='ls -lha'
113
112
  alias ltr='ls -CF --color=auto -lthr'
114
113
  alias genv='env | grep -i'
115
114
  alias glep='grep -l -s'
116
- alias golog='cd /var/log/levlog'
117
115
  alias m=less
118
116
  alias menv='env | sort | less'
119
117
 
120
118
  alias whatsmyip='wget -qO- ifconfig.co'
121
119
 
122
- alias rcli='redis-cli -h \${DATABASES_REDIS_SERVICE_HOST}'
123
-
124
- alias buny='/usr/src/app/node_modules/bunyan/bin/bunyan'
125
- alias bunlog='golog;cat *-1.log | buny | m'
126
120
  alias dbg='wget -q -O- localhost:5111/logLevel/debug'
127
121
  alias inf='wget -q -O- localhost:5111/logLevel/info'
122
+ alias err='wget -q -O- localhost:5111/logLevel/error'
123
+ alias wrn='wget -q -O- localhost:5111/logLevel/warn'
128
124
 
129
125
  loglev()
130
126
  {
@@ -136,7 +132,7 @@ loglev()
136
132
  logl="logLevel/\$1"
137
133
  fi
138
134
 
139
- printf "Running=> \$wget/\$logl\n"
135
+ printf "Running=> \$wget/\${logl}\n"
140
136
  printf "\n\`\$wget/\$logl\`\n\n"
141
137
  }
142
138
  EOBASHRC
@@ -204,6 +204,14 @@ spec:
204
204
  path: /
205
205
  port: node-metrics
206
206
  initialDelaySeconds: 10
207
+ {{- if (.Values.$chartname_go.LIVENESS_PROBE) and eq .Values.$chartname_go.LIVENESS_PROBE "true" }}
208
+ livenessProbe:
209
+ httpGet:
210
+ path: /livenessProbe
211
+ port: api
212
+ initialDelaySeconds: 15
213
+ periodSeconds: 60
214
+ {{- end }}
207
215
  resources:
208
216
  requests:
209
217
  cpu: "50m"
@@ -220,11 +228,11 @@ spec:
220
228
  containerPort: 5111
221
229
  volumeMounts:
222
230
  - name: model-firebase-key
223
- mountPath: {{ quote .Values.default.MODEL_FIREBASE_SERVICE_ACCOUNT }}
231
+ mountPath: {{ .Values.default.MODEL_FIREBASE_SERVICE_ACCOUNT | quote }}
224
232
  - name: tmpfs
225
233
  mountPath: "/tmp"
226
234
  - name: pubsub-key
227
- mountPath: {{ quote .Values.default.PUBSUB_SERVICE_ACCOUNT }}
235
+ mountPath: {{ .Values.default.PUBSUB_SERVICE_ACCOUNT | quote }}
228
236
  env:
229
237
  - name: NODE_ENV
230
238
  value: {{ .Values.default.NODE_ENVIRONMENT }}
@@ -237,11 +245,11 @@ spec:
237
245
  - name: LOG_CONFIG
238
246
  value: {{ required "Log config required" .Values.default.LOG_CONFIG | quote }}
239
247
  - name: MAX_CHILD_PROCESSES
240
- value: {{ quote .Values.default.MAX_CHILD_PROCESSES }}
248
+ value: {{ .Values.default.MAX_CHILD_PROCESSES | default 1 | quote }}
241
249
  - name: MODEL_FIREBASE_SERVICE_ACCOUNT
242
250
  value: {{ .Values.default.MODEL_FIREBASE_SERVICE_ACCOUNT }}/{{ .Values.default.SECRET_KEY }}
243
251
  - name: MODEL_FIREBASE_DATABASE_URL
244
- value: {{ quote .Values.default.MODEL_FIREBASE_DATABASE_URL }}
252
+ value: {{ .Values.default.MODEL_FIREBASE_DATABASE_URL | quote }}
245
253
  DEPLOYMENT_YAML
246
254
 
247
255
  read -p "Does your server need an open port to the Internet (i.e. ingress or service)? [Y or N] " -n 1 -r
package/lib/server/helmup CHANGED
@@ -355,10 +355,13 @@ function doInstall() {
355
355
  fi
356
356
  HELMUP="helm upgrade --install $SERVICE chartmuseum/$MUSEUM -f $SERVICE/values.yaml $CHARTVER"
357
357
  printf "Helming => `color g \"$HELMUP\"`\n" && $HELMUP
358
- if [ $? -ne 0 ];
358
+ SAVERR=$?
359
+ if [ $SAVERR -ne 0 ];
359
360
  then
360
361
  cat<<NOTRUNNING
361
362
 
363
+ $RED_ERROR helm exited with error status: $SAVERR
364
+
362
365
  $RED_ERROR The $SERVICE chart failed to upgrade or install. There may be an
363
366
  issue with the service's helm charts, or chartmuseum may not be
364
367
  up and running? If the latter, try firing it up with:
@@ -6,8 +6,6 @@ require("core-js/modules/es6.symbol");
6
6
 
7
7
  require("core-js/modules/web.dom.iterable");
8
8
 
9
- require("core-js/modules/es6.promise");
10
-
11
9
  require("core-js/modules/es6.regexp.to-string");
12
10
 
13
11
  require("core-js/modules/es6.object.to-string");
@@ -22,10 +20,6 @@ function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) ||
22
20
 
23
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
24
22
 
25
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
26
-
27
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
28
-
29
23
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
30
24
 
31
25
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -64,81 +58,71 @@ function () {
64
58
 
65
59
  _createClass(CloudflareAPI, [{
66
60
  key: "decrypt",
67
- value: function () {
68
- var _decrypt = _asyncToGenerator(
69
- /*#__PURE__*/
70
- regeneratorRuntime.mark(function _callee() {
71
- var projectId,
72
- keyRingId,
73
- cryptoKeyId,
74
- ciphertextFileName,
75
- plaintextFileName,
76
- kms,
77
- client,
78
- locationId,
79
- readFile,
80
- contentsBuffer,
81
- name,
82
- ciphertext,
83
- _ref,
84
- _ref2,
85
- result,
86
- writeFile,
87
- _args = arguments;
88
-
89
- return regeneratorRuntime.wrap(function _callee$(_context) {
90
- while (1) {
91
- switch (_context.prev = _context.next) {
92
- case 0:
93
- projectId = _args.length > 0 && _args[0] !== undefined ? _args[0] : 'leverege-docker-images';
94
- keyRingId = _args.length > 1 && _args[1] !== undefined ? _args[1] : 'build-tools';
95
- cryptoKeyId = _args.length > 2 && _args[2] !== undefined ? _args[2] : 'circle-ci';
96
- ciphertextFileName = _args.length > 3 && _args[3] !== undefined ? _args[3] : './accounts.json.enc';
97
- plaintextFileName = _args.length > 4 && _args[4] !== undefined ? _args[4] : './accounts.json';
98
- // Import the library and create a client
99
- kms = require('@google-cloud/kms');
100
- client = new kms.KeyManagementServiceClient(); // The location of the crypto key's key ring, e.g. "global"
101
-
102
- locationId = 'us-east4'; // Reads the file to be decrypted
103
-
104
- readFile = promisify(fs.readFile);
105
- _context.next = 11;
106
- return readFile(path.resolve(__dirname, ciphertextFileName));
107
-
108
- case 11:
109
- contentsBuffer = _context.sent;
110
- name = client.cryptoKeyPath(projectId, locationId, keyRingId, cryptoKeyId);
111
- ciphertext = contentsBuffer.toString('base64'); // Decrypts the file using the specified crypto key
112
-
113
- _context.next = 16;
114
- return client.decrypt({
115
- name: name,
116
- ciphertext: ciphertext
117
- });
118
-
119
- case 16:
120
- _ref = _context.sent;
121
- _ref2 = _slicedToArray(_ref, 1);
122
- result = _ref2[0];
123
- // Writes the decrypted file to disk
124
- writeFile = promisify(fs.writeFile);
125
- _context.next = 22;
126
- return writeFile(path.resolve(__dirname, plaintextFileName), Buffer.from(result.plaintext, 'base64'));
127
-
128
- case 22:
129
- case "end":
130
- return _context.stop();
131
- }
61
+ value: function decrypt() {
62
+ var projectId,
63
+ keyRingId,
64
+ cryptoKeyId,
65
+ ciphertextFileName,
66
+ plaintextFileName,
67
+ kms,
68
+ client,
69
+ locationId,
70
+ readFile,
71
+ contentsBuffer,
72
+ name,
73
+ ciphertext,
74
+ _ref,
75
+ _ref2,
76
+ result,
77
+ writeFile,
78
+ _args = arguments;
79
+
80
+ return regeneratorRuntime.async(function decrypt$(_context) {
81
+ while (1) {
82
+ switch (_context.prev = _context.next) {
83
+ case 0:
84
+ projectId = _args.length > 0 && _args[0] !== undefined ? _args[0] : 'leverege-docker-images';
85
+ keyRingId = _args.length > 1 && _args[1] !== undefined ? _args[1] : 'build-tools';
86
+ cryptoKeyId = _args.length > 2 && _args[2] !== undefined ? _args[2] : 'circle-ci';
87
+ ciphertextFileName = _args.length > 3 && _args[3] !== undefined ? _args[3] : './accounts.json.enc';
88
+ plaintextFileName = _args.length > 4 && _args[4] !== undefined ? _args[4] : './accounts.json';
89
+ // Import the library and create a client
90
+ kms = require('@google-cloud/kms');
91
+ client = new kms.KeyManagementServiceClient(); // The location of the crypto key's key ring, e.g. "global"
92
+
93
+ locationId = 'us-east4'; // Reads the file to be decrypted
94
+
95
+ readFile = promisify(fs.readFile);
96
+ _context.next = 11;
97
+ return regeneratorRuntime.awrap(readFile(path.resolve(__dirname, ciphertextFileName)));
98
+
99
+ case 11:
100
+ contentsBuffer = _context.sent;
101
+ name = client.cryptoKeyPath(projectId, locationId, keyRingId, cryptoKeyId);
102
+ ciphertext = contentsBuffer.toString('base64'); // Decrypts the file using the specified crypto key
103
+
104
+ _context.next = 16;
105
+ return regeneratorRuntime.awrap(client.decrypt({
106
+ name: name,
107
+ ciphertext: ciphertext
108
+ }));
109
+
110
+ case 16:
111
+ _ref = _context.sent;
112
+ _ref2 = _slicedToArray(_ref, 1);
113
+ result = _ref2[0];
114
+ // Writes the decrypted file to disk
115
+ writeFile = promisify(fs.writeFile);
116
+ _context.next = 22;
117
+ return regeneratorRuntime.awrap(writeFile(path.resolve(__dirname, plaintextFileName), Buffer.from(result.plaintext, 'base64')));
118
+
119
+ case 22:
120
+ case "end":
121
+ return _context.stop();
132
122
  }
133
- }, _callee);
134
- }));
135
-
136
- function decrypt() {
137
- return _decrypt.apply(this, arguments);
138
- }
139
-
140
- return decrypt;
141
- }()
123
+ }
124
+ });
125
+ }
142
126
  }, {
143
127
  key: "setAccountValues",
144
128
  value: function setAccountValues() {
@@ -156,92 +140,72 @@ function () {
156
140
  }
157
141
  }, {
158
142
  key: "deleteSecrets",
159
- value: function () {
160
- var _deleteSecrets = _asyncToGenerator(
161
- /*#__PURE__*/
162
- regeneratorRuntime.mark(function _callee2() {
163
- var deleteFile;
164
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
165
- while (1) {
166
- switch (_context2.prev = _context2.next) {
167
- case 0:
168
- deleteFile = promisify(fs.unlink);
169
- _context2.next = 3;
170
- return deleteFile(path.resolve(__dirname, './accounts.json'));
171
-
172
- case 3:
173
- case "end":
174
- return _context2.stop();
175
- }
143
+ value: function deleteSecrets() {
144
+ var deleteFile;
145
+ return regeneratorRuntime.async(function deleteSecrets$(_context2) {
146
+ while (1) {
147
+ switch (_context2.prev = _context2.next) {
148
+ case 0:
149
+ deleteFile = promisify(fs.unlink);
150
+ _context2.next = 3;
151
+ return regeneratorRuntime.awrap(deleteFile(path.resolve(__dirname, './accounts.json')));
152
+
153
+ case 3:
154
+ case "end":
155
+ return _context2.stop();
176
156
  }
177
- }, _callee2);
178
- }));
179
-
180
- function deleteSecrets() {
181
- return _deleteSecrets.apply(this, arguments);
182
- }
183
-
184
- return deleteSecrets;
185
- }()
157
+ }
158
+ });
159
+ }
186
160
  }, {
187
161
  key: "createDNSRecord",
188
- value: function () {
189
- var _createDNSRecord = _asyncToGenerator(
190
- /*#__PURE__*/
191
- regeneratorRuntime.mark(function _callee3() {
192
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
193
- while (1) {
194
- switch (_context3.prev = _context3.next) {
195
- case 0:
196
- _context3.prev = 0;
197
- this.spinner.start();
198
- this.spinner.text = 'Decrypting Cloudflare secrets...';
199
- _context3.next = 5;
200
- return this.decrypt();
201
-
202
- case 5:
203
- this.spinner.text = 'Initializing Cloudflare API...';
204
- this.setAccountValues();
205
- this.spinner.text = 'Adding A name record...';
206
- _context3.next = 10;
207
- return this.cf.dnsRecords.add(this.zone, {
208
- type: 'A',
209
- name: this.url,
210
- content: this.ipaddress,
211
- proxied: this.proxy
212
- });
213
-
214
- case 10:
215
- this.spinner.text = 'Removing secrets...';
216
- _context3.next = 13;
217
- return this.deleteSecrets();
218
-
219
- case 13:
220
- this.spinner.stop();
221
- _context3.next = 21;
222
- break;
223
-
224
- case 16:
225
- _context3.prev = 16;
226
- _context3.t0 = _context3["catch"](0);
227
- this.spinner.stop();
228
- console.log(_context3.t0);
229
- throw _context3.t0;
230
-
231
- case 21:
232
- case "end":
233
- return _context3.stop();
234
- }
162
+ value: function createDNSRecord() {
163
+ return regeneratorRuntime.async(function createDNSRecord$(_context3) {
164
+ while (1) {
165
+ switch (_context3.prev = _context3.next) {
166
+ case 0:
167
+ _context3.prev = 0;
168
+ this.spinner.start();
169
+ this.spinner.text = 'Decrypting Cloudflare secrets...';
170
+ _context3.next = 5;
171
+ return regeneratorRuntime.awrap(this.decrypt());
172
+
173
+ case 5:
174
+ this.spinner.text = 'Initializing Cloudflare API...';
175
+ this.setAccountValues();
176
+ this.spinner.text = 'Adding A name record...';
177
+ _context3.next = 10;
178
+ return regeneratorRuntime.awrap(this.cf.dnsRecords.add(this.zone, {
179
+ type: 'A',
180
+ name: this.url,
181
+ content: this.ipaddress,
182
+ proxied: this.proxy
183
+ }));
184
+
185
+ case 10:
186
+ this.spinner.text = 'Removing secrets...';
187
+ _context3.next = 13;
188
+ return regeneratorRuntime.awrap(this.deleteSecrets());
189
+
190
+ case 13:
191
+ this.spinner.stop();
192
+ _context3.next = 21;
193
+ break;
194
+
195
+ case 16:
196
+ _context3.prev = 16;
197
+ _context3.t0 = _context3["catch"](0);
198
+ this.spinner.stop();
199
+ console.log(_context3.t0);
200
+ throw _context3.t0;
201
+
202
+ case 21:
203
+ case "end":
204
+ return _context3.stop();
235
205
  }
236
- }, _callee3, this, [[0, 16]]);
237
- }));
238
-
239
- function createDNSRecord() {
240
- return _createDNSRecord.apply(this, arguments);
241
- }
242
-
243
- return createDNSRecord;
244
- }()
206
+ }
207
+ }, null, this, [[0, 16]]);
208
+ }
245
209
  }]);
246
210
 
247
211
  return CloudflareAPI;
@@ -9,24 +9,18 @@ require("core-js/modules/web.dom.iterable");
9
9
 
10
10
  require("core-js/modules/es6.array.iterator");
11
11
 
12
+ require("core-js/modules/es6.object.to-string");
13
+
12
14
  require("core-js/modules/es6.object.keys");
13
15
 
14
16
  require("regenerator-runtime/runtime");
15
17
 
16
- require("core-js/modules/es6.promise");
17
-
18
- require("core-js/modules/es6.object.to-string");
19
-
20
18
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
21
19
 
22
20
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
23
21
 
24
22
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25
23
 
26
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
27
-
28
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
29
-
30
24
  var commandLineArgs = require('command-line-args');
31
25
 
32
26
  var commandLineUsage = require('command-line-usage');
@@ -89,63 +83,54 @@ var optionDefinitions = [{
89
83
  var args = commandLineArgs(optionDefinitions);
90
84
 
91
85
  function main() {
92
- return _main.apply(this, arguments);
93
- }
94
-
95
- function _main() {
96
- _main = _asyncToGenerator(
97
- /*#__PURE__*/
98
- regeneratorRuntime.mark(function _callee() {
99
- var CF;
100
- return regeneratorRuntime.wrap(function _callee$(_context) {
101
- while (1) {
102
- switch (_context.prev = _context.next) {
103
- case 0:
104
- if (args.help) {
105
- console.log(usage);
106
- }
107
-
108
- if (!(!args.url || !args.ipaddress)) {
109
- _context.next = 10;
110
- break;
111
- }
112
-
113
- console.log('\n*******************************************');
114
- console.log('** **');
115
- console.log('** Need to specify URL and/or IP address **');
116
- console.log('** **');
117
- console.log('*******************************************');
86
+ var CF;
87
+ return regeneratorRuntime.async(function main$(_context) {
88
+ while (1) {
89
+ switch (_context.prev = _context.next) {
90
+ case 0:
91
+ if (args.help) {
118
92
  console.log(usage);
119
- _context.next = 21;
120
- break;
93
+ }
121
94
 
122
- case 10:
123
- CF = new Cloudflare(_objectSpread({}, defaultConfig, {
124
- args: args
125
- }));
126
- _context.prev = 11;
127
- _context.next = 14;
128
- return CF.createDNSRecord();
129
-
130
- case 14:
131
- console.log('Successfully created a new DNS record');
132
- console.log('It may take a few minutes for DNS to propagate');
133
- _context.next = 21;
95
+ if (!(!args.url || !args.ipaddress)) {
96
+ _context.next = 10;
134
97
  break;
135
-
136
- case 18:
137
- _context.prev = 18;
138
- _context.t0 = _context["catch"](11);
139
- console.error(_context.t0.message);
140
-
141
- case 21:
142
- case "end":
143
- return _context.stop();
144
- }
98
+ }
99
+
100
+ console.log('\n*******************************************');
101
+ console.log('** **');
102
+ console.log('** Need to specify URL and/or IP address **');
103
+ console.log('** **');
104
+ console.log('*******************************************');
105
+ console.log(usage);
106
+ _context.next = 21;
107
+ break;
108
+
109
+ case 10:
110
+ CF = new Cloudflare(_objectSpread({}, defaultConfig, {
111
+ args: args
112
+ }));
113
+ _context.prev = 11;
114
+ _context.next = 14;
115
+ return regeneratorRuntime.awrap(CF.createDNSRecord());
116
+
117
+ case 14:
118
+ console.log('Successfully created a new DNS record');
119
+ console.log('It may take a few minutes for DNS to propagate');
120
+ _context.next = 21;
121
+ break;
122
+
123
+ case 18:
124
+ _context.prev = 18;
125
+ _context.t0 = _context["catch"](11);
126
+ console.error(_context.t0.message);
127
+
128
+ case 21:
129
+ case "end":
130
+ return _context.stop();
145
131
  }
146
- }, _callee, null, [[11, 18]]);
147
- }));
148
- return _main.apply(this, arguments);
132
+ }
133
+ }, null, null, [[11, 18]]);
149
134
  }
150
135
 
151
136
  main();