@mojaloop/ml-testing-toolkit-client-lib 1.2.0 → 1.2.2-snapshot

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.
@@ -1,4 +1,4 @@
1
- # CircleCI v2 Config
1
+ # CircleCI v2.1 Config
2
2
  version: 2.1
3
3
 
4
4
  ##
@@ -7,17 +7,17 @@ version: 2.1
7
7
  # Orbs used in this pipeline
8
8
  ##
9
9
  orbs:
10
- anchore: anchore/anchore-engine@1.9.0
11
- slack: circleci/slack@4.9.3 # Ref: https://github.com/mojaloop/ci-config/tree/master/slack-templates
10
+ slack: circleci/slack@4.12.5 # Ref: https://github.com/mojaloop/ci-config/tree/master/slack-templates
12
11
  pr-tools: mojaloop/pr-tools@0.1.10 # Ref: https://github.com/mojaloop/ci-config/
13
- gh: circleci/github-cli@2.1.0
12
+ gh: circleci/github-cli@2.2.0
13
+ anchore: anchore/anchore-engine@1.9.0
14
14
 
15
15
  ##
16
16
  # defaults
17
17
  #
18
18
  # YAML defaults templates, in alphabetical order
19
19
  ##
20
- defaults_Dependencies: &defaults_Dependencies |
20
+ defaults_docker_Dependencies: &defaults_docker_Dependencies |
21
21
  apk --no-cache add bash
22
22
  apk --no-cache add git
23
23
  apk --no-cache add ca-certificates
@@ -25,8 +25,7 @@ defaults_Dependencies: &defaults_Dependencies |
25
25
  apk --no-cache add openssh-client
26
26
  apk add --no-cache -t build-dependencies make gcc g++ python3 libtool autoconf automake jq
27
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
+ apk --no-cache add librdkafka-dev
30
29
 
31
30
  defaults_awsCliDependencies: &defaults_awsCliDependencies |
32
31
  apk --no-cache add aws-cli
@@ -51,7 +50,7 @@ defaults_npm_publish_release: &defaults_npm_publish_release
51
50
  defaults_export_version_from_package: &defaults_export_version_from_package
52
51
  name: Format the changelog into the github release body and get release tag
53
52
  command: |
54
- git diff --no-indent-heuristic master~1 HEAD CHANGELOG.md | sed -n '/^+[^+]/ s/^+//p' > /tmp/changes
53
+ git diff --no-indent-heuristic main~1 HEAD CHANGELOG.md | sed -n '/^+[^+]/ s/^+//p' > /tmp/changes
55
54
  echo 'export RELEASE_CHANGES=`cat /tmp/changes`' >> $BASH_ENV
56
55
  echo 'export RELEASE_TAG=`cat package-lock.json | jq -r .version`' >> $BASH_ENV
57
56
 
@@ -61,17 +60,85 @@ defaults_configure_git: &defaults_configure_git
61
60
  git config user.email ${GIT_CI_EMAIL}
62
61
  git config user.name ${GIT_CI_USER}
63
62
 
63
+ defaults_configure_nvmrc: &defaults_configure_nvmrc
64
+ name: Configure NVMRC
65
+ command: |
66
+ if [ -z "$NVMRC_VERSION" ]; then
67
+ echo "==> Configuring NVMRC_VERSION!"
68
+
69
+ export ENV_DOT_PROFILE=$HOME/.profile
70
+ touch $ENV_DOT_PROFILE
71
+
72
+ export NVMRC_VERSION=$(cat $CIRCLE_WORKING_DIRECTORY/.nvmrc)
73
+ echo "export NVMRC_VERSION=$NVMRC_VERSION" >> $ENV_DOT_PROFILE
74
+ fi
75
+ echo "NVMRC_VERSION=$NVMRC_VERSION"
76
+
64
77
  defaults_configure_nvm: &defaults_configure_nvm
65
78
  name: Configure NVM
66
79
  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)
80
+ cd $HOME
81
+ export ENV_DOT_PROFILE=$HOME/.profile
82
+ touch $ENV_DOT_PROFILE
83
+ echo "1. Check/Set NVM_DIR env variable"
84
+ if [ -z "$NVM_DIR" ]; then
85
+ export NVM_DIR="$HOME/.nvm"
86
+ echo "==> NVM_DIR has been exported - $NVM_DIR"
87
+ else
88
+ echo "==> NVM_DIR already exists - $NVM_DIR"
89
+ fi
90
+ echo "2. Check/Set NVMRC_VERSION env variable"
91
+ if [ -z "$NVMRC_VERSION" ]; then
92
+ echo "==> Configuring NVMRC_VERSION!"
93
+ export NVMRC_VERSION=$(cat $CIRCLE_WORKING_DIRECTORY/.nvmrc)
94
+ echo "export NVMRC_VERSION=$NVMRC_VERSION" >> $ENV_DOT_PROFILE
95
+ fi
96
+ echo "3. Configure NVM"
97
+ ## Lets check if an existing NVM_DIR exists, if it does lets skil
98
+ if [ -e "$NVM_DIR" ]; then
99
+ echo "==> $NVM_DIR exists. Skipping steps 3!"
100
+ # echo "5. Executing $NVM_DIR/nvm.sh"
101
+ # [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
102
+ else
103
+ echo "==> $NVM_DIR does not exists. Executing steps 4-5!"
104
+ echo "4. Installing NVM"
105
+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
106
+ echo "5. Executing $NVM_DIR/nvm.sh"
107
+ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
108
+ fi
109
+ ## Ref: https://github.com/nvm-sh/nvm/issues/1102#issuecomment-550572252
110
+ if [ ! -z "$NVM_ARCH_UNOFFICIAL_OVERRIDE" ]; then
111
+ echo "==> Handle NVM_ARCH_UNOFFICIAL_OVERRIDE=$NVM_ARCH_UNOFFICIAL_OVERRIDE!"
112
+ echo "nvm_get_arch() { nvm_echo \"${NVM_ARCH_UNOFFICIAL_OVERRIDE}\"; }" >> $ENV_DOT_PROFILE
113
+ echo "export NVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release" >> $ENV_DOT_PROFILE
114
+ source $ENV_DOT_PROFILE
115
+ fi
116
+ echo "6. Setup Node version"
117
+ if [ -n "$NVMRC_VERSION" ]; then
118
+ echo "==> Installing Node version: $NVMRC_VERSION"
119
+ nvm install $NVMRC_VERSION
120
+ nvm alias default $NVMRC_VERSION
121
+ nvm use $NVMRC_VERSION
122
+ cd $CIRCLE_WORKING_DIRECTORY
123
+ else
124
+ echo "==> ERROR - NVMRC_VERSION has not been set! - NVMRC_VERSION: $NVMRC_VERSION"
125
+ exit 1
126
+ fi
127
+
128
+ defaults_display_versions: &defaults_display_versions
129
+ name: Display Versions
130
+ command: |
131
+ echo "What is the active version of Nodejs?"
132
+ echo "node: $(node --version)"
133
+ echo "yarn: $(yarn --version)"
134
+ echo "npm: $(npm --version)"
135
+ echo "nvm: $(nvm --version)"
136
+
137
+ defaults_environment: &defaults_environment
138
+ ## env var for nx to set main branch
139
+ MAIN_BRANCH_NAME: main
140
+ ## Disable LIBRDKAFKA build since we install it via general dependencies
141
+ # BUILD_LIBRDKAFKA: 0
75
142
 
76
143
  ##
77
144
  # Executors
@@ -81,13 +148,18 @@ defaults_configure_nvm: &defaults_configure_nvm
81
148
  executors:
82
149
  default-docker:
83
150
  working_directory: &WORKING_DIR /home/circleci/project
151
+ shell: "/bin/sh -leo pipefail" ## Ref: https://circleci.com/docs/env-vars/#alpine-linux
152
+ environment:
153
+ BASH_ENV: /etc/profile ## Ref: https://circleci.com/docs/env-vars/#alpine-linux
154
+ NVM_ARCH_UNOFFICIAL_OVERRIDE: x64-musl ## Ref: https://github.com/nvm-sh/nvm/issues/1102#issuecomment-550572252
84
155
  docker:
85
- - image: node:16.15.0-alpine # Ref: https://hub.docker.com/_/node?tab=tags&page=1&name=alpine
156
+ - image: node:lts-alpine # Ref: https://hub.docker.com/_/node?tab=tags&page=1&name=alpine
86
157
 
87
158
  default-machine:
88
159
  working_directory: *WORKING_DIR
160
+ shell: "/bin/bash -leo pipefail"
89
161
  machine:
90
- image: ubuntu-2004:current # Ref: https://circleci.com/developer/machine/image/ubuntu-2004
162
+ image: ubuntu-2204:2023.04.2 # Ref: https://circleci.com/developer/machine/image/ubuntu-2204
91
163
 
92
164
  ##
93
165
  # Jobs
@@ -97,13 +169,17 @@ executors:
97
169
  jobs:
98
170
  setup:
99
171
  executor: default-docker
172
+ environment:
173
+ <<: *defaults_environment
100
174
  steps:
101
175
  - run:
102
176
  name: Install general dependencies
103
- command: *defaults_Dependencies
177
+ command: *defaults_docker_Dependencies
104
178
  - checkout
105
179
  - run:
106
180
  <<: *defaults_configure_nvm
181
+ - run:
182
+ <<: *defaults_display_versions
107
183
  - run:
108
184
  name: Update NPM install
109
185
  command: npm ci
@@ -112,105 +188,112 @@ jobs:
112
188
  paths:
113
189
  - node_modules
114
190
 
115
- test-unit:
191
+ test-dependencies:
116
192
  executor: default-docker
193
+ environment:
194
+ <<: *defaults_environment
117
195
  steps:
118
196
  - run:
119
197
  name: Install general dependencies
120
- command: *defaults_Dependencies
198
+ command: *defaults_docker_Dependencies
121
199
  - checkout
122
200
  - run:
123
201
  <<: *defaults_configure_nvm
202
+ - run:
203
+ <<: *defaults_display_versions
124
204
  - restore_cache:
125
205
  key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
126
206
  - run:
127
- name: Create dir for test results
128
- command: mkdir -p ./test/results
129
- - run:
130
- name: Execute unit tests
131
- command: |
132
- export NODE_OPTIONS=--max_old_space_size=4096
133
- npm run test:unit --silent -- --json --maxWorkers=2 --outputFile ./test/results/unit.json
134
- - store_artifacts:
135
- path: ./test/results
136
- prefix: test
137
- - store_test_results:
138
- path: ./test/results
207
+ name: Execute dependency tests
208
+ command: npm run dep:check
139
209
 
140
- test-dependencies:
210
+ test-lint:
141
211
  executor: default-docker
212
+ environment:
213
+ <<: *defaults_environment
142
214
  steps:
143
215
  - run:
144
216
  name: Install general dependencies
145
- command: *defaults_Dependencies
217
+ command: *defaults_docker_Dependencies
146
218
  - checkout
147
219
  - run:
148
220
  <<: *defaults_configure_nvm
221
+ - run:
222
+ <<: *defaults_display_versions
149
223
  - restore_cache:
150
224
  key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
151
225
  - run:
152
- name: Execute dependency tests
153
- command: npm run dep:check
226
+ name: Execute lint tests
227
+ command: npm run lint
154
228
 
155
- test-lint:
229
+ test-unit:
156
230
  executor: default-docker
231
+ environment:
232
+ <<: *defaults_environment
157
233
  steps:
158
234
  - run:
159
235
  name: Install general dependencies
160
- command: *defaults_Dependencies
236
+ command: *defaults_docker_Dependencies
161
237
  - checkout
162
238
  - run:
163
239
  <<: *defaults_configure_nvm
240
+ - run:
241
+ <<: *defaults_display_versions
164
242
  - restore_cache:
165
243
  key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
166
244
  - run:
167
- name: Execute lint tests
168
- command: npm run lint
245
+ name: Install jest
246
+ command: npm install jest
247
+ - run:
248
+ name: Create dir for test results
249
+ command: mkdir -p ./test/results
250
+ - run:
251
+ name: Execute unit tests
252
+ command: npm -s run test:junit
253
+ - store_artifacts:
254
+ path: ./test/results
255
+ destination: test
256
+ - store_test_results:
257
+ path: ./test/results
169
258
 
170
259
  test-coverage:
171
260
  executor: default-docker
261
+ environment:
262
+ <<: *defaults_environment
172
263
  steps:
173
264
  - run:
174
265
  name: Install general dependencies
175
- command: *defaults_Dependencies
266
+ command: *defaults_docker_Dependencies
176
267
  - run:
177
268
  name: Install AWS CLI dependencies
178
269
  command: *defaults_awsCliDependencies
179
270
  - checkout
180
271
  - run:
181
272
  <<: *defaults_configure_nvm
273
+ - run:
274
+ <<: *defaults_display_versions
182
275
  - restore_cache:
183
276
  key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
184
277
  - run:
185
278
  name: Execute code coverage check
186
- command: |
187
- export NODE_OPTIONS=--max_old_space_size=4096
188
- npm -s run test:coverage-check -- --maxWorkers=2
279
+ command: npm -s run test:coverage-check
189
280
  - store_artifacts:
190
281
  path: coverage
191
- prefix: test
192
- - store_test_results:
193
- path: coverage
194
- - run:
195
- name: Copy code coverage to SonarQube
196
- command: |
197
- if [ "${CIRCLE_BRANCH}" == "master" ];
198
- then
199
- echo "Sending lcov.info to SonarQube..."
200
- aws s3 cp coverage/lcov.info $AWS_S3_DIR_SONARQUBE/${CIRCLE_PROJECT_REPONAME}/lcov.info
201
- else
202
- echo "Not a release (env CIRCLE_BRANCH != 'master'), skipping sending lcov.info to SonarQube."
203
- fi
282
+ destination: test
204
283
 
205
284
  vulnerability-check:
206
285
  executor: default-docker
286
+ environment:
287
+ <<: *defaults_environment
207
288
  steps:
208
289
  - run:
209
290
  name: Install general dependencies
210
- command: *defaults_Dependencies
291
+ command: *defaults_docker_Dependencies
211
292
  - checkout
212
293
  - run:
213
294
  <<: *defaults_configure_nvm
295
+ - run:
296
+ <<: *defaults_display_versions
214
297
  - restore_cache:
215
298
  key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
216
299
  - run:
@@ -218,17 +301,19 @@ jobs:
218
301
  command: mkdir -p ./audit/results
219
302
  - run:
220
303
  name: Check for new npm vulnerabilities
221
- command: npm run audit:check --silent -- --json > ./audit/results/auditResults.json
304
+ command: npm run audit:check -- -o json > ./audit/results/auditResults.json
222
305
  - store_artifacts:
223
306
  path: ./audit/results
224
- prefix: audit
307
+ destination: audit
225
308
 
226
309
  audit-licenses:
227
310
  executor: default-docker
311
+ environment:
312
+ <<: *defaults_environment
228
313
  steps:
229
314
  - run:
230
315
  name: Install general dependencies
231
- command: *defaults_Dependencies
316
+ command: *defaults_docker_Dependencies
232
317
  - run:
233
318
  <<: *defaults_license_scanner
234
319
  - checkout
@@ -239,41 +324,29 @@ jobs:
239
324
  command: cd /tmp/license-scanner && pathToRepo=$CIRCLE_WORKING_DIRECTORY make run
240
325
  - store_artifacts:
241
326
  path: /tmp/license-scanner/results
242
- prefix: licenses
327
+ destination: licenses
243
328
 
244
329
  build-local:
245
330
  executor: default-machine
331
+ environment:
332
+ <<: *defaults_environment
246
333
  steps:
247
334
  - checkout
248
335
  - run:
249
- name: Build Docker local image
250
- command: |
251
- echo "Building Docker image: local"
252
- docker build -t $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:local .
336
+ <<: *defaults_configure_nvmrc
253
337
  - run:
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
338
+ <<: *defaults_display_versions
269
339
  - run:
270
- name: Re-tag the image
340
+ name: Build Docker local image
271
341
  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
342
+ source ~/.profile
343
+ export DOCKER_NODE_VERSION="$NVMRC_VERSION-alpine"
344
+ echo "export DOCKER_NODE_VERSION=$NVMRC_VERSION-alpine" >> $BASH_ENV
345
+ echo "Building Docker image: ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local --build-arg NODE_VERSION=$DOCKER_NODE_VERSION"
346
+ docker build -t ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local --build-arg NODE_VERSION=$DOCKER_NODE_VERSION .
274
347
  - run:
275
- name: Save the new docker image to workspace
276
- command: docker save -o /tmp/docker-image.tar $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG
348
+ name: Save docker image to workspace
349
+ command: docker save -o /tmp/docker-image.tar ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local
277
350
  - persist_to_workspace:
278
351
  root: /tmp
279
352
  paths:
@@ -281,6 +354,8 @@ jobs:
281
354
 
282
355
  license-scan:
283
356
  executor: default-machine
357
+ environment:
358
+ <<: *defaults_environment
284
359
  steps:
285
360
  - attach_workspace:
286
361
  at: /tmp
@@ -291,15 +366,31 @@ jobs:
291
366
  <<: *defaults_license_scanner
292
367
  - run:
293
368
  name: Run the license-scanner
294
- command: cd /tmp/license-scanner && mode=docker dockerImages=$DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG make run
369
+ command: cd /tmp/license-scanner && mode=docker dockerImages=${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local make run
295
370
  - store_artifacts:
296
371
  path: /tmp/license-scanner/results
297
- prefix: licenses
372
+ destination: licenses
298
373
 
299
374
  image-scan:
300
375
  executor: anchore/anchore_engine
376
+ shell: /bin/sh -leo pipefail ## Ref: https://circleci.com/docs/env-vars/#alpine-linux
377
+ environment:
378
+ <<: *defaults_environment
379
+ BASH_ENV: /etc/profile ## Ref: https://circleci.com/docs/env-vars/#alpine-linux
380
+ ENV: ~/.profile
381
+ NVM_ARCH_UNOFFICIAL_OVERRIDE: x64-musl ## Ref: https://github.com/nvm-sh/nvm/issues/1102#issuecomment-550572252
382
+ working_directory: *WORKING_DIR
301
383
  steps:
302
384
  - setup_remote_docker
385
+ - attach_workspace:
386
+ at: /tmp
387
+ - run:
388
+ name: Install docker dependencies for anchore
389
+ command: |
390
+ apk add --update py-pip docker python3-dev libffi-dev openssl-dev gcc libc-dev make jq npm curl bash
391
+ - run:
392
+ name: Install AWS CLI dependencies
393
+ command: *defaults_awsCliDependencies
303
394
  - checkout
304
395
  - run:
305
396
  name: Setup Slack config
@@ -311,24 +402,12 @@ jobs:
311
402
  echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
312
403
  echo "export SLACK_CUSTOM_MSG='Anchore Image Scan failed for: \`${DOCKER_ORG}/${CIRCLE_PROJECT_REPONAME}:${CIRCLE_TAG}\`'" >> $BASH_ENV
313
404
  - run:
314
- name: Install docker dependencies for anchore
315
- command: |
316
- apk add --update py-pip docker python3-dev libffi-dev openssl-dev gcc libc-dev make jq npm
405
+ <<: *defaults_configure_nvm
317
406
  - run:
318
- name: Install general dependencies
319
- command: |
320
- apk --no-cache add git
321
- apk --no-cache add ca-certificates
322
- apk --no-cache add curl
323
- apk --no-cache add openssh-client
324
- apk add --no-cache -t build-dependencies make gcc g++ python3 libtool autoconf automake
325
- npm config set unsafe-perm true
326
- npm install -g node-gyp
407
+ <<: *defaults_display_versions
327
408
  - run:
328
- name: Install AWS CLI dependencies
329
- command: *defaults_awsCliDependencies
330
- - attach_workspace:
331
- at: /tmp
409
+ name: Install general dependencies
410
+ command: *defaults_docker_Dependencies
332
411
  - run:
333
412
  name: Load the pre-built docker image from workspace
334
413
  command: docker load -i /tmp/docker-image.tar
@@ -341,13 +420,14 @@ jobs:
341
420
  - run:
342
421
  name: Pull base image locally
343
422
  command: |
344
- docker pull node:16.15.0-alpine
345
- # Analyze the base and derived image
346
- # Note: It seems images are scanned in parallel, so preloading the base image result doesn't give us any real performance gain
423
+ echo "Pulling docker image: node:$NVMRC_VERSION-alpine"
424
+ docker pull node:$NVMRC_VERSION-alpine
425
+ ## Analyze the base and derived image
426
+ ## Note: It seems images are scanned in parallel, so preloading the base image result doesn't give us any real performance gain
347
427
  - anchore/analyze_local_image:
348
428
  # Force the older version, version 0.7.0 was just published, and is broken
349
429
  anchore_version: v0.6.1
350
- image_name: "docker.io/node:16.15.0-alpine $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG"
430
+ image_name: "docker.io/node:${NVMRC_VERSION}-alpine ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local"
351
431
  policy_failure: false
352
432
  timeout: '500'
353
433
  # Note: if the generated policy is invalid, this will fallback to the default policy, which we don't want!
@@ -360,7 +440,7 @@ jobs:
360
440
  aws s3 cp anchore-reports ${AWS_S3_DIR_ANCHORE_REPORTS}/latest/ --recursive
361
441
  - run:
362
442
  name: Evaluate failures
363
- command: /tmp/ci-config/container-scanning/anchore-result-diff.js anchore-reports/node_16.15.0-alpine-policy.json anchore-reports/${CIRCLE_PROJECT_REPONAME}*-policy.json
443
+ command: /tmp/ci-config/container-scanning/anchore-result-diff.js anchore-reports/node_${NVMRC_VERSION}-alpine-policy.json anchore-reports/${CIRCLE_PROJECT_REPONAME}*-policy.json
364
444
  - store_artifacts:
365
445
  path: anchore-reports
366
446
  - slack/notify:
@@ -369,13 +449,13 @@ jobs:
369
449
 
370
450
  release:
371
451
  executor: default-docker
452
+ environment:
453
+ <<: *defaults_environment
372
454
  steps:
373
455
  - run:
374
456
  name: Install general dependencies
375
- command: *defaults_Dependencies
457
+ command: *defaults_docker_Dependencies
376
458
  - checkout
377
- - run:
378
- <<: *defaults_configure_nvm
379
459
  - restore_cache:
380
460
  keys:
381
461
  - dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
@@ -401,6 +481,9 @@ jobs:
401
481
 
402
482
  github-release:
403
483
  executor: default-machine
484
+ shell: "/bin/bash -eo pipefail"
485
+ environment:
486
+ <<: *defaults_environment
404
487
  steps:
405
488
  - run:
406
489
  name: Install git
@@ -441,8 +524,11 @@ jobs:
441
524
  event: fail
442
525
  template: SLACK_TEMP_RELEASE_FAILURE
443
526
 
444
- publish-docker:
527
+ publish:
445
528
  executor: default-machine
529
+ shell: "/bin/bash -eo pipefail"
530
+ environment:
531
+ <<: *defaults_environment
446
532
  steps:
447
533
  - checkout
448
534
  - run:
@@ -466,7 +552,7 @@ jobs:
466
552
  at: /tmp
467
553
  - run:
468
554
  name: Load the pre-built docker image from workspace
469
- command: |
555
+ command: |
470
556
  docker load -i /tmp/docker-image.tar
471
557
  - run:
472
558
  name: Login to Docker Hub
@@ -474,18 +560,19 @@ jobs:
474
560
  - run:
475
561
  name: Re-tag pre built image
476
562
  command: |
477
- docker tag $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG
563
+ docker tag ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG
564
+ docker tag ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG
478
565
  - run:
479
566
  name: Publish Docker image $CIRCLE_TAG & Latest tag to Docker Hub
480
567
  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
568
+ echo "Publishing ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG"
569
+ docker push ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG
570
+ echo "Publishing ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG"
571
+ docker push ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG
485
572
  - run:
486
573
  name: Set Image Digest
487
574
  command: |
488
- IMAGE_DIGEST=$(docker inspect $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:v${CIRCLE_TAG:1} | jq '.[0].RepoDigests | .[]')
575
+ IMAGE_DIGEST=$(docker inspect ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:v${CIRCLE_TAG:1} | jq '.[0].RepoDigests | .[]')
489
576
  echo "IMAGE_DIGEST=${IMAGE_DIGEST}"
490
577
  echo "export IMAGE_DIGEST=${IMAGE_DIGEST}" >> $BASH_ENV
491
578
  - run:
@@ -499,8 +586,11 @@ jobs:
499
586
  event: fail
500
587
  template: SLACK_TEMP_RELEASE_FAILURE
501
588
 
502
- publish-docker-snapshot:
589
+ publish-snapshot:
503
590
  executor: default-machine
591
+ shell: "/bin/bash -eo pipefail"
592
+ environment:
593
+ <<: *defaults_environment
504
594
  steps:
505
595
  - checkout
506
596
  - run:
@@ -532,18 +622,19 @@ jobs:
532
622
  - run:
533
623
  name: Re-tag pre built image
534
624
  command: |
535
- docker tag $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG
625
+ docker tag ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG
626
+ docker tag ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:local ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG
536
627
  - run:
537
628
  name: Publish Docker image $CIRCLE_TAG & Latest tag to Docker Hub
538
629
  command: |
539
- echo "Publishing $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG"
540
- docker push $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG
541
- echo "Publishing $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG"
542
- docker push $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG
630
+ echo "Publishing ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG"
631
+ docker push ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG
632
+ echo "Publishing ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG"
633
+ docker push ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG
543
634
  - run:
544
635
  name: Set Image Digest
545
636
  command: |
546
- IMAGE_DIGEST=$(docker inspect $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:v${CIRCLE_TAG:1} | jq '.[0].RepoDigests | .[]')
637
+ IMAGE_DIGEST=$(docker inspect ${DOCKER_ORG:-mojaloop}/$CIRCLE_PROJECT_REPONAME:v${CIRCLE_TAG:1} | jq '.[0].RepoDigests | .[]')
547
638
  echo "IMAGE_DIGEST=${IMAGE_DIGEST}"
548
639
  echo "export IMAGE_DIGEST=${IMAGE_DIGEST}" >> $BASH_ENV
549
640
  - run:
@@ -562,7 +653,7 @@ jobs:
562
653
  steps:
563
654
  - run:
564
655
  name: Install general dependencies
565
- command: *defaults_Dependencies
656
+ command: *defaults_docker_Dependencies
566
657
  - checkout
567
658
  - restore_cache:
568
659
  key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
@@ -599,7 +690,7 @@ jobs:
599
690
  steps:
600
691
  - run:
601
692
  name: Install general dependencies
602
- command: *defaults_Dependencies
693
+ command: *defaults_docker_Dependencies
603
694
  - checkout
604
695
  - restore_cache:
605
696
  key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
@@ -639,7 +730,6 @@ jobs:
639
730
  # CircleCI Workflow config
640
731
  ##
641
732
  workflows:
642
- version: 2
643
733
  build_and_test:
644
734
  jobs:
645
735
  - pr-tools/pr-title-check:
@@ -659,11 +749,10 @@ workflows:
659
749
  - setup
660
750
  filters:
661
751
  tags:
662
- only: /.*/
752
+ ignore: /.*/
663
753
  branches:
664
754
  ignore:
665
- - /feature*/
666
- - /bugfix*/
755
+ - main
667
756
  - test-lint:
668
757
  context: org-global
669
758
  requires:
@@ -723,24 +812,11 @@ workflows:
723
812
  context: org-global
724
813
  requires:
725
814
  - setup
726
- filters:
727
- tags:
728
- only: /.*/
729
- branches:
730
- ignore:
731
- - /feature*/
732
- - /bugfix*/
733
- - build:
734
- context: org-global
735
- requires:
736
- - setup
737
- - test-dependencies
738
815
  - test-lint
739
816
  - test-unit
740
817
  - test-coverage
741
818
  - vulnerability-check
742
819
  - audit-licenses
743
- - build-local
744
820
  filters:
745
821
  tags:
746
822
  only: /v[0-9]+(\.[0-9]+)*(\-snapshot(\.[0-9]+)?)?(\-hotfix(\.[0-9]+)?)?(\-perf(\.[0-9]+)?)?/
@@ -750,7 +826,7 @@ workflows:
750
826
  - license-scan:
751
827
  context: org-global
752
828
  requires:
753
- - build
829
+ - build-local
754
830
  filters:
755
831
  tags:
756
832
  only: /v[0-9]+(\.[0-9]+)*(\-snapshot(\.[0-9]+)?)?(\-hotfix(\.[0-9]+)?)?(\-perf(\.[0-9]+)?)?/
@@ -760,19 +836,18 @@ workflows:
760
836
  - image-scan:
761
837
  context: org-global
762
838
  requires:
763
- - build
839
+ - build-local
764
840
  filters:
765
841
  tags:
766
842
  only: /v[0-9]+(\.[0-9]+)*(\-snapshot(\.[0-9]+)?)?(\-hotfix(\.[0-9]+)?)?(\-perf(\.[0-9]+)?)?/
767
843
  branches:
768
844
  ignore:
769
845
  - /.*/
770
- # New commits to master release automatically
846
+ # New commits to main release automatically
771
847
  - release:
772
848
  context: org-global
773
849
  requires:
774
850
  - pr-tools/pr-title-check
775
- - test-dependencies
776
851
  - test-lint
777
852
  - test-unit
778
853
  - test-coverage
@@ -783,7 +858,7 @@ workflows:
783
858
  filters:
784
859
  branches:
785
860
  only:
786
- - master
861
+ - main
787
862
  - /release\/v.*/
788
863
  - github-release:
789
864
  context: org-global
@@ -792,16 +867,14 @@ workflows:
792
867
  filters:
793
868
  branches:
794
869
  only:
795
- - master
870
+ - main
796
871
  - /release\/v.*/
797
- - publish-docker:
872
+ - publish:
798
873
  context: org-global
799
874
  requires:
800
875
  - pr-tools/pr-title-check
801
- - test-dependencies
802
876
  - test-lint
803
877
  - test-unit
804
- - build
805
878
  - test-coverage
806
879
  - vulnerability-check
807
880
  - audit-licenses
@@ -813,14 +886,12 @@ workflows:
813
886
  branches:
814
887
  ignore:
815
888
  - /.*/
816
- - publish-docker-snapshot:
889
+ - publish-snapshot:
817
890
  context: org-global
818
891
  requires:
819
892
  - pr-tools/pr-title-check
820
- - test-dependencies
821
893
  - test-lint
822
894
  - test-unit
823
- - build
824
895
  - test-coverage
825
896
  - vulnerability-check
826
897
  - audit-licenses
@@ -867,4 +938,4 @@ workflows:
867
938
  only: /v[0-9]+(\.[0-9]+)*\-snapshot+((\.[0-9]+)?)/
868
939
  branches:
869
940
  ignore:
870
- - /.*/
941
+ - /.*/
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 16.15.0
1
+ 18.17.1
package/.versionrc ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "types": [
3
+ {"type": "feat", "section": "Features"},
4
+ {"type": "fix", "section": "Bug Fixes"},
5
+ {"type": "docs", "section": "Documentation"},
6
+ {"type": "style", "section": "Styling"},
7
+ {"type": "refactor", "section": "Refactors"},
8
+ {"type": "perf", "section": "Performance"},
9
+ {"type": "test", "section": "Tests"},
10
+ {"type": "build", "section": "Build System"},
11
+ {"type": "ci", "section": "CI"},
12
+ {"type": "chore", "section": "Chore"},
13
+ {"type": "revert", "section": "Reverts"}
14
+ ]
15
+ }
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.2.1](https://github.com/mojaloop/ml-testing-toolkit-client-lib/compare/v1.2.0...v1.2.1) (2023-10-11)
6
+
7
+
8
+ ### Chore
9
+
10
+ * **mojaloop/#3461:** nodejs upgrade ([#8](https://github.com/mojaloop/ml-testing-toolkit-client-lib/issues/8)) ([8a46fd6](https://github.com/mojaloop/ml-testing-toolkit-client-lib/commit/8a46fd634e42e72c6e0f21d97ecadd4839e17d62)), closes [mojaloop/#3461](https://github.com/mojaloop/project/issues/3461)
11
+
5
12
  ## [1.2.0](https://github.com/mojaloop/ml-testing-toolkit-client-lib/compare/v1.1.1...v1.2.0) (2023-03-17)
6
13
 
7
14
 
package/Dockerfile CHANGED
@@ -1,27 +1,49 @@
1
- FROM node:16.15.0-alpine as builder
1
+ # Arguments
2
+ ARG NODE_VERSION=lts-alpine
3
+
4
+ # NOTE: Ensure you set NODE_VERSION Build Argument as follows...
5
+ #
6
+ # export NODE_VERSION="$(cat .nvmrc)-alpine" \
7
+ # docker build \
8
+ # --build-arg NODE_VERSION=$NODE_VERSION \
9
+ # -t mojaloop/sdk-scheme-adapter:local \
10
+ # . \
11
+ #
12
+
13
+ # Build Image
14
+ FROM node:${NODE_VERSION} as builder
15
+ USER root
16
+
2
17
  WORKDIR /opt/app
3
18
 
4
- RUN apk add --no-cache -t build-dependencies make gcc g++ python3 libtool libressl-dev openssl-dev autoconf automake \
5
- && cd $(npm root -g)/npm \
6
- && npm config set unsafe-perm true \
7
- && npm install -g node-gyp
19
+ RUN apk --no-cache add git
20
+ RUN apk add --no-cache -t build-dependencies make gcc g++ python3 libtool openssl-dev autoconf automake bash \
21
+ && cd $(npm root -g)/npm
8
22
 
9
23
  COPY package.json package-lock.json* /opt/app/
10
24
 
11
- RUN npm install
25
+ RUN npm ci
26
+
27
+ RUN apk del build-dependencies
12
28
 
13
29
  COPY src /opt/app/src
14
30
 
15
- FROM node:16.15.0-alpine
31
+ FROM node:${NODE_VERSION}
32
+
16
33
  WORKDIR /opt/app
17
34
 
18
- # Create a non-root user: ml-user
19
- RUN adduser -D ml-user
35
+ # Create empty log file & link stdout to the application log file
36
+ RUN mkdir ./logs && touch ./logs/combined.log
37
+ # Links combined to stdout
38
+ RUN ln -sf /dev/stdout ./logs/combined.log
39
+
40
+ # Create a non-root user:app-user
41
+ RUN adduser -D app-user
20
42
 
21
- COPY --chown=ml-user --from=builder /opt/app .
22
- RUN chown ml-user:ml-user /opt/app
43
+ COPY --chown=app-user --from=builder /opt/app .
44
+ RUN chown app-user:app-user /opt/app
23
45
 
24
- USER ml-user
46
+ USER app-user
25
47
 
26
48
  RUN npm prune --production
27
49
 
package/README.md CHANGED
@@ -3,7 +3,7 @@ Mojaloop Testing Toolkit Client Library and Tools
3
3
 
4
4
  This package is intended to provide various clients and tools to connect with **Mojaloop Testing Toolkit** instead of using web interface.
5
5
 
6
- For additional back ground information on the `Mojaloop Testing Toolkit`, please see [Mojaloop Testing Toolkit Documentation](https://github.com/mojaloop/ml-testing-toolkit/blob/master/documents/User-Guide.md). It would be to the particpant's benefit to familiarise themselves with the understanding of the [Architecture Diagram](https://github.com/mojaloop/ml-testing-toolkit/blob/master/documents/Mojaloop-Testing-Toolkit.md#7-architecture) that explains the various components and related flows.
6
+ For additional back ground information on the `Mojaloop Testing Toolkit`, please see [Mojaloop Testing Toolkit Documentation](https://github.com/mojaloop/ml-testing-toolkit/blob/main/documents/User-Guide.md). It would be to the particpant's benefit to familiarise themselves with the understanding of the [Architecture Diagram](https://github.com/mojaloop/ml-testing-toolkit/blob/main/documents/Mojaloop-Testing-Toolkit.md#7-architecture) that explains the various components and related flows.
7
7
 
8
8
  ## Testing Toolkit Command Line Client
9
9
 
@@ -282,8 +282,8 @@ As part of our CI/CD process, we use a combination of CircleCI, standard-version
282
282
  npm package and github-release CircleCI orb to automatically trigger our releases
283
283
  and image builds. This process essentially mimics a manual tag and release.
284
284
 
285
- On a merge to master, CircleCI is configured to use the mojaloopci github account
285
+ On a merge to main, CircleCI is configured to use the mojaloopci github account
286
286
  to push the latest generated CHANGELOG and package version number.
287
287
 
288
- Once those changes are pushed, CircleCI will pull the updated master, tag and
288
+ Once those changes are pushed, CircleCI will pull the updated main, tag and
289
289
  push a release triggering another subsequent build that also publishes a docker image.
package/audit-ci.jsonc CHANGED
@@ -4,11 +4,8 @@
4
4
  // Only use one of ["low": true, "moderate": true, "high": true, "critical": true]
5
5
  "moderate": true,
6
6
  "allowlist": [
7
- // @mojaloop/sdk-standard-components>jsonwebtoken
8
- "GHSA-hjrf-2m68-5959",
9
- "GHSA-qwph-4952-7xr6",
10
- "GHSA-8cf7-32gw-wr33",
11
- // request-promise-native>request-promise-core>request
12
- "GHSA-p8p7-x288-28g6"
7
+ // request-promise-native>request-promise-core>request - Library is now deprecated. see https://github.com/mojaloop/project/issues/3545
8
+ "GHSA-p8p7-x288-28g6",
9
+ "GHSA-72xf-g2v4-qvf3"
13
10
  ]
14
11
  }
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@mojaloop/ml-testing-toolkit-client-lib",
3
3
  "description": "Testing Toolkit Client Library",
4
- "version": "1.2.0",
4
+ "version": "1.2.2-snapshot",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Vijaya Kumar Guthi, ModusBox Inc. ",
7
7
  "contributors": [
8
8
  "Georgi Logodazhki <georgi.logodazhki@modusbox.com>",
9
9
  "Sam Kummary <sam@modusbox.com>",
10
10
  "Steven Oderayi <steven.oderayi@modusbox.com>",
11
- "Vijay Kumar <vijaya.guthi@modusbox.com>"
11
+ "Vijay Kumar <vijaya.guthi@modusbox.com>",
12
+ "Aaron Reynoza <aaron.reynoza@infitx.com>"
12
13
  ],
13
14
  "repository": {
14
15
  "type": "git",
@@ -16,7 +17,7 @@
16
17
  },
17
18
  "bugs": "https://github.com/mojaloop/ml-testing-toolkit-client-lib/issues",
18
19
  "engines": {
19
- "node": "=16.x"
20
+ "node": ">=18.x"
20
21
  },
21
22
  "config": {},
22
23
  "bin": {
@@ -51,6 +52,7 @@
51
52
  "cover": "npx nyc --all report --reporter=lcov npm run test",
52
53
  "lint": "npm run standard",
53
54
  "lint:fix": "npm run standard:fix",
55
+ "audit:fix": "npm audit fix",
54
56
  "generate-docs": "jsdoc -c jsdoc.json",
55
57
  "audit:check": "npx audit-ci --config ./audit-ci.jsonc",
56
58
  "dep:check": "npx ncu -e 2",
@@ -61,39 +63,39 @@
61
63
  "snapshot": "npx standard-version --no-verify --skip.changelog --prerelease snapshot --releaseCommitMessageFormat 'chore(snapshot): {{currentTag}}'"
62
64
  },
63
65
  "dependencies": {
64
- "@mojaloop/central-services-logger": "^11.2.0",
65
- "@mojaloop/ml-testing-toolkit-shared-lib": "^13.0.0",
66
- "@mojaloop/sdk-standard-components": "17.1.1",
67
- "@slack/webhook": "^6.1.0",
66
+ "@mojaloop/central-services-logger": "11.2.2",
67
+ "@mojaloop/ml-testing-toolkit-shared-lib": "14.0.1",
68
+ "@mojaloop/sdk-standard-components": "17.1.3",
69
+ "@slack/webhook": "7.0.2",
68
70
  "atob": "2.1.2",
69
- "aws-sdk": "^2.1337.0",
70
- "axios": "^1.3.4",
71
+ "aws-sdk": "2.1552.0",
72
+ "axios": "1.6.7",
71
73
  "cli-table3": "0.6.3",
72
- "commander": "10.0.0",
73
- "dotenv": "^16.0.3",
74
+ "commander": "12.0.0",
75
+ "dotenv": "16.4.1",
74
76
  "fs": "0.0.1-security",
75
- "lodash": "^4.17.21",
76
- "mv": "^2.1.1",
77
+ "lodash": "4.17.21",
78
+ "mv": "2.1.1",
77
79
  "node-dir": "0.1.17",
78
- "node-strings": "^1.0.2",
80
+ "node-strings": "1.0.2",
79
81
  "parse-strings-in-object": "1.6.0",
80
- "path": "^0.12.7",
82
+ "path": "0.12.7",
81
83
  "rc": "1.2.8",
82
- "request": "^2.88.2",
84
+ "request": "2.88.2",
83
85
  "request-promise-native": "1.0.8",
84
- "socket.io-client": "^4.6.1"
86
+ "socket.io-client": "4.7.4"
85
87
  },
86
88
  "devDependencies": {
87
89
  "audit-ci": "^6.6.1",
88
- "jest": "^29.5.0",
89
- "jest-junit": "^15.0.0",
90
- "npm-check-updates": "16.7.12",
90
+ "jest": "^29.7.0",
91
+ "jest-junit": "^16.0.0",
92
+ "npm-check-updates": "16.14.14",
91
93
  "nyc": "^15.1.0",
92
94
  "parse-strings-in-object": "1.6.0",
93
95
  "pre-commit": "1.2.2",
94
96
  "replace": "^1.2.2",
95
- "sinon": "15.0.2",
96
- "standard": "^17.0.0",
97
+ "sinon": "17.0.1",
98
+ "standard": "^17.1.0",
97
99
  "standard-version": "^9.5.0"
98
100
  },
99
101
  "generator-swaggerize": {