feat(run-environment): add CircleCI provider for GitHub repositories - #473
feat(run-environment): add CircleCI provider for GitHub repositories#473fargito wants to merge 1 commit into
Conversation
Greptile SummaryAdds CircleCI support for GitHub-hosted repositories.
Confidence Score: 5/5The PR appears safe to merge with respect to the eligible follow-up findings. No blocking failure remains from the previous logger thread, because direct stdout output is required inside the logging sink and matches the repository's other logger backends.
|
| Filename | Overview |
|---|---|
| src/run_environment/circleci/provider.rs | Implements CircleCI detection, GitHub repository validation, event metadata, static-token enforcement, and workflow run-part identity. |
| src/run_environment/circleci/logger.rs | Adds a CircleCI logging sink with colored headings and level-aware output consistent with the repository's logger implementations. |
| src/run_environment/mod.rs | Registers CircleCI in provider detection before the local fallback. |
| src/run_environment/interfaces.rs | Adds the serialized CircleCI run-environment variant. |
| src/upload/uploader.rs | Provides CircleCI users the static-token authentication hint for unauthorized uploads. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Env["CircleCI environment variables"] --> Detect["Detect CIRCLECI=true"]
Detect --> Validate["Parse and validate GitHub repository"]
Validate --> Metadata["Build run-environment metadata"]
Validate --> Part["Build workflow/job/node run-part identity"]
Metadata --> Upload["Upload benchmark profile"]
Part --> Upload
Token["CODSPEED_TOKEN"] --> Upload
Reviews (4): Last reviewed commit: "feat(run-environment): add CircleCI prov..." | Re-trigger Greptile
Merging this PR will not alter performance
|
f002a69 to
bc6db31
Compare
Support running benchmarks from CircleCI on GitHub-hosted repositories. The build runs on CircleCI while commits and pull requests live on GitHub, so the run reports against the GitHub commit and PR. Unlike GitHub Actions, CircleCI checks out the associated commit itself rather than a synthetic merge ref, so the default git HEAD read already yields CIRCLE_SHA1 and no commit hash override is needed. CircleCI exposes no base branch variable either: baseRef is left empty and CodSpeed resolves the base branch from the pull request. CircleCI also builds Bitbucket and GitLab repositories, so the domain of CIRCLE_REPOSITORY_URL is validated and anything but github.com is rejected with an explicit error. That domain is the only signal available at runtime: the explicit pipeline.project.type is a pipeline value, interpolated when the config is compiled, so it never reaches the job as a variable. Uploads authenticate with a static CODSPEED_TOKEN. Run part data is already reported, so runs group correctly once multi-part upload support lands: CIRCLE_WORKFLOW_ID is shared by every job and every parallel container of a workflow, while CIRCLE_JOB and CIRCLE_NODE_INDEX identify a single part. Refs COD-2977 Refs COD-2995 Refs COD-3262
bc6db31 to
4e52cfa
Compare
| gh_data: None, | ||
| gl_data: None, | ||
| local_data: None, | ||
| sender: None, |
There was a problem hiding this comment.
As seen together, if this is not needed anymore, let's remove the field
Add a CircleCI run environment, for repositories hosted on GitHub.
The build runs on CircleCI while commits and pull requests live on GitHub, so the run is reported
against the GitHub commit and pull request. Detection is
CIRCLECI=true, and the repository comesfrom
CIRCLE_REPOSITORY_URL.CircleCI also builds Bitbucket and GitLab repositories, so the remote's domain is checked and
anything but
github.comis rejected with an error naming the domain found. That domain is theonly signal available at runtime:
pipeline.project.typeis a pipeline value, interpolated whenthe config is compiled, so it never reaches the job as an environment variable.
Two things worth a look:
merge ref, so reading git
HEADalready yieldsCIRCLE_SHA1.runIdisCIRCLE_WORKFLOW_ID, shared by every job and every parallel container of aworkflow. The per-job
CIRCLE_WORKFLOW_JOB_IDwould split one workflow into unrelated runs.runPartIdis{CIRCLE_JOB}-{CIRCLE_NODE_INDEX}, to stay unique along both fan-out axes.baseRefis left empty, as CircleCI exposes no base-branch variable. Pull request uploads need aserver-side change that is not released yet; push events are unaffected.
Uploads authenticate with a static
CODSPEED_TOKEN. Minting OIDC tokens instead is #482, stackedon top.
Refs COD-2995
Refs COD-3262