Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions bin/network-monitor/src/commands/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ pub async fn start_monitor(config: MonitorConfig) -> Result<()> {
let validator_rx =
config.validator_url.is_some().then(|| tasks.spawn_validator_checker(&config));

// External nightly CI card. Both --nightly-ci-repo and --nightly-ci-workflow must be
// set; either alone is treated as misconfiguration and the card is dropped silently.
// (We don't error out so a partial/copy-paste config doesn't block the whole monitor.)
let nightly_ci_rx = match (&config.nightly_ci_repo, &config.nightly_ci_workflow) {
(Some(_), Some(_)) => Some(tasks.spawn_nightly_ci_checker(&config)),
_ => None,
};

// Build the flat services Vec in the order the dashboard expects to render cards.
let services = std::iter::once(rpc_rx)
.chain(prover_rxs)
Expand All @@ -72,6 +80,7 @@ pub async fn start_monitor(config: MonitorConfig) -> Result<()> {
.chain(ntx_tracking_rx)
.chain(note_transport_rx)
.chain(validator_rx)
.chain(nightly_ci_rx)
.collect();

let server_state = ServerState {
Expand Down
62 changes: 62 additions & 0 deletions bin/network-monitor/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,66 @@ pub struct MonitorConfig {
help = "Maximum time without a chain tip update before marking RPC as unhealthy"
)]
pub stale_chain_tip_threshold: Duration,

// ============================================================================================
// External nightly CI card
// ============================================================================================
//
// Optional card surfacing the latest scheduled run of a workflow on a public GitHub
// repository (anonymous read; 60 req/hr quota). Intended for the wallet's
// `e2e-blockchain-chrome-{devnet,testnet}.yml` nightly. Set both `--nightly-ci-repo`
// and `--nightly-ci-workflow` to enable; either alone is treated as misconfiguration
// and the card stays absent.

/// External repository to monitor in `owner/repo` form (e.g. `0xMiden/wallet`).
///
/// When set together with `--nightly-ci-workflow`, the monitor adds a card showing the
/// latest scheduled run of that workflow on the configured branch.
#[arg(
long = "nightly-ci-repo",
env = "MIDEN_MONITOR_NIGHTLY_CI_REPO",
help = "External GitHub repo to surface a nightly CI card for, in owner/repo form"
)]
pub nightly_ci_repo: Option<String>,

/// Workflow filename inside the configured repo (e.g.
/// `e2e-blockchain-chrome-devnet.yml`). Filename is stable across repo renames; we use
/// it instead of the numeric workflow id.
#[arg(
long = "nightly-ci-workflow",
env = "MIDEN_MONITOR_NIGHTLY_CI_WORKFLOW",
help = "Workflow filename to monitor inside --nightly-ci-repo"
)]
pub nightly_ci_workflow: Option<String>,

/// Card title shown on the dashboard for the nightly CI card.
#[arg(
long = "nightly-ci-card-name",
env = "MIDEN_MONITOR_NIGHTLY_CI_CARD_NAME",
default_value = "Wallet Nightly E2E",
help = "Display name for the nightly CI card"
)]
pub nightly_ci_card_name: String,

/// Branch the nightly schedule runs against. Almost always `main` — exposed as a
/// config knob mostly so a maintainer can point at a temporary branch for testing.
#[arg(
long = "nightly-ci-branch",
env = "MIDEN_MONITOR_NIGHTLY_CI_BRANCH",
default_value = "main",
help = "Branch the monitored nightly workflow runs against"
)]
pub nightly_ci_branch: String,

/// Poll interval for the nightly CI card. 10 min is well under the 60 req/hr anon
/// limit (6/hour) while still being fresh enough that a UI viewer never sees data
/// older than a quarter hour.
#[arg(
long = "nightly-ci-check-interval",
env = "MIDEN_MONITOR_NIGHTLY_CI_CHECK_INTERVAL",
default_value = "10m",
value_parser = humantime::parse_duration,
help = "How often to poll GitHub for the latest nightly run"
)]
pub nightly_ci_check_interval: Duration,
}
1 change: 1 addition & 0 deletions bin/network-monitor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub mod explorer;
pub mod faucet;
pub mod frontend;
mod monitor;
pub mod nightly_ci;
pub mod note_transport;
pub mod remote_prover;
pub mod service;
Expand Down
24 changes: 24 additions & 0 deletions bin/network-monitor/src/monitor/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::deploy::ensure_accounts_exist;
use crate::explorer::ExplorerService;
use crate::faucet::FaucetService;
use crate::frontend::{ServerState, serve};
use crate::nightly_ci::{NightlyCiConfig, NightlyCiService};
use crate::note_transport::NoteTransportService;
use crate::remote_prover::{ProbeSnapshot, ProverStatusService, generate_prover_test_payload};
use crate::service::{Service, build_tls_client};
Expand Down Expand Up @@ -88,6 +89,29 @@ impl Tasks {
self.spawn_service(svc)
}

/// Spawn the external nightly CI checker task. Requires both
/// `--nightly-ci-repo` and `--nightly-ci-workflow` to be set; the caller is responsible
/// for that gating (returns early in `start.rs` if either is missing).
pub fn spawn_nightly_ci_checker(&mut self, config: &MonitorConfig) -> Receiver<ServiceStatus> {
let repo = config
.nightly_ci_repo
.clone()
.expect("--nightly-ci-repo set when spawn_nightly_ci_checker is called");
let workflow_path = config
.nightly_ci_workflow
.clone()
.expect("--nightly-ci-workflow set when spawn_nightly_ci_checker is called");
let svc = NightlyCiService::new(NightlyCiConfig {
name: config.nightly_ci_card_name.clone(),
repo,
workflow_path,
branch: config.nightly_ci_branch.clone(),
interval: config.nightly_ci_check_interval,
request_timeout: config.request_timeout,
});
self.spawn_service(svc)
}

/// Spawn prover status tasks for all configured provers.
///
/// Each prover is monitored by a [`ProverStatusService`] that polls on the status cadence.
Expand Down
Loading
Loading