Skip to content

publish: send X-Market-CI-Provider header with Marketplace requests - #1345

Merged
Benjamin Christopher Simmonds (benibenj) merged 1 commit into
mainfrom
benibenj/agents/ci-provider-header-logging-enhancement
Oct 21, 2026
Merged

Benjamin Christopher Simmonds (benibenj) merged 1 commit into
mainfrom
benibenj/agents/ci-provider-header-logging-enhancement

Conversation

@benibenj

Copy link
Copy Markdown
Contributor

The VS Marketplace team wants to know which CI system extensions are published from (GitHub Actions, GitLab CI, Azure Pipelines, manual, ...). Today the server only sees which tool was used (vsce vs VsixPublisher.exe), not where it ran.

What changed

  • New src/ciProvider.ts isolates CI detection:
    • CIProvider: well-known, stable set of values so the Marketplace gets a consistent signal: github-actions, azure-pipelines, gitlab-ci, bitbucket-pipelines, jenkins, circleci, travis-ci, appveyor, teamcity, bamboo, jetbrains-space, buildkite, aws-codebuild, other (generic CI set but unknown provider), none (no CI detected, e.g. manual publish).
    • detectCIProvider(): ordered, env-var-based detection (first match wins), based on each provider's documented variables. Inspired by Nerdbank.GitVersioning's CloudBuildServices.
    • CIProviderRequestHandler: an azure-devops-node-api IRequestHandler that adds X-Market-CI-Provider: <value> to every request.
  • getGalleryAPI registers the handler, so publish, unpublish and verify-pat requests all carry the header.
  • Logging and OIDC now use the shared isGitHubActions() check instead of reading GITHUB_ACTIONS directly.

Notes for reviewers

  • The header is always sent, including none. That lets the Marketplace tell manual publishes apart from older vsce versions, which don't send the header at all.
  • This is a rough, spoofable stats signal and must not be used for any security decision.
  • Minor behavior change: GitHub Actions log formatting now requires GITHUB_ACTIONS=true; before, any non-empty value turned it on. GitHub always sets it to true.
  • Tests cover detection for each provider and the precedence order. An end-to-end test sends a real GalleryApi request to a local HTTP server and asserts the header arrives.

Detect the CI system vsce runs in from well-known environment variables and
report it to the Marketplace via the X-Market-CI-Provider header, so publish
statistics can distinguish GitHub Actions, Azure Pipelines, GitLab CI, manual
publishes, etc.

Co-authored-by: Copilot <[email protected]>
@benibenj
Benjamin Christopher Simmonds (benibenj) merged commit 402a12c into main Oct 21, 2026
5 checks passed
@benibenj
Benjamin Christopher Simmonds (benibenj) deleted the benibenj/agents/ci-provider-header-logging-enhancement branch October 21, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants