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 with central-ledger #48

Merged
merged 38 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
38 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
dbf655e
Merge branch 'master' of github.com:mojaloop/mojaloop-simulator into …
KamuelaFranco Jun 16, 2020
3580f5d
Update .circleci/config.yml
KamuelaFranco Jun 16, 2020
0b3591c
Add ESLint and node-fetch
KamuelaFranco Jun 19, 2020
ea95717
Update config to master branch
KamuelaFranco Jun 19, 2020
c144d30
Merge branch 'master' of github.com:mojaloop/mojaloop-simulator into …
KamuelaFranco Jun 19, 2020
192d8bd
Add onboarding steps
KamuelaFranco Jun 29, 2020
d4a1ec5
Update finance-portal-lib dependency
KamuelaFranco Jun 29, 2020
ec43525
Add logging
KamuelaFranco Jul 2, 2020
97cf8c7
Update Dockerfile
KamuelaFranco Jul 2, 2020
8fa4720
Add items to .gitignore
KamuelaFranco Jul 2, 2020
f898623
Align output
KamuelaFranco Jul 2, 2020
b3c9d28
Graceful exit on failure
KamuelaFranco Jul 2, 2020
4a5753d
Add log output
KamuelaFranco Jul 3, 2020
4e540d7
Add detailed logging on error
KamuelaFranco Jul 3, 2020
2a78293
Update finance-portal-lib dependency
KamuelaFranco Jul 6, 2020
91149b9
Add more detailed logging
KamuelaFranco Jul 6, 2020
f552321
Allow re-registration of same DFSP name and currency
KamuelaFranco Jul 7, 2020
40abbf5
Fix bug
KamuelaFranco Jul 7, 2020
fc499cb
Fix output by calling script directly
KamuelaFranco Jul 8, 2020
20e34ac
Fix logging and request edge cases
KamuelaFranco Jul 8, 2020
c7a98f9
Merge branch 'master' of github.com:mojaloop/mojaloop-simulator into …
KamuelaFranco Jul 9, 2020
75b69bc
Add onboard-central-ledger to pipeline
KamuelaFranco Jul 9, 2020
fd67730
Bump version
KamuelaFranco Jul 9, 2020
53e9436
Add comments
KamuelaFranco Jul 9, 2020
a258d15
Fix build argument references
KamuelaFranco Jul 9, 2020
875c446
Require setup for local builds
KamuelaFranco Jul 9, 2020
e7f4fab
Update init/onboard-central-ledger/onboard-dfsp.js
KamuelaFranco Jul 9, 2020
4020ca8
Log script commands and exit on error
partiallyordered Jul 9, 2020
d1c4cc8
Exit when required variable is not present
partiallyordered 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
141 changes: 129 additions & 12 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 CREATED="$(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 SOURCE="$CIRCLE_REPOSITORY_URL"
--build-arg REVISION="$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-central-ledger:
executor: default-machine
steps:
- checkout
- run:
name: Build Docker onboard-central-ledger $CIRCLE_TAG image
command: >
echo "Building Docker image: onboard-central-ledger $CIRCLE_TAG"

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

build-onboard-msisdn-oracle:
executor: default-machine
steps:
Expand All @@ -225,10 +248,10 @@ jobs:
echo "Building Docker image: onboard-msisdn-oracle $CIRCLE_TAG"

docker build
--build-arg BUILD_DATE="$(date -u --iso-8601=seconds)"
--build-arg CREATED="$(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 SOURCE="$CIRCLE_REPOSITORY_URL"
--build-arg REVISION="$CIRCLE_SHA1"
-t $DOCKER_ORG/onboard-msisdn-oracle:$CIRCLE_TAG .
- run:
name: Save docker image to workspace
Expand All @@ -248,10 +271,10 @@ jobs:
echo "Building Docker image: local"

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

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

docker build
--build-arg CREATED="$(date -u --iso-8601=seconds)"
--build-arg VERSION="local"
--build-arg SOURCE="$CIRCLE_REPOSITORY_URL"
--build-arg REVISION="$CIRCLE_SHA1"
-t $DOCKER_ORG/onboard-central-ledger:local ./init/onboard-central-ledger/
- run:
name: Save docker image to workspace
command: docker save -o /tmp/docker-onboard-central-ledger.tar $DOCKER_ORG/onboard-central-ledger:local
- persist_to_workspace:
root: /tmp
paths:
- ./docker-onboard-central-ledger.tar
KamuelaFranco marked this conversation as resolved.
Show resolved Hide resolved

build-local-onboard-msisdn-oracle:
executor: default-machine
steps:
Expand All @@ -271,10 +317,10 @@ jobs:
echo "Building Docker image: onboard-msisdn-oracle local"

docker build
--build-arg BUILD_DATE="$(date -u --iso-8601=seconds)"
--build-arg CREATED="$(date -u --iso-8601=seconds)"
--build-arg VERSION="local"
--build-arg VCS_URL="$CIRCLE_REPOSITORY_URL"
--build-arg VCS_REF="$CIRCLE_SHA1"
--build-arg SOURCE="$CIRCLE_REPOSITORY_URL"
--build-arg REVISION="$CIRCLE_SHA1"
-t $DOCKER_ORG/onboard-msisdn-oracle:local ./init/onboard-msisdn-oracle/
- run:
name: Save docker image to workspace
Expand Down Expand Up @@ -384,6 +430,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-central-ledger:
executor: default-machine
steps:
- checkout
- attach_workspace:
at: /tmp
- run:
name: Load the pre-built docker image for onboard-central-ledger from workspace
command: docker load -i /tmp/docker-onboard-central-ledger.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_ORG/onboard-central-ledger:$CIRCLE_TAG $DOCKER_ORG/onboard-central-ledger:$RELEASE_TAG
- run:
name: Publish Docker image $CIRCLE_TAG & Latest tag to Docker Hub for onboard-central-ledger
command: |
echo "Publishing $DOCKER_ORG/onboard-central-ledger:$CIRCLE_TAG"
docker push $DOCKER_ORG/onboard-central-ledger:$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-central-ledger* - Release \`${CIRCLE_TAG}\`: https://github.com/mojaloop/${CIRCLE_PROJECT_REPONAME}/releases/tag/${CIRCLE_TAG}\"}"

publish-onboard-msisdn-oracle:
executor: default-machine
steps:
Expand Down Expand Up @@ -487,6 +566,18 @@ workflows:
- /hotfix*/
- build-local:
context: org-global
requires:
- setup
filters:
branches:
ignore:
- /feature*/
- /bugfix*/
- /hotfix*/
- build-local-onboard-central-ledger:
context: org-global
requires:
- setup
filters:
branches:
ignore:
Expand All @@ -495,6 +586,8 @@ workflows:
- /hotfix*/
- build-local-onboard-msisdn-oracle:
context: org-global
requires:
- setup
filters:
branches:
ignore:
Expand Down Expand Up @@ -531,6 +624,16 @@ workflows:
branches:
ignore:
- /.*/
- build-onboard-central-ledger:
context: org-global
requires:
- setup
filters:
tags:
only: /v[0-9]+(\.[0-9]+)*(\-snapshot)?(\-hotfix(\.[0-9]+))?/
branches:
ignore:
- /.*/
- build-onboard-msisdn-oracle:
context: org-global
requires:
Expand All @@ -552,10 +655,23 @@ workflows:
branches:
ignore:
- /.*/
- publish-onboard-central-ledger:
context: org-global
requires:
- build
- build-onboard-central-ledger
- 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-central-ledger
- build-onboard-msisdn-oracle
filters:
tags:
Expand All @@ -567,6 +683,7 @@ workflows:
context: org-global
requires:
- publish
- publish-onboard-central-ledger
- publish-onboard-msisdn-oracle
filters:
tags:
Expand Down
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ typings/
# Optional eslint cache
.eslintcache

# ESlint config
.eslintrc.json

# Optional REPL history
.node_repl_history

Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,6 @@ goldenpayerfsp
goldenpayeefsp

#vscode configs
.vscode/
.vscode/
/init/.DS_Store
/.DS_Store
6 changes: 6 additions & 0 deletions init/onboard-central-ledger/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "airbnb-base",
"env": {
"node": true
}
}
1 change: 1 addition & 0 deletions init/onboard-central-ledger/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
28 changes: 28 additions & 0 deletions init/onboard-central-ledger/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM node:12.18.2-alpine as builder

ARG CREATED
ARG SOURCE
ARG REVISION
ARG VERSION
KamuelaFranco marked this conversation as resolved.
Show resolved Hide resolved

# 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-central-ledger"
LABEL org.opencontainers.image.authors="kamuela.franco@modusbox.com"
LABEL org.opencontainers.image.licenses="Apache-2.0"

WORKDIR /opt/onboard-central-ledger
COPY package* *.js /opt/onboard-central-ledger/

RUN ["npm", "ci", "--production"]

FROM node:12.18.2-alpine
WORKDIR /opt/onboard-central-ledger

COPY --from=builder /opt/onboard-central-ledger .

CMD ["node", "onboard-dfsp.js"]
Loading