@leverege/build-tools 2.6.5 → 2.6.6
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.
|
Binary file
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
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; }
|
|
4
|
-
|
|
5
3
|
const {
|
|
6
4
|
Transform
|
|
7
5
|
} = require('stream');
|
|
@@ -17,79 +15,76 @@ class ToBuildSpec extends Transform {
|
|
|
17
15
|
super({
|
|
18
16
|
objectMode: true
|
|
19
17
|
});
|
|
18
|
+
this.buildSpec = buildSpec;
|
|
19
|
+
this.regexp = new RegExp('REPI:<(\\w+\\.*\\w*)>', 'g');
|
|
20
|
+
}
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
_transform = function _transformFunc(chunk, encoding, done) {
|
|
23
|
+
const chunkStr = chunk.toString();
|
|
24
|
+
/**
|
|
25
|
+
* Concern of possible partial strings when working with large files.
|
|
26
|
+
* In this case, most source will be less than 10K so this should not
|
|
27
|
+
* be a problem for the most part, but error out if it occurs.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
if (!chunkStr.endsWith('\n')) {
|
|
31
|
+
// TODO: This logic if flawed looking for \n
|
|
32
|
+
console.error(`***PARTIAL LINE***[${chunkStr}]`);
|
|
33
|
+
process.exit(1); // TODO: throw something not exit
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Used for pulling nested or flat values from the buildSpec. This allows
|
|
37
|
+
* the build spec to look like this:
|
|
38
|
+
* {
|
|
39
|
+
* gitName : 'myName',
|
|
40
|
+
* git : {
|
|
41
|
+
* name : 'myName',
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
* and either can be retrieved with a key of gitName or git.name.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
const valueFromSpec = (key, spec = this.buildSpec) => {
|
|
49
|
+
if (!key.match(/\.+/)) {
|
|
50
|
+
return spec[key];
|
|
33
51
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Used for pulling nested or flat values from the buildSpec. This allows
|
|
36
|
-
* the build spec to look like this:
|
|
37
|
-
* {
|
|
38
|
-
* gitName : 'myName',
|
|
39
|
-
* git : {
|
|
40
|
-
* name : 'myName',
|
|
41
|
-
* }
|
|
42
|
-
* }
|
|
43
|
-
* and either can be retrieved with a key of gitName or git.name.
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const valueFromSpec = (key, spec = this.buildSpec) => {
|
|
48
|
-
if (!key.match(/\.+/)) {
|
|
49
|
-
return spec[key];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const keys = key.split('.');
|
|
53
|
-
return valueFromSpec(keys[1], spec[keys[0]]);
|
|
54
|
-
};
|
|
55
52
|
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
const keys = key.split('.');
|
|
54
|
+
return valueFromSpec(keys[1], spec[keys[0]]);
|
|
55
|
+
};
|
|
59
56
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
const splitLines = chunkStr.split('\n');
|
|
58
|
+
const xfmLines = splitLines.map(line => {
|
|
59
|
+
let replaced = line;
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
61
|
+
for (const match of line.matchAll(this.regexp)) {
|
|
62
|
+
// eslint-disable-line no-restricted-syntax
|
|
63
|
+
const replaceWith = valueFromSpec(match[1]);
|
|
68
64
|
|
|
69
|
-
|
|
65
|
+
if (typeof replaceWith === 'undefined') {
|
|
66
|
+
// console.log( `Skipping unknown build spec property =>[${match[1]}]` )//XXX
|
|
67
|
+
continue;
|
|
70
68
|
}
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
const xfmString = xfmLines.join('\n');
|
|
75
|
-
this.push(Buffer.from(xfmString));
|
|
76
|
-
done();
|
|
77
|
-
});
|
|
70
|
+
replaced = replaced.replace(match[0], replaceWith);
|
|
71
|
+
}
|
|
78
72
|
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
if ( this._partialLine ) {
|
|
82
|
-
this.push( [ this._partialLine ] )
|
|
83
|
-
}
|
|
84
|
-
this._partialLine = null
|
|
85
|
-
*/
|
|
86
|
-
done();
|
|
73
|
+
return replaced;
|
|
87
74
|
});
|
|
88
|
-
|
|
89
|
-
this.
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
75
|
+
const xfmString = xfmLines.join('\n');
|
|
76
|
+
this.push(Buffer.from(xfmString));
|
|
77
|
+
done();
|
|
78
|
+
};
|
|
79
|
+
_flush = function _flushFunc(done) {
|
|
80
|
+
/**
|
|
81
|
+
if ( this._partialLine ) {
|
|
82
|
+
this.push( [ this._partialLine ] )
|
|
83
|
+
}
|
|
84
|
+
this._partialLine = null
|
|
85
|
+
*/
|
|
86
|
+
done();
|
|
87
|
+
};
|
|
93
88
|
}
|
|
94
89
|
|
|
95
90
|
module.exports = ToBuildSpec;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.6",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -64,21 +64,21 @@
|
|
|
64
64
|
"inquirer": "^8.1.2",
|
|
65
65
|
"js-yaml": "^4.1.0",
|
|
66
66
|
"ncp": "^2.0.0",
|
|
67
|
-
"npm-check-updates": "^11.8.
|
|
67
|
+
"npm-check-updates": "^11.8.5",
|
|
68
68
|
"npm-registry-fetch": "^11.0.0",
|
|
69
69
|
"open": "^8.2.1",
|
|
70
70
|
"ora": "^5.4.1",
|
|
71
71
|
"parse-gitignore": "^1.0.1",
|
|
72
72
|
"readline-sync": "^1.4.10",
|
|
73
73
|
"semver": "^7.3.5",
|
|
74
|
-
"simple-git": "^2.
|
|
74
|
+
"simple-git": "^2.45.1"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@babel/cli": "^7.
|
|
78
|
-
"@babel/core": "^7.15.
|
|
79
|
-
"@babel/node": "^7.
|
|
80
|
-
"@leverege/babel-preset-leverege-node": "^
|
|
81
|
-
"@leverege/eslint-config-leverege": "^3.0.
|
|
82
|
-
"npm": "^7.
|
|
77
|
+
"@babel/cli": "^7.15.4",
|
|
78
|
+
"@babel/core": "^7.15.5",
|
|
79
|
+
"@babel/node": "^7.15.4",
|
|
80
|
+
"@leverege/babel-preset-leverege-node": "^2.0.0",
|
|
81
|
+
"@leverege/eslint-config-leverege": "^3.0.1",
|
|
82
|
+
"npm": "^7.22.0"
|
|
83
83
|
}
|
|
84
84
|
}
|
package/src/dockreate
CHANGED
|
@@ -76,6 +76,7 @@ COPY ./.npmrc /usr/src/app/.npmrc
|
|
|
76
76
|
RUN apk --no-cache add curl git openssh-client && \
|
|
77
77
|
apk --update add --no-cache --virtual build-dep g++ gcc libgcc \\
|
|
78
78
|
libstdc++ linux-headers make python ${apkadds} && \
|
|
79
|
+
npm install -g npm@7 && \
|
|
79
80
|
npm ci --only-production --ignore-scripts --silent && \
|
|
80
81
|
rm -f /usr/src/app/.npmrc /root/.ssh/*
|
|
81
82
|
|
|
@@ -363,14 +364,14 @@ BUILDERR
|
|
|
363
364
|
fi
|
|
364
365
|
|
|
365
366
|
# Tag the container with the node detailsand the culprit.
|
|
366
|
-
gcloud
|
|
367
|
+
gcloud container images add-tag --quiet $gcimage:$version $gcimage:$pckgdts-$nodeimg-$USER
|
|
367
368
|
|
|
368
369
|
if [ $tagging ];
|
|
369
370
|
then
|
|
370
371
|
printf "\n$(colorize 'green' "Tagging and Pushing $version")\n"
|
|
371
372
|
git tag -af $1 -m "Docker version $1"
|
|
372
373
|
git push --follow-tags
|
|
373
|
-
gcloud
|
|
374
|
+
gcloud container images add-tag --quiet $gcimage:$version $gcimage:latest
|
|
374
375
|
else
|
|
375
376
|
printf "\n$(colorize 'yellow' '*** Skipped git tagging - beta release')\n\n"
|
|
376
377
|
fi
|
package/src/helmup
CHANGED
|
@@ -137,7 +137,7 @@ SA_EXISTS
|
|
|
137
137
|
printf "\n*** Binding IAM role of monitoring viewer to stackdriver-exporter in $GCP_PROJECT_ID\n"
|
|
138
138
|
gcloud projects add-iam-policy-binding "$GCP_PROJECT_ID" \
|
|
139
139
|
--role "roles/monitoring.viewer" \
|
|
140
|
-
--member "serviceAccount:$SDEXP_SA@$GCP_PROJECT_ID.iam.gserviceaccount.com"
|
|
140
|
+
--member "serviceAccount:$SDEXP_SA@$GCP_PROJECT_ID.iam.gserviceaccount.com" &>/dev/null
|
|
141
141
|
|
|
142
142
|
printf "\n*** Binding IAM role of workloadIdentityUser to stackdriver-exporter\n"
|
|
143
143
|
gcloud iam service-accounts add-iam-policy-binding \
|
|
@@ -157,20 +157,21 @@ SA_EXISTS
|
|
|
157
157
|
helm upgrade --install prometheus prometheus-community/prometheus \
|
|
158
158
|
--namespace monitoring \
|
|
159
159
|
--values prometheus/values.yaml \
|
|
160
|
-
--version 13
|
|
160
|
+
--version 13
|
|
161
161
|
|
|
162
162
|
## Installing ES exporter
|
|
163
163
|
helm upgrade --install elasticsearch-exporter prometheus-community/prometheus-elasticsearch-exporter \
|
|
164
164
|
--namespace monitoring \
|
|
165
165
|
--values elasticsearch-exporter/values-es-exporter.yaml \
|
|
166
|
-
--version 4.
|
|
166
|
+
--version 4.6
|
|
167
167
|
|
|
168
168
|
## Install Grafana
|
|
169
169
|
helm repo add grafana https://grafana.github.io/helm-charts && helm repo update
|
|
170
170
|
helm upgrade --install grafana grafana/grafana \
|
|
171
171
|
--namespace monitoring \
|
|
172
172
|
--values grafana/values-grafana.yaml \
|
|
173
|
-
--version 6.
|
|
173
|
+
--version 6.11 # 6.11 last of v7 grafana
|
|
174
|
+
# --version 6.16 # latest v8 grafana
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
function monitoringHelp(){
|