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

refactor: add database crates #1407

Merged
merged 35 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
46b599b
refactor: add database crates
May 19, 2022
293dd9a
checkpoint: Box<dyn std::error::Error>
Jun 3, 2022
84824c0
checkpoint: about to try to add generic to ServerState for db_pool
Jun 6, 2022
4ca7334
checkpoint: working on building out spanner feature
Jun 6, 2022
0bc4208
checkpoint: compiles with some TODOs
Jun 7, 2022
dff402e
checkpoint: removed tokenserver-mysql: syncstorage-mysql depdendency
Jun 7, 2022
bf0de73
checkpoint: organized errors. everything compiles
Jun 8, 2022
f92a4e5
refactor
Jun 27, 2022
3849409
add type aliases for database trait objects
Jun 27, 2022
cd3f2e6
minor fixes
Jun 29, 2022
cbff4f6
tmp
Sep 25, 2022
77178b1
bump versions
Sep 26, 2022
dc3d23d
add syncstorage-db-common crate
Sep 26, 2022
50787ad
docker speedup checkpoint
Sep 27, 2022
0ff4e66
fix deploy stage
Sep 30, 2022
7cedd3c
minor fixes
Sep 30, 2022
a6126a2
fix ReportableError impls
Sep 30, 2022
8350800
further restrict visibility
Sep 30, 2022
a56cfb1
fmt
Nov 5, 2022
ea19405
fix compile errors
Nov 15, 2022
2bbfbeb
fix build
Nov 18, 2022
a17a6c1
Revert "fix build"
Nov 18, 2022
544b76b
fix build?
Nov 18, 2022
142d68d
Merge branch 'master' into refactor/add-db-crates
Nov 22, 2022
8f8fd96
format
Nov 22, 2022
f922b9a
1.65 updates
Nov 22, 2022
0daa600
change docker resource class
Nov 30, 2022
4e201ac
remove debug flags
Nov 30, 2022
893ff39
add release flag to cargo chef
Nov 30, 2022
68478da
Merge branch 'master' into refactor/add-db-crates
ethowitz Jan 4, 2023
78fd772
changes for review
Jan 9, 2023
128a6e3
Merge branch 'master' into refactor/add-db-crates
Jan 9, 2023
2511438
fmt
Jan 9, 2023
56d2186
Merge branch 'master' into refactor/add-db-crates
Jan 9, 2023
e459814
fix conflict
Jan 9, 2023
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
132 changes: 104 additions & 28 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ commands:
steps:
- run:
name: Display Rust Version
command:
command:
rustc --version
setup-rust-check:
steps:
Expand Down Expand Up @@ -43,12 +43,18 @@ commands:
flake8 syncserver/src/tokenserver
flake8 tools/integration_tests
flake8 tools/tokenserver
rust-clippy:
rust-clippy-mysql:
steps:
- run:
name: Rust Clippy
name: Rust Clippy MySQL
command: |
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo clippy --workspace --all-targets --no-default-features --features=syncstorage-db/mysql -- -D warnings
rust-clippy-spanner:
steps:
- run:
name: Rust Clippy Spanner
command: |
cargo clippy --workspace --all-targets --no-default-features --features=syncstorage-db/spanner -- -D warnings
cargo-build:
steps:
- run:
Expand All @@ -69,7 +75,7 @@ commands:
- run:
name: Create Tokenserver database
command: |
mysql -u root -ppassword -h 127.0.0.1 -e 'CREATE DATABASE tokenserver;'
mysql -u root -ppassword -h 127.0.0.1 -e 'CREATE DATABASE tokenserver;'
mysql -u root -ppassword -h 127.0.0.1 -e "GRANT ALL ON tokenserver.* to 'test'@'%';"

write-version:
Expand Down Expand Up @@ -105,7 +111,7 @@ commands:
-f docker-compose.mysql.yaml
-f docker-compose.e2e.mysql.yaml
up
--exit-code-from e2e-tests
--exit-code-from mysql-e2e-tests
--abort-on-container-exit
environment:
SYNCSTORAGE_RS_IMAGE: app:build
Expand All @@ -129,7 +135,7 @@ commands:
-f docker-compose.spanner.yaml
-f docker-compose.e2e.spanner.yaml
up
--exit-code-from e2e-tests
--exit-code-from spanner-e2e-tests
--abort-on-container-exit
environment:
SYNCSTORAGE_RS_IMAGE: app:build
Expand Down Expand Up @@ -164,13 +170,15 @@ jobs:
auth:
username: $DOCKER_USER
password: $DOCKER_PASS
resource_class: large
steps:
- checkout
- display-rust
- setup-rust-check
- setup-gcp-grpc
- rust-check
- rust-clippy
- rust-clippy-spanner
- rust-clippy-mysql
- setup-python
- python-check

Expand All @@ -197,16 +205,6 @@ jobs:
MYSQL_DATABASE: syncstorage
resource_class: large
steps:
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Login to Dockerhub
command: |
if [ "${DOCKER_USER}" == "" ] || [ "${DOCKER_PASS}" == "" ]; then
echo "Skipping Login to DockerHub, credentials unavailable"
else
echo "${DOCKER_PASS}" | docker login -u="${DOCKER_USER}" --password-stdin
fi
- checkout
- display-rust
- setup-python
Expand All @@ -221,9 +219,20 @@ jobs:
- run-tests
- run-tokenserver-scripts-tests
#- save-sccache-cache
build-mysql-image:
docker:
- image: cimg/rust:1.60.0
auth:
username: $DOCKER_USER
password: $DOCKER_PASS
resource_class: large
steps:
- setup_remote_docker:
docker_layer_caching: true
- checkout
- run:
name: Build Docker image
command: docker build -t app:build .
name: Build MySQL Docker image
command: docker build -t app:build --build-arg DATABASE_BACKEND=mysql .
no_output_timeout: 30m
# save the built docker container into CircleCI's cache. This is
# required since Workflows do not have the same remote docker instance.
Expand All @@ -234,13 +243,43 @@ jobs:
docker save -o /home/circleci/cache/docker.tar "app:build"
- run:
name: Save docker-compose config
command: cp docker-compose*.yaml /home/circleci/cache
command: cp docker-compose*mysql.yaml /home/circleci/cache
- save_cache:
key: v1-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}-{{ epoch }}
key: mysql-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}-{{ epoch }}
paths:
- /home/circleci/cache

e2e-tests:
build-spanner-image:
docker:
- image: cimg/rust:1.60.0
auth:
username: $DOCKER_USER
password: $DOCKER_PASS
resource_class: large
steps:
- setup_remote_docker:
docker_layer_caching: true
- checkout
- run:
name: Build Spanner Docker image
command: docker build -t app:build --build-arg DATABASE_BACKEND=spanner .
no_output_timeout: 30m
# save the built docker container into CircleCI's cache. This is
# required since Workflows do not have the same remote docker instance.
- run:
name: docker save app:build
command: |
mkdir -p /home/circleci/cache
docker save -o /home/circleci/cache/docker.tar "app:build"
- run:
name: Save docker-compose config
command: cp docker-compose*spanner.yaml /home/circleci/cache
- save_cache:
key: spanner-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}-{{ epoch }}
paths:
- /home/circleci/cache

mysql-e2e-tests:
docker:
- image: docker/compose:1.24.0
auth:
Expand All @@ -249,14 +288,31 @@ jobs:
steps:
- setup_remote_docker
- restore_cache:
key: v1-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
key: mysql-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Restore Docker image cache
command: docker load -i /home/circleci/cache/docker.tar
- run:
name: Restore docker-compose config
command: cp /home/circleci/cache/docker-compose*.yaml .
- run-e2e-mysql-tests

spanner-e2e-tests:
docker:
- image: docker/compose:1.24.0
auth:
username: $DOCKER_USER
password: $DOCKER_PASS
steps:
- setup_remote_docker
- restore_cache:
key: spanner-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Restore Docker image cache
command: docker load -i /home/circleci/cache/docker.tar
- run:
name: Restore docker-compose config
command: cp /home/circleci/cache/docker-compose*.yaml .
- run-e2e-spanner-tests

deploy:
Expand All @@ -268,7 +324,7 @@ jobs:
steps:
- setup_remote_docker
- restore_cache:
key: v1-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
key: spanner-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Restore Docker image cache
command: docker load -i /home/circleci/cache/docker.tar
Expand Down Expand Up @@ -346,21 +402,41 @@ workflows:
filters:
tags:
only: /.*/
- e2e-tests:
- build-mysql-image:
requires:
- build-and-test
filters:
tags:
only: /.*/
- build-spanner-image:
requires:
- build-and-test
filters:
tags:
only: /.*/
- mysql-e2e-tests:
requires:
- build-mysql-image
filters:
tags:
only: /.*/
- spanner-e2e-tests:
requires:
- build-spanner-image
filters:
tags:
only: /.*/
- deploy:
requires:
- e2e-tests
- mysql-e2e-tests
- spanner-e2e-tests
filters:
tags:
only: /.*/
- deploy-python-utils:
requires:
- e2e-tests
- mysql-e2e-tests
- spanner-e2e-tests
filters:
tags:
only: /.*/
Loading