Skip to content

Commit

Permalink
Merge pull request #353 from systemaccounting/352-ecr-deployments
Browse files Browse the repository at this point in the history
352 deploy lambdas from ecr
  • Loading branch information
mxfactorial authored Apr 13, 2024
2 parents 7269aae + 2cf9d9c commit 6746036
Show file tree
Hide file tree
Showing 164 changed files with 2,465 additions and 3,263 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<p align="center">
<img width="475" alt="systemaccounting" src="https://user-images.githubusercontent.com/12200465/37568924-06f05d08-2a99-11e8-8891-60f373b33421.png">
</p>

dev to prod docker image promotion

# service workflow files
1. test code: `cargo test` (todo: test in Dockerfile builder step)
2. build image: `make -C services/rule build-image`
3. tag image with git sha A: `make -C services/rule tag-dev-image`
4. push git sha A image to dev ecr repo: `make -C services/rule push-dev-image`

# dev-integration.yaml
5. merge to develop
6. test if currently deployed image in each dev function is last image in ecr repo: `tag-merge-commit.sh`
7. get git sha B from merge commit: `tag-merge-commit.sh`
8. tag each last undeployed image with git sha B: `tag-merge-commit.sh`
9. deploy each image with git sha B: `deploy-last-image.sh`
10. integration test in dev: `cargo test --manifest-path ./tests/Cargo.toml --features integration_tests -- --test-threads=1`
11. query dev ecr images for git sha B tags: `push-prod-image.sh`
12. tag dev git sha B images with prod: `push-prod-image.sh`
13. push git sha B images to prod: `push-prod-image.sh`

#### prod-services-deploy.yaml
14. merge to master
15. test if currently deployed image in each prod function is last image in ecr repo: `tag-merge-commit.sh`
16. get git sha C from merge commit: `tag-merge-commit.sh`
17. tag each last undeployed image with git sha C: `tag-merge-commit.sh`
18. deploy each image with git sha C: `deploy-last-image.sh`
53 changes: 53 additions & 0 deletions .github/workflows/auto-confirm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: auto-confirm

on:
push:
paths:
- 'services/auto-confirm/**'
branches-ignore:
- 'master'

jobs:
lint_test:
name: lint test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- name: linting
run: |
cargo fmt -- --check
cargo clippy -- -Dwarnings
unit_test:
name: unit test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- name: unit test
run: cargo test
push_image:
name: push image to dev ecr
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
APP_DIR: services/auto-confirm
needs: [lint_test, unit_test]
steps:
- uses: actions/checkout@v4
- name: mask values
run: echo "::add-mask::${{ secrets.AWS_ACCOUNT_ID }}"
- name: build image
run: make -C $APP_DIR build-image
- name: tag image
run: ENV_ID=${{ secrets.DEV_ENV_ID }} make -C $APP_DIR tag-dev-image
- name: push image
run: ENV_ID=${{ secrets.DEV_ENV_ID }} make -C $APP_DIR push-dev-image
104 changes: 104 additions & 0 deletions .github/workflows/balance-by-account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: balance-by-account

on:
push:
paths:
- 'services/balance-by-account/**'
- 'crates/**'
- 'migrations/schema/*'
branches-ignore:
- 'master'
- 'develop'

jobs:
lint_test:
name: lint test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- name: linting
run: |
cargo fmt -- --check
cargo clippy -- -Dwarnings
unit_test:
name: unit test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- name: unit test
run: cargo test
database_test:
name: database test in local docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- name: test database
run: make -C crates/pg test-db
integration_test:
name: integration test in local docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- name: install latest psql client
run: |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install --yes --no-install-recommends postgresql-client
- name: install golang-migrate
run: |
curl -LO https://github.com/golang-migrate/migrate/releases/download/v4.15.2/migrate.linux-amd64.deb
sudo dpkg -i migrate.linux-amd64.deb
rm migrate.linux-amd64.deb
- name: start services
run: make start
- name: test service integration
run: make -C ./tests test-local
- name: clean up
run: make stop
client_test:
name: client test in local docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: start services
run: make start
- name: e2e test client
run: make -C ./client test-ci
- name: clean up
run: make stop
push_image:
name: push image to dev ecr
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
APP_DIR: services/balance-by-account
needs: [lint_test, unit_test, database_test, integration_test, client_test]
steps:
- uses: actions/checkout@v4
- name: mask values
run: echo "::add-mask::${{ secrets.AWS_ACCOUNT_ID }}"
- name: build image
run: make -C $APP_DIR build-image
- name: tag image
run: ENV_ID=${{ secrets.DEV_ENV_ID }} make -C $APP_DIR tag-dev-image
- name: push image
run: ENV_ID=${{ secrets.DEV_ENV_ID }} make -C $APP_DIR push-dev-image
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: dev-client
name: client

on:
push:
Expand All @@ -11,10 +11,8 @@ jobs:
test:
name: test client
runs-on: ubuntu-latest
env:
CI: true
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: start services
run: make start
- name: e2e test client
Expand All @@ -27,9 +25,8 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
CI: true
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: install dependencies
run: make install
working-directory: client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: dev-crates-postgres
name: crates-postgres

on:
push:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: dev-crates
name: crates

on:
push:
Expand Down
39 changes: 0 additions & 39 deletions .github/workflows/dev-auto-confirm.yaml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/dev-balance-by-account.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/dev-go-migrate.yaml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/dev-graphql.yaml

This file was deleted.

Loading

0 comments on commit 6746036

Please sign in to comment.