@mojaloop/ml-testing-toolkit-client-lib 0.0.6 → 1.0.0-snapshot.2
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/.circleci/config.yml +218 -39
- package/CODEOWNERS +30 -0
- package/Dockerfile +5 -2
- package/README.md +42 -0
- package/audit-ci.jsonc +7 -0
- package/package.json +23 -20
- package/audit-resolve.json +0 -14
package/.circleci/config.yml
CHANGED
|
@@ -7,10 +7,10 @@ version: 2.1
|
|
|
7
7
|
# Orbs used in this pipeline
|
|
8
8
|
##
|
|
9
9
|
orbs:
|
|
10
|
+
anchore: anchore/anchore-engine@1.9.0
|
|
10
11
|
slack: circleci/slack@4.9.3 # Ref: https://github.com/mojaloop/ci-config/tree/master/slack-templates
|
|
11
12
|
pr-tools: mojaloop/pr-tools@0.1.10 # Ref: https://github.com/mojaloop/ci-config/
|
|
12
13
|
gh: circleci/github-cli@2.1.0
|
|
13
|
-
anchore: anchore/anchore-engine@1.9.0
|
|
14
14
|
|
|
15
15
|
##
|
|
16
16
|
# defaults
|
|
@@ -18,13 +18,15 @@ orbs:
|
|
|
18
18
|
# YAML defaults templates, in alphabetical order
|
|
19
19
|
##
|
|
20
20
|
defaults_Dependencies: &defaults_Dependencies |
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
apk --no-cache add bash
|
|
22
|
+
apk --no-cache add git
|
|
23
|
+
apk --no-cache add ca-certificates
|
|
24
|
+
apk --no-cache add curl
|
|
25
|
+
apk --no-cache add openssh-client
|
|
26
|
+
apk add --no-cache -t build-dependencies make gcc g++ python3 libtool autoconf automake jq
|
|
27
|
+
apk add --no-cache -t openssl ncurses coreutils libgcc linux-headers grep util-linux binutils findutils
|
|
28
|
+
npm config set unsafe-perm true
|
|
29
|
+
npm install -g node-gyp
|
|
28
30
|
|
|
29
31
|
defaults_awsCliDependencies: &defaults_awsCliDependencies |
|
|
30
32
|
apk --no-cache add aws-cli
|
|
@@ -39,7 +41,6 @@ defaults_npm_auth: &defaults_npm_auth
|
|
|
39
41
|
name: Update NPM registry auth token
|
|
40
42
|
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
|
|
41
43
|
|
|
42
|
-
|
|
43
44
|
defaults_npm_publish_release: &defaults_npm_publish_release
|
|
44
45
|
name: Publish NPM $RELEASE_TAG artifact
|
|
45
46
|
command: |
|
|
@@ -60,6 +61,18 @@ defaults_configure_git: &defaults_configure_git
|
|
|
60
61
|
git config user.email ${GIT_CI_EMAIL}
|
|
61
62
|
git config user.name ${GIT_CI_USER}
|
|
62
63
|
|
|
64
|
+
defaults_configure_nvm: &defaults_configure_nvm
|
|
65
|
+
name: Configure NVM
|
|
66
|
+
command: |
|
|
67
|
+
touch $HOME/.profile
|
|
68
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
|
|
69
|
+
export NVM_DIR="$HOME/.nvm"
|
|
70
|
+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
71
|
+
echo "Installing Node version: $(cat .nvmrc)"
|
|
72
|
+
nvm install $(cat .nvmrc)
|
|
73
|
+
nvm alias default $(cat .nvmrc)
|
|
74
|
+
nvm use $(cat .nvmrc)
|
|
75
|
+
|
|
63
76
|
##
|
|
64
77
|
# Executors
|
|
65
78
|
#
|
|
@@ -69,13 +82,18 @@ executors:
|
|
|
69
82
|
default-docker:
|
|
70
83
|
working_directory: &WORKING_DIR /home/circleci/project
|
|
71
84
|
docker:
|
|
72
|
-
- image: node:16.15.0-alpine
|
|
85
|
+
- image: node:16.15.0-alpine # Ref: https://hub.docker.com/_/node?tab=tags&page=1&name=alpine
|
|
73
86
|
|
|
74
87
|
default-machine:
|
|
75
88
|
working_directory: *WORKING_DIR
|
|
76
89
|
machine:
|
|
77
|
-
image: ubuntu-2004:current
|
|
90
|
+
image: ubuntu-2004:current # Ref: https://circleci.com/developer/machine/image/ubuntu-2004
|
|
78
91
|
|
|
92
|
+
##
|
|
93
|
+
# Jobs
|
|
94
|
+
#
|
|
95
|
+
# A map of CircleCI jobs
|
|
96
|
+
##
|
|
79
97
|
jobs:
|
|
80
98
|
setup:
|
|
81
99
|
executor: default-docker
|
|
@@ -84,6 +102,8 @@ jobs:
|
|
|
84
102
|
name: Install general dependencies
|
|
85
103
|
command: *defaults_Dependencies
|
|
86
104
|
- checkout
|
|
105
|
+
- run:
|
|
106
|
+
<<: *defaults_configure_nvm
|
|
87
107
|
- run:
|
|
88
108
|
name: Update NPM install
|
|
89
109
|
command: npm ci
|
|
@@ -99,6 +119,8 @@ jobs:
|
|
|
99
119
|
name: Install general dependencies
|
|
100
120
|
command: *defaults_Dependencies
|
|
101
121
|
- checkout
|
|
122
|
+
- run:
|
|
123
|
+
<<: *defaults_configure_nvm
|
|
102
124
|
- restore_cache:
|
|
103
125
|
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
104
126
|
- run:
|
|
@@ -122,6 +144,8 @@ jobs:
|
|
|
122
144
|
name: Install general dependencies
|
|
123
145
|
command: *defaults_Dependencies
|
|
124
146
|
- checkout
|
|
147
|
+
- run:
|
|
148
|
+
<<: *defaults_configure_nvm
|
|
125
149
|
- restore_cache:
|
|
126
150
|
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
127
151
|
- run:
|
|
@@ -135,6 +159,8 @@ jobs:
|
|
|
135
159
|
name: Install general dependencies
|
|
136
160
|
command: *defaults_Dependencies
|
|
137
161
|
- checkout
|
|
162
|
+
- run:
|
|
163
|
+
<<: *defaults_configure_nvm
|
|
138
164
|
- restore_cache:
|
|
139
165
|
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
140
166
|
- run:
|
|
@@ -151,6 +177,8 @@ jobs:
|
|
|
151
177
|
name: Install AWS CLI dependencies
|
|
152
178
|
command: *defaults_awsCliDependencies
|
|
153
179
|
- checkout
|
|
180
|
+
- run:
|
|
181
|
+
<<: *defaults_configure_nvm
|
|
154
182
|
- restore_cache:
|
|
155
183
|
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
156
184
|
- run:
|
|
@@ -181,6 +209,8 @@ jobs:
|
|
|
181
209
|
name: Install general dependencies
|
|
182
210
|
command: *defaults_Dependencies
|
|
183
211
|
- checkout
|
|
212
|
+
- run:
|
|
213
|
+
<<: *defaults_configure_nvm
|
|
184
214
|
- restore_cache:
|
|
185
215
|
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
186
216
|
- run:
|
|
@@ -204,9 +234,6 @@ jobs:
|
|
|
204
234
|
- checkout
|
|
205
235
|
- restore_cache:
|
|
206
236
|
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
207
|
-
- run:
|
|
208
|
-
name: Prune non-production packages before running license-scanner
|
|
209
|
-
command: npm prune --production
|
|
210
237
|
- run:
|
|
211
238
|
name: Run the license-scanner
|
|
212
239
|
command: cd /tmp/license-scanner && pathToRepo=$CIRCLE_WORKING_DIRECTORY make run
|
|
@@ -214,23 +241,61 @@ jobs:
|
|
|
214
241
|
path: /tmp/license-scanner/results
|
|
215
242
|
prefix: licenses
|
|
216
243
|
|
|
217
|
-
build:
|
|
244
|
+
build-local:
|
|
218
245
|
executor: default-machine
|
|
219
246
|
steps:
|
|
220
247
|
- checkout
|
|
221
248
|
- run:
|
|
222
|
-
name: Build Docker
|
|
249
|
+
name: Build Docker local image
|
|
223
250
|
command: |
|
|
224
|
-
echo "Building Docker image:
|
|
225
|
-
docker build -t $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME
|
|
251
|
+
echo "Building Docker image: local"
|
|
252
|
+
docker build -t $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:local .
|
|
226
253
|
- run:
|
|
227
254
|
name: Save docker image to workspace
|
|
255
|
+
command: docker save -o /tmp/docker-image-local.tar $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:local
|
|
256
|
+
- persist_to_workspace:
|
|
257
|
+
root: /tmp
|
|
258
|
+
paths:
|
|
259
|
+
- ./docker-image-local.tar
|
|
260
|
+
|
|
261
|
+
build:
|
|
262
|
+
executor: default-machine
|
|
263
|
+
steps:
|
|
264
|
+
- attach_workspace:
|
|
265
|
+
at: /tmp
|
|
266
|
+
- run:
|
|
267
|
+
name: Load the pre-built docker local image from workspace
|
|
268
|
+
command: docker load -i /tmp/docker-image-local.tar
|
|
269
|
+
- run:
|
|
270
|
+
name: Re-tag the image
|
|
271
|
+
command: |
|
|
272
|
+
echo "Re-tagging Docker image: $CIRCLE_TAG"
|
|
273
|
+
docker tag $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:local $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG
|
|
274
|
+
- run:
|
|
275
|
+
name: Save the new docker image to workspace
|
|
228
276
|
command: docker save -o /tmp/docker-image.tar $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG
|
|
229
277
|
- persist_to_workspace:
|
|
230
278
|
root: /tmp
|
|
231
279
|
paths:
|
|
232
280
|
- ./docker-image.tar
|
|
233
281
|
|
|
282
|
+
license-scan:
|
|
283
|
+
executor: default-machine
|
|
284
|
+
steps:
|
|
285
|
+
- attach_workspace:
|
|
286
|
+
at: /tmp
|
|
287
|
+
- run:
|
|
288
|
+
name: Load the pre-built docker image from workspace
|
|
289
|
+
command: docker load -i /tmp/docker-image.tar
|
|
290
|
+
- run:
|
|
291
|
+
<<: *defaults_license_scanner
|
|
292
|
+
- run:
|
|
293
|
+
name: Run the license-scanner
|
|
294
|
+
command: cd /tmp/license-scanner && mode=docker dockerImages=$DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG make run
|
|
295
|
+
- store_artifacts:
|
|
296
|
+
path: /tmp/license-scanner/results
|
|
297
|
+
prefix: licenses
|
|
298
|
+
|
|
234
299
|
image-scan:
|
|
235
300
|
executor: anchore/anchore_engine
|
|
236
301
|
steps:
|
|
@@ -309,6 +374,8 @@ jobs:
|
|
|
309
374
|
name: Install general dependencies
|
|
310
375
|
command: *defaults_Dependencies
|
|
311
376
|
- checkout
|
|
377
|
+
- run:
|
|
378
|
+
<<: *defaults_configure_nvm
|
|
312
379
|
- restore_cache:
|
|
313
380
|
keys:
|
|
314
381
|
- dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
|
|
@@ -399,7 +466,65 @@ jobs:
|
|
|
399
466
|
at: /tmp
|
|
400
467
|
- run:
|
|
401
468
|
name: Load the pre-built docker image from workspace
|
|
402
|
-
command: |
|
|
469
|
+
command: |
|
|
470
|
+
docker load -i /tmp/docker-image.tar
|
|
471
|
+
- run:
|
|
472
|
+
name: Login to Docker Hub
|
|
473
|
+
command: docker login -u $DOCKER_USER -p $DOCKER_PASS
|
|
474
|
+
- run:
|
|
475
|
+
name: Re-tag pre built image
|
|
476
|
+
command: |
|
|
477
|
+
docker tag $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG
|
|
478
|
+
- run:
|
|
479
|
+
name: Publish Docker image $CIRCLE_TAG & Latest tag to Docker Hub
|
|
480
|
+
command: |
|
|
481
|
+
echo "Publishing $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG"
|
|
482
|
+
docker push $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG
|
|
483
|
+
echo "Publishing $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG"
|
|
484
|
+
docker push $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG
|
|
485
|
+
- run:
|
|
486
|
+
name: Set Image Digest
|
|
487
|
+
command: |
|
|
488
|
+
IMAGE_DIGEST=$(docker inspect $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:v${CIRCLE_TAG:1} | jq '.[0].RepoDigests | .[]')
|
|
489
|
+
echo "IMAGE_DIGEST=${IMAGE_DIGEST}"
|
|
490
|
+
echo "export IMAGE_DIGEST=${IMAGE_DIGEST}" >> $BASH_ENV
|
|
491
|
+
- run:
|
|
492
|
+
name: Update Slack config
|
|
493
|
+
command: |
|
|
494
|
+
echo "export SLACK_RELEASE_URL='https://hub.docker.com/layers/${CIRCLE_PROJECT_REPONAME}/${DOCKER_ORG}/${CIRCLE_PROJECT_REPONAME}/v${CIRCLE_TAG:1}/images/${IMAGE_DIGEST}?context=explore'" | sed -r "s/${DOCKER_ORG}\/${CIRCLE_PROJECT_REPONAME}@sha256:/sha256-/g" >> $BASH_ENV
|
|
495
|
+
- slack/notify:
|
|
496
|
+
event: pass
|
|
497
|
+
template: SLACK_TEMP_RELEASE_SUCCESS
|
|
498
|
+
- slack/notify:
|
|
499
|
+
event: fail
|
|
500
|
+
template: SLACK_TEMP_RELEASE_FAILURE
|
|
501
|
+
|
|
502
|
+
publish-docker-snapshot:
|
|
503
|
+
executor: default-machine
|
|
504
|
+
steps:
|
|
505
|
+
- checkout
|
|
506
|
+
- run:
|
|
507
|
+
name: Setup for SNAPSHOT release
|
|
508
|
+
command: |
|
|
509
|
+
echo "export RELEASE_TAG=$RELEASE_TAG_SNAPSHOT" >> $BASH_ENV
|
|
510
|
+
echo "RELEASE_TAG=$RELEASE_TAG_SNAPSHOT"
|
|
511
|
+
|
|
512
|
+
PACKAGE_VERSION=$(cat package-lock.json | jq -r .version)
|
|
513
|
+
echo "export PACKAGE_VERSION=${PACKAGE_VERSION}" >> $BASH_ENV
|
|
514
|
+
echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
|
|
515
|
+
- run:
|
|
516
|
+
name: Setup Slack config
|
|
517
|
+
command: |
|
|
518
|
+
echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
|
|
519
|
+
echo "export SLACK_RELEASE_TYPE='Docker Release'" >> $BASH_ENV
|
|
520
|
+
echo "export SLACK_RELEASE_TAG=v${CIRCLE_TAG:1}" >> $BASH_ENV
|
|
521
|
+
echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
|
|
522
|
+
echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
|
|
523
|
+
- attach_workspace:
|
|
524
|
+
at: /tmp
|
|
525
|
+
- run:
|
|
526
|
+
name: Load the pre-built docker image from workspace
|
|
527
|
+
command: |
|
|
403
528
|
docker load -i /tmp/docker-image.tar
|
|
404
529
|
- run:
|
|
405
530
|
name: Login to Docker Hub
|
|
@@ -432,7 +557,7 @@ jobs:
|
|
|
432
557
|
event: fail
|
|
433
558
|
template: SLACK_TEMP_RELEASE_FAILURE
|
|
434
559
|
|
|
435
|
-
publish:
|
|
560
|
+
publish-npm:
|
|
436
561
|
executor: default-docker
|
|
437
562
|
steps:
|
|
438
563
|
- run:
|
|
@@ -446,7 +571,6 @@ jobs:
|
|
|
446
571
|
command: |
|
|
447
572
|
echo "export RELEASE_TAG=$RELEASE_TAG_PROD" >> $BASH_ENV
|
|
448
573
|
echo "RELEASE_TAG=$RELEASE_TAG_PROD"
|
|
449
|
-
|
|
450
574
|
PACKAGE_VERSION=$(cat package-lock.json | jq -r .version)
|
|
451
575
|
echo "export PACKAGE_VERSION=${PACKAGE_VERSION}" >> $BASH_ENV
|
|
452
576
|
echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
|
|
@@ -470,7 +594,7 @@ jobs:
|
|
|
470
594
|
event: fail
|
|
471
595
|
template: SLACK_TEMP_RELEASE_FAILURE
|
|
472
596
|
|
|
473
|
-
publish-snapshot:
|
|
597
|
+
publish-npm-snapshot:
|
|
474
598
|
executor: default-docker
|
|
475
599
|
steps:
|
|
476
600
|
- run:
|
|
@@ -484,10 +608,8 @@ jobs:
|
|
|
484
608
|
command: |
|
|
485
609
|
echo "export RELEASE_TAG=${RELEASE_TAG_SNAPSHOT}" >> $BASH_ENV
|
|
486
610
|
echo "RELEASE_TAG=${RELEASE_TAG_SNAPSHOT}"
|
|
487
|
-
|
|
488
611
|
echo "Override package version: ${CIRCLE_TAG:1}"
|
|
489
612
|
npx standard-version --skip.tag --skip.commit --skip.changelog --release-as ${CIRCLE_TAG:1}
|
|
490
|
-
|
|
491
613
|
PACKAGE_VERSION=$(cat package-lock.json | jq -r .version)
|
|
492
614
|
echo "export PACKAGE_VERSION=${PACKAGE_VERSION}" >> $BASH_ENV
|
|
493
615
|
echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
|
|
@@ -511,6 +633,11 @@ jobs:
|
|
|
511
633
|
event: fail
|
|
512
634
|
template: SLACK_TEMP_RELEASE_FAILURE
|
|
513
635
|
|
|
636
|
+
##
|
|
637
|
+
# Workflows
|
|
638
|
+
#
|
|
639
|
+
# CircleCI Workflow config
|
|
640
|
+
##
|
|
514
641
|
workflows:
|
|
515
642
|
version: 2
|
|
516
643
|
build_and_test:
|
|
@@ -526,17 +653,17 @@ workflows:
|
|
|
526
653
|
ignore:
|
|
527
654
|
- /feature*/
|
|
528
655
|
- /bugfix*/
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
656
|
+
- test-dependencies:
|
|
657
|
+
context: org-global
|
|
658
|
+
requires:
|
|
659
|
+
- setup
|
|
660
|
+
filters:
|
|
661
|
+
tags:
|
|
662
|
+
only: /.*/
|
|
663
|
+
branches:
|
|
664
|
+
ignore:
|
|
665
|
+
- /feature*/
|
|
666
|
+
- /bugfix*/
|
|
540
667
|
- test-lint:
|
|
541
668
|
context: org-global
|
|
542
669
|
requires:
|
|
@@ -592,16 +719,38 @@ workflows:
|
|
|
592
719
|
ignore:
|
|
593
720
|
- /feature*/
|
|
594
721
|
- /bugfix*/
|
|
722
|
+
- build-local:
|
|
723
|
+
context: org-global
|
|
724
|
+
requires:
|
|
725
|
+
- setup
|
|
726
|
+
filters:
|
|
727
|
+
tags:
|
|
728
|
+
only: /.*/
|
|
729
|
+
branches:
|
|
730
|
+
ignore:
|
|
731
|
+
- /feature*/
|
|
732
|
+
- /bugfix*/
|
|
595
733
|
- build:
|
|
596
734
|
context: org-global
|
|
597
735
|
requires:
|
|
598
736
|
- setup
|
|
599
|
-
|
|
737
|
+
- test-dependencies
|
|
600
738
|
- test-lint
|
|
601
739
|
- test-unit
|
|
602
740
|
- test-coverage
|
|
603
741
|
- vulnerability-check
|
|
604
742
|
- audit-licenses
|
|
743
|
+
- build-local
|
|
744
|
+
filters:
|
|
745
|
+
tags:
|
|
746
|
+
only: /v[0-9]+(\.[0-9]+)*(\-snapshot(\.[0-9]+)?)?(\-hotfix(\.[0-9]+)?)?(\-perf(\.[0-9]+)?)?/
|
|
747
|
+
branches:
|
|
748
|
+
ignore:
|
|
749
|
+
- /.*/
|
|
750
|
+
- license-scan:
|
|
751
|
+
context: org-global
|
|
752
|
+
requires:
|
|
753
|
+
- build
|
|
605
754
|
filters:
|
|
606
755
|
tags:
|
|
607
756
|
only: /v[0-9]+(\.[0-9]+)*(\-snapshot(\.[0-9]+)?)?(\-hotfix(\.[0-9]+)?)?(\-perf(\.[0-9]+)?)?/
|
|
@@ -623,12 +772,14 @@ workflows:
|
|
|
623
772
|
context: org-global
|
|
624
773
|
requires:
|
|
625
774
|
- pr-tools/pr-title-check
|
|
626
|
-
|
|
775
|
+
- test-dependencies
|
|
627
776
|
- test-lint
|
|
628
777
|
- test-unit
|
|
629
778
|
- test-coverage
|
|
630
779
|
- vulnerability-check
|
|
631
780
|
- audit-licenses
|
|
781
|
+
- license-scan
|
|
782
|
+
- image-scan
|
|
632
783
|
filters:
|
|
633
784
|
branches:
|
|
634
785
|
only:
|
|
@@ -647,11 +798,14 @@ workflows:
|
|
|
647
798
|
context: org-global
|
|
648
799
|
requires:
|
|
649
800
|
- pr-tools/pr-title-check
|
|
801
|
+
- test-dependencies
|
|
650
802
|
- test-lint
|
|
651
803
|
- test-unit
|
|
804
|
+
- build
|
|
652
805
|
- test-coverage
|
|
653
806
|
- vulnerability-check
|
|
654
807
|
- audit-licenses
|
|
808
|
+
- license-scan
|
|
655
809
|
- image-scan
|
|
656
810
|
filters:
|
|
657
811
|
tags:
|
|
@@ -659,30 +813,55 @@ workflows:
|
|
|
659
813
|
branches:
|
|
660
814
|
ignore:
|
|
661
815
|
- /.*/
|
|
662
|
-
- publish:
|
|
816
|
+
- publish-docker-snapshot:
|
|
663
817
|
context: org-global
|
|
664
818
|
requires:
|
|
665
819
|
- pr-tools/pr-title-check
|
|
820
|
+
- test-dependencies
|
|
666
821
|
- test-lint
|
|
667
822
|
- test-unit
|
|
823
|
+
- build
|
|
668
824
|
- test-coverage
|
|
669
825
|
- vulnerability-check
|
|
670
826
|
- audit-licenses
|
|
827
|
+
- license-scan
|
|
828
|
+
- image-scan
|
|
829
|
+
filters:
|
|
830
|
+
tags:
|
|
831
|
+
only: /v[0-9]+(\.[0-9]+)*\-snapshot+((\.[0-9]+)?)/
|
|
832
|
+
branches:
|
|
833
|
+
ignore:
|
|
834
|
+
- /.*/
|
|
835
|
+
- publish-npm:
|
|
836
|
+
context: org-global
|
|
837
|
+
requires:
|
|
838
|
+
- pr-tools/pr-title-check
|
|
839
|
+
- test-dependencies
|
|
840
|
+
- test-lint
|
|
841
|
+
- test-unit
|
|
842
|
+
- test-coverage
|
|
843
|
+
- vulnerability-check
|
|
844
|
+
- audit-licenses
|
|
845
|
+
- license-scan
|
|
846
|
+
- image-scan
|
|
671
847
|
filters:
|
|
672
848
|
tags:
|
|
673
849
|
only: /v[0-9]+(\.[0-9]+)*/
|
|
674
850
|
branches:
|
|
675
851
|
ignore:
|
|
676
852
|
- /.*/
|
|
677
|
-
- publish-snapshot:
|
|
853
|
+
- publish-npm-snapshot:
|
|
678
854
|
context: org-global
|
|
679
855
|
requires:
|
|
680
856
|
- pr-tools/pr-title-check
|
|
857
|
+
- test-dependencies
|
|
681
858
|
- test-lint
|
|
682
859
|
- test-unit
|
|
683
860
|
- test-coverage
|
|
684
861
|
- vulnerability-check
|
|
685
862
|
- audit-licenses
|
|
863
|
+
- license-scan
|
|
864
|
+
- image-scan
|
|
686
865
|
filters:
|
|
687
866
|
tags:
|
|
688
867
|
only: /v[0-9]+(\.[0-9]+)*\-snapshot+((\.[0-9]+)?)/
|
package/CODEOWNERS
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Each line is a file pattern followed by one or more owners.
|
|
2
|
+
## These owners will be the default owners for everything in
|
|
3
|
+
## the repo. Unless a later match takes precedence,
|
|
4
|
+
## @global-owner1 and @global-owner2 will be requested for
|
|
5
|
+
## review when someone opens a pull request.
|
|
6
|
+
#* @global-owner1 @global-owner2
|
|
7
|
+
* @vijayg10 @mdebarros @elnyry-sam-k
|
|
8
|
+
## Order is important; the last matching pattern takes the most
|
|
9
|
+
## precedence. When someone opens a pull request that only
|
|
10
|
+
## modifies JS files, only @js-owner and not the global
|
|
11
|
+
## owner(s) will be requested for a review.
|
|
12
|
+
# *.js @js-owner
|
|
13
|
+
## You can also use email addresses if you prefer. They'll be
|
|
14
|
+
## used to look up users just like we do for commit author
|
|
15
|
+
## emails.
|
|
16
|
+
#*.go docs@example.com
|
|
17
|
+
# In this example, @doctocat owns any files in the build/logs
|
|
18
|
+
# directory at the root of the repository and any of its
|
|
19
|
+
# subdirectories.
|
|
20
|
+
# /build/logs/ @doctocat
|
|
21
|
+
## The `docs/*` pattern will match files like
|
|
22
|
+
## `docs/getting-started.md` but not further nested files like
|
|
23
|
+
## `docs/build-app/troubleshooting.md`.
|
|
24
|
+
# docs/* docs@example.com
|
|
25
|
+
## In this example, @octocat owns any file in an apps directory
|
|
26
|
+
## anywhere in your repository.
|
|
27
|
+
#apps/ @octocat
|
|
28
|
+
## In this example, @doctocat owns any file in the `/docs`
|
|
29
|
+
## directory in the root of your repository.
|
|
30
|
+
#/docs/ @doctocat
|
package/Dockerfile
CHANGED
|
@@ -16,10 +16,13 @@ FROM node:16.15.0-alpine
|
|
|
16
16
|
WORKDIR /opt/app
|
|
17
17
|
|
|
18
18
|
# Create a non-root user: ml-user
|
|
19
|
-
RUN adduser -D ml-user
|
|
20
|
-
USER ml-user
|
|
19
|
+
RUN adduser -D ml-user
|
|
21
20
|
|
|
22
21
|
COPY --chown=ml-user --from=builder /opt/app .
|
|
22
|
+
RUN chown ml-user:ml-user /opt/app
|
|
23
|
+
|
|
24
|
+
USER ml-user
|
|
25
|
+
|
|
23
26
|
RUN npm prune --production
|
|
24
27
|
|
|
25
28
|
CMD ["npm", "run", "cli"]
|
package/README.md
CHANGED
|
@@ -242,3 +242,45 @@ Example Command:
|
|
|
242
242
|
```
|
|
243
243
|
ml-ttk-cli -m outbound -i examples/collections/dfsp/p2p_happy_path.json -e examples/environments/dfsp_local_environment.json --slack-webhook-url=https://hooks.slack.com/services/blablabla...
|
|
244
244
|
```
|
|
245
|
+
|
|
246
|
+
-------
|
|
247
|
+
|
|
248
|
+
## Auditing Dependencies
|
|
249
|
+
|
|
250
|
+
We use `npm-audit-resolver` along with `npm audit` to check dependencies for node vulnerabilities, and keep track of resolved dependencies with an `audit-resolve.json` file.
|
|
251
|
+
|
|
252
|
+
To start a new resolution process, run:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
npm run audit:resolve
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
You can then check to see if the CI will pass based on the current dependencies with:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
npm run audit:check
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
And commit the changed `audit-resolve.json` to ensure that CircleCI will build correctly.
|
|
265
|
+
|
|
266
|
+
## Container Scans
|
|
267
|
+
|
|
268
|
+
As part of our CI/CD process, we use anchore-cli to scan our built docker container for vulnerabilities upon release.
|
|
269
|
+
|
|
270
|
+
If you find your release builds are failing, refer to the [container scanning](https://github.com/mojaloop/ci-config#container-scanning) in our shared Mojaloop CI config repo. There is a good chance you simply need to update the `mojaloop-policy-generator.js` file and re-run the circleci workflow.
|
|
271
|
+
|
|
272
|
+
For more information on anchore and anchore-cli, refer to:
|
|
273
|
+
- [Anchore CLI](https://github.com/anchore/anchore-cli)
|
|
274
|
+
- [Circle Orb Registry](https://circleci.com/orbs/registry/orb/anchore/anchore-engine)
|
|
275
|
+
|
|
276
|
+
## Automated Releases
|
|
277
|
+
|
|
278
|
+
As part of our CI/CD process, we use a combination of CircleCI, standard-version
|
|
279
|
+
npm package and github-release CircleCI orb to automatically trigger our releases
|
|
280
|
+
and image builds. This process essentially mimics a manual tag and release.
|
|
281
|
+
|
|
282
|
+
On a merge to master, CircleCI is configured to use the mojaloopci github account
|
|
283
|
+
to push the latest generated CHANGELOG and package version number.
|
|
284
|
+
|
|
285
|
+
Once those changes are pushed, CircleCI will pull the updated master, tag and
|
|
286
|
+
push a release triggering another subsequent build that also publishes a docker image.
|
package/audit-ci.jsonc
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://github.com/IBM/audit-ci/raw/main/docs/schema.json",
|
|
3
|
+
// audit-ci supports reading JSON, JSONC, and JSON5 config files.
|
|
4
|
+
// Only use one of ["low": true, "moderate": true, "high": true, "critical": true]
|
|
5
|
+
"moderate": true,
|
|
6
|
+
"allowlist": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/ml-testing-toolkit-client-lib",
|
|
3
3
|
"description": "Testing Toolkit Client Library",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "1.0.0-snapshot.2",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Vijaya Kumar Guthi, ModusBox Inc. ",
|
|
7
7
|
"contributors": [
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
"url": "https://github.com/mojaloop/ml-testing-toolkit-client-lib.git"
|
|
16
16
|
},
|
|
17
17
|
"bugs": "https://github.com/mojaloop/ml-testing-toolkit-client-lib/issues",
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": "=16.x"
|
|
20
|
+
},
|
|
18
21
|
"config": {},
|
|
19
22
|
"bin": {
|
|
20
23
|
"ml-ttk-cli": "bin/cli.js"
|
|
@@ -46,13 +49,10 @@
|
|
|
46
49
|
"test:junit": "jest --reporters=default --reporters=jest-junit --testMatch '**/test/unit/**/*.test.js'",
|
|
47
50
|
"test:integration": "./test/integration-runner.sh ",
|
|
48
51
|
"cover": "npx nyc --all report --reporter=lcov npm run test",
|
|
49
|
-
"lint": "
|
|
50
|
-
"lint:fix": "
|
|
51
|
-
"build": "docker build -t mojaloop-testing-toolkit:local -f ./Dockerfile .",
|
|
52
|
-
"run": "docker run -p 5000:5000 --rm ",
|
|
52
|
+
"lint": "npm run standard",
|
|
53
|
+
"lint:fix": "npm run standard:fix",
|
|
53
54
|
"generate-docs": "jsdoc -c jsdoc.json",
|
|
54
|
-
"audit:
|
|
55
|
-
"audit:check": "SHELL=sh check-audit",
|
|
55
|
+
"audit:check": "npx audit-ci --config ./audit-ci.jsonc",
|
|
56
56
|
"dep:check": "npx ncu -e 2",
|
|
57
57
|
"dep:update": "npx ncu -u",
|
|
58
58
|
"genexec": "pkg -t node8-win .",
|
|
@@ -62,21 +62,21 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@mojaloop/central-services-logger": "^11.0.1",
|
|
65
|
-
"@mojaloop/ml-testing-toolkit-shared-lib": "^
|
|
66
|
-
"@mojaloop/sdk-standard-components": "17.
|
|
65
|
+
"@mojaloop/ml-testing-toolkit-shared-lib": "^13.0.0",
|
|
66
|
+
"@mojaloop/sdk-standard-components": "17.1.1",
|
|
67
67
|
"@slack/webhook": "^6.1.0",
|
|
68
68
|
"atob": "2.1.2",
|
|
69
|
-
"aws-sdk": "^2.
|
|
69
|
+
"aws-sdk": "^2.1181.0",
|
|
70
70
|
"axios": "^0.27.2",
|
|
71
71
|
"cli-table3": "0.6.2",
|
|
72
|
-
"commander": "9.
|
|
72
|
+
"commander": "9.4.0",
|
|
73
73
|
"dotenv": "^16.0.1",
|
|
74
74
|
"fs": "0.0.1-security",
|
|
75
75
|
"lodash": "^4.17.21",
|
|
76
76
|
"mv": "^2.1.1",
|
|
77
77
|
"node-dir": "0.1.17",
|
|
78
78
|
"node-strings": "^1.0.2",
|
|
79
|
-
"parse-strings-in-object": "1.
|
|
79
|
+
"parse-strings-in-object": "1.6.0",
|
|
80
80
|
"path": "^0.12.7",
|
|
81
81
|
"rc": "1.2.8",
|
|
82
82
|
"request": "^2.88.2",
|
|
@@ -85,16 +85,14 @@
|
|
|
85
85
|
"ws": "^7.5.5"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"jest": "^
|
|
91
|
-
"
|
|
92
|
-
"jsdoc": "^3.6.10",
|
|
93
|
-
"npm-audit-resolver": "3.0.0-7",
|
|
94
|
-
"npm-check-updates": "13.1.1",
|
|
88
|
+
"audit-ci": "^6.3.0",
|
|
89
|
+
"jest": "^28.1.3",
|
|
90
|
+
"jest-junit": "^14.0.0",
|
|
91
|
+
"npm-check-updates": "16.0.0",
|
|
95
92
|
"nyc": "^15.1.0",
|
|
96
|
-
"parse-strings-in-object": "1.
|
|
93
|
+
"parse-strings-in-object": "1.6.0",
|
|
97
94
|
"pre-commit": "1.2.2",
|
|
95
|
+
"replace": "^1.2.1",
|
|
98
96
|
"sinon": "14.0.0",
|
|
99
97
|
"standard": "^17.0.0",
|
|
100
98
|
"standard-version": "^9.5.0"
|
|
@@ -110,5 +108,10 @@
|
|
|
110
108
|
},
|
|
111
109
|
"publishConfig": {
|
|
112
110
|
"registry": "https://registry.npmjs.org/"
|
|
111
|
+
},
|
|
112
|
+
"standard-version": {
|
|
113
|
+
"scripts": {
|
|
114
|
+
"postchangelog": "replace '\\[mojaloop/#(\\d+)\\]\\(https://github.com/mojaloop/(.*)/issues/(\\d+)\\)' '[mojaloop/#$1](https://github.com/mojaloop/project/issues/$1)' CHANGELOG.md"
|
|
115
|
+
}
|
|
113
116
|
}
|
|
114
117
|
}
|
package/audit-resolve.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"decisions": {
|
|
3
|
-
"1067560|swagmock>swagger-parser>z-schema>validator": {
|
|
4
|
-
"decision": "postpone",
|
|
5
|
-
"madeAt": 1653992416102
|
|
6
|
-
},
|
|
7
|
-
"1068118|socket.io>engine.io": {
|
|
8
|
-
"decision": "postpone",
|
|
9
|
-
"madeAt": 1653992430065
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
"rules": {},
|
|
13
|
-
"version": 1
|
|
14
|
-
}
|