Skip to content

Commit 6a0ab6b

Browse files
authored
feat: Add machine profiles to invalid instances in gcp config (mozilla-releng#604)
1 parent 20ba46e commit 6a0ab6b

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

environments.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ firefoxci:
146146
families: [t2a]
147147
- zones: [us-east1-b, us-east1-d, us-west1-c]
148148
families: [n1]
149+
# There are no highcpu c3d in us-west1
150+
- zones: [us-west1-a, us-west1-b, us-west1-c]
151+
families: [c3d]
152+
profiles: ["highcpu"]
153+
# There are no highcpu c4d in us-west1-c
154+
- zones: [us-west1-c]
155+
families: [c4d]
156+
profiles: ["highcpu"]
149157
cron:
150158
gecko:
151159
hooks_owner: [email protected]

src/ciadmin/generate/worker_pools.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ def is_invalid_aws_instance_type(invalid_instances, zone, instance_type):
2727

2828

2929
def is_invalid_gcp_instance_type(invalid_instances, zone, machine_type):
30-
# Parse machine type: family-configuration-cpus[-suffix]
30+
# Parse machine type: family-profile-cpus[-suffix]
3131
# e.g., "c4d-standard-8-lssd" -> family="c4d", suffix="lssd"
3232
parts = machine_type.split("-")
3333
family = parts[0]
34+
profile = parts[1]
3435
# Suffix will be anything after cpus number
3536
if len(parts) < 3:
3637
# Wrong machine type
3738
raise Exception(
38-
f"Machine type should be on the format <family>-<configuration>-<cpus>[-<suffix>]. Got: {machine_type}"
39+
f"Machine type should be on the format <family>-<profile>-<cpus>[-<suffix>]. Got: {machine_type}"
3940
)
4041
elif len(parts) == 3:
4142
# No suffix
@@ -51,8 +52,14 @@ def is_invalid_gcp_instance_type(invalid_instances, zone, machine_type):
5152

5253
# True if suffixes undefined, or [], or actually matches config
5354
matches_suffix = not entry.get("suffixes") or suffix in entry["suffixes"]
55+
matches_profile = not entry.get("profiles") or profile in entry["profiles"]
5456

55-
if zone in entry["zones"] and family in entry["families"] and matches_suffix:
57+
if (
58+
zone in entry["zones"]
59+
and family in entry["families"]
60+
and matches_suffix
61+
and matches_profile
62+
):
5663
# Invalid!
5764
return True
5865
# No matches found, machine_type is valid in this zone

0 commit comments

Comments
 (0)