@leverege/build-tools 2.0.5 → 2.0.6

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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "A package for development build tools.",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "build": "npm run compile",
8
8
  "compile": "rm -fr lib && npm run compile_server && npm run compile_web",
9
- "compile_server": "NODE_ENV=server babel -d lib/server src/ --copy-files",
9
+ "compile_server": "NODE_ENV=server babel -d lib/server src/ && cp src/dnsify/accounts.json.enc lib/server/dnsify/accounts.json.enc",
10
10
  "compile_web": "NODE_ENV=web babel -d lib/web src/",
11
11
  "licenseCheck": "license-checker --summary --failOn GPL",
12
12
  "prepublintOnly": "npm run lint && npm run build",
package/src/circleate CHANGED
@@ -45,44 +45,12 @@ create_server_config(){
45
45
  version: 2.1
46
46
  orbs:
47
47
  gcp-gcr: circleci/gcp-gcr@0.6.1
48
- anchore: anchore/anchore-engine@1.2.0
49
48
  executors:
50
49
  default:
51
50
  description: >
52
51
  A debian-based machine executor.
53
52
  machine: true
54
- anchore_engine:
55
- description: Machine runner with anchore engine default environment variables set.
56
- parameters:
57
- anchore_engine_version:
58
- description: Version of anchore-engine container to run (recommended to keep default value)
59
- type: string
60
- default: "v0.3.2"
61
- environment:
62
- ANCHORE_CLI_USER: admin
63
- ANCHORE_CLI_PASS: foobar
64
- ANCHORE_CLI_SSL_VERIFY: 'n'
65
- ANCHORE_VERSION: << parameters.anchore_engine_version >>
66
- machine:
67
- image: circleci/classic:201808-01
68
53
  jobs:
69
- docker-scan:
70
- # runs anchore image scan for vulnerabilities
71
- executor: anchore/anchore_engine
72
- steps:
73
- - attach_workspace:
74
- at: ~/project
75
- - run:
76
- name: build container
77
- command: 'docker build -t "\${CIRCLE_PROJECT_REPONAME}:ci" ~/project/docker/'
78
- - anchore/analyze_local_image:
79
- image_name: '\${CIRCLE_PROJECT_REPONAME}:ci'
80
- timeout: '500'
81
- policy_failure: true
82
- - anchore/parse_reports
83
- - store_artifacts:
84
- path: anchore-report
85
-
86
54
  gcr:
87
55
  # gcr build docker image and pushes to gcr
88
56
  executor: default
@@ -98,14 +66,23 @@ jobs:
98
66
  image: \$CONTAINER_NAME
99
67
  tag: \$PACKAGE_VERSION
100
68
  path: docker
69
+ dockerfile: docker/Dockerfile
101
70
  - gcp-gcr/push-image:
102
71
  image: \$CONTAINER_NAME
103
72
  tag: \$PACKAGE_VERSION
104
- - gcp-gcr/add-image-tag:
73
+ - run:
74
+ name: Check if branch is master
75
+ command: |
76
+ if [ \$CIRCLE_BRANCH == 'master' ]; then
77
+ echo "export GCR_TAG=stable" >> \$BASH_ENV;
78
+ else
79
+ echo "export GCR_TAG=latest" >> \$BASH_ENV;
80
+ fi
81
+ - gcp-gcr/tag-image:
105
82
  image: \$CONTAINER_NAME
106
83
  source-tag: \$PACKAGE_VERSION
107
- target-tag: latest
108
- - gcp-gcr/add-image-tag:
84
+ target-tag: \$GCR_TAG
85
+ - gcp-gcr/tag-image:
109
86
  image: \$CONTAINER_NAME
110
87
  source-tag: \$PACKAGE_VERSION
111
88
  target-tag: circle-\$NODE_IMAGE-\$CIRCLE_USERNAME
@@ -273,27 +250,24 @@ workflows:
273
250
  context: npm
274
251
  filters:
275
252
  branches:
276
- only: master
253
+ only:
254
+ - development
255
+ - /release-.*/
256
+ - master
277
257
  requires:
278
258
  - smoke-test
279
- - docker-scan:
280
- filters:
281
- branches:
282
- only: master
283
- requires:
284
- - smoke-test
285
- - coverage
286
- - build
287
259
  - gcr:
288
260
  context: google
289
261
  filters:
290
262
  branches:
291
- only: master
263
+ only:
264
+ - development
265
+ - /release-.*/
266
+ - master
292
267
  requires:
293
268
  - smoke-test
294
269
  - build
295
270
  - coverage
296
- - docker-scan
297
271
  EOCIRCLE
298
272
  }
299
273
 
package/src/helmup CHANGED
@@ -149,7 +149,7 @@ function installVelero() {
149
149
  --set schedules.timescale.schedule="0 3 * * *" \
150
150
  --set schedules.timescale.template.ttl="720h" \
151
151
  --set schedules.timescale.template.labelSelector.matchLabels.app="postgresql" \
152
- --set schedules.timescale.template.snapshotVolumes="true" \
152
+ --set schedules.timescale.template.snapshotVolumes="true"
153
153
 
154
154
  ## Instruct users to move velero keys
155
155
  printf "\n$YELO_WARN MOVE THE SERVICE ACCOUNT TO YOUR KEYS FOLDER"
@@ -1,573 +0,0 @@
1
- #!/bin/bash
2
- if [ -z "$1" ]; then
3
- echo " Usage: repo type <ui/server/lib>"
4
- exit 1
5
- fi
6
-
7
- if [ "$1" != "server" ] && [ "$1" != "ui" ] && [ "$1" != "lib" ]; then
8
- echo " Only ui, server, or lib accepted currently"
9
- exit 1
10
- fi
11
-
12
- repo_type=$1
13
-
14
- check_circle_config(){
15
- if [ -d "./.circleci" ];
16
- then
17
- printf "\nThere is an existing CircleCI config, do you want to override?\n\n"
18
- printf "Hit return to continue or ^C to exit\n\n"; read ANS
19
- rm -rf ./.circleci
20
- fi
21
-
22
- mkdir -p ./.circleci
23
- }
24
-
25
- strip_undefined() {
26
- local result="$1"
27
- [ "$1" == "undefined" ] && result=""
28
- printf "$result"
29
- }
30
-
31
- create_circle_config(){
32
- echo "Creating the CircleCI config file"
33
- cd .circleci
34
- if [ "$repo_type" = "server" ]; then
35
- create_server_config
36
- elif [ "$repo_type" = "lib" ]; then
37
- create_lib_config
38
- else
39
- create_ui_config
40
- fi
41
- }
42
-
43
- create_server_config(){
44
- cat<<EOCIRCLE > config.yml
45
- version: 2.1
46
- orbs:
47
- gcp-gcr: circleci/gcp-gcr@0.6.1
48
- anchore: anchore/anchore-engine@1.2.0
49
- executors:
50
- default:
51
- description: >
52
- A debian-based machine executor.
53
- machine: true
54
- anchore_engine:
55
- description: Machine runner with anchore engine default environment variables set.
56
- parameters:
57
- anchore_engine_version:
58
- description: Version of anchore-engine container to run (recommended to keep default value)
59
- type: string
60
- default: "v0.3.2"
61
- environment:
62
- ANCHORE_CLI_USER: admin
63
- ANCHORE_CLI_PASS: foobar
64
- ANCHORE_CLI_SSL_VERIFY: 'n'
65
- ANCHORE_VERSION: << parameters.anchore_engine_version >>
66
- machine:
67
- image: circleci/classic:201808-01
68
- jobs:
69
- docker-scan:
70
- # runs anchore image scan for vulnerabilities
71
- executor: anchore/anchore_engine
72
- steps:
73
- - attach_workspace:
74
- at: ~/project
75
- - run:
76
- name: build container
77
- command: 'docker build -t "\${CIRCLE_PROJECT_REPONAME}:ci" ~/project/docker/'
78
- - anchore/analyze_local_image:
79
- image_name: '\${CIRCLE_PROJECT_REPONAME}:ci'
80
- timeout: '500'
81
- policy_failure: true
82
- - anchore/parse_reports
83
- - store_artifacts:
84
- path: anchore-report
85
-
86
- gcr:
87
- # gcr build docker image and pushes to gcr
88
- executor: default
89
- steps:
90
- - attach_workspace:
91
- at: ~/project
92
- - run: |
93
- echo "export CONTAINER_NAME=\$(cat ~/project/container_name)" >> \$BASH_ENV
94
- echo "export PACKAGE_VERSION=\$(cat ~/project/package_version)" >> \$BASH_ENV
95
- echo "export NODE_IMAGE=\$(cat ~/project/node_img)" >> \$BASH_ENV
96
- - gcp-gcr/gcr-auth
97
- - gcp-gcr/build-image:
98
- image: \$CONTAINER_NAME
99
- tag: \$PACKAGE_VERSION
100
- path: docker
101
- - gcp-gcr/push-image:
102
- image: \$CONTAINER_NAME
103
- tag: \$PACKAGE_VERSION
104
- - gcp-gcr/add-image-tag:
105
- image: \$CONTAINER_NAME
106
- source-tag: \$PACKAGE_VERSION
107
- target-tag: latest
108
- - gcp-gcr/add-image-tag:
109
- image: \$CONTAINER_NAME
110
- source-tag: \$PACKAGE_VERSION
111
- target-tag: circle-\$NODE_IMAGE-\$CIRCLE_USERNAME
112
-
113
- smoke-test:
114
- # smoke test checks for license, security, and linting
115
- docker:
116
- - image: circleci/node:12.10.0
117
- steps:
118
- - checkout
119
- - restore_cache:
120
- key: dependency-cache-{{ checksum "package.json" }}
121
- - run:
122
- name: Setup @leverege Token
123
- command: echo \${NPMRC} > ~/.npmrc
124
- - run: npm install
125
-
126
- - save_cache:
127
- key: dependency-cache-{{ checksum "package.json" }}
128
- paths:
129
- - ./node_modules
130
-
131
- - run:
132
- name: Check for vulnerabilities
133
- command: npm audit --production
134
-
135
- - run:
136
- name: Check for LICENSE and README files
137
- command: npm run pkglint
138
-
139
- - run:
140
- name: Check for license violations (e.g. GPL)
141
- command: |
142
- npm install license-checker
143
- npm run licenseCheck
144
-
145
- - run:
146
- name: Lint and save results
147
- command: npm run lint-ci
148
-
149
- - store_test_results:
150
- path: reports
151
-
152
- coverage:
153
- # coverage runs tests, generates coverage, and saves docs
154
- environment:
155
- TZ: 'America/New_York'
156
- docker:
157
- - image: circleci/node:12.10.0
158
- # IF YOU NEED ANY OF THESE, UNCOMMENT TO USE
159
- # - image: redis
160
- # - image: circleci/mysql:5.7
161
- # environment:
162
- # MYSQL_USER: root
163
- # MYSQL_ROOT_PASSWORD: root
164
- # MYSQL_ALLOW_EMPTY_PASSWORD: true
165
- # MYSQL_HOST: 127.0.0.1
166
- # - image: nsqio/nsq
167
- # command: /nsqlookupd -broadcast-address localhost:4160 -tcp-address 0.0.0.0:4160 -http-address 0.0.0.0:4161
168
-
169
- # - image: nsqio/nsq
170
- # command: >
171
- # /nsqd
172
- # -broadcast-address localhost:4150
173
- # -tcp-address 0.0.0.0:4150
174
- # -http-address 0.0.0.0:4151
175
- # -lookupd-tcp-address localhost:4160
176
-
177
- steps:
178
- - checkout
179
- - restore_cache:
180
- key: dependency-cache-{{ checksum "package.json" }}
181
-
182
- - run:
183
- name: Setup @leverege Token
184
- command: echo \${NPMRC} > ~/.npmrc
185
-
186
- - run: npm install
187
-
188
- # UNCOMMENT IF YOU NEED DECRYPTING SECRETS
189
- # - run:
190
- # name: Load secrets
191
- # command: npm run decrypt
192
-
193
- - run:
194
- name: Run Tests and Generate Code Coverage
195
- command: npm run coverage
196
-
197
- - run:
198
- name: Check if coverage meets at least 70%
199
- command: ./node_modules/.bin/nyc check-coverage --functions 70 --lines 70 --statements 70
200
-
201
- - run:
202
- name: Generate docs
203
- command: |
204
- npm install jsdoc
205
- npm run docs
206
-
207
- - store_artifacts:
208
- path: coverage
209
- prefix: coverage
210
-
211
- - store_artifacts:
212
- path: docs
213
- prefix: docs
214
-
215
- build:
216
- # build should make dist image and prepare docker file
217
- docker:
218
- - image: circleci/node:12.10.0
219
-
220
- steps:
221
- - checkout
222
- - restore_cache:
223
- key: dependency-cache-{{ checksum "package.json" }}
224
-
225
- - run:
226
- name: Setup @leverege Token
227
- command: |
228
- echo \${NPMRC} > ~/.npmrc
229
- echo \${NPMRC} > ~/.npmrc.ro
230
-
231
- - run: npm install
232
-
233
- - run:
234
- name: Determine version number and container name
235
- command: |
236
- PACKAGE_VERSION=\$(node -p "require('./package.json').version")
237
- container="\`node -p \"require('./package.json').leverege.container\"\`"
238
- if [ "\$container" == "undefined" ];
239
- then
240
- container=\$CIRCLE_PROJECT_REPONAME
241
- fi
242
- NODE_IMAGE="\`node -p \"require('./package.json').leverege.nodeimg\"\`"
243
-
244
- echo v\${PACKAGE_VERSION} > package_version
245
- echo "export PACKAGE_VERSION=v\${PACKAGE_VERSION}" >> \$BASH_ENV
246
- echo \${container} > container_name
247
- echo \${NODE_IMAGE} > node_img
248
- - run:
249
- name: Create Dockerfile and build dist directory
250
- command: mkdir -p docker && npm run dockerize \$PACKAGE_VERSION
251
-
252
- - persist_to_workspace:
253
- root: ~/project
254
- paths:
255
- - dist/*
256
- - docker/*
257
- - package_version
258
- - container_name
259
- - node_img
260
- - package*json
261
-
262
- workflows:
263
- version: 2.1
264
- test-build-deploy:
265
- jobs:
266
- - smoke-test:
267
- context: npm
268
- - coverage:
269
- context: npm
270
- requires:
271
- - smoke-test
272
- - build:
273
- context: npm
274
- filters:
275
- branches:
276
- only: master
277
- requires:
278
- - smoke-test
279
- - docker-scan:
280
- filters:
281
- branches:
282
- only: master
283
- requires:
284
- - smoke-test
285
- - coverage
286
- - build
287
- - gcr:
288
- context: google
289
- filters:
290
- branches:
291
- only: master
292
- requires:
293
- - smoke-test
294
- - build
295
- - coverage
296
- - docker-scan
297
- EOCIRCLE
298
- }
299
-
300
- create_lib_config(){
301
- cat<<EOCIRCLE > config.yml
302
- version: 2.1
303
- jobs:
304
- smoke-test:
305
- # smoke test checks for license, security, and linting
306
- docker:
307
- - image: circleci/node:12.10.0
308
- steps:
309
- - checkout
310
- - restore_cache:
311
- key: dependency-cache-{{ checksum "package.json" }}
312
- - run:
313
- name: Setup @leverege Token
314
- command: echo \${NPMRC} > ~/.npmrc
315
- - run: npm install
316
-
317
- - save_cache:
318
- key: dependency-cache-{{ checksum "package.json" }}
319
- paths:
320
- - ./node_modules
321
-
322
- - run:
323
- name: Check for vulnerabilities
324
- command: npm audit --production
325
-
326
- - run:
327
- name: Check for LICENSE and README files
328
- command: npm run pkglint
329
-
330
- - run:
331
- name: Check for license violations (e.g. GPL)
332
- command: |
333
- npm install license-checker
334
- npm run licenseCheck
335
-
336
- - run:
337
- name: Lint and save results
338
- command: npm run lint-ci
339
-
340
- - store_test_results:
341
- path: reports
342
-
343
- coverage:
344
- # coverage runs tests, generates coverage, and saves docs
345
- docker:
346
- - image: circleci/node:12.10.0
347
- # IF YOU NEED ANY OF THESE, UNCOMMENT TO USE
348
- # - image: redis
349
- # - image: circleci/mysql:5.7
350
- # environment:
351
- # MYSQL_USER: root
352
- # MYSQL_ROOT_PASSWORD: root
353
- # MYSQL_ALLOW_EMPTY_PASSWORD: true
354
- # MYSQL_HOST: 127.0.0.1
355
- # - image: nsqio/nsq
356
- # command: /nsqlookupd -broadcast-address localhost:4160 -tcp-address 0.0.0.0:4160 -http-address 0.0.0.0:4161
357
-
358
- # - image: nsqio/nsq
359
- # command: >
360
- # /nsqd
361
- # -broadcast-address localhost:4150
362
- # -tcp-address 0.0.0.0:4150
363
- # -http-address 0.0.0.0:4151
364
- # -lookupd-tcp-address localhost:4160
365
-
366
- steps:
367
- - checkout
368
- - restore_cache:
369
- key: dependency-cache-{{ checksum "package.json" }}
370
-
371
- - run:
372
- name: Setup @leverege Token
373
- command: echo \${NPMRC} > ~/.npmrc
374
-
375
- - run: npm install
376
-
377
- # UNCOMMENT IF YOU NEED DECRYPTING SECRETS
378
- # - run:
379
- # name: Load secrets
380
- # command: npm run decrypt
381
-
382
- - run:
383
- name: Run Tests and Generate Code Coverage
384
- command: npm run coverage
385
-
386
- - run:
387
- name: Check if coverage meets at least 70%
388
- command: ./node_modules/.bin/nyc check-coverage --functions 70 --lines 70 --statements 70
389
-
390
- - run:
391
- name: Generate docs
392
- command: |
393
- npm install jsdoc
394
- npm run docs
395
-
396
- - store_artifacts:
397
- path: coverage
398
- prefix: coverage
399
-
400
- - store_artifacts:
401
- path: docs
402
- prefix: docs
403
-
404
- # publish:
405
- # # publish the package to npm registry - CURRENTLY DISABLED
406
-
407
- workflows:
408
- version: 2.1
409
- test-build-deploy:
410
- jobs:
411
- - smoke-test:
412
- context: npm
413
- - coverage:
414
- context: npm
415
- requires:
416
- - smoke-test
417
- # - publish:
418
- # context: npm
419
- # filters:
420
- # branches:
421
- # only: master
422
- # requires:
423
- # - smoke-test
424
- # - coverage
425
- EOCIRCLE
426
- }
427
-
428
- create_ui_config(){
429
- # Determine URLs per environment
430
- echo "Please provide the dev site URL"
431
- read DEV_URL
432
-
433
- echo "Please provide the prod site URL"
434
- read PROD_URL
435
-
436
- # Determine GCP project
437
- echo "Please provide the dev GCP project id"
438
- read DEV_PROJECT
439
-
440
- echo "Please provide the prod GCP project id"
441
- read PROD_PROJECT
442
-
443
- # Build circle config based on variables
444
- cat<<EOCIRCLE > config.yml
445
- version: 2.1
446
- orbs:
447
- gcp-gcr: circleci/gcp-cli@1.0.4
448
- executors:
449
- google:
450
- description: The official Google docker container with gcloud SDK pre-installed
451
- docker:
452
- - image: google/cloud-sdk
453
-
454
- jobs:
455
- gcs-dev:
456
- executor: google
457
- steps:
458
- - attach_workspace:
459
- at: ~/project
460
- # https://gist.github.com/DarrenN/8c6a5b969481725a4413
461
- - run: |
462
- echo "export PACKAGE_VERSION=v\$(grep -m1 version package.json | awk -F: '{ print \$2 }' | sed 's/[", ]//g')" >> \$BASH_ENV
463
- - gcp-gcr/initialize
464
- - run: |
465
- gsutil mb gs://\$PACKAGE_VERSION.$DEV_URL
466
- gsutil -m cp -r ./project/image/* gs://\$PACKAGE_VERSION.$DEV_URL
467
- gsutil setmeta -h "Content-Encoding:gzip" gs://\$PACKAGE_VERSION.$DEV_URL/bundle.js
468
- gsutil iam ch allUsers:objectViewer gs://$DEV_URL
469
- - run: |
470
- gsutil mb gs://$DEV_URL
471
- gsutil -m rm gs://$DEV_URL/**
472
- gsutil -m cp -r gs://\$PACKAGE_VERSION.$DEV_URL/* gs://$DEV_URL
473
- gsutil setmeta -h "Content-Encoding:gzip" gs://$DEV_URL/bundle.js
474
- gsutil iam ch allUsers:objectViewer gs://$DEV_URL
475
-
476
- gcs-prod:
477
- executor: google
478
- steps:
479
- - attach_workspace:
480
- at: ~/project
481
- # https://gist.github.com/DarrenN/8c6a5b969481725a4413
482
- - run: |
483
- echo "export PACKAGE_VERSION=v\$(grep -m1 version package.json | awk -F: '{ print \$2 }' | sed 's/[", ]//g')" >> \$BASH_ENV
484
- - gcp-gcr/initialize
485
- - run: |
486
- gsutil mb gs://\$PACKAGE_VERSION.$PROD_URL
487
- gsutil -m cp -r ./project/image/* gs://\$PACKAGE_VERSION.$PROD_URL
488
- gsutil setmeta -h "Content-Encoding:gzip" gs://\$PACKAGE_VERSION.$PROD_URL/bundle.js
489
- gsutil iam ch allUsers:objectViewer gs://$PROD_URL
490
- - run: |
491
- gsutil mb gs://$PROD_URL
492
- gsutil -m rm gs://$PROD_URL/**
493
- gsutil -m cp -r gs://\$PACKAGE_VERSION.$PROD_URL/* gs://$PROD_URL
494
- gsutil setmeta -h "Content-Encoding:gzip" gs://$PROD_URL/bundle.js
495
- gsutil iam ch allUsers:objectViewer gs://$PROD_URL
496
-
497
- build:
498
- docker:
499
- - image: circleci/node:12.10.0
500
- steps:
501
- - checkout
502
- - restore_cache:
503
- key: dependency-cache-{{ checksum "package.json" }}
504
-
505
- - run:
506
- name: Setup @leverege Token
507
- command: echo \${NPMRC} > ~/.npmrc
508
-
509
- - run: npm install
510
-
511
- - save_cache:
512
- key: dependency-cache-{{ checksum "package.json" }}
513
- paths:
514
- - ./node_modules
515
-
516
- - run:
517
- name: Install license-checker
518
- command: npm install license-checker
519
-
520
- - run:
521
- name: Check for license violations (e.g. GPL)
522
- command: npm run licenseCheck
523
-
524
- - run:
525
- name: Bundle using webpack
526
- command: |
527
- npm run clean
528
- npm run build
529
- rm -fr ./image
530
- mkdir ./image
531
- cp -fr ./dist/* ./image/
532
- gzip ./image/bundle.js
533
- mv ./image/bundle.js.gz ./image/bundle.js
534
-
535
- - persist_to_workspace:
536
- root: ~/project
537
- paths:
538
- - image/*
539
- - package.json
540
-
541
- workflows:
542
- version: 2.1
543
- build-deploy-dev:
544
- jobs:
545
- - build:
546
- context: npm
547
- - gcs-dev:
548
- context: $DEV_PROJECT
549
- filters:
550
- branches:
551
- only: /release-.*/
552
- requires:
553
- - build
554
- build-deploy-prod:
555
- jobs:
556
- - build:
557
- context: npm
558
- filters:
559
- branches:
560
- only: master
561
- - gcs-prod:
562
- context: $PROD_PROJECT
563
- filters:
564
- branches:
565
- only: master
566
- requires:
567
- - build
568
-
569
- EOCIRCLE
570
- }
571
-
572
- check_circle_config
573
- create_circle_config