feat(env): auto-detect 10 additional CI providers (PER-7828)#2194
Open
feat(env): auto-detect 10 additional CI providers (PER-7828)#2194
Conversation
Add detection plus commit/branch/PR/parallel-nonce extraction for:
TeamCity, AWS CodeBuild, Google Cloud Build, Atlassian Bamboo, Bitrise,
Codemagic, Vercel, Cloudflare Pages, GoCD, Woodpecker.
Detection ordering:
- Woodpecker placed before Drone (guards against pre-3.x Woodpecker
installs that set DRONE=true for backwards compatibility).
- GCB placed last before the CI/unknown fallback because BUILD_ID +
PROJECT_ID is the most generic marker; defensive !JENKINS_URL guard
added.
Parallel-nonce rerun-stability choices:
- Bamboo uses bamboo_buildResultKey (includes build-N suffix) rather
than bamboo_buildNumber (reused on rerun).
- Cloudflare Pages uses a composite \${commit}-\${url} nonce with a
strict null-guard on commit SHA so we never emit "undefined".
- GoCD uses a composite \${pipeline}.\${stage} counter so stage reruns
do not collide.
Each provider gets a dedicated test file covering detection, PR builds
(where applicable), edge cases (CodeBuild manual triggers, GCB manual
submits, Vercel system-env-vars-off, Woodpecker Drone-compat collision,
Jenkins-over-GCB precedence), and PERCY_* override precedence.
API side is a no-op: the 'source' field is free-form metadata with no
allowlist.
Tekton/Argo excluded — no standard git env vars.
Documentation for the 10 new providers (plus doc gaps for Harness,
Heroku CI, Probo.CI) ships in a follow-up PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
E2E testing revealed the Cloudflare Pages composite nonce
(CF_PAGES_COMMIT_SHA-CF_PAGES_URL) exceeded Percy's 64-char
API limit, causing build creation to fail. Switched to
CF_PAGES_COMMIT_SHA alone — this also gives correct rerun
dedup behavior since the URL changes per redeploy.
Added opt-in detection for Tekton Pipelines and Argo Workflows.
Neither auto-injects identifying env vars into step containers,
so users set them via template substitution:
# Tekton
env:
- name: TEKTON_PIPELINE_RUN
value: "$(context.pipelineRun.name)"
- name: TEKTON_COMMIT_SHA
value: "$(params.commit-sha)"
- name: TEKTON_BRANCH
value: "$(params.branch)"
# Argo Workflows
env:
- name: ARGO_WORKFLOW_NAME
value: "{{workflow.name}}"
- name: ARGO_WORKFLOW_UID
value: "{{workflow.uid}}"
- name: ARGO_COMMIT_SHA
value: "{{workflow.parameters.commit-sha}}"
- name: ARGO_BRANCH
value: "{{workflow.parameters.branch}}"
🤖 Generated with Claude Opus 4.7 (1M context) via Claude Code
+ Compound Engineering v2.50.0
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds README entries for the 10 auto-detect providers (TeamCity, AWS CodeBuild, GCB, Bamboo, Bitrise, Codemagic, Vercel, Cloudflare Pages, GoCD, Woodpecker), backfills Harness CI (was detected in code but missing from the list), and documents the opt-in setup for Tekton Pipelines and Argo Workflows with copy-paste YAML snippets. Also calls out the Vercel System Env Vars + PERCY_PARALLEL_TOTAL=-1 requirement surfaced during E2E testing. 🤖 Generated with Claude Opus 4.7 (1M context) via Claude Code + Compound Engineering v2.50.0 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Expands Percy CLI's
@percy/envpackage to auto-detect 12 additional CI providers (10 auto-detect + 2 opt-in): TeamCity, AWS CodeBuild, Google Cloud Build, Atlassian Bamboo, Bitrise, Codemagic, Vercel, Cloudflare Pages, GoCD, Woodpecker, Tekton Pipelines, and Argo Workflows.Key decisions
Testing
Unit: 123 specs pass (up from 115 previously). Added 9 new test cases across Tekton (4) and Argo Workflows (5), plus modified the Cloudflare Pages nonce assertion to reflect the fix below.
E2E: 9 providers verified by creating real Percy builds from each and asserting
ci,commit-sha,branch,pull-request-number,parallel-noncevia Percy's admin API:Bug found + fixed during E2E
The original Cloudflare Pages nonce formula
${CF_PAGES_COMMIT_SHA}-${CF_PAGES_URL}produced strings >64 chars. Percy's API rejects nonces over 64 chars, so build creation failed even though CI detection itself worked. Fixed to useCF_PAGES_COMMIT_SHAalone (40 chars, deterministic, gives correct rerun dedup).Scope
packages/env/src/environment.js: add 12 providers + 1 nonce fixpackages/env/test/: 12 new test files (one per provider) + updated cloudflare-pages.test.jsPost-Deploy Monitoring & Validation
user-agentcontaining any of the 12 new CI slugs (teamcity,aws-codebuild,gcb,bamboo,bitrise,codemagic,vercel,cloudflare-pages,gocd,woodpecker,tekton,argo-workflows).SELECT COUNT(*) FROM builds WHERE user_agent LIKE '%; vercel)%' AND created_at > NOW() - INTERVAL 24 HOUR;(and equivalent per provider).commit_sha,branch, andparallel_noncefields populated.Nonce is too longorSha must be 40 hexadecimal charactersbuild-create errors. If triggered, revert the two commits onfeat/per-7828-ci-provider-coverage.🤖 Generated with Claude Opus 4.7 (1M context) via Claude Code + Compound Engineering v2.50.0