@leverege/build-tools 2.12.0-john.3 → 2.12.0-john.4

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.12.0-john.3",
3
+ "version": "2.12.0-john.4",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
package/src/dockreate CHANGED
@@ -34,25 +34,6 @@ cleanup() {
34
34
  }
35
35
  trap cleanup INT
36
36
 
37
- # Usage: colorize <color> <string>
38
- # where: color = [red|green|yellow]
39
- # string = the thing to apply the color to
40
- colorize() {
41
- local C_green='\e[92m'
42
- local C_yellow='\e[93m'
43
- local C_red='\e[91m'
44
- local C_off='\e[0m'
45
-
46
- case "$1" in
47
- 'red' ) clr="$C_red" ;;
48
- 'green' ) clr="$C_green" ;;
49
- 'yellow') clr="$C_yellow" ;;
50
- *) clr=$C_off;;
51
- esac
52
-
53
- printf "$clr$2$C_off"
54
- }
55
-
56
37
  strip_undefined() {
57
38
  local result="$1"
58
39
  [ "$1" == "undefined" ] && result=""
@@ -72,7 +53,7 @@ create_Dockerfile() {
72
53
  local nodeimg="${2:-gallium-alpine}"
73
54
  local apkadds="${3}"
74
55
 
75
- echo "Creating the Dockerfile for node ${nodeimg}"
56
+ # echo "Creating the Dockerfile for node ${nodeimg}"
76
57
  cat<<DOCKERBLD > Dockerfile
77
58
  # Version ${regvers} @ `date`
78
59
  #
@@ -180,13 +161,13 @@ if [ ! -f "$NPMRC" ];
180
161
  then
181
162
  cat<<ROTOKEN
182
163
 
183
- $(colorize 'red' '***ERROR: expecting to see a readonly npmjs token')
164
+ $(color r '***ERROR: expecting to see a readonly npmjs token')
184
165
 
185
166
  For security purposes, we deploy images with read-only npmjs tokens.
186
167
  These may be acquired from another developer, or can be created with the
187
168
  npmjs leverege account.
188
169
 
189
- Obtain the token and drop it here => $(colorize 'green' "$NPMRC")
170
+ Obtain the token and drop it here => $(color g "$NPMRC")
190
171
 
191
172
 
192
173
  ROTOKEN
@@ -199,7 +180,7 @@ if [ "$project" == "" ];
199
180
  then
200
181
  cat<<NOPROJ
201
182
 
202
- $(colorize 'red' '***ERROR: package.json missing a leverege project statement')
183
+ $(color r '***ERROR: package.json missing a leverege project statement')
203
184
 
204
185
  The package.json file must contain a project setting in the leverege
205
186
  namespace stating which GCP project the docker images are written to. It
@@ -234,11 +215,11 @@ then
234
215
  then
235
216
  cat<<NOCONTAINER
236
217
 
237
- $(colorize 'red' '***ERROR: attempting to build an unnamed container')
218
+ $(color r '***ERROR: attempting to build an unnamed container')
238
219
 
239
220
  You are attempting to create a docker image without a container name or
240
- a git remote setup. Either define a $(colorize 'yellow' 'container') statement in the leverege
241
- section of package.json, or add a $(colorize 'green' 'git remote') to this repository.
221
+ a git remote setup. Either define a $(color y 'container') statement in the leverege
222
+ section of package.json, or add a $(color g 'git remote') to this repository.
242
223
 
243
224
  NOCONTAINER
244
225
  exit 1
@@ -260,7 +241,7 @@ then
260
241
  if [[ `git status --porcelain` ]]; then
261
242
  cat<<DIRTAG
262
243
 
263
- $(colorize 'red' '***ERROR: attempting to tag a non-beta dirty git repository')
244
+ $(color r '***ERROR: attempting to tag a non-beta dirty git repository')
264
245
 
265
246
  You are attempting to create a tagged release image for pushing to the
266
247
  container registry, but there are locally modified files. This is not
@@ -269,9 +250,9 @@ then
269
250
 
270
251
  Available options for proceeding:
271
252
 
272
- $(colorize 'green' '1) cleanly commit all local mods assuming relevance')
273
- $(colorize 'yellow' '2) eliminate unwanted local modifications')
274
- $(colorize 'red' '3) stash anything that is irrelevant to this release')
253
+ $(color g '1) cleanly commit all local mods assuming relevance')
254
+ $(color y '2) eliminate unwanted local modifications')
255
+ $(color r '3) stash anything that is irrelevant to this release')
275
256
 
276
257
 
277
258
  DIRTAG
@@ -286,7 +267,7 @@ DIRTAG
286
267
  then
287
268
  cat<<NOUPSTR
288
269
 
289
- $(colorize 'red' '***ERROR: the current branch must have an upstream')
270
+ $(color r '***ERROR: the current branch must have an upstream')
290
271
 
291
272
  You are attempting to create a tagged release image for pushing to the
292
273
  container registry, but the current branch does not have an upstream to
@@ -295,54 +276,53 @@ DIRTAG
295
276
 
296
277
  Available options for proceeding:
297
278
 
298
- $(colorize 'green' '1) set an upstream for this branch via:')
299
- $(colorize 'green' " git push --set-upstream origin ${branch}")
279
+ $(color g '1) set an upstream for this branch via:')
280
+ $(color g " git push --set-upstream origin ${branch}")
300
281
 
301
- $(colorize 'yellow' '2) rebase, squash and merge onto a branch with an upstream')
282
+ $(color y '2) rebase, squash and merge onto a branch with an upstream')
302
283
 
303
284
  NOUPSTR
304
285
  exit 1
305
286
  fi
306
287
 
307
- tagstat=$(colorize 'yellow' 'will be tagged')
288
+ tagstat=$(color y 'will be tagged')
308
289
  else
309
- tagstat=$(colorize 'red' 'BETA RELEASE WILL NOT BE TAGGED')
290
+ tagstat=$(color r 'BETA RELEASE WILL NOT BE TAGGED')
310
291
  fi
311
292
 
312
- pluggedIn=$(colorize 'green' "no")
313
- [ -f "${pluginFile}" ] && pluggedIn=$(colorize 'yellow' "YES")
293
+ pluggedIn=$(color g "no")
294
+ [ -f "${pluginFile}" ] && pluggedIn=$(color y "YES")
314
295
 
315
296
  cat<<IMGINFO
316
- LOCAL LOCAL LOCAL
317
- Project: $(colorize 'green' "$project")
318
- Container: $(colorize 'green' "$container")
319
- NodeImage: $(colorize 'green' "$nodeimg")
320
- NopeOps: $(colorize 'yellow' "$nodeops")
321
- NPM Logs: $(colorize 'green' "$npmlogging")
322
- AddedPkgs: $(colorize 'green' "$apkadds")
297
+ Project: $(color g $project)
298
+ Container: $(color g $container)
299
+ NodeImage: $(color g $nodeimg)
300
+ NopeOps: $(color y $nodeops)
301
+ NPM Logs: $(color g $npmlogging)
302
+ AddedPkgs: $(color g $apkadds)
323
303
  PluggedIn: ${pluggedIn}
324
- Version: $(colorize 'green' "$version") $tagstat
325
- Run User: $(colorize 'green' "$runuser")
326
- Previous: $(colorize 'yellow' "$previous")
327
- DateStamp: $(colorize 'green' "$pckgdts")
328
- GCImage: $(colorize 'green' "$gcimage:$version")
329
- Registry: $(colorize 'yellow' "$registry:$version")
304
+ Version: $(color g $version) $tagstat
305
+ Run User: $(color g $runuser)
306
+ Previous: $(color y $previous)
307
+ DateStamp: $(color g $pckgdts)
308
+ GCImage: $(color g $gcimage:$version)
309
+ Registry: $(color y $registry:$version)
330
310
 
331
311
  IMGINFO
332
312
 
333
313
  if [ "$pckgver" != "$version" ];
334
314
  then
335
315
  cat<<EOPKG
336
- $(colorize 'yellow' '***WARNING: specified version does not match package.json version' )
337
- package.json => $(colorize 'green' "$pckgver")
338
- specified => $(colorize 'red' "$version")
316
+ $(color y '***WARNING: specified version does not match package.json version' )
317
+ package.json => $(color g "$pckgver")
318
+ specified => $(color r "$version")
339
319
 
340
320
  EOPKG
341
321
  if [ $tagging ];
342
322
  then
343
323
  cat<<EONOPE
344
324
 
345
- $(colorize 'red' '... and you are attempting to release so NOPE!' )
325
+ $(color r '... and you are attempting to release so NOPE!' )
346
326
 
347
327
  EONOPE
348
328
  exit 1
@@ -386,7 +366,7 @@ then
386
366
  bldErr=$?
387
367
  cat<<BUILDERR
388
368
 
389
- $(colorize 'red' '***ERROR: build failed! Aborting without tagging.')
369
+ $(color r '***ERROR: build failed! Aborting without tagging.')
390
370
 
391
371
  The gcloud build process seems to have run into a problem. Please fix the
392
372
  issue and rerun the dockerize process. This build will not be tagged, nor
@@ -399,18 +379,26 @@ fi
399
379
  # Tag the container with the node detailsand the culprit.
400
380
  gcloud container images add-tag --quiet $gcimage:$version $gcimage:$pckgdts-$nodeimg-$USER
401
381
  if [ "$USE_ARTIFACTORY" == "yes" ];
402
- printf "Background send `color y $gcimage:$version` to the artifactory - `color g 'thanks for testing!'`\n\n"
382
+ then
383
+ cat<<END_ARTY
384
+
385
+ Sending `color y $gcimage:$version` to the `color g artifactory`
386
+ in the background, which may take up to a minute to complete.
387
+
388
+ `color g 'Thank you for testing!'`
389
+
390
+ END_ARTY
403
391
  gcloud container images add-tag --quiet $gcimage:$version $registry:$version &
404
392
  fi
405
393
 
406
394
  if [ $tagging ];
407
395
  then
408
- printf "\n$(colorize 'green' "Tagging and Pushing $version")\n"
396
+ printf "\n$(color g "Tagging and Pushing $version")\n"
409
397
  git tag -af $1 -m "Docker version $1"
410
398
  git push --follow-tags
411
399
  gcloud container images add-tag --quiet $gcimage:$version $gcimage:latest
412
400
  else
413
- printf "\n$(colorize 'yellow' '*** Skipped git tagging - beta release')\n\n"
401
+ printf "\n$(color y '*** Skipped git tagging - beta release')\n\n"
414
402
  fi
415
403
 
416
404
  cleanup