Skip to content

Commit dfa68d0

Browse files
fargitoclaude
andcommitted
refactor(upload): drop ghData and glData from the run environment metadata
Both carried a run id and a job name that `runPart` already carries for every provider, so the payload named the same job twice, and only ever for GitHub Actions and GitLab CI. Every other provider filled both fields with `None` to say it was neither of them. GitHub Actions and GitLab CI keep the two values as plain fields read when the provider is built, the way CircleCI holds the ones its own run part needs. The payload no longer has the shape version 10 describes, so it becomes version 11. The backend accepts both: it reads either field only when `runPart` is missing, which no version since 6 has been. Refs COD-3257 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 417e0f9 commit dfa68d0

21 files changed

Lines changed: 35 additions & 123 deletions

File tree

src/run_environment/buildkite/provider.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ impl RunEnvironmentProvider for BuildkiteProvider {
137137
repository: self.repository.clone(),
138138
ref_: self.ref_.clone(),
139139
repository_root_path: self.repository_root_path.clone(),
140-
gh_data: None,
141-
gl_data: None,
142140
local_data: None,
143141
sender: None,
144142
})

src/run_environment/buildkite/snapshots/codspeed_runner__run_environment__buildkite__provider__tests__pull_request_run_environment_metadata.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ expression: run_environment_metadata
1010
"repository": "adrien-python-test",
1111
"event": "pull_request",
1212
"sender": null,
13-
"ghData": null,
14-
"glData": null,
1513
"localData": null,
1614
"repositoryRootPath": "/buildkite/builds/7b10eca7600b-1/my-org/buildkite-test/"
1715
}

src/run_environment/circleci/provider.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,6 @@ impl RunEnvironmentProvider for CircleCIProvider {
181181
repository: self.repository.clone(),
182182
ref_: self.ref_.clone(),
183183
repository_root_path: self.repository_root_path.clone(),
184-
gh_data: None,
185-
gl_data: None,
186184
local_data: None,
187185
// CircleCI does not provide the sender information.
188186
sender: None,

src/run_environment/circleci/snapshots/codspeed_runner__run_environment__circleci__provider__tests__pull_request_run_environment_metadata.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ expression: run_environment_metadata
1010
"repository": "adrien-python-test",
1111
"event": "pull_request",
1212
"sender": null,
13-
"ghData": null,
14-
"glData": null,
1513
"localData": null,
1614
"repositoryRootPath": "/home/circleci/project/"
1715
}

src/run_environment/github_actions/provider.rs

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::executor::config::OrchestratorConfig;
1515
use crate::prelude::*;
1616
use crate::request_client::OIDC_CLIENT;
1717
use crate::run_environment::interfaces::{
18-
GhData, RepositoryProvider, RunEnvironmentMetadata, RunEvent, Sender,
18+
RepositoryProvider, RunEnvironmentMetadata, RunEvent, Sender,
1919
};
2020
use crate::run_environment::provider::{RunEnvironmentDetector, RunEnvironmentProvider};
2121
use crate::run_environment::{RunEnvironment, RunPart};
@@ -29,7 +29,8 @@ pub struct GitHubActionsProvider {
2929
pub head_ref: Option<String>,
3030
pub base_ref: Option<String>,
3131
pub sender: Option<Sender>,
32-
pub gh_data: GhData,
32+
pub run_id: String,
33+
pub job_name: String,
3334
pub event: RunEvent,
3435
pub repository_root_path: String,
3536

@@ -135,10 +136,8 @@ impl TryFrom<&OrchestratorConfig> for GitHubActionsProvider {
135136
ref_,
136137
head_ref,
137138
event,
138-
gh_data: GhData {
139-
job: get_env_variable("GITHUB_JOB")?,
140-
run_id: get_env_variable("GITHUB_RUN_ID")?,
141-
},
139+
run_id: get_env_variable("GITHUB_RUN_ID")?,
140+
job_name: get_env_variable("GITHUB_JOB")?,
142141
sender: Some(Sender {
143142
login: get_env_variable("GITHUB_ACTOR")?,
144143
id: get_env_variable("GITHUB_ACTOR_ID")?,
@@ -178,8 +177,6 @@ impl RunEnvironmentProvider for GitHubActionsProvider {
178177
base_ref: self.base_ref.clone(),
179178
head_ref: self.head_ref.clone(),
180179
event: self.event.clone(),
181-
gh_data: Some(self.gh_data.clone()),
182-
gl_data: None,
183180
local_data: None,
184181
sender: self.sender.clone(),
185182
owner: self.owner.clone(),
@@ -211,7 +208,7 @@ impl RunEnvironmentProvider for GitHubActionsProvider {
211208
/// Plus we are interested in the content of these objects,
212209
/// so it makes sense to parse and re-serialize them.
213210
fn get_run_provider_run_part(&self) -> Option<RunPart> {
214-
let job_name = self.gh_data.job.clone();
211+
let job_name = self.job_name.clone();
215212

216213
let mut metadata = BTreeMap::new();
217214

@@ -240,13 +237,13 @@ impl RunEnvironmentProvider for GitHubActionsProvider {
240237

241238
format!("{job_name}-{matrix_str}-{strategy_str}")
242239
} else {
243-
job_name
240+
job_name.clone()
244241
};
245242

246243
Some(RunPart {
247-
run_id: self.gh_data.run_id.clone(),
244+
run_id: self.run_id.clone(),
248245
run_part_id,
249-
job_name: self.gh_data.job.clone(),
246+
job_name,
250247
metadata,
251248
})
252249
}
@@ -446,8 +443,8 @@ mod tests {
446443
assert_eq!(github_actions_provider.base_ref, Some("main".into()));
447444
assert_eq!(github_actions_provider.head_ref, None);
448445
assert_eq!(github_actions_provider.event, RunEvent::Push);
449-
assert_eq!(github_actions_provider.gh_data.job, "job");
450-
assert_eq!(github_actions_provider.gh_data.run_id, "1234567890");
446+
assert_eq!(github_actions_provider.job_name, "job");
447+
assert_eq!(github_actions_provider.run_id, "1234567890");
451448
assert_eq!(
452449
github_actions_provider.sender.as_ref().unwrap().login,
453450
"actor"
@@ -663,10 +660,8 @@ mod tests {
663660
head_ref: Some("my-branch".into()),
664661
base_ref: None,
665662
sender: None,
666-
gh_data: GhData {
667-
job: "my_job".into(),
668-
run_id: "123789".into(),
669-
},
663+
run_id: "123789".into(),
664+
job_name: "my_job".into(),
670665
event: RunEvent::Push,
671666
repository_root_path: "/home/work/my-repo".into(),
672667
is_head_repo_fork: false,
@@ -708,10 +703,8 @@ mod tests {
708703
head_ref: Some("my-branch".into()),
709704
base_ref: None,
710705
sender: None,
711-
gh_data: GhData {
712-
job: "my_job".into(),
713-
run_id: "123789".into(),
714-
},
706+
run_id: "123789".into(),
707+
job_name: "my_job".into(),
715708
event: RunEvent::Push,
716709
repository_root_path: "/home/work/my-repo".into(),
717710
is_head_repo_fork: false,
@@ -762,10 +755,8 @@ mod tests {
762755
head_ref: Some("my-branch".into()),
763756
base_ref: None,
764757
sender: None,
765-
gh_data: GhData {
766-
job: "my_job".into(),
767-
run_id: "123789".into(),
768-
},
758+
run_id: "123789".into(),
759+
job_name: "my_job".into(),
769760
event: RunEvent::Push,
770761
repository_root_path: "/home/work/my-repo".into(),
771762
is_head_repo_fork: false,
@@ -814,10 +805,8 @@ mod tests {
814805
head_ref: Some("my-branch".into()),
815806
base_ref: None,
816807
sender: None,
817-
gh_data: GhData {
818-
job: "my_job".into(),
819-
run_id: "123789".into(),
820-
},
808+
run_id: "123789".into(),
809+
job_name: "my_job".into(),
821810
event: RunEvent::Push,
822811
repository_root_path: "/home/work/my-repo".into(),
823812
is_head_repo_fork: false,

src/run_environment/github_actions/snapshots/codspeed_runner__run_environment__github_actions__provider__tests__fork_pull_request_run_environment_metadata.snap

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ expression: run_environment_metadata
1313
"id": "19605940",
1414
"login": "adriencaccia"
1515
},
16-
"ghData": {
17-
"runId": "6957110437",
18-
"job": "log-env"
19-
},
20-
"glData": null,
2116
"localData": null,
2217
"repositoryRootPath": "/home/runner/work/adrien-python-test/adrien-python-test/"
2318
}

src/run_environment/github_actions/snapshots/codspeed_runner__run_environment__github_actions__provider__tests__matrix_job_run_environment_metadata.snap

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ expression: run_environment_metadata
1313
"id": "19605940",
1414
"login": "adriencaccia"
1515
},
16-
"ghData": {
17-
"runId": "6957110437",
18-
"job": "log-env"
19-
},
20-
"glData": null,
2116
"localData": null,
2217
"repositoryRootPath": "/home/runner/work/adrien-python-test/adrien-python-test/"
2318
}

src/run_environment/github_actions/snapshots/codspeed_runner__run_environment__github_actions__provider__tests__pull_request_run_environment_metadata.snap

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ expression: run_environment_metadata
1313
"id": "19605940",
1414
"login": "adriencaccia"
1515
},
16-
"ghData": {
17-
"runId": "6957110437",
18-
"job": "log-env"
19-
},
20-
"glData": null,
2116
"localData": null,
2217
"repositoryRootPath": "/home/runner/work/adrien-python-test/adrien-python-test/"
2318
}

src/run_environment/gitlab_ci/provider.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::cli::run::helpers::get_env_variable;
77
use crate::executor::config::OrchestratorConfig;
88
use crate::prelude::*;
99
use crate::run_environment::interfaces::{
10-
GlData, RepositoryProvider, RunEnvironment, RunEnvironmentMetadata, RunEvent, Sender,
10+
RepositoryProvider, RunEnvironment, RunEnvironmentMetadata, RunEvent, Sender,
1111
};
1212
use crate::run_environment::provider::RunEnvironmentDetector;
1313
use crate::run_environment::{RunEnvironmentProvider, RunPart};
@@ -21,7 +21,8 @@ pub struct GitLabCIProvider {
2121
ref_: String,
2222
head_ref: Option<String>,
2323
base_ref: Option<String>,
24-
gl_data: GlData,
24+
run_id: String,
25+
job_name: String,
2526
sender: Sender,
2627
event: RunEvent,
2728
repository_root_path: String,
@@ -106,12 +107,11 @@ impl TryFrom<&OrchestratorConfig> for GitLabCIProvider {
106107
};
107108

108109
let run_id = get_env_variable("CI_JOB_ID")?;
109-
let job = get_env_variable("CI_JOB_NAME")?;
110+
let job_name = get_env_variable("CI_JOB_NAME")?;
110111

111112
let gitlab_user_id = get_env_variable("GITLAB_USER_ID")?;
112113
let gitlab_user_login = get_env_variable("GITLAB_USER_LOGIN")?;
113114

114-
let gl_data = GlData { run_id, job };
115115
let sender = Sender {
116116
id: gitlab_user_id,
117117
login: gitlab_user_login,
@@ -125,7 +125,8 @@ impl TryFrom<&OrchestratorConfig> for GitLabCIProvider {
125125
ref_,
126126
head_ref,
127127
base_ref,
128-
gl_data,
128+
run_id,
129+
job_name,
129130
sender,
130131
event,
131132
repository_root_path,
@@ -159,8 +160,6 @@ impl RunEnvironmentProvider for GitLabCIProvider {
159160
base_ref: self.base_ref.clone(),
160161
head_ref: self.head_ref.clone(),
161162
event: self.event.clone(),
162-
gh_data: None,
163-
gl_data: Some(self.gl_data.clone()),
164163
local_data: None,
165164
sender: Some(self.sender.clone()),
166165
owner: self.owner.clone(),
@@ -172,9 +171,9 @@ impl RunEnvironmentProvider for GitLabCIProvider {
172171

173172
fn get_run_provider_run_part(&self) -> Option<RunPart> {
174173
Some(RunPart {
175-
run_id: self.gl_data.run_id.clone(),
176-
run_part_id: self.gl_data.job.clone(),
177-
job_name: self.gl_data.job.clone(),
174+
run_id: self.run_id.clone(),
175+
run_part_id: self.job_name.clone(),
176+
job_name: self.job_name.clone(),
178177
metadata: BTreeMap::new(),
179178
})
180179
}

src/run_environment/gitlab_ci/snapshots/codspeed_runner__run_environment__gitlab_ci__provider__tests__fork_merge_request_run_environment_metadata.snap

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ expression: run_environment_metadata
1313
"id": "19605940",
1414
"login": "actor"
1515
},
16-
"ghData": null,
17-
"glData": {
18-
"runId": "6957110437",
19-
"job": "build-job"
20-
},
2116
"localData": null,
2217
"repositoryRootPath": "/builds/owner/repository"
2318
}

0 commit comments

Comments
 (0)