diff --git a/example.toml b/example.toml index 2e89854..e857f82 100644 --- a/example.toml +++ b/example.toml @@ -16,6 +16,15 @@ repos = [ { url = "https://github.com/justcallmekoko/ESP32Marauder" } ] +# Optional: List of repository names to exclude from verification (if --verify-canfetch is used) +repos_exclude_verify = [ + { name = "ESP32Marauder", reason = "This repo is known to be flaky." }, + { name = "some-other-repo", reason = """ + This repo is very large and times out. + We will fix this later. + """ } +] + organizations = [ { url = "https://gitea.hak8or.com/mirrors" }, ] diff --git a/src/main.rs b/src/main.rs index 3996e17..1ab3cea 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,6 +49,12 @@ struct OrgConfig { api_key: Option, } +#[derive(Deserialize, Debug, Clone)] +struct ExcludeVerifyConfig { + name: String, + reason: String, +} + #[derive(Deserialize, Debug)] struct Config { gitea_url: String, @@ -56,6 +62,7 @@ struct Config { repos: Option>, organizations: Option>, repo_owner: Option, + repos_exclude_verify: Option>, } #[derive(serde::Serialize, Debug)] @@ -94,6 +101,13 @@ async fn main() -> Result<(), Box> { }; info!("Target Owner: {}", owner_name); + // Prepare exclusion map for verification (Name -> Reason) + let exclude_verify_map: HashMap = config + .repos_exclude_verify + .as_ref() + .map(|list| list.iter().map(|item| (item.name.clone(), item.reason.clone())).collect()) + .unwrap_or_default(); + // 2. Build 'Desired' State (Map) info!("Resolving desired state from configuration..."); let mut desired_repos: HashMap = HashMap::new(); @@ -164,6 +178,10 @@ async fn main() -> Result<(), Box> { info!("Verifying accessibility of existing repositories..."); let mut verification_failed = false; for name in &existing_set { + if let Some(reason) = exclude_verify_map.get(name) { + info!("Skipping verification for [EXCLUDED]: {} - Reason: {}", name, reason); + continue; + } let repo_url = format!("{}/{}/{}.git", config.gitea_url, owner_name, name); // Use the API key for auth if needed match verify_repo_accessible(&repo_url, &owner_name, Some(&final_api_key)) { @@ -280,14 +298,18 @@ async fn main() -> Result<(), Box> { info!("Successfully migrated {}", name); // Verify after migration if requested if args.verify_canfetch { - let repo_url = format!("{}/{}/{}.git", config.gitea_url, owner_name, name); - match verify_repo_accessible(&repo_url, &owner_name, Some(&final_api_key)) { - Ok(_) => info!("Verified [OK] (Post-Migration): {}", name), - Err(e) => { - error!("Verified [FAIL] (Post-Migration): {} - {}", name, e); - migration_verification_failed = true; - } - } + if let Some(reason) = exclude_verify_map.get(&name) { + info!("Skipping post-migration verification for [EXCLUDED]: {} - Reason: {}", name, reason); + } else { + let repo_url = format!("{}/{}/{}.git", config.gitea_url, owner_name, name); + match verify_repo_accessible(&repo_url, &owner_name, Some(&final_api_key)) { + Ok(_) => info!("Verified [OK] (Post-Migration): {}", name), + Err(e) => { + error!("Verified [FAIL] (Post-Migration): {} - {}", name, e); + migration_verification_failed = true; + } + } + } } }, Err(e) => error!("Failed to migrate {}: {}", name, e), diff --git a/vibe_coding_log/session_2026_01_14_exclude_verify.md b/vibe_coding_log/session_2026_01_14_exclude_verify.md new file mode 100644 index 0000000..d92ac41 --- /dev/null +++ b/vibe_coding_log/session_2026_01_14_exclude_verify.md @@ -0,0 +1,28 @@ +# Session Log: Exclude Repos from Verification + +**Date**: 2026-01-14 +**Model**: Gemini CLI +**Goal**: Add functionality to exclude specific repositories from verification via `repos_exclude_verify` in TOML config. +**Outcome**: Implemented the config field, updated `main.rs` to filter excluded repos during verification steps, and updated `example.toml`. Verified with cargo checks. +**Update**: Enhanced `repos_exclude_verify` to require a mandatory reason for each exclusion. + +## Details + +User requested the ability to exclude specific repositories from the `verify_canfetch` check via the configuration file. +User subsequently requested that the exclusion list requires a mandatory reason string (which can be multiline) and that this reason is printed during execution. + +### Changes + +1. **Modified `src/main.rs`**: + * Defined `ExcludeVerifyConfig` struct with `name` and `reason` fields. + * Updated `Config` struct to use `Option>` for `repos_exclude_verify`. + * In `main()`, parsed the configuration into a `HashMap` mapping repo names to reasons. + * Updated verification loops (initial and post-migration) to check this map. + * If a repo is excluded, the log now prints: `Skipping verification for [EXCLUDED]: - Reason: `. + +2. **Modified `example.toml`**: + * Updated the `repos_exclude_verify` example to show the new table-array syntax with `name` and `reason` fields, including a multiline string example. + +### Verification + +Ran `cargo check`, `cargo clippy`, and `cargo test`. All passed. \ No newline at end of file