The kdx sync command enables GitOps workflows for Kodexa platform metadata. Store your organization and project configurations in version control, review changes through pull requests, and promote configurations across environments with confidence.
Tag mappings work the same way as branch mappings but trigger on git tags instead of branches. This is especially useful for release workflows:
Copy
Ask AI
tag_mappings: # Release tags deploy to production - pattern: "v*" targets: - target: shared environment: prod - target: division-a environment: prod # Release candidates deploy to staging - pattern: "rc-*" targets: - target: shared - target: division-a environment: staging # Beta tags deploy to dev - pattern: "beta-*" target: development environment: dev
You can use both branch_mappings and tag_mappings in the same configuration. When using --tag or --branch flags, automatic git detection is overridden with your specified value.
The deploy command automatically determines what to deploy based on your current git branch or tag:
Copy
Ask AI
# Auto-deploy based on current git branchkdx sync deploy# Preview without making changeskdx sync deploy --dry-run# Ask for confirmation before deployingkdx sync deploy --confirm-all# Ask before each target deploymentkdx sync deploy --confirm-each
How it works:
Detects current git branch (or tag if specified with --tag)
Matches branch against branch_mappings or tag against tag_mappings patterns
Deploys all specified targets to their environments
Reports results for each target
Manual branch override (NEW in v0.5.0):
Copy
Ask AI
# Deploy using specific branch pattern (without switching branches)kdx sync deploy --branch main# Test feature branch deployment without creating branchkdx sync deploy --branch feature/test --dry-run
Tag-based deployment (NEW in v0.5.0):
Copy
Ask AI
# Deploy using tag patternkdx sync deploy --tag v1.5.0# Preview tag deploymentkdx sync deploy --tag rc-1 --dry-run
Manual deployment (override automatic detection):
Copy
Ask AI
# Deploy specific target to specific environmentkdx sync deploy --target shared --env prod# Deploy using a specific branch mapping (override auto-detection)kdx sync deploy --branch release/v1.0# Deploy using a specific tag mappingkdx sync deploy --tag v1.0.0# Deploy multiple targetskdx sync deploy --target division-a --env devkdx sync deploy --target division-b --env dev
Speed up deployments by processing multiple resources in parallel:
Copy
Ask AI
# Deploy with 8 parallel threads (recommended for large deployments)kdx sync deploy --threads 8# Default is 1 (sequential) for backwards compatibilitykdx sync deploy --threads 1
Using --threads 8 can significantly reduce deployment time for repositories with many resources. The optimal number depends on your system and network conditions.
Deploy only specific resources matching a pattern:
Copy
Ask AI
# Deploy only resources matching "invoice-*"kdx sync deploy --filter "invoice-*"# Filter with dry-run to preview what would be deployedkdx sync deploy --filter "prod-*" --dry-run# Combine filter with parallel executionkdx sync deploy --filter "division-a-*" --threads 4
The filter applies to resource slugs. If your filter doesn’t match any resources, the deploy will complete with no changes. Use --dry-run to verify your filter pattern first.
Download resources from an environment to local files:
Copy
Ask AI
# Pull resources defined in a target from an environmentkdx sync pull --target shared --env dev# Pull from different environmentkdx sync pull --target division-a --env prod
What pull does:
Reads target’s manifests to determine what resources to fetch
Connects to source environment
Downloads each resource from the API
Writes YAML files to local filesystem (default: kodexa-resources/)
# Revert to previous versiongit revert HEAD# Or reset to specific commitgit reset --hard abc1234# Push reverted state back to environmentkdx sync deploy --env prod --target my-org
Combine multiple manifests for flexible resource grouping:
Copy
Ask AI
targets: division-a: organization: acme-division-a manifests: - manifests/shared.yaml # Core resources used by all - manifests/common-types.yaml # Common to division A - manifests/division-a.yaml # Division A specific
This allows:
Shared resources defined once, reused across divisions
The referenced environment variable must be exported:
Copy
Ask AI
# Check if variable is setecho $KODEXA_DEV_API_KEY# Set it in your shellexport KODEXA_DEV_API_KEY="your-api-key-here"# Or add to your shell profile (~/.bashrc or ~/.zshrc)echo 'export KODEXA_DEV_API_KEY="your-api-key"' >> ~/.bashrc
“No branch mapping found” or “No tag mapping found”
Either specify target/environment manually, use override flags, or add appropriate mappings:
Copy
Ask AI
# Option 1: Manual override (no mapping needed)kdx sync deploy --target my-org-dev --env dev# Option 2: Use branch override (NEW in v0.5.0)kdx sync deploy --branch main# Option 3: Use tag override (NEW in v0.5.0)kdx sync deploy --tag v1.0.0# Or add branch/tag mapping
Resolution with branch mapping:
Copy
Ask AI
branch_mappings: - pattern: "feature/test" # Exact match target: my-org-dev environment: dev - pattern: "feature/*" # Wildcard pattern target: my-org-dev environment: dev
Resolution with tag mapping (NEW in v0.5.0):
Copy
Ask AI
tag_mappings: - pattern: "v*" # Any version tag target: my-org-dev environment: prod - pattern: "v*-rc*" # Release candidates target: my-org-dev environment: staging
Check your API key is correct and has proper permissions:
Copy
Ask AI
# Verify environment variable is setecho $KODEXA_DEV_API_KEY# Test API access directlycurl -H "Authorization: Bearer $KODEXA_DEV_API_KEY" \ https://dev.kodexa.ai/api/workspaces# Update API key if neededexport KODEXA_DEV_API_KEY="new-api-key"
Make incremental changes rather than large batches:
Copy
Ask AI
# Good: one taxonomy at a timegit commit -m "Add invoice classification taxonomy"# Avoid: many unrelated changesgit commit -m "Update all taxonomies, stores, and projects"
# Goodgit commit -m "Add OCR feature instance for production environment"# Bettergit commit -m "feat: add OCR feature instance for production- Configured with high-accuracy model- Enabled for invoice-automation project- Memory limit set to 4GB"