镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Support DMS migration during bundle deploy - #6989

Open
shreyas-goenka wants to merge 42 commits into
shreyas-goenka_data/shreyas-goenka/dms-serial-stackfrom
shreyas-goenka_data/shreyas-goenka/dms-deploy-migration
Open

shreyas-goenka wants to merge 42 commits into
shreyas-goenka_data/shreyas-goenka/dms-serial-stackfrom
shreyas-goenka_data/shreyas-goenka/dms-deploy-migration

Conversation

@shreyas-goenka

@shreyas-goenka shreyas-goenka commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Stack

  1. Let deployment history config override the environment #7045 — config/environment precedence
  2. Persist the DMS version in resources.json serial #7046 — persist DMS serial
  3. Support DMS migration during bundle deploy #6989 — existing-bundle migration (this PR)

This PR is based on #7046. Configuration precedence and serial persistence are reviewed in the preceding PRs; the remaining diff is migration and the remote-state selection required to decide when migration runs.

Human description:

This PR:

  1. Adds support for disabling DMS when experimental.deployment_history: false is set, same as bundle.direct.
  2. Adds support to automatically mgirate a bundle when this option is set. All migration happens in a new version, with the INITIAL_REGISTER action type and then the rest of the deployment happens in a new version.

AI summary

Changes

Before migration, copy remote resources.json to resources.json.backup. Register its resources using INITIAL_REGISTER in version max(direct serial, last DMS version) + 1, complete that version, then run the deployment in the following version when operations exist. Preserve resource IDs, state, and dependencies, and log the migration and deployment URLs separately.

A remote state file without the history marker triggers migration even when DMS already has versions. State selection therefore uses the remote marker rather than a stale local cache. The serial is persisted by #7046 but remains a cache of the service-owned version.

Saved direct-state plans cannot yet be applied during migration; the TODO records this as a blocker for automatic migration after GA. No special DMS initialization is added to bundle debug states; the new cache test uses --force-pull.

Tests

  • Initial migration creates registration/deployment versions 2/3; repeated migration creates 4/5.
  • API readbacks verify completed operations, preserved IDs/state/dependencies, and updated DMS state.
  • Backups match the imported state byte-for-byte and repeated migration overwrites the original backup with the latest snapshot.
  • Package tests and Go lint pass on Go 1.26.9.
  • State/DMS: 40 directories, 56 variants; inline scripts: 8 directories, 16 variants. Telemetry and workspace-import checks also pass, with zero skips.

Implemented with Codex, using Astra for planning and Sol subagents for implementation and testing.

@github-actions github-actions Bot added the DABs DABs related issues label Oct 8, 2026
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: f90499d

Run: 38570293103

Env ❌​FAIL 🔄​flaky ✅​pass 🙈​skip Time
❌​ aws linux-2core-8gb 5 296 25 16:34
❌​ aws-windows-latest-4core-16gb 5 298 23 16:20
❌​ azure linux-2core-8gb 5 295 25 20:02
❌​ azure-windows-latest-4core-16gb 5 1 296 23 17:43
❌​ gcp linux-2core-8gb 5 296 25 18:05
❌​ gcp-windows-latest-4core-16gb 5 298 23 17:52
6 interesting tests: 5 FAIL, 1 flaky
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
❌​ TestAccept ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
❌​ TestAccept/bundle/dms/existing-state ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
❌​ TestAccept/bundle/dms/existing-state/DMS= ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
❌​ TestAccept/bundle/dms/repeated-migration ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
❌​ TestAccept/bundle/dms/repeated-migration/DMS=true ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
🔄​ TestSyncFullFileSync ✅​p ✅​p ✅​p 🔄​f ✅​p ✅​p
Top 11 slowest tests (at least 2 minutes):
duration env testname
2:35 azure-windows-latest-4core-16gb TestAccept/bundle/dms/stale-local-state/DMS=
2:35 gcp-windows-latest-4core-16gb TestAccept/bundle/dms/successful-recreate/DMS=true
2:25 gcp-windows-latest-4core-16gb TestAccept/bundle/dms/stale-local-state/DMS=
2:24 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsRead
2:17 gcp linux-2core-8gb TestAccept/bundle/dms/stale-local-state/DMS=
2:13 gcp linux-2core-8gb TestAccept/bundle/dms/successful-recreate/DMS=true
2:12 aws-windows-latest-4core-16gb TestAccept/bundle/dms/declined-deploy/DMS=true
2:12 aws-windows-latest-4core-16gb TestAccept/bundle/dms/stale-plan/DMS=true/READPLAN=
2:10 aws-windows-latest-4core-16gb TestAccept/bundle/dms/successful-recreate/DMS=true
2:08 gcp linux-2core-8gb TestImportDirWithOverwriteFlag
2:02 azure-windows-latest-4core-16gb TestAccept/bundle/dms/declined-deploy/DMS=true

@shreyas-goenka
shreyas-goenka marked this pull request as ready for review October 12, 2026 15:27
@shreyas-goenka
shreyas-goenka requested review from a team as code owners October 12, 2026 15:27
Comment thread cmd/bundle/debug/states.go Outdated
}
// Deployment history reads remote state even without --force-pull.
t0 := time.Now()
phases.Initialize(ctx, b)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we call Initialize() in PostInitFunc?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make debug states work for DMS. Without this, if you don't specify --force-pull this command would not pull in remote state.

This bit was added to make some tests work that rely on the debug state pulling remote state work with DMS as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For DMS the point of --force-pull is moot, right? Can we update here:

SkipInitialize: !forcePull && !IsDMS,

?

@denik

denik commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Adds support for disabling DMS when experimental.deployment_history: false is set, same as bundle.direct.

This seems a bit narrow? In direct we have env var and config setting. Config setting is consulted first, then env var, then state-derived, then the default.

Important also that state is sticky, so if you are on DMS and neither config nor env var are set, you still remain on DMS and not migrated back. Do we have that?

The config setting/env var/stickiness is complex enough so that it warrants its own PR, what do you think?

func PullResourcesState(ctx context.Context, b *bundle.Bundle, alwaysPull AlwaysPull) *StateDesc {
var err error

// We read all 4 possible states: terraform/direct X local/remote and pick the most recent one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this comment removed, is it not relevant anymore?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit outdated. We prioritize DMS even when local states have a higher serial (because for DMS, resources.json does not have a serial)

This actually highlights a gap. If a user has DMS, removes the config, has a outdated local resources.json and then does a deployment, they'll end up overriding the DMS feature.

I think we need to keep serial around in resources.json to mitigate this. Otherwise this problem does not go away.

@shreyas-goenka
shreyas-goenka changed the base branch from main to shreyas-goenka_data/shreyas-goenka/dms-serial-stack October 14, 2026 12:22
@shreyas-goenka
shreyas-goenka added this pull request to stack #7047 October 14, 2026 12:22

This branch has not been deployed

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

Labels

DABs DABs related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants