@leverege/build-tools 2.11.5 → 2.12.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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.11.5",
3
+ "version": "2.12.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/dockreate CHANGED
@@ -4,6 +4,24 @@ if [ -z "$1" ]; then
4
4
  exit 1
5
5
  fi
6
6
 
7
+ # Load common bash functions
8
+ . `build-tools --bashfun`
9
+ GITTOP=`git rev-parse --show-toplevel`
10
+
11
+ if [ ! -x "$(command -v jq)" ];
12
+ then
13
+ cat<<NO_JQ
14
+
15
+ `color r "***ERROR: Missing jq JSON processor"` => `color g 'brew install jq'`
16
+
17
+ NO_JQ
18
+ exit 1
19
+ fi
20
+
21
+ function packageJson() {
22
+ jq -r $1 $GITTOP/package.json
23
+ }
24
+
7
25
  # Global Vars
8
26
  pluginFile="Dockerfile.plugin"
9
27
 
@@ -111,7 +129,7 @@ COPY --chown=node:node --from=intermediate /usr/src/app /usr/src/app
111
129
 
112
130
  USER ${runuser}
113
131
  COPY ./bashrc /home/node/.bashrc
114
- CMD [ "/bin/bash", "-c", "node index.js" ]
132
+ CMD [ "/bin/bash", "-c", "node ${nodeops} index.js" ]
115
133
  EODOCKER
116
134
  } # end of create_Dockerfile
117
135
 
@@ -133,10 +151,11 @@ alias menv='env | sort | less'
133
151
 
134
152
  alias whatsmyip='wget -qO- ifconfig.co'
135
153
 
136
- alias dbg='wget -q -O- localhost:5111/logLevel/debug'
137
- alias inf='wget -q -O- localhost:5111/logLevel/info'
138
154
  alias err='wget -q -O- localhost:5111/logLevel/error'
139
155
  alias wrn='wget -q -O- localhost:5111/logLevel/warn'
156
+ alias inf='wget -q -O- localhost:5111/logLevel/info'
157
+ alias dbg='wget -q -O- localhost:5111/logLevel/debug'
158
+ alias trc='wget -q -O- localhost:5111/logLevel/trace'
140
159
 
141
160
  cmetrics()
142
161
  {
@@ -174,7 +193,7 @@ ROTOKEN
174
193
  fi
175
194
 
176
195
  # Look for leverege specifics, but only require the project name.
177
- project=$(strip_undefined "`node -p \"require('../package.json').leverege.project\"`")
196
+ project=$(packageJson .leverege.project)
178
197
  if [ "$project" == "" ];
179
198
  then
180
199
  cat<<NOPROJ
@@ -193,10 +212,12 @@ NOPROJ
193
212
  exit 1
194
213
  fi
195
214
 
196
- nodeimg=$(strip_undefined "`node -p \"require('../package.json').leverege.nodeimg\"`")
215
+ # TODO: these should be combined into one require
216
+ nodeimg=$(packageJson '.leverege.nodeimg')
197
217
  nodeimg="${nodeimg:-gallium-alpine}"
198
- apkadds=$(strip_undefined "`node -p \"require('../package.json').leverege.apkadds\"`")
199
- runuser=$(strip_undefined "`node -p \"require('../package.json').leverege.runuser\"`")
218
+ nodeops=$(packageJson '.leverege.nodeops')
219
+ apkadds=$(packageJson '.leverege.apkadds')
220
+ runuser=$(packageJson '.leverege.runuser')
200
221
  [ -z "${runuser}" ] && runuser='node'
201
222
 
202
223
  npmlogging='--silent' # allow for verbose npm logs
@@ -224,6 +245,8 @@ NOCONTAINER
224
245
  container=$(basename $gitremote .git)
225
246
  fi
226
247
  gcimage=gcr.io/$project/$container
248
+ artifactory=us-docker.pkg.dev/leverege-registry/artifactory
249
+ registry=$artifactory/$container/images
227
250
 
228
251
  version=$1
229
252
  [[ -f '.previous' ]] && previous=`cat .previous` || previous='FIRST BUILD'
@@ -289,10 +312,11 @@ pluggedIn=$(colorize 'green' "no")
289
312
  [ -f "${pluginFile}" ] && pluggedIn=$(colorize 'yellow' "YES")
290
313
 
291
314
  cat<<IMGINFO
292
-
315
+ LOCAL LOCAL LOCAL
293
316
  Project: $(colorize 'green' "$project")
294
317
  Container: $(colorize 'green' "$container")
295
318
  NodeImage: $(colorize 'green' "$nodeimg")
319
+ NopeOps: $(colorize 'yellow' "$nodeops")
296
320
  NPM Logs: $(colorize 'green' "$npmlogging")
297
321
  AddedPkgs: $(colorize 'green' "$apkadds")
298
322
  PluggedIn: ${pluggedIn}
@@ -301,6 +325,7 @@ cat<<IMGINFO
301
325
  Previous: $(colorize 'yellow' "$previous")
302
326
  DateStamp: $(colorize 'green' "$pckgdts")
303
327
  GCImage: $(colorize 'green' "$gcimage:$version")
328
+ Registry: $(colorize 'yellow' "$registry:$version")
304
329
 
305
330
  IMGINFO
306
331
 
@@ -372,6 +397,7 @@ fi
372
397
 
373
398
  # Tag the container with the node detailsand the culprit.
374
399
  gcloud container images add-tag --quiet $gcimage:$version $gcimage:$pckgdts-$nodeimg-$USER
400
+ [ "$USE_ARTIFACTORY" == "yes" ] && gcloud container images add-tag --quiet $gcimage:$version $registry:$version &
375
401
 
376
402
  if [ $tagging ];
377
403
  then
package/src/helmup CHANGED
@@ -164,8 +164,7 @@ SA_EXISTS
164
164
  helm upgrade --install grafana grafana/grafana \
165
165
  --namespace monitoring \
166
166
  --values grafana/values-grafana.yaml \
167
- # --version 6.11 # 6.11 last of v7 grafana
168
- --version 6.21 # latest v8 grafana
167
+ --version 6.26.5 # latest v8 grafana
169
168
  }
170
169
 
171
170
  function monitoringHelp(){
@@ -275,6 +274,8 @@ function installPreemptibleKiller() {
275
274
  }
276
275
 
277
276
  function installCronZombieKiller() {
277
+ local BATCH_SYNTAX='batch/v1' # GKE 1.21 and beyond
278
+ [ ! -z "$PRE_GKE_21" ] && BATCH_SYNTAX='batch/v1beta1'
278
279
  cat<<END_OF_ZOMBIE | kubectl apply -f -
279
280
  apiVersion: v1
280
281
  kind: ServiceAccount
@@ -306,7 +307,7 @@ roleRef:
306
307
  name: pod-accessor-role
307
308
  apiGroup: ""
308
309
  ---
309
- apiVersion: batch/v1
310
+ apiVersion: $BATCH_SYNTAX
310
311
  kind: CronJob
311
312
  metadata:
312
313
  namespace: default
@@ -334,6 +335,19 @@ spec:
334
335
  - "echo Zombie Hunting `date` ; kubectl get pods -n default --field-selector='status.phase==Failed' -o name | xargs kubectl delete -n default 2> /dev/null"
335
336
  status: {}
336
337
  END_OF_ZOMBIE
338
+
339
+ if [[ $? -eq 1 ]];
340
+ then
341
+ cat<<OLDER_GKE
342
+
343
+ Deployment failed is the GKE version pre 1.21? Try rerunning with PRE_GKE_21 defined:
344
+
345
+ $ `color y "PRE_GKE_21=1 helmup zombie-killer"`
346
+
347
+
348
+ OLDER_GKE
349
+ exit 1
350
+ fi
337
351
  }
338
352
 
339
353
  function installCertManager() {
@@ -680,6 +694,10 @@ function doInstall() {
680
694
  --set volumeClaimTemplate.storageClassName="ssd"
681
695
  ;;
682
696
 
697
+ "estafette"|"preemptible-killer")
698
+ installPreemptibleKiller # the gke preemptible node spreader outer
699
+ ;;
700
+
683
701
  "monitoring")
684
702
  installMonitoringCharts
685
703
  monitoringHelp
@@ -695,10 +713,6 @@ function doInstall() {
695
713
  helm upgrade --install postgres bitnami/postgresql -f postgres/postgres-values.yaml --version 8.9.6
696
714
  ;;
697
715
 
698
- "preemptible-killer")
699
- installPreemptibleKiller # the gke preemptible node spreader outer
700
- ;;
701
-
702
716
  "redis")
703
717
  showInstalling "Redis Network Cache"
704
718
  addHelmRepo bitnami https://charts.bitnami.com/bitnami
@@ -799,6 +813,9 @@ NOTRUNNING
799
813
  }
800
814
 
801
815
  # ---------- helmup MAIN ----------
816
+ GITTOP=`git rev-parse --show-toplevel` && cd $GITTOP
817
+ K8S_UTILS="${GITTOP}/k8s-utils"
818
+
802
819
  overwhelm
803
820
  [ $? -ne 0 ] && printf "\n\n***Aborting helmup...\n\n" && exit 1
804
821