aboutsummaryrefslogtreecommitdiff
path: root/home/profiles/work.nix
diff options
context:
space:
mode:
authorFranck Cuny <fcuny@roblox.com>2025-08-29 10:42:53 -0700
committerFranck Cuny <fcuny@roblox.com>2025-08-29 10:42:53 -0700
commitd44351dd716f62b139d98d931fcb1d467ea91600 (patch)
tree2a84ff6e5b93a8662df68f7cc76d83e623468080 /home/profiles/work.nix
parentfix path for where to find rust binaries (diff)
downloadinfra-d44351dd716f62b139d98d931fcb1d467ea91600.tar.gz
make `nomad-prod` work for all production nomad cells
We also want to get access to cells in ASH.
Diffstat (limited to 'home/profiles/work.nix')
-rw-r--r--home/profiles/work.nix29
1 files changed, 27 insertions, 2 deletions
diff --git a/home/profiles/work.nix b/home/profiles/work.nix
index 067710f..28cf820 100644
--- a/home/profiles/work.nix
+++ b/home/profiles/work.nix
@@ -15,8 +15,33 @@ let
CELL_ID=$1
- echo ">> Login to chi1 vault using Okta"
- export VAULT_ADDR="https://chi1-vault.simulprod.com:8200"
+ echo ">> Fetching cell definition for $CELL_ID from GitHub"
+ REGION_ID=$(${pkgs.gh}/bin/gh api --hostname github.rbx.com repos/Roblox/cell-lifecycle/contents/definitions/''${CELL_ID}.yaml --jq '.content' | base64 -d | yq -r '.regionId')
+
+ if [ -z "$REGION_ID" ] || [ "$REGION_ID" = "null" ]; then
+ echo "Error: Could not retrieve regionId for cell $CELL_ID"
+ exit 1
+ fi
+
+ echo ">> Found regionId: $REGION_ID"
+
+ case "$REGION_ID" in
+ r002)
+ VAULT_REGION="chi1"
+ ;;
+ r003)
+ VAULT_REGION="ash1"
+ ;;
+ *)
+ echo "Error: Unknown regionId $REGION_ID. Expected r002 or r003."
+ exit 1
+ ;;
+ esac
+
+ echo ">> Using vault region: $VAULT_REGION"
+
+ echo ">> Login to $VAULT_REGION vault using Okta"
+ export VAULT_ADDR="https://$VAULT_REGION-vault.simulprod.com:8200"
export VAULT_TOKEN=$(${pkgs.vault}/bin/vault login -field=token -method=oidc username=$USER)
echo ">> Accessing cell $CELL_ID"