Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Init Container To Onboard MSISDN's #55

Merged
merged 33 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
029f407
Add init container to onboard with central-ledger
KamuelaFranco Apr 28, 2020
7090f84
Remove environment var processing script
KamuelaFranco Apr 29, 2020
8b42349
Switch RUN to CMD
KamuelaFranco Apr 29, 2020
ad9b34a
Add OCI labels
KamuelaFranco Apr 29, 2020
65e15e2
Add contributor
KamuelaFranco Apr 29, 2020
8bb7315
Update init/central-ledger/Dockerfile
KamuelaFranco Apr 29, 2020
1772363
Clear whitespace and unused comments
KamuelaFranco Apr 30, 2020
b955310
Add build and publish to CI for init-central-ledger
KamuelaFranco Apr 30, 2020
d0ceb92
Fix indentation
KamuelaFranco Apr 30, 2020
6b391c5
created insert msisnd script
May 7, 2020
8786a00
complete docker container and MSISDN onboarding script
Jun 18, 2020
b05afb3
change MSISDN_LIST name
Jun 18, 2020
18d41c7
change script to handle MSISDN data
Jun 18, 2020
563cc80
delete other stuff and fix pipeline
Jun 18, 2020
be6f577
ignore dependency vulneravility
Jun 18, 2020
87eb68c
update dockerfile
Jun 18, 2020
f954a02
rename thingy
Jun 18, 2020
fa93e1d
change pathfinder url name
Jun 22, 2020
681c7a7
modify scripts
Jun 23, 2020
0db2203
fix script and docker container
Jun 23, 2020
805ca5c
add CI pipeline and remove unused files
Jul 9, 2020
f0738e0
merge from upstream
Jul 9, 2020
009e3c1
fix docker command
Jul 9, 2020
aa522a2
fix indentation
Jul 9, 2020
881ef63
fix tag implementation
Jul 9, 2020
00187b0
yaml is fun
Jul 9, 2020
81b5f90
resolve vulnerabilities and fix docker save
Jul 9, 2020
c7e44d0
fix docker build
Jul 9, 2020
1e4ab9b
fix docker image naming and add Matt suggestion
Jul 9, 2020
139a02b
log current images
Jul 9, 2020
744c615
idk why but it works now
Jul 9, 2020
f343f04
Clean up naming and pipeline
KamuelaFranco Jul 9, 2020
2a0e883
Bump version
KamuelaFranco Jul 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 116 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ jobs:
echo "Building Docker image: $CIRCLE_TAG"

docker build
--build-arg=BUILD_DATE="$(date -u --iso-8601=seconds)"
--build-arg=VERSION="$RELEASE_TAG"
--build-arg=VCS_URL="$CIRCLE_REPOSITORY_URL"
--build-arg=VCS_REF="$CIRCLE_SHA1"
--build-arg BUILD_DATE="$(date -u --iso-8601=seconds)"
--build-arg VERSION="$RELEASE_TAG"
--build-arg VCS_URL="$CIRCLE_REPOSITORY_URL"
--build-arg VCS_REF="$CIRCLE_SHA1"
-t $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:$CIRCLE_TAG .
- run:
name: Save docker image to workspace
Expand All @@ -215,6 +215,29 @@ jobs:
paths:
- ./docker-image.tar

build-onboard-msisdn-oracle:
executor: default-machine
steps:
- checkout
- run:
name: Build Docker onboard-msisdn-oracle $CIRCLE_TAG image
command: >
echo "Building Docker image: onboard-msisdn-oracle $CIRCLE_TAG"

docker build
--build-arg BUILD_DATE="$(date -u --iso-8601=seconds)"
--build-arg VERSION="$RELEASE_TAG"
--build-arg VCS_URL="$CIRCLE_REPOSITORY_URL"
--build-arg VCS_REF="$CIRCLE_SHA1"
-t $DOCKER_ORG/onboard-msisdn-oracle:$CIRCLE_TAG .
- run:
name: Save docker image to workspace
command: docker save -o /tmp/docker-onboard-msisdn-oracle.tar $DOCKER_ORG/onboard-msisdn-oracle:$CIRCLE_TAG
- persist_to_workspace:
root: /tmp
paths:
- ./docker-onboard-msisdn-oracle.tar

build-local:
executor: default-machine
steps:
Expand All @@ -225,10 +248,10 @@ jobs:
echo "Building Docker image: local"

docker build
--build-arg=BUILD_DATE="$(date -u --iso-8601=seconds)"
--build-arg=VERSION="local"
--build-arg=VCS_URL="$CIRCLE_REPOSITORY_URL"
--build-arg=VCS_REF="$CIRCLE_SHA1"
--build-arg BUILD_DATE="$(date -u --iso-8601=seconds)"
--build-arg VERSION="local"
--build-arg VCS_URL="$CIRCLE_REPOSITORY_URL"
--build-arg VCS_REF="$CIRCLE_SHA1"
-t $DOCKER_ORG/$CIRCLE_PROJECT_REPONAME:local .
- run:
name: Save docker image to workspace
Expand All @@ -238,6 +261,29 @@ jobs:
paths:
- ./docker-image.tar

build-local-onboard-msisdn-oracle:
executor: default-machine
steps:
- checkout
- run:
name: Build Docker onboard-msisdn-oracle local image for testing
command: >
echo "Building Docker image: onboard-msisdn-oracle local"

docker build
--build-arg BUILD_DATE="$(date -u --iso-8601=seconds)"
--build-arg VERSION="local"
--build-arg VCS_URL="$CIRCLE_REPOSITORY_URL"
--build-arg VCS_REF="$CIRCLE_SHA1"
-t $DOCKER_ORG/onboard-msisdn-oracle:local ./init/onboard-msisdn-oracle/
- run:
name: Save docker image to workspace
command: docker save -o /tmp/docker-onboard-msisdn-oracle.tar $DOCKER_ORG/onboard-msisdn-oracle:local
- persist_to_workspace:
root: /tmp
paths:
- ./docker-onboard-msisdn-oracle.tar

license-scan:
executor: default-machine
steps:
Expand Down Expand Up @@ -338,6 +384,39 @@ jobs:
-H 'cache-control: no-cache' \
-d "{\"text\": \"*${CIRCLE_PROJECT_REPONAME}* - Release \`${CIRCLE_TAG}\`: https://github.com/mojaloop/${CIRCLE_PROJECT_REPONAME}/releases/tag/${CIRCLE_TAG}\"}"

publish-onboard-msisdn-oracle:
executor: default-machine
steps:
- checkout
- attach_workspace:
at: /tmp
- run:
name: Load the pre-built docker image for onboard-msisdn-oracle from workspace
command: docker load -i /tmp/docker-onboard-msisdn-oracle.tar
- run:
name: Login to Docker Hub
command: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run:
name: Setup environment vars for release/snapshot
command: ./.circleci/_set_up_deploy_envs.sh
- run:
name: Re-tag pre built image
command: |
docker tag docker-onboard-msisdn-oracle.tar $DOCKER_ORG/onboard-msisdn-oracle:$RELEASE_TAG
- run:
name: Publish Docker image $CIRCLE_TAG & Latest tag to Docker Hub for onboard-msisdn-oracle
command: |
echo "Publishing $DOCKER_ORG/onboard-msisdn-oracle:$CIRCLE_TAG"
docker push $DOCKER_ORG/onboard-msisdn-oracle:$CIRCLE_TAG
- run:
name: Slack announcement for tag releases
command: |
curl -X POST \
$SLACK_WEBHOOK_ANNOUNCEMENT \
-H 'Content-type: application/json' \
-H 'cache-control: no-cache' \
-d "{\"text\": \"*onboard-msisdn-oracle* - Release \`${CIRCLE_TAG}\`: https://github.com/mojaloop/${CIRCLE_PROJECT_REPONAME}/releases/tag/${CIRCLE_TAG}\"}"

deploy:
executor: deploy-kube/helm-kube
steps:
Expand Down Expand Up @@ -414,6 +493,14 @@ workflows:
- /feature*/
- /bugfix*/
- /hotfix*/
- build-local-onboard-msisdn-oracle:
context: org-global
filters:
branches:
ignore:
- /feature*/
- /bugfix*/
- /hotfix*/
- license-scan:
context: org-global
requires:
Expand Down Expand Up @@ -442,10 +529,30 @@ workflows:
branches:
ignore:
- /.*/
- build-onboard-msisdn-oracle:
context: org-global
filters:
tags:
only: /v[0-9]+(\.[0-9]+)*(\-snapshot)?(\-hotfix(\.[0-9]+))?/
branches:
ignore:
- /.*/
- publish:
context: org-global
requires:
- build
- build-onboard-msisdn-oracle
filters:
tags:
only: /v[0-9]+(\.[0-9]+)*(\-snapshot)?(\-hotfix(\.[0-9]+))?/
branches:
ignore:
- /.*/
- publish-onboard-msisdn-oracle:
context: org-global
requires:
- build
- build-onboard-msisdn-oracle
filters:
tags:
only: /v[0-9]+(\.[0-9]+)*(\-snapshot)?(\-hotfix(\.[0-9]+))?/
Expand All @@ -456,6 +563,7 @@ workflows:
context: org-global
requires:
- publish
- publish-onboard-msisdn-oracle
filters:
tags:
only: /v[0-9]+(\.[0-9]+)*(\-snapshot)?/
Expand Down
22 changes: 22 additions & 0 deletions init/onboard-msisdn-oracle/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM alpine

ARG CREATED
ARG SOURCE
ARG REVISION
ARG VERSION

# See https://github.com/opencontainers/image-spec/blob/master/annotations.md#pre-defined-annotation-keys and https://github.com/opencontainers/image-spec/blob/master/spec.md for info
LABEL org.opencontainers.image.created=${CREATED}
LABEL org.opencontainers.image.url="https://mojaloop.io/"
LABEL org.opencontainers.image.source=${SOURCE}
LABEL org.opencontainers.image.version=${VERSION}
LABEL org.opencontainers.image.revision=${REVISION}
LABEL org.opencontainers.image.title="onboard-msisdn-oracle"
LABEL org.opencontainers.image.authors="aaron.reynoza@modusbox.com"
LABEL org.opencontainers.image.licenses="Apache-2.0"

RUN apk add --no-cache --upgrade bash curl jq

COPY insert_msisdns.sh /insert_msisdns.sh

CMD ["sh", "/insert_msisdns.sh"]
16 changes: 16 additions & 0 deletions init/onboard-msisdn-oracle/insert_msisdns.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env sh

CURRENT_DATE=$(date)
for participantMSISDN in $(echo "${MSISDN_LIST}" | jq -c '.[]'); do
MSISDN=$(echo "${participantMSISDN}" | jq -r '.MSISDN');
CURRENCY=$(echo "${participantMSISDN}" | jq -r '.currency');
DATA="{\"currency\": \"${CURRENCY}\", \"fspId\": \"${DFSP_NAME}\"}"

curl -v --location --request PUT "${HOST_PATHFINDER_ORACLE}/participants/MSISDN/${MSISDN}" \
--header 'Content-Type: application/json' \
--header "date: ${CURRENT_DATE}" \
--header "fspiop-source: ${DFSP_NAME}" \
--data-raw "${DATA}";
done

echo "MSISDN's have been onboarded"
25 changes: 2 additions & 23 deletions src/audit-resolve.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,9 @@
{
"decisions": {
"1300|nyc>istanbul-reports>handlebars": {
"madeAt": 0,
"decision": "fix"
},
"1316|nyc>istanbul-reports>handlebars": {
"madeAt": 0,
"decision": "fix"
},
"1324|nyc>istanbul-reports>handlebars": {
"madeAt": 0,
"decision": "fix"
},
"1325|nyc>istanbul-reports>handlebars": {
"madeAt": 0,
"decision": "fix"
},
"1500|npm-audit-resolver>yargs-unparser>yargs>yargs-parser": {
"decision": "ignore",
"madeAt": 1591787086979,
"expiresAt": 1592391879076
},
"1500|npm-audit-resolver>audit-resolve-core>yargs-parser": {
"decision": "ignore",
"madeAt": 1591787090589,
"expiresAt": 1592391879076
"madeAt": 1594258444388,
"expiresAt": 1594863234907
}
},
"rules": {},
Expand Down
9 changes: 4 additions & 5 deletions src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"name": "mojaloop-simulator",
"version": "10.4.1",
"version": "10.6.0",
"description": "A canonical test example implementation of the parties, transfers and quotes resources of the Mojaloop API",
"license": "Apache-2.0",
"main": "index.js",
"author": "Matt Kingston, ModusBox Inc.",
"contributors": [
"Kamuela Franco <kamuela.franco@modusbox.com>",
"Matt Kingston <matt.kingston@modusbox.com>",
"Steven Oderayi <steven.oderayi@modusbox.com>",
"Aaron Reynoza <aaron.reynoza@modusbox.com>",
"ModusBox",
"Mowali"
],
Expand Down