Skip to content

Commit fae36fa

Browse files
Clara Rullmeta-codesync[bot]
authored andcommitted
clientinfo: thread CI_PURPOSE through FbClientInfo
Summary: When the sandcastle worker sets the CI_PURPOSE environment variable, we want to pass that information to Mononoke. This diff adds a ci_purpose field to FbClientInfo, which is serialized into the X-Client-Info header similar to Sandcastle Alias. Their values are not dissimlar form aliases but better suited for demand control. In faxct, they are the identifier RE uses for CI demand control. This table contain some examples: https://fburl.com/scuba/ci_demand_budget_entity_purpose_quotas_grodd_inde/kluni1nk | purpose | Hits | Samples | | -----| -----| ----- | | "diff_citadel_fbcode" | 11 | 11 | | "autoknowledge" | 8 | 8 | | "citadel_orchestrator" | 8 | 8 | | "ig-postcommit" | 6 | 6 | | "rl_robotics_xqb" | 6 | 6 | | "whatsapp_ml_agent" | 6 | 6 | | "ads_ai_baf" | 5 | 5 | | "devmate_code_review" | 5 | 5 | | "quality_analyser" | 5 | 5 | | "whatsapp-cf" | 5 | 5 | If no purpose is set, the field is omitted from the header. Reviewed By: muirdm Differential Revision: D109559711 fbshipit-source-id: 52681b934573b224929558e7bb8a27eea5e2458f
1 parent 581661a commit fae36fa

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

eden/scm/lib/clientinfo/src/facebook.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ pub struct FbClientInfo {
3434
#[serde(skip_serializing_if = "Option::is_none")]
3535
sandcastle_vcs: Option<String>,
3636
#[serde(skip_serializing_if = "Option::is_none")]
37+
ci_purpose: Option<String>,
38+
#[serde(skip_serializing_if = "Option::is_none")]
3739
atlas: Option<bool>,
3840
#[serde(skip_serializing_if = "Option::is_none")]
3941
atlas_rl: Option<bool>,
@@ -68,6 +70,10 @@ impl FbClientInfo {
6870
self.sandcastle_vcs.as_deref()
6971
}
7072

73+
pub fn ci_purpose(&self) -> Option<&str> {
74+
self.ci_purpose.as_deref()
75+
}
76+
7177
pub fn is_atlas(&self) -> Option<bool> {
7278
self.atlas
7379
}
@@ -121,6 +127,7 @@ pub fn get_fb_client_info() -> FbClientInfo {
121127
sandcastle_alias: var("SANDCASTLE_ALIAS").ok(),
122128
sandcastle_type: var("SANDCASTLE_TYPE").ok(),
123129
sandcastle_vcs: var("SANDCASTLE_VCS").ok(),
130+
ci_purpose: var("CI_PURPOSE").ok(),
124131
atlas: atlas_env_flag("ATLAS"),
125132
atlas_rl: atlas_rl_from_whoami(),
126133
atlas_env_id: var("ATLAS_ENV_ID").ok(),

eden/scm/lib/clientinfo/src/oss.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ impl FbClientInfo {
4040
None
4141
}
4242

43+
pub fn ci_purpose(&self) -> Option<&str> {
44+
None
45+
}
46+
4347
pub fn is_atlas(&self) -> Option<bool> {
4448
None
4549
}

0 commit comments

Comments
 (0)