Migration Steps

Prerequisites

Before migrating, ensure you have:

  • Copier 9.17.0+ installed (pipx or Docker)

  • Git repository with all changes committed (copier requires clean working directory)

Step 1: Install Copier

# Install pipx if needed (macOS)
brew install pipx
pipx ensurepath

# Install Copier
pipx install copier

# Verify
copier --version  # Should be 9.17.0+

See Copier Installation Guide for Docker and other options.

Step 2: Commit Current State

Copier requires a clean git working directory:

cd my-service
git add -A && git commit -m "Pre-migration state"

Step 3: Run Copier Template

Run the DevOps template on your existing project:

copier copy https://coderepo.mobilehealth.va.gov/scm/ckm/ngss-devops-template.git . --trust

The template will:

  • Auto-detect settings from your pom.xml (artifactId, groupId, version)

  • Detect existing configurations where possible (Dynatrace labels, skaffold profiles, etc.)

  • Prompt for configuration values with detected defaults

Step 4: Answer Configuration Questions

The template prompts for several configuration values. Most have auto-detected defaults shown in brackets.

Project Information

🎤 Maven artifactId (service name) [my-service]:
🎤 DTR organization prefix [ckm]:
🎤 Service version [1.0.0-SNAPSHOT]:
🎤 Project Type (service, web, library) [service]:
🎤 Major version (e.g., v1) [v1]:
🎤 Coderepo Bitbucket Project Key [ckm]:
Press Enter to accept the auto-detected default shown in brackets.

VAEC Cost Allocation Labels

These labels are required for AWS EKS cost attribution:

🎤 CKID (Cost Key ID) from ECSO Tenant Registration: <your-ckid>
🎤 VASI (Tenant ID) from ECSO Tenant Registration: <your-vasi>
🎤 Product name (e.g., Telehealth, VAOS, RxRefill): <your-product>
🎤 Product line (e.g., DHAS, VHA, Scheduling, OIT): <your-product-line>
🎤 Application service type (e.g., Backend, Frontend, API) [Backend]:
🎤 Application name [my-service]:
🎤 Service short name for Dynatrace labels [ms]:
If you have existing Dynatrace labels in your Kubernetes manifests, these values may be auto-detected.

Skaffold Profile Selection

Enable the profiles your project needs:

🎤 Include dev-with-dependencies profile? [Y/n]:
🎤 Include map-sandbox-deploy profile? [y/N]:
🎤 Include map-staging-deploy profile? [Y/n]:
🎤 Include sandbox-build-test profile? [Y/n]:
🎤 Include staging-build-test profile? [Y/n]:
🎤 Include debug-all profile? [y/N]:
🎤 Include map-prod-deploy profile? [Y/n]:
🎤 Include vault-test profile? [y/N]:

Service Dependencies (if dev-with-dependencies enabled)

If you enabled dev-with-dependencies, you’ll be prompted for dependencies:

🎤 List of service dependencies (YAML list format):
   - ckm/service-a:v1.0.0
   - ckm/service-b
You can also manage dependencies later via .copier-answers/service-dependencies.yaml.

Step 5: Review and Resolve Conflicts

Copier uses 3-way merge to intelligently handle conflicts between your existing files, the old template version, and the new template version.

For each conflicting file, Copier will prompt you:

Conflict in kubernetes/components/dev/overrides.env:
  [y] Overwrite with new template version
  [n] Keep your current version
  [d] Show diff between versions
  [e] Edit file manually to resolve

Recommended approach:

  1. Press d to view the diff first

  2. If your customizations should be preserved, press n or e

  3. If the template change is needed, press y

You can also use git diff (or use your favorite diff viewer) to review changes after the Copier run and select each change you want to keep for each changed file.

Common files with customizations to watch for:

  • kubernetes/components/dev/overrides.env - Environment variables

  • kubernetes/dev-with-dependencies/kustomization.yaml - Service dependencies

  • skaffold.yaml - Custom build/deploy configurations

Step 6: Validate and Test

# Validate skaffold configuration
./scripts/validate-skaffold.sh

# Test local deployment with dependencies
skaffold dev

Step 7: Commit Migration

git add -A
git commit -m "Migrate to filegen 6.0 / Copier templates

- Added Copier-based DevOps generation
- Added .copier-answers/devops.yaml for future updates"

VAEC Labels Reference

The following labels are added to all deployments for AWS cost allocation:

Label Purpose

vaec-map/ckid

CKM project identifier (Cost Key ID)

vaec-map/vasi

VA System Identifier (Tenant ID)

vaec-map/product

Product name

vaec-map/product-line

Product line grouping

vaec-map/application-service

Application service type (Backend, Frontend, API)

vaec-map/application-name

Full application name

These labels appear in both metadata.labels and spec.template.metadata.labels of deployments.

Updating After Migration

Once migrated, use Copier’s update command to incorporate template improvements:

# Copier CLI - Check for updates
copier check-update -a .copier-answers/devops.yaml .

# Copier CLI - Apply updates (with 3-way merge)
copier update -a .copier-answers/devops.yaml

# Maven equivalent
mvn filegen:copier-update -Dcopier.template=devops

# Copier CLI - Re-answer specific questions
copier update --ask version --ask vaec_vasi -a .copier-answers/devops.yaml --skip-answered

# Copier CLI - Provide new answers to specific questions
copier update --data vaec_vasi="4334" -a .copier-answers/devops.yaml --skip-answered

# Maven - Update all Copier templates at once
mvn filegen:copier-update
See the full Copier Update CLI for more options.

Copier’s 3-way merge will:

  1. Compare your current files with the original template version you started from

  2. Compare with the new template version

  3. Automatically merge non-conflicting changes

  4. Prompt you to resolve actual conflicts

Next Steps