Skip to content

refactor(pipeline): extract pipelineschema package and shared schema cache#370

Merged
Viktor (tiulpin) merged 1 commit into
mainfrom
refactor/extract-pipeline-schema
Jun 19, 2026
Merged

refactor(pipeline): extract pipelineschema package and shared schema cache#370
Viktor (tiulpin) merged 1 commit into
mainfrom
refactor/extract-pipeline-schema

Conversation

@tiulpin

Copy link
Copy Markdown
Member

Summary

Split out of #226 to keep that PR focused on migrate. Pulls the pipeline JSON-schema helpers out of internal/cmd/pipeline into a reusable internal/pipelineschema package and the on-disk schema cache into cmdutil.FetchOrCachePipelineSchema, so both pipeline and the upcoming migrate command share one definition. Adds config.ConfigDir() as the single source for the config-dir path, and makes pipeline validate fall back to the embedded schema when run unauthenticated instead of erroring.

Changes

  • New internal/pipelineschema package: Bytes, Compile, ValidateWithSchema, ConvertYAMLToJSON, HostedAgentNames.
  • New cmdutil.FetchOrCachePipelineSchema (24h on-disk cache, embedded fallback, corrupt-cache self-heal); removes the duplicate cache logic from pipeline/schema.go.
  • config.ConfigDir() extracted; update state path and schema cache now derive from it.
  • pipeline validate validates against the embedded schema when not authenticated (warns instead of failing).
  • Bump fus-reporting-api-go.

Design Decisions

Straightforward.

Example

$ teamcity pipeline validate .tc.yml   # no auth
⚠ Not authenticated - validating against the embedded schema; run 'teamcity auth login' to use your server's schema
✓ .tc.yml is valid

Test Plan

  • Unit tests pass (just unit)
  • Linter passes (just lint)
  • Acceptance tests pass (just acceptance) — N/A — no command/flag surface change
  • If adding a new command/flag: added .txtar test in acceptance/testdata/ — N/A — no new command/flag
  • If adding a data-producing command: includes --json support — N/A
  • If modifying --json output: no field removals/renames (additive only) — N/A
  • If changing docs-visible behavior: updated docs/, skills/, and README.md — N/A — internal refactor + unauth fallback only
  • External contributors: links a status:finalized issue — N/A — internal change

@tiulpin Viktor (tiulpin) merged commit 3395cfe into main Jun 19, 2026
4 of 7 checks passed
@tiulpin Viktor (tiulpin) deleted the refactor/extract-pipeline-schema branch June 19, 2026 07:01
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.

1 participant