@leverege/build-tools 2.10.1 → 2.11.1

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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.10.1",
3
+ "version": "2.11.1",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -51,13 +51,13 @@
51
51
  "chalk": "^4.1.2",
52
52
  "clipboardy": "^2.3.0",
53
53
  "command-line-args": "^5.2.1",
54
- "command-line-usage": "^6.1.1",
54
+ "command-line-usage": "^6.1.2",
55
55
  "deepmerge": "^4.2.2",
56
56
  "dotenv": "^16.0.0",
57
57
  "execa": "^5.1.1",
58
58
  "figlet": "^1.5.2",
59
59
  "glob": "^7.2.0",
60
- "inquirer": "^8.2.1",
60
+ "inquirer": "^8.2.2",
61
61
  "js-yaml": "^4.1.0",
62
62
  "ncp": "^2.0.0",
63
63
  "npm-registry-fetch": "^11.0.0",
@@ -66,7 +66,7 @@
66
66
  "parse-gitignore": "^1.0.1",
67
67
  "readline-sync": "^1.4.10",
68
68
  "semver": "^7.3.5",
69
- "simple-git": "^3.4.0"
69
+ "simple-git": "^3.5.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@babel/cli": "^7.17.6",
@@ -74,6 +74,6 @@
74
74
  "@babel/node": "^7.16.8",
75
75
  "@leverege/babel-preset-leverege-node": "^2.0.0",
76
76
  "@leverege/eslint-config-leverege": "^3.0.1",
77
- "npm": "^8.5.5"
77
+ "npm": "^8.6.0"
78
78
  }
79
79
  }
package/src/dirty-git CHANGED
@@ -3,9 +3,10 @@
3
3
  CLEAN="\e[32m✔\e[0m"
4
4
  DIRTY="\e[31m✘\e[0m"
5
5
  STASH="\e[33;44m$\e[0m"
6
+ AHEAD="\e[34;42m!\e[0m"
6
7
 
7
8
  clear
8
- printf "${CLEAN} clean ${DIRTY} dirty ${STASH} stashed\n\n"
9
+ printf "${CLEAN} clean ${DIRTY} dirty ${STASH} stashed ${AHEAD} unpushed\n\n"
9
10
  for dir in $@;
10
11
  do
11
12
  [ ! -d $dir ] || [ ! -d $dir/.git ] && continue
@@ -14,6 +15,8 @@ do
14
15
  [[ `git status --porcelain` ]] && status="$DIRTY" || status="$CLEAN"
15
16
  scount=`git stash list | wc -l`
16
17
  [ $scount -gt 0 ] && stash="\e[33;44m$\e[0m" || stash=" "
18
+ ahead=`git rev-list FETCH_HEAD..HEAD --count`
19
+ [ $ahead -gt 0 ] && ahead="$AHEAD" || ahead=" "
17
20
  cd - &>/dev/null
18
- printf "${status} %-28s ${stash} %s\n" $dir $branch
21
+ printf "${status} %-28s ${stash}${ahead} %s\n" $dir $branch
19
22
  done
package/src/dockreate CHANGED
@@ -223,7 +223,9 @@ NOCONTAINER
223
223
  fi
224
224
  container=$(basename $gitremote .git)
225
225
  fi
226
- gcimage=gcr.io/$project/$container
226
+ #gcimage=gcr.io/$project/$container
227
+ gcimage=us-central1-docker.pkg.dev/$project/kudelski/$container
228
+ gcimage=us-docker.pkg.dev/$project/leverege/$container
227
229
 
228
230
  version=$1
229
231
  [[ -f '.previous' ]] && previous=`cat .previous` || previous='FIRST BUILD'
@@ -289,7 +291,7 @@ pluggedIn=$(colorize 'green' "no")
289
291
  [ -f "${pluginFile}" ] && pluggedIn=$(colorize 'yellow' "YES")
290
292
 
291
293
  cat<<IMGINFO
292
-
294
+ LOCAL LOCAL LOCAL
293
295
  Project: $(colorize 'green' "$project")
294
296
  Container: $(colorize 'green' "$container")
295
297
  NodeImage: $(colorize 'green' "$nodeimg")
package/src/helmup CHANGED
@@ -31,6 +31,7 @@ SYSTEM=(
31
31
  postgres
32
32
  timescale-db
33
33
  preemptible-killer
34
+ zombie-killer
34
35
  reloader
35
36
  cert-manager
36
37
  traefik
@@ -273,6 +274,67 @@ function installPreemptibleKiller() {
273
274
  [ -f "google_service_account.json" ] && rm google_service_account.json
274
275
  }
275
276
 
277
+ function installCronZombieKiller() {
278
+ cat<<END_OF_ZOMBIE | kubectl apply -f -
279
+ apiVersion: v1
280
+ kind: ServiceAccount
281
+ metadata:
282
+ name: cronjob-sa
283
+ namespace: default
284
+ ---
285
+ apiVersion: rbac.authorization.k8s.io/v1
286
+ kind: Role
287
+ metadata:
288
+ name: pod-accessor-role
289
+ namespace: default
290
+ rules:
291
+ - apiGroups: [""]
292
+ resources: ["pods"]
293
+ verbs: ["get","delete","watch","list"]
294
+ ---
295
+ apiVersion: rbac.authorization.k8s.io/v1
296
+ kind: RoleBinding
297
+ metadata:
298
+ name: pod-access
299
+ namespace: default
300
+ subjects:
301
+ - kind: ServiceAccount
302
+ name: cronjob-sa
303
+ namespace: default
304
+ roleRef:
305
+ kind: Role
306
+ name: pod-accessor-role
307
+ apiGroup: ""
308
+ ---
309
+ apiVersion: batch/v1
310
+ kind: CronJob
311
+ metadata:
312
+ namespace: default
313
+ name: cron-zombie-killer
314
+ spec:
315
+ schedule: "*/4 * * * *"
316
+ successfulJobsHistoryLimit: 1
317
+ jobTemplate:
318
+ spec:
319
+ template:
320
+ metadata:
321
+ name: cron-zombie-killer
322
+ namespace: default
323
+ spec:
324
+ serviceAccountName: cronjob-sa
325
+ restartPolicy: Never
326
+ containers:
327
+ - name: cron-zombie-killer
328
+ image: bitnami/kubectl
329
+ command:
330
+ - "/bin/sh"
331
+ args:
332
+ - "-c"
333
+ - "echo Zombie Hunting `date` ; kubectl get pods -n default --field-selector='status.phase==Failed' -o name | xargs kubectl delete -n default 2> /dev/null"
334
+ status: {}
335
+ END_OF_ZOMBIE
336
+ }
337
+
276
338
  function installCertManager() {
277
339
  showInstalling "Cert Managment"
278
340
  createNamespaceIfNeeded cert-manager
@@ -553,12 +615,12 @@ DEPRECATED_CHART
553
615
  }
554
616
 
555
617
  doHelmup() {
556
- local helmup="$1"
557
- local doing="Helming => `color g \"$HELMUP\"`"
618
+ local helmup="$@"
619
+ local doing="Helming => `color g \"$helmup\"`"
558
620
  local from=
559
621
  [ ! -z "$FROM_VERSIONS" ] && from="`color y \"<= from Versions.json\"`"
560
622
  printf "$doing $from\n"
561
- $HELMUP
623
+ $helmup
562
624
  }
563
625
 
564
626
  # not a fan of global vars but bash forced me to - set by getServiceAndChartVersion
@@ -567,7 +629,7 @@ CHARTVER=
567
629
  FROM_VERSIONS=
568
630
  function doInstall() {
569
631
 
570
- helm repo remove stable &> /dev/null # stable was deprecated
632
+ # helm repo remove stable &> /dev/null # stable was deprecated
571
633
  helm repo update &> /dev/null
572
634
 
573
635
  for PARAM in "$@";
@@ -598,6 +660,10 @@ function doInstall() {
598
660
  installCertManager
599
661
  ;;
600
662
 
663
+ "cronZombieKiller"|"zombie-killer")
664
+ installCronZombieKiller # eradicate the gke 1.20+ zombies
665
+ ;;
666
+
601
667
  "custom-metrics")
602
668
  kubectl create -f https://raw.githubusercontent.com/GoogleCloudPlatform/k8s-stackdriver/master/custom-metrics-stackdriver-adapter/deploy/production/adapter.yaml
603
669
  ;;
@@ -684,6 +750,17 @@ function doInstall() {
684
750
  fi
685
751
 
686
752
  printf "\n--------------------------------------------------------------\nCharting $SERVICE\n"
753
+ if [ ! -x "$(command -v service-man)" ];
754
+ then
755
+ cat<<NO_SERVICE_MAN
756
+
757
+ $RED_ERROR The Leverege service-man utility is missing - install and rerun helmup
758
+
759
+ `color g "npm i -g @leverege/service-man"`
760
+
761
+ NO_SERVICE_MAN
762
+ exit 1
763
+ fi
687
764
  service-man --from-helmup --create-service $SERVICE
688
765
 
689
766
  # By default the museum chart name will be the same as the service, but
@@ -721,55 +798,8 @@ NOTRUNNING
721
798
  }
722
799
 
723
800
  # ---------- helmup MAIN ----------
724
- GITTOP=`git rev-parse --show-toplevel` && cd $GITTOP
725
- if [ -d "${GITTOP}/k8-utils" ];
726
- then
727
- cat<<BADK8
728
-
729
- $YELO_WARN The k8_utils directory should be renamed to k8s_utils
730
-
731
- This repository has the old k8_util directory name in place. Please rename
732
- it to the newer k8s_utils directory that `color c helmup` will be looking for.
733
-
734
- Run this => `color g "git mv k8-utils k8s-utils; git add k8*utils"`
735
-
736
- $YELO_WARN Don't forget to commit and push after the renaming.
737
-
738
- BADK8
739
- exit 1
740
- fi
741
-
742
- K8S_UTILS="${GITTOP}/k8s-utils"
743
- if [ ! -d "$K8S_UTILS" ];
744
- then
745
- cat<<EOK8S
746
-
747
- $RED_ERROR Missing the k8s utils dir => `color y $K8S_UTILS`
748
-
749
- This is a relatively new directory setup that should be copied over from one
750
- of the other configuration branches. The new-baseline branch should have this
751
- setup in place, so check there.
752
-
753
- EOK8S
754
-
755
- exit 1
756
- fi
757
-
758
801
  overwhelm
759
802
  [ $? -ne 0 ] && printf "\n\n***Aborting helmup...\n\n" && exit 1
760
803
 
761
804
  doInstall $@
762
805
  cd - &> /dev/null
763
-
764
- OLD_MONITORING="${GITTOP}/values-monitoring.yaml"
765
- if [ -f "$OLD_MONITORING" ];
766
- then
767
- cat<<OLDMON
768
-
769
- $YELO_WARN The old monitoring setup has been detected.
770
- Upgrade by running => `color g "helmup monitoring"`
771
-
772
- OLDMON
773
- exit 1
774
- fi
775
-