-
-
Notifications
You must be signed in to change notification settings - Fork 26
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 #353 from systemaccounting/352-ecr-deployments
352 deploy lambdas from ecr
- Loading branch information
Showing
164 changed files
with
2,465 additions
and
3,263 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,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` |
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,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 |
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,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 |
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
2 changes: 1 addition & 1 deletion
2
.github/workflows/dev-crates-postgres.yaml → .github/workflows/crates-postgres.yaml
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: dev-crates-postgres | ||
name: crates-postgres | ||
|
||
on: | ||
push: | ||
|
2 changes: 1 addition & 1 deletion
2
.github/workflows/dev-crates.yaml → .github/workflows/crates.yaml
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: dev-crates | ||
name: crates | ||
|
||
on: | ||
push: | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.