-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #328 from sumesh-aot/event_listener
Entity event listener to update transaction references
- Loading branch information
Showing
45 changed files
with
2,796 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Events Listener Queue PR CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- development | ||
paths: | ||
- "queue_services/events-listener/**" | ||
|
||
jobs: | ||
events-listener-queue_service-check: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: ./queue_services/events-listener | ||
|
||
if: github.repository == 'bcgov/sbc-pay' | ||
env: | ||
DATABASE_TEST_URL: "postgresql://postgres:postgres@localhost:5432/postgres" | ||
TEST_NATS_DOCKER: "YES" | ||
STAN_CLUSTER_NAME: "test-cluster" | ||
|
||
strategy: | ||
matrix: | ||
python-version: [3.8] | ||
services: | ||
postgres: | ||
image: postgres:11 | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: postgres | ||
ports: | ||
- 5432:5432 | ||
# needed because the postgres container does not provide a healthcheck | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install -r requirements/dev.txt | ||
- name: Lint with pylint | ||
run: | | ||
pylint --rcfile=setup.cfg --disable=C0301,W0511 src/events_listener | ||
# - name: Lint with flake8 | ||
# run: | | ||
# flake8 src/events_listener tests | ||
- name: Test with pytest | ||
run: | | ||
pip install . | ||
export PYTHONPATH=./src/ | ||
pytest | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
file: ./queue_services/events-listener/coverage.xml | ||
flags: events_listener | ||
name: codecov-events-listener | ||
fail_ci_if_error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Events Listener Queue DEV CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- development | ||
paths: | ||
- "queue_services/events-listener/**" | ||
|
||
env: | ||
IMAGE_NAME: events-listener | ||
TAG_NAME: dev | ||
|
||
jobs: | ||
events-listener-dev: | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'bcgov/sbc-pay' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install tools | ||
run: | | ||
./scripts/install_tools.sh | ||
oc version | ||
op --version | ||
- name: Login Openshift | ||
working-directory: ./queue_services/events-listener | ||
run: | | ||
oc login ${{ secrets.OPENSHIFT_LOGIN_REGISTRY }} --token=${{ secrets.OPENSHIFT_SA_TOKEN }} | ||
- name: Set Deployment Environment Variables | ||
working-directory: . | ||
run: | | ||
vaults='[{ "vault": "shared", "application": ["nats"]}, {"vault": "relationship","application": ["postgres-pay", "events-listener"]}]' | ||
./scripts/1pass.sh ${{ secrets.op_parameters }} -m "secret" -e "${TAG_NAME}" -v "${vaults}" -a "${IMAGE_NAME}-${TAG_NAME}" -n ${{ secrets.OPENSHIFT_REPOSITORY_DEV}} | ||
- name: Log into registry | ||
run: echo "${{ secrets.OPENSHIFT_SA_TOKEN }}" | docker login ${{ secrets.OPENSHIFT_DOCKER_REGISTRY }} -u ${{ secrets.OPENSHIFT_SA_NAME}} --password-stdin | ||
- name: Build image | ||
working-directory: ./queue_services/events-listener | ||
run: docker build . --file Dockerfile --tag image | ||
- name: Push image | ||
working-directory: ./queue_services/events-listener | ||
run: | | ||
IMAGE_ID=${{ secrets.OPENSHIFT_DOCKER_REGISTRY }}/${{ secrets.OPENSHIFT_REPOSITORY_TOOLS }}/$IMAGE_NAME | ||
docker tag image $IMAGE_ID:latest | ||
docker push $IMAGE_ID:latest | ||
docker image tag $IMAGE_ID:latest $IMAGE_ID:$TAG_NAME | ||
docker push $IMAGE_ID:$TAG_NAME | ||
- name: Rollout new deployment | ||
working-directory: ./queue_services/events-listener | ||
run: | | ||
oc rollout status dc/$IMAGE_NAME-${TAG_NAME} -n ${{ secrets.OPENSHIFT_REPOSITORY_DEV}} -w | ||
- name: Rocket.Chat Notification | ||
uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master | ||
if: failure() | ||
with: | ||
type: ${{ job.status }} | ||
job_name: "*Events Listener Build and Deploy to ${{env.TAG_NAME}}*" | ||
channel: "#registries-bot" | ||
url: ${{ secrets.ROCKETCHAT_WEBHOOK }} | ||
commit: true | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Events Listener Queue TEST CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- "queue_services/events-listener/**" | ||
env: | ||
IMAGE_NAME: events-listener | ||
TAG_NAME: test | ||
|
||
jobs: | ||
events-listener-test: | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'bcgov/sbc-pay' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install tools | ||
run: | | ||
./scripts/install_tools.sh | ||
oc version | ||
op --version | ||
- name: Login Openshift | ||
working-directory: ./queue_services/events-listener | ||
run: | | ||
oc login ${{ secrets.OPENSHIFT_LOGIN_REGISTRY }} --token=${{ secrets.OPENSHIFT_SA_TOKEN }} | ||
- name: Set Deployment Environment Variables | ||
working-directory: . | ||
run: | | ||
vaults='[{ "vault": "shared", "application": [nats"]}, {"vault": "relationship","application": ["postgres-pay", "events-listener"]}]' | ||
./scripts/1pass.sh ${{ secrets.op_parameters }} -m "secret" -e "${TAG_NAME}" -v "${vaults}" -a "${IMAGE_NAME}-${TAG_NAME}" -n ${{ secrets.OPENSHIFT_REPOSITORY_TEST }} | ||
- name: Log into registry | ||
run: echo "${{ secrets.OPENSHIFT_SA_TOKEN }}" | docker login ${{ secrets.OPENSHIFT_DOCKER_REGISTRY }} -u ${{ secrets.OPENSHIFT_SA_NAME}} --password-stdin | ||
- name: Build image | ||
working-directory: ./queue_services/events-listener | ||
run: docker build . --file Dockerfile --tag image | ||
- name: Push image | ||
working-directory: ./queue_services/events-listener | ||
run: | | ||
IMAGE_ID=${{ secrets.OPENSHIFT_DOCKER_REGISTRY }}/${{ secrets.OPENSHIFT_REPOSITORY_TOOLS }}/$IMAGE_NAME | ||
docker tag image $IMAGE_ID:latest | ||
docker push $IMAGE_ID:latest | ||
docker image tag $IMAGE_ID:latest $IMAGE_ID:$TAG_NAME | ||
docker push $IMAGE_ID:$TAG_NAME | ||
- name: Rollout new deployment | ||
working-directory: ./queue_services/events-listener | ||
run: | | ||
oc rollout status dc/$IMAGE_NAME-${TAG_NAME} -n ${{ secrets.OPENSHIFT_REPOSITORY_TEST}} -w | ||
- name: Rocket.Chat Notification | ||
uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master | ||
if: failure() | ||
with: | ||
type: ${{ job.status }} | ||
job_name: "*Events Listener Queue Build and Deploy to ${{env.TAG_NAME}}*" | ||
channel: "#registries-bot" | ||
url: ${{ secrets.ROCKETCHAT_WEBHOOK }} | ||
commit: true | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.