@mojaloop/ml-testing-toolkit-client-lib 0.0.3 → 0.0.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.
@@ -10,6 +10,7 @@ orbs:
10
10
  slack: circleci/slack@4.9.3 # Ref: https://github.com/mojaloop/ci-config/tree/master/slack-templates
11
11
  pr-tools: mojaloop/pr-tools@0.1.10 # Ref: https://github.com/mojaloop/ci-config/
12
12
  gh: circleci/github-cli@2.1.0
13
+ anchore: anchore/anchore-engine@1.9.0
13
14
 
14
15
  ##
15
16
  # defaults
@@ -213,6 +214,94 @@ jobs:
213
214
  path: /tmp/license-scanner/results
214
215
  prefix: licenses
215
216
 
217
+ build:
218
+ executor: default-machine
219
+ steps:
220
+ - checkout
221
+ - run:
222
+ name: Build Docker $CIRCLE_TAG image
223
+ command: |
224
+ echo "Building Docker image: $CIRCLE_TAG"
225
+ docker build -t $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG .
226
+ - run:
227
+ name: Save docker image to workspace
228
+ command: docker save -o /tmp/docker-image.tar $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG
229
+ - persist_to_workspace:
230
+ root: /tmp
231
+ paths:
232
+ - ./docker-image.tar
233
+
234
+ image-scan:
235
+ executor: anchore/anchore_engine
236
+ steps:
237
+ - setup_remote_docker
238
+ - checkout
239
+ - run:
240
+ name: Setup Slack config
241
+ command: |
242
+ echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
243
+ echo "export SLACK_RELEASE_TYPE='GitHub Release'" >> $BASH_ENV
244
+ echo "export SLACK_RELEASE_TAG='${RELEASE_TAG} on ${CIRCLE_BRANCH} branch'" >> $BASH_ENV
245
+ echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
246
+ echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
247
+ echo "export SLACK_CUSTOM_MSG='Anchore Image Scan failed for: \`${DOCKER_ORG}/${CIRCLE_PROJECT_REPONAME}:${CIRCLE_TAG}\`'" >> $BASH_ENV
248
+ - run:
249
+ name: Install docker dependencies for anchore
250
+ command: |
251
+ apk add --update py-pip docker python3-dev libffi-dev openssl-dev gcc libc-dev make jq npm
252
+ - run:
253
+ name: Install general dependencies
254
+ command: |
255
+ apk --no-cache add git
256
+ apk --no-cache add ca-certificates
257
+ apk --no-cache add curl
258
+ apk --no-cache add openssh-client
259
+ apk add --no-cache -t build-dependencies make gcc g++ python3 libtool autoconf automake
260
+ npm config set unsafe-perm true
261
+ npm install -g node-gyp
262
+ - run:
263
+ name: Install AWS CLI dependencies
264
+ command: *defaults_awsCliDependencies
265
+ - attach_workspace:
266
+ at: /tmp
267
+ - run:
268
+ name: Load the pre-built docker image from workspace
269
+ command: docker load -i /tmp/docker-image.tar
270
+ - run:
271
+ name: Download the mojaloop/ci-config repo
272
+ command: |
273
+ git clone https://github.com/mojaloop/ci-config /tmp/ci-config
274
+ # Generate the mojaloop anchore-policy
275
+ cd /tmp/ci-config/container-scanning && ./mojaloop-policy-generator.js /tmp/mojaloop-policy.json
276
+ - run:
277
+ name: Pull base image locally
278
+ command: |
279
+ docker pull node:16.15.0-alpine
280
+ # Analyze the base and derived image
281
+ # Note: It seems images are scanned in parallel, so preloading the base image result doesn't give us any real performance gain
282
+ - anchore/analyze_local_image:
283
+ # Force the older version, version 0.7.0 was just published, and is broken
284
+ anchore_version: v0.6.1
285
+ image_name: "docker.io/node:16.15.0-alpine $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG"
286
+ policy_failure: false
287
+ timeout: '500'
288
+ # Note: if the generated policy is invalid, this will fallback to the default policy, which we don't want!
289
+ policy_bundle_file_path: /tmp/mojaloop-policy.json
290
+ - run:
291
+ name: Upload Anchore reports to s3
292
+ command: |
293
+ aws s3 cp anchore-reports ${AWS_S3_DIR_ANCHORE_REPORTS}/${CIRCLE_PROJECT_REPONAME}/ --recursive
294
+ aws s3 rm ${AWS_S3_DIR_ANCHORE_REPORTS}/latest/ --recursive --exclude "*" --include "${CIRCLE_PROJECT_REPONAME}*"
295
+ aws s3 cp anchore-reports ${AWS_S3_DIR_ANCHORE_REPORTS}/latest/ --recursive
296
+ - run:
297
+ name: Evaluate failures
298
+ 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
299
+ - store_artifacts:
300
+ path: anchore-reports
301
+ - slack/notify:
302
+ event: fail
303
+ template: SLACK_TEMP_RELEASE_FAILURE
304
+
216
305
  release:
217
306
  executor: default-docker
218
307
  steps:
@@ -285,6 +374,64 @@ jobs:
285
374
  event: fail
286
375
  template: SLACK_TEMP_RELEASE_FAILURE
287
376
 
377
+ publish-docker:
378
+ executor: default-machine
379
+ steps:
380
+ - checkout
381
+ - run:
382
+ name: Setup for LATEST release
383
+ command: |
384
+ echo "export RELEASE_TAG=$RELEASE_TAG_PROD" >> $BASH_ENV
385
+ echo "RELEASE_TAG=$RELEASE_TAG_PROD"
386
+
387
+ PACKAGE_VERSION=$(cat package-lock.json | jq -r .version)
388
+ echo "export PACKAGE_VERSION=${PACKAGE_VERSION}" >> $BASH_ENV
389
+ echo "PACKAGE_VERSION=${PACKAGE_VERSION}"
390
+ - run:
391
+ name: Setup Slack config
392
+ command: |
393
+ echo "export SLACK_PROJECT_NAME=${CIRCLE_PROJECT_REPONAME}" >> $BASH_ENV
394
+ echo "export SLACK_RELEASE_TYPE='Docker Release'" >> $BASH_ENV
395
+ echo "export SLACK_RELEASE_TAG=v${CIRCLE_TAG:1}" >> $BASH_ENV
396
+ echo "export SLACK_BUILD_ID=${CIRCLE_BUILD_NUM}" >> $BASH_ENV
397
+ echo "export SLACK_CI_URL=${CIRCLE_BUILD_URL}" >> $BASH_ENV
398
+ - attach_workspace:
399
+ at: /tmp
400
+ - run:
401
+ name: Load the pre-built docker image from workspace
402
+ command: |
403
+ docker load -i /tmp/docker-image.tar
404
+ - run:
405
+ name: Login to Docker Hub
406
+ command: docker login -u $DOCKER_USER -p $DOCKER_PASS
407
+ - run:
408
+ name: Re-tag pre built image
409
+ command: |
410
+ docker tag $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG
411
+ - run:
412
+ name: Publish Docker image $CIRCLE_TAG & Latest tag to Docker Hub
413
+ command: |
414
+ echo "Publishing $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG"
415
+ docker push $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG
416
+ echo "Publishing $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG"
417
+ docker push $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$RELEASE_TAG
418
+ - run:
419
+ name: Set Image Digest
420
+ command: |
421
+ IMAGE_DIGEST=$(docker inspect $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:v${CIRCLE_TAG:1} | jq '.[0].RepoDigests | .[]')
422
+ echo "IMAGE_DIGEST=${IMAGE_DIGEST}"
423
+ echo "export IMAGE_DIGEST=${IMAGE_DIGEST}" >> $BASH_ENV
424
+ - run:
425
+ name: Update Slack config
426
+ command: |
427
+ 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
428
+ - slack/notify:
429
+ event: pass
430
+ template: SLACK_TEMP_RELEASE_SUCCESS
431
+ - slack/notify:
432
+ event: fail
433
+ template: SLACK_TEMP_RELEASE_FAILURE
434
+
288
435
  publish:
289
436
  executor: default-docker
290
437
  steps:
@@ -445,6 +592,32 @@ workflows:
445
592
  ignore:
446
593
  - /feature*/
447
594
  - /bugfix*/
595
+ - build:
596
+ context: org-global
597
+ requires:
598
+ - setup
599
+ # - test-dependencies
600
+ - test-lint
601
+ - test-unit
602
+ - test-coverage
603
+ - vulnerability-check
604
+ - audit-licenses
605
+ filters:
606
+ tags:
607
+ only: /v[0-9]+(\.[0-9]+)*(\-snapshot(\.[0-9]+)?)?(\-hotfix(\.[0-9]+)?)?(\-perf(\.[0-9]+)?)?/
608
+ branches:
609
+ ignore:
610
+ - /.*/
611
+ - image-scan:
612
+ context: org-global
613
+ requires:
614
+ - build
615
+ filters:
616
+ tags:
617
+ only: /v[0-9]+(\.[0-9]+)*(\-snapshot(\.[0-9]+)?)?(\-hotfix(\.[0-9]+)?)?(\-perf(\.[0-9]+)?)?/
618
+ branches:
619
+ ignore:
620
+ - /.*/
448
621
  # New commits to master release automatically
449
622
  - release:
450
623
  context: org-global
@@ -470,6 +643,22 @@ workflows:
470
643
  only:
471
644
  - master
472
645
  - /release\/v.*/
646
+ - publish-docker:
647
+ context: org-global
648
+ requires:
649
+ - pr-tools/pr-title-check
650
+ - test-lint
651
+ - test-unit
652
+ - test-coverage
653
+ - vulnerability-check
654
+ - audit-licenses
655
+ - image-scan
656
+ filters:
657
+ tags:
658
+ only: /v[0-9]+(\.[0-9]+)*/
659
+ branches:
660
+ ignore:
661
+ - /.*/
473
662
  - publish:
474
663
  context: org-global
475
664
  requires:
package/.ncurc.js ADDED
@@ -0,0 +1,10 @@
1
+ module.exports = {
2
+ // Add a TODO comment indicating the reason for each rejected dependency upgrade added to this list, and what should be done to resolve it (i.e. handle it through a story, etc).
3
+ reject: [
4
+ // TODO: Upgrading ws is causing incompatibility issues with old versions of ws servers. Need to investigate the cause.
5
+ "ws",
6
+ // TODO: Upgrading socket.io-client is causing incompatibility issues with old versions of socket.io servers. Need to investigate the cause.
7
+ "socket.io-client",
8
+ "@types/socket.io"
9
+ ]
10
+ }
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
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
+ ### [0.0.4](https://github.com/mojaloop/ml-testing-toolkit-client-lib/compare/v0.0.3...v0.0.4) (2022-06-06)
6
+
5
7
  ### [0.0.3](https://github.com/mojaloop/ml-testing-toolkit-client-lib/compare/v0.0.2...v0.0.3) (2022-05-31)
6
8
 
7
9
  ### 0.0.2 (2022-05-31)
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.3",
4
+ "version": "0.0.4",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Vijaya Kumar Guthi, ModusBox Inc. ",
7
7
  "contributors": [
@@ -38,7 +38,6 @@
38
38
  "start": "node src/index.js",
39
39
  "standard": "standard",
40
40
  "standard:fix": "standard --fix",
41
- "dev": "nodemon src/index.js",
42
41
  "test": "npm run test:unit",
43
42
  "test:unit": "jest --testMatch '**/test/unit/**/*.test.js'",
44
43
  "test:int": "jest --reporters=default --reporters=jest-junit --testMatch '**/test/integration/**/*.test.js'",
@@ -62,59 +61,42 @@
62
61
  "snapshot": "npx standard-version --no-verify --skip.changelog --prerelease snapshot --releaseCommitMessageFormat 'chore(snapshot): {{currentTag}}'"
63
62
  },
64
63
  "dependencies": {
65
- "@mojaloop/central-services-logger": "^10.6.2",
64
+ "@mojaloop/central-services-logger": "^11.0.1",
66
65
  "@mojaloop/ml-testing-toolkit-shared-lib": "^12.2.0",
67
- "@mojaloop/sdk-standard-components": "10.2.0",
68
- "@slack/webhook": "^6.0.0",
69
- "@types/socket.io": "^2.1.4",
70
- "adm-zip": "^0.4.14",
66
+ "@mojaloop/sdk-standard-components": "17.0.3",
67
+ "@slack/webhook": "^6.1.0",
71
68
  "atob": "2.1.2",
72
- "aws-sdk": "^2.1009.0",
73
- "axios": "^0.21.4",
74
- "blipp": "4.0.1",
75
- "cli-table3": "0.6.0",
76
- "commander": "4.0.0",
77
- "docdash": "1.1.1",
78
- "dotenv": "^8.6.0",
69
+ "aws-sdk": "^2.1148.0",
70
+ "axios": "^0.27.2",
71
+ "cli-table3": "0.6.2",
72
+ "commander": "9.3.0",
73
+ "dotenv": "^16.0.1",
79
74
  "fs": "0.0.1-security",
80
- "js-yaml": "^3.13.1",
81
- "lodash": "^4.17.19",
75
+ "lodash": "^4.17.21",
82
76
  "mv": "^2.1.1",
83
77
  "node-dir": "0.1.17",
84
78
  "node-strings": "^1.0.2",
85
- "npm-run-all": "4.1.5",
86
- "parse-strings-in-object": "1.2.0",
79
+ "parse-strings-in-object": "1.4.0",
87
80
  "path": "^0.12.7",
88
81
  "rc": "1.2.8",
89
82
  "request": "^2.88.2",
90
83
  "request-promise-native": "1.0.8",
91
- "selectn": "^1.1.2",
92
- "socket.io": "^2.3.0",
93
84
  "socket.io-client": "^2.3.0",
94
- "uuid": "8.1.0",
95
- "uuid4": "1.1.4",
96
85
  "ws": "^7.5.5"
97
86
  },
98
87
  "devDependencies": {
99
- "@types/jest": "24.0.22",
100
- "eslint": "^8.0.1",
101
- "eslint-plugin-import": "^2.25.2",
102
- "get-port": "5.0.0",
103
- "jest": "^27.3.0",
104
- "jest-junit": "^13.0.0",
88
+ "eslint": "^8.17.0",
89
+ "eslint-plugin-import": "^2.26.0",
90
+ "jest": "^28.1.0",
91
+ "jest-junit": "^13.2.0",
105
92
  "jsdoc": "^3.6.10",
106
- "nodemon": "^2.0.13",
107
93
  "npm-audit-resolver": "3.0.0-7",
108
- "npm-check-updates": "11.3.0",
109
- "nyc": "^15.0.0",
110
- "parse-strings-in-object": "1.2.0",
94
+ "npm-check-updates": "13.1.1",
95
+ "nyc": "^15.1.0",
96
+ "parse-strings-in-object": "1.4.0",
111
97
  "pre-commit": "1.2.2",
112
- "proxyquire": "2.1.3",
113
- "sinon": "7.5.0",
114
- "standard": "^16.0.4",
115
- "supertest": "^4.0.2",
116
- "swagmock": "1.0.0",
117
- "tap-xunit": "2.4.1",
98
+ "sinon": "14.0.0",
99
+ "standard": "^17.0.0",
118
100
  "standard-version": "^9.5.0"
119
101
  },
120
102
  "generator-swaggerize": {