Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Categories are now a mapping of architecture to list of hardware categories #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cole-h
Copy link
Member

@cole-h cole-h commented Sep 21, 2023

This allows adding arbitrary categories to supplement others.

Tested by panicking before hitting the EM API.

…gories

This allows adding arbitrary categories to supplement others.

Tested by panicking before hitting the EM API.
@cole-h
Copy link
Member Author

cole-h commented Sep 21, 2023

diff --git a/src/main.rs b/src/main.rs
index 467b7be..6ce6ae0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -30,10 +30,12 @@ struct Cli {
 async fn main() -> Result<()> {
     let args = Cli::parse();
 
-    let equinix_auth_token =
-        std::env::var("METAL_AUTH_TOKEN").expect("Please set METAL_AUTH_TOKEN");
-    let equinix_project_id =
-        std::env::var("METAL_PROJECT_ID").expect("Please set METAL_PROJECT_ID");
+    let equinix_auth_token = std::env::var("METAL_AUTH_TOKEN").unwrap_or_default();
+    let equinix_project_id = std::env::var("METAL_PROJECT_ID").unwrap_or_default();
+    // let equinix_auth_token =
+    //     std::env::var("METAL_AUTH_TOKEN").expect("Please set METAL_AUTH_TOKEN");
+    // let equinix_project_id =
+    //     std::env::var("METAL_PROJECT_ID").expect("Please set METAL_PROJECT_ID");
 
     real_main(
         equinix_auth_token,
@@ -69,6 +71,8 @@ async fn real_main(
     let mut desired_hardware =
         hardware::get_desired_hardware(&http_client, &hydra_root, &config_file).await?;
     let desired_tags = BTreeSet::from_iter(desired_hardware.tags.iter());
+    dbg!(&desired_hardware);
+    panic!();
 
     let mut all_devices: Vec<device::Device> =
         device::get_all_devices(&http_client, &equinix_auth_token, &equinix_project_id)

here's the diff I tested with. cargo r -- --config-file ./hardware_categories.json should print out the list of builders we'd try to bid for.

See NixOS/infra#280 for the
reason why it was 2.5 and why this PR exists in the first place.
@cole-h cole-h force-pushed the more-flexible-categories branch from 91617ad to dbc5fc3 Compare September 21, 2023 17:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant