Skip to content

feat(idp): add migrate-schema command to migrate service catalog YAML to v3#567

Open
andre-rodrigues-dd wants to merge 1 commit into
DataDog:mainfrom
andre-rodrigues-dd:feat/idp-migrate-schema
Open

feat(idp): add migrate-schema command to migrate service catalog YAML to v3#567
andre-rodrigues-dd wants to merge 1 commit into
DataDog:mainfrom
andre-rodrigues-dd:feat/idp-migrate-schema

Conversation

@andre-rodrigues-dd
Copy link
Copy Markdown

Summary

Adds pup idp migrate-schema [path] which migrates Datadog service catalog YAML files (v1, v2, v2.1, v2.2) to v3 format using a Rust-native migration engine with JSON schema validation.

Changes

  • src/commands/idp/ — converted from idp.rs to a directory module (mod.rs + migrate.rs)
  • src/main.rs — added migrate-schema subcommand to IdpActions
  • Cargo.toml / Cargo.lock — added jsonschema crate (default-features = false)

Features

  • Detects schema version (v1/v2/v2.1/v2.2/v3) and migrates field mappings: contacts, links, repos, docs, integrations, lifecycle, tags, extensions
  • Generates companion kind: system entities from application: fields, deduplicating across multi-doc files
  • Validates output against v3 JSON schemas fetched from GitHub at runtime (in-memory $ref resolution — no blocking HTTP, no bundled schemas)
  • Interactive output prompt: write in-place, custom path, or stdout
  • Auto-discovers *.datadog.yaml files recursively when no path given; accepts a file or directory
  • Multi-file: single confirm prompt, parallel execution in batches of 16 (avoids fd exhaustion on large repos), consolidated summary with migrated / warnings / failed / skipped counts and elapsed time
  • Gracefully skips empty files, comment-only files, and broken symlinks
  • Handles indented YAML correctly (strips only the first newline after ---, preserving block indentation)
  • ANSI-coloured output following codebase conventions (no colour crate)

Testing

  • 26 unit tests covering version detection, all four migration paths, multi-doc handling, companion deduplication, and file discovery
  • Manually tested against a large monorepo (dd-source) with 500+ *.datadog.yaml files

… to v3

Adds `pup idp migrate-schema [path]` which migrates Datadog service catalog
YAML files (v1, v2, v2.1, v2.2) to v3 format using a Rust-native migration
engine with JSON schema validation against the official DataDog/schema schemas.

Features:
- Detects schema version (v1/v2/v2.1/v2.2/v3) and migrates to v3
- Migrates all field mappings: contacts, links, repos, docs, integrations,
  lifecycle, tags, extensions, and unknown fields (moved to extensions)
- Generates companion 'kind: system' entities from 'application:' fields,
  deduplicating across multi-doc files
- Validates migrated output against v3 JSON schemas fetched from GitHub
  (in-memory $ref resolution, no blocking HTTP)
- Interactive output prompt: write in-place, custom path, or stdout
- Auto-discovers *.datadog.yaml files when no path given; accepts a file
  or directory as argument
- Multi-file mode: confirms once, migrates in parallel (batches of 16 to
  avoid fd exhaustion), prints consolidated summary with counts and timing
- Gracefully skips empty files, comment-only files, and broken symlinks
- Handles indented YAML (e.g. 4-space indent after ---) correctly
- ANSI-coloured output following codebase conventions (no colour crate)

Implementation:
- src/commands/idp/ directory module (idp/mod.rs + idp/migrate.rs)
- jsonschema crate (default-features = false, no blocking HTTP resolver)
- 26 unit tests covering version detection, all migration paths,
  multi-doc handling, companion deduplication, and file discovery
@andre-rodrigues-dd andre-rodrigues-dd requested a review from a team as a code owner June 5, 2026 18:00
@datadog-prod-us1-4
Copy link
Copy Markdown

datadog-prod-us1-4 Bot commented Jun 5, 2026

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 5 Pipeline jobs failed

CI | Check, Test & Coverage   View in Datadog   GitHub Actions

CI | Cross Compile (Linux)   View in Datadog   GitHub Actions

CI | Cross Compile (Windows)   View in Datadog   GitHub Actions

View all 5 failed jobs.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 03bf5ba | Docs | Datadog PR Page | Give us feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants