Page MenuHomePhabricator

Introduce Cargo workspace and update Dockerfiles
ClosedPublic

Authored by bartek on May 21 2024, 6:09 AM.
Tags
None
Referenced Files
F2054922: D12140.id40453.diff
Thu, Jun 20, 5:55 AM
Unknown Object (File)
Wed, Jun 19, 3:57 PM
Unknown Object (File)
Tue, Jun 18, 5:30 AM
Unknown Object (File)
Fri, Jun 14, 3:31 PM
Unknown Object (File)
Fri, Jun 14, 10:16 AM
Unknown Object (File)
Thu, Jun 13, 6:46 PM
Unknown Object (File)
Tue, Jun 11, 6:37 AM
Unknown Object (File)
Tue, Jun 11, 4:16 AM
Subscribers

Details

Summary

Introduced cargo workspace for services, shared and rust-node-addon.
Some context in this comment.

I put inline comments to explain it better.

This is the first and most important diff in the stack.

Test Plan
  • Locally: cargo commands inside packages work as before
    • When ran in repo root, e.g. cargo check runs wor the whole workspace
  • Docker build times and image sizes are comparable to non-workspace setup
  • Pre-commit hooks for Rust still work as before
  • CI: All Docker images are built successfully, including Keyserver
  • CI: All non-Docker jobs (e.g. Android, iOS) compile Rust successfully
  • Ran Services with Commtest locally
  • Commtest on CI runs - it requires all services' docker images + its own Docker

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek retitled this revision from [DRAFT] Try cargo workspace for CI to Introduce Cargo workspace and update Dockerfiles.May 21 2024, 1:28 PM
bartek edited the summary of this revision. (Show Details)
bartek edited the test plan for this revision. (Show Details)
bartek published this revision for review.May 21 2024, 10:41 PM
bartek edited the summary of this revision. (Show Details)
bartek edited the test plan for this revision. (Show Details)
bartek added inline comments.
keyserver/Dockerfile
145–147 ↗(On Diff #40514)

For keyserver, we don't copy any of services into Docker image, so cargo build would fail with Couldn't find 'services/*/Cargo.toml' - no such file or directory.
This sed removes that line from Cargo.toml

services/backup/Dockerfile
7 ↗(On Diff #40514)

Directory structure inside Docker image must follow structure from repo. Otherwise Cargo won't be able to find correct paths

19 ↗(On Diff #40514)

Similarly to keyserver scenario, this sed removes rust-node-addon from workspace members because it's not copied into Docker image and Cargo would be unable to find it.

It should work without the others now (they're now excluded), I'll check it and apply this change in the next revision

services/commtest/src/identity/mod.rs
2 ↗(On Diff #40514)

When I included CommTest into workspace, it downloaded a littne newer version of ed25519_dalek which replaced SignerMut with Signer

services/identity/Dockerfile
14–23 ↗(On Diff #40514)

This was to cache dependencies when only modifying sources. But from my experience, it wasn't saving much time.
On CI, everything is recompiled each time

This revision is now accepted and ready to land.Fri, May 24, 10:13 AM