Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

ci(storage-mongodb): make the MongoDB workflow cancellation-aware

Steven Enamakel08053bde7035
diff --git a/.github/ci-paths-filter.yml b/.github/ci-paths-filter.yml
index dbe9514382..e0ede10a0b 100644
--- a/.github/ci-paths-filter.yml
+++ b/.github/ci-paths-filter.yml
@@ -220,6 +220,8 @@ storage:
- 'crates/openhuman-core/src/web3/wallet/**'
- 'crates/openhuman-core/src/config/schema/storage.rs'
- 'crates/openhuman-rpc/src/session_store/**'
+ - 'Cargo.toml'
+ - 'Cargo.lock'
- 'crates/openhuman-*/Cargo.toml'
- 'tests/storage_*.rs'
- 'tests/cli_storage_url_e2e.rs'
diff --git a/.github/workflows/storage-mongodb.yml b/.github/workflows/storage-mongodb.yml
index ff3fec5bb3..faf302124f 100644
--- a/.github/workflows/storage-mongodb.yml
+++ b/.github/workflows/storage-mongodb.yml
@@ -26,6 +26,12 @@ on:
branches: [main, release]
paths:
- ".github/workflows/storage-mongodb.yml"
+ - ".github/ci-paths-filter.yml"
+ - "Cargo.toml"
+ - "Cargo.lock"
+ - "crates/openhuman-*/Cargo.toml"
+ - ".cargo/config.toml"
+ - "rust-toolchain.toml"
- "crates/openhuman-core/src/storage/**"
- "crates/openhuman-core/src/cron/**"
- "crates/openhuman-core/src/flows/**"
@@ -56,6 +62,9 @@ on:
workflow_dispatch: {}
permissions:
+ # `actions: read` lets scripts/ci-cancel-aware.sh poll the run status, so a
+ # cancelled run stops its own cargo/docker client.
+ actions: read
contents: read
concurrency:
@@ -79,7 +88,7 @@ jobs:
timeout-minutes: 90
steps:
- name: Checkout
- uses: actions/checkout@v7
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 1
# Submodules come from the step below (only the ones a build reads).
@@ -111,7 +120,9 @@ jobs:
run: |
set -euo pipefail
mkdir -p target .cargo-registry
- docker run --rm --network host --init \
+ # Through the cancellation wrapper: a cancelled run TERMs the docker
+ # client, and the `Stop` step below removes the named container.
+ bash scripts/ci-cancel-aware.sh docker run --rm --name oh-storage-test --network host --init \
-v "$PWD:/work" -w /work \
-v "$PWD/.cargo-registry:/usr/local/cargo/registry" \
-e TSD_MONGO_URL \
@@ -142,6 +153,6 @@ jobs:
if: failure()
run: docker logs tsd-mongo 2>&1 | tail -n 100 || true
- - name: Stop the MongoDB container
+ - name: Stop the containers
if: always()
- run: docker rm -f tsd-mongo >/dev/null 2>&1 || true
+ run: docker rm -f oh-storage-test tsd-mongo >/dev/null 2>&1 || true
diff --git a/tests/support/storage_drivers.rs b/tests/support/storage_drivers.rs
index 3ec05f9a4d..a507b6ad7d 100644
--- a/tests/support/storage_drivers.rs
+++ b/tests/support/storage_drivers.rs
@@ -12,7 +12,7 @@
//! - `file`: when the `storage-file` feature is compiled in, on a temp
//! directory;
//! - `mongodb`: when `storage-mongodb` is compiled in AND `TSD_MONGO_URL` is
-//! set (a replica set, as `tinystoragedrivers`' CI uses). Each case gets a
+//! set to a local throwaway server (localhost, 127.0.0.1 or ::1; a replica set, as `tinystoragedrivers`' CI uses). Each case gets a
//! database of its own (`oh_e2e_<uuid>`), so runs never see each other's
//! records and scopes stay isolated. With `TSD_MONGO_URL` unset the case
//! passes after printing that it was skipped.