@leverege/build-tools 2.34.1 → 2.35.0-john.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.
@@ -2,6 +2,8 @@
2
2
 
3
3
  /**
4
4
  * This script parses a firebase config into something useful.
5
+ *
6
+ * firebase --project leverege-dev-john apps:sdkconfig | getfbcfg
5
7
  */
6
8
  "use strict";
7
9
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  /**
4
4
  * This script parses a firebase config into something useful.
5
+ *
6
+ * firebase --project leverege-dev-john apps:sdkconfig | getfbcfg
5
7
  */
6
8
  "use strict";
7
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.34.1",
3
+ "version": "2.35.0-john.1",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
package/src/bash-funcs CHANGED
@@ -129,3 +129,17 @@ function removeHelmRepo(){
129
129
  [ ! -z "$SKIP_RM_HELM_REPO" ] && return
130
130
  helm repo remove $1 &>/dev/null
131
131
  }
132
+
133
+ # initial use for logging helm activities
134
+ function postToSlack() {
135
+ local toPost="$@"
136
+ local running="`basename $0`"
137
+ local dts="`date +\"%c\"`"
138
+ local slackURL="https://hooks.slack.com/services/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"
139
+ local channel="#dev-ops-helm"
140
+ local slackmsg="\n--- $running \`$GCP_PROJECT_ID\` => $USER / `node --version` @ $dts\n \`$toPost\`"
141
+
142
+ curl -X POST -H 'Content-type: application/json' \
143
+ --data "{\"text\":\"$slackmsg\",\"channel\":\"$channel\"}" \
144
+ "$slackURL" &>/dev/null
145
+ }
package/src/dockreate CHANGED
@@ -249,7 +249,12 @@ runuser=$(packageJson '.leverege.runuser')
249
249
  [ -z "${runuser}" ] && runuser='node'
250
250
 
251
251
  npmlogging='--silent' # allow for verbose npm logs
252
- [ "$VERBOSE_DOCKREATE_NPM" == "yes" ] && npmlogging='--ddd'
252
+ if [ "$VERBOSE_DOCKREATE_NPM" == "yes" ];
253
+ then
254
+ npmlogging='--ddd'
255
+ else
256
+ hintverbose=1
257
+ fi
253
258
 
254
259
  echo "Updating dependencies and workspace..." && npm install
255
260
  if [ $? -ne 0 ];
@@ -362,7 +367,6 @@ cat<<IMGINFO
362
367
  Container: $(color g $container)
363
368
  NodeImage: $(color g $nodeimg)
364
369
  NopeOps: $(color y $nodeops)
365
- NPM Logs: $(color g $npmlogging)
366
370
  AddedPkgs: $(color g $apkadds)
367
371
  PluggedIn: ${pluggedIn}
368
372
  Version: $(color g $version) $tagstat
@@ -371,9 +375,12 @@ cat<<IMGINFO
371
375
  DateStamp: $(color g $pckgdts)
372
376
  GCImage: $(color g $gcimage:$version)
373
377
  Registry: $(color y $registry)
378
+ NPM Logs: $(color g $npmlogging)
374
379
 
375
380
  IMGINFO
376
381
 
382
+ [ $hintverbose ] && printf " Define $(color g VERBOSE_DOCKREATE_NPM=\"yes\") for verbose build logging\n\n"
383
+
377
384
  if [ "$pckgver" != "$version" ];
378
385
  then
379
386
  cat<<EOPKG
package/src/getfbcfg.js CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  /**
4
4
  * This script parses a firebase config into something useful.
5
+ *
6
+ * firebase --project leverege-dev-john apps:sdkconfig | getfbcfg
5
7
  */
6
8
  const stdbuf = []
7
9
 
package/src/helmdn CHANGED
@@ -1,27 +1,7 @@
1
1
  #!/bin/bash
2
- # TODO: maybe update this?
3
-
4
- # Simple ANSI color coded string generator.
5
- color() {
6
- local color=
7
- case "$1" in
8
- 'g') color="92m" ;; # green
9
- 'c') color="96m" ;; # lt blue
10
- 'y') color="93m" ;; # yellow
11
- 'r') color="91m" ;; # red
12
- 'toast') color="1;3;7;91;103;5m" ;;
13
- esac
14
- printf "\e[$color$2\e[0m"
15
- }
16
-
17
- clearlyWarn() {
18
- clear
19
- cat<<CLEARWARN
20
-
21
- `color toast '*** WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***'`
22
2
 
23
- CLEARWARN
24
- }
3
+ # Load the standard helper functions
4
+ . `build-tools --bashfun`
25
5
 
26
6
  clearlyWarn
27
7
  cat<<ABOUT2NUKE
@@ -111,6 +91,14 @@ function annihilateVelero() {
111
91
  velero@${GCP_PROJECT_ID}.iam.gserviceaccount.com &>/dev/null
112
92
  }
113
93
 
94
+ function helmDown() {
95
+ local namespace=${2:-default}
96
+ local helmdn="helm uninstall $1 -n $namespace"
97
+ printf "Gonna=>[$helmdn]\n"
98
+ eval $helmdn
99
+ postToSlack $helmdn
100
+ }
101
+
114
102
  function doNuking() {
115
103
 
116
104
  for PARAM in "$@";
@@ -119,7 +107,7 @@ function doNuking() {
119
107
 
120
108
  case "$SERVICE" in
121
109
  "cert-manager")
122
- helm uninstall -n cert-manager cert-manager
110
+ helmDown cert-manager cert-manager
123
111
  ;;
124
112
 
125
113
  "elastic"|"elasticsearch")
@@ -169,7 +157,8 @@ NOGRESS
169
157
  ;;
170
158
 
171
159
  *)
172
- helm -n default uninstall $SERVICE
160
+ helmDown $SERVICE "default"
161
+ #helm -n default uninstall $SERVICE
173
162
  esac
174
163
  done
175
164
  }
package/src/helmup CHANGED
@@ -39,6 +39,7 @@ SYSTEM=(
39
39
  monitoring # do monitoring last to show password
40
40
  )
41
41
 
42
+ # audit trail via slack
42
43
  # support for legacy bitnami charts
43
44
  function addBitnamiRepo() {
44
45
  if [ ! -z "$BITNAMI_LATEST" ] || [ "$1" == "latest" ];
@@ -118,7 +119,7 @@ function bootstrapLocalSetup() {
118
119
  then
119
120
  mkdir $SERVICE
120
121
  else
121
- # If the service dir already exists but the helmup.plugin file is missing
122
+ # If the service dir already exists but the nghelmup.plugin file is missing
122
123
  # then this is most likely a legacy setup - for example, an older setup for
123
124
  # elasticsearch that only had an es-values.yaml file. Note that we cannot
124
125
  # get to this logic if the helmup.plugin file exists so no need to check
@@ -592,7 +593,8 @@ doHelmup() {
592
593
  local from=
593
594
  [ ! -z "$FROM_VERSIONS" ] && from="`color y \"<= from Versions.json\"`"
594
595
  printf "$doing $from\n"
595
- $helmup
596
+ eval $helmup
597
+ postToSlack "$helmup"
596
598
  }
597
599
 
598
600
  # not a fan of global vars but bash forced me to - set by getServiceAndChartVersion