feat(idp): add migrate-schema command to migrate service catalog YAML to v3#567
Open
andre-rodrigues-dd wants to merge 1 commit into
Open
feat(idp): add migrate-schema command to migrate service catalog YAML to v3#567andre-rodrigues-dd wants to merge 1 commit into
andre-rodrigues-dd wants to merge 1 commit into
Conversation
… 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
|
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
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 fromidp.rsto a directory module (mod.rs+migrate.rs)src/main.rs— addedmigrate-schemasubcommand toIdpActionsCargo.toml/Cargo.lock— addedjsonschemacrate (default-features = false)Features
kind: systementities fromapplication:fields, deduplicating across multi-doc files*.datadog.yamlfiles recursively when no path given; accepts a file or directory---, preserving block indentation)Testing
dd-source) with 500+*.datadog.yamlfiles