@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.
- package/lib/server/repo-init/config.tgz +0 -0
- package/package.json +1 -1
- package/src/dockreate +47 -59
|
Binary file
|
package/package.json
CHANGED
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
|
-
|
|
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
|
-
$(
|
|
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 => $(
|
|
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
|
-
$(
|
|
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
|
-
$(
|
|
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 $(
|
|
241
|
-
section of package.json, or add a $(
|
|
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
|
-
$(
|
|
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
|
-
$(
|
|
273
|
-
$(
|
|
274
|
-
$(
|
|
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
|
-
$(
|
|
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
|
-
$(
|
|
299
|
-
$(
|
|
279
|
+
$(color g '1) set an upstream for this branch via:')
|
|
280
|
+
$(color g " git push --set-upstream origin ${branch}")
|
|
300
281
|
|
|
301
|
-
$(
|
|
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=$(
|
|
288
|
+
tagstat=$(color y 'will be tagged')
|
|
308
289
|
else
|
|
309
|
-
tagstat=$(
|
|
290
|
+
tagstat=$(color r 'BETA RELEASE WILL NOT BE TAGGED')
|
|
310
291
|
fi
|
|
311
292
|
|
|
312
|
-
pluggedIn=$(
|
|
313
|
-
[ -f "${pluginFile}" ] && pluggedIn=$(
|
|
293
|
+
pluggedIn=$(color g "no")
|
|
294
|
+
[ -f "${pluginFile}" ] && pluggedIn=$(color y "YES")
|
|
314
295
|
|
|
315
296
|
cat<<IMGINFO
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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: $(
|
|
325
|
-
Run User: $(
|
|
326
|
-
Previous: $(
|
|
327
|
-
DateStamp: $(
|
|
328
|
-
GCImage: $(
|
|
329
|
-
Registry: $(
|
|
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
|
-
$(
|
|
337
|
-
package.json => $(
|
|
338
|
-
specified => $(
|
|
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
|
-
$(
|
|
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
|
-
$(
|
|
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
|
-
|
|
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$(
|
|
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$(
|
|
401
|
+
printf "\n$(color y '*** Skipped git tagging - beta release')\n\n"
|
|
414
402
|
fi
|
|
415
403
|
|
|
416
404
|
cleanup
|