@leverege/build-tools 2.6.4 → 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.
- package/lib/server/repo-init/config.tgz +0 -0
- package/lib/server/repo-init/templates/ToBuildSpec.js +60 -65
- package/package.json +9 -9
- package/src/dockreate +3 -2
- package/src/helmdn +5 -4
- package/src/helmup +14 -24
|
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/helmdn
CHANGED
|
@@ -50,16 +50,17 @@ PLATFORM=(
|
|
|
50
50
|
resource-server
|
|
51
51
|
scheduler
|
|
52
52
|
transponder-bq
|
|
53
|
-
transponder-fb
|
|
54
53
|
transponder-postgres
|
|
55
54
|
transponder-rt
|
|
56
55
|
)
|
|
57
56
|
|
|
58
57
|
SYSTEM=(
|
|
59
58
|
elastic
|
|
60
|
-
monitoring
|
|
61
|
-
polaris
|
|
62
59
|
redis
|
|
60
|
+
postgres
|
|
61
|
+
timescale-db
|
|
62
|
+
monitoring
|
|
63
|
+
reloader
|
|
63
64
|
traefik
|
|
64
65
|
velero
|
|
65
66
|
)
|
|
@@ -116,7 +117,7 @@ function doNuking() {
|
|
|
116
117
|
annihilateMonitoring && continue
|
|
117
118
|
fi
|
|
118
119
|
|
|
119
|
-
if [ "$SERVICE" == "velero" ];
|
|
120
|
+
if [ "$SERVICE" == "velero-nuke" ];
|
|
120
121
|
then
|
|
121
122
|
annihilateVelero && continue
|
|
122
123
|
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(){
|
|
@@ -442,22 +443,22 @@ function doInstall() {
|
|
|
442
443
|
# Allows chart version from command line via <deployment>/<x.y.z>
|
|
443
444
|
IFS="/" read SERVICE CHARTVER <<< "$PARAM"
|
|
444
445
|
|
|
445
|
-
# Allows chart version as <deployment
|
|
446
|
+
# Allows chart version as <deployment>/Chart-x.y.z*>
|
|
446
447
|
if [ -z "$CHARTVER" ];
|
|
447
448
|
then
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
done
|
|
449
|
+
LCL_CHART=`compgen -G $SERVICE/Chart-?.?.?*` &>/dev/null
|
|
450
|
+
if [ ! -z "$LCL_CHART" ];
|
|
451
|
+
then
|
|
452
|
+
CHARTVER=${LCL_CHART#*/Chart-}
|
|
453
|
+
printf "\n$YELO_WARN Chart version controlled by => `color y $LCL_CHART`\n"
|
|
454
|
+
fi
|
|
455
455
|
fi
|
|
456
|
+
#printf "SVC=[$SERVICE] CHT=[$CHARTVER]\n"
|
|
456
457
|
|
|
457
458
|
# slap additional helm syntax in there if the version is set
|
|
458
459
|
[ ! -z "$CHARTVER" ] && CHARTVER="--version $CHARTVER"
|
|
459
460
|
|
|
460
|
-
# If we're referencing a plugin
|
|
461
|
+
# If we're referencing a plugin then execute it and continue
|
|
461
462
|
ifPluggedIn $SERVICE && continue
|
|
462
463
|
|
|
463
464
|
case "$SERVICE" in
|
|
@@ -469,11 +470,6 @@ function doInstall() {
|
|
|
469
470
|
doInstall "${SYSTEM[@]}"
|
|
470
471
|
;;
|
|
471
472
|
|
|
472
|
-
"coredns")
|
|
473
|
-
helm install --name coredns --namespace=kube-system stable/coredns
|
|
474
|
-
printf "\nGithub repo is here => https://github.com/helm/charts/tree/master/stable/coredns\n\n"
|
|
475
|
-
;;
|
|
476
|
-
|
|
477
473
|
"custom-metrics")
|
|
478
474
|
kubectl create -f https://raw.githubusercontent.com/GoogleCloudPlatform/k8s-stackdriver/master/custom-metrics-stackdriver-adapter/deploy/production/adapter.yaml
|
|
479
475
|
;;
|
|
@@ -497,12 +493,6 @@ function doInstall() {
|
|
|
497
493
|
monitoringHelp && exit 0
|
|
498
494
|
;;
|
|
499
495
|
|
|
500
|
-
"polaris")
|
|
501
|
-
helm repo add reactiveops-stable https://charts.reactiveops.com/stable
|
|
502
|
-
helm upgrade --install polaris reactiveops-stable/polaris --namespace polaris
|
|
503
|
-
printf "\n***Proxy 8081 with this=> kubectl port-forward --namespace polaris svc/polaris-dashboard 8081:80\n\n"
|
|
504
|
-
;;
|
|
505
|
-
|
|
506
496
|
"postgres"|"postgresql")
|
|
507
497
|
helm repo add bitnami https://charts.bitnami.com/bitnami
|
|
508
498
|
helm upgrade --install postgres bitnami/postgresql -f postgres/postgres-values.yaml --version 8.9.6
|