feat: add ability to deploy Docker Swarm stacks from Git repo with GitOps updates (#2386)#2412
Merged
kmendell merged 10 commits intoApr 21, 2026
Merged
Conversation
…emove unreachable code
- Reset dialogTargetType when opening the edit dialog to prevent create-mode state from leaking into sync updates. - Rename performSingleFileSync to performSingleFileSyncInternal to follow internal function naming conventions. - Remove redundant targetType logging in the single file sync path.
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.
Checklist
mainbranchWhat This PR Implements
This PR implements full GitOps synchronization support for Docker Swarm Stacks in Arcane. Previously, Swarm stacks could only be created via the web UI or templates natively. This addition brings Swarm deployments up strictly to parity with local projects, allowing users to select a Git repository as the source of truth for their Swarm stack configurations, complete with external
.env,configs, andsecretsresolution natively from the repository.Addresses #2386
Fixes:
Changes Made
target_typecolumn to thegitops_syncsdatabase model and created corresponding047SQL schema migrations for both PostgreSQL and SQLite. This explicitly categorizes sync targets as eitherprojectorswarm_stack.performSwarmStackSyncdynamically without requiring new huma handler endpoints. Constructor injectedSwarmServicesafely intoGitOpsSyncService.WorkingDir): Fixed a significant issue holding back Swarm stack replication by passing the cloned Git repository folder explicitly down tolibswarm.DeployStackasWorkingDir. This allows Swarm stacks to seamlessly load.envvariables and relatedconfigs:directly from sibling Git files.service does not have a previous specbug that surfaces when doing rolling registry updates. Intercepted the crash and seamlessly retried the update with a cleared registry map (matching the official Docker CLI architecture).GitOpsSyncFormSheetgracefully using strict Svelte 5$props()and$derived()reactivity without polluting global stores.Testing
just test backendjust lint frontend.envmappings; verified Docker daemon retry-logic successfully updated existing specs natively lacking registry metadata.AI Tool Used
AI Tool: Google DeepMind Antigravity
Assistance Level: Significant
Additional Notes
Supersedes #2234 as this will keep Swarm Stacks as a first class citizen and maintain them as separate entities (
docker compose upvsdocker stack deploy)Disclaimer Greptiles Reviews use AI, make sure to check over its work.
To better help train Greptile on our codebase, if the comment is useful and valid Like the comment, if its not helpful or invalid Dislike
To have Greptile Re-Review the changes, mention
greptileai.Greptile Summary
This PR adds GitOps synchronization support for Docker Swarm stacks, bringing them to parity with project-based syncs. It adds a
target_typecolumn togitops_syncs, wiresSwarmServiceintoGitOpsSyncService, passes the cloned repo path asWorkingDirto resolve.env/configsfrom sibling files, and includes a retry workaround for the Docker daemon "service does not have a previous spec" bug.The three concerns raised in prior review threads (dead-code
swarm_stackguard inperformSingleFileSyncInternal, missingInternalsuffix, and$state-in-$effect) all appear addressed in this revision.Confidence Score: 5/5
Safe to merge; all previous P0/P1 concerns are resolved and the two remaining findings are non-blocking P2 suggestions.
No P0 or P1 findings remain. The two open comments are both P2: a missing exhaustive switch for TargetType (silent fallthrough is safe but ambiguous) and a missing QueryRegistry=false on the Docker retry path (only relevant for private-registry always-resolve mode). Neither blocks functionality for the primary user path.
backend/pkg/libarcane/swarm/stack_deploy_engine.go — Docker retry path; backend/internal/services/gitops_sync_service.go — TargetType dispatch.
Comments Outside Diff (1)
frontend/src/routes/(app)/environments/[id]/gitops/+page.svelte, line 87-90 (link)dialogTargetTypenot reset when opening the edit dialogopenCreateSyncDialogwrites todialogTargetType, butopenEditSyncDialognever resets it. If a user lands on this page via?action=create&targetType=swarm_stack(triggering a swarm-stack create), then without reloading navigates to edit an existing project sync, the stale'swarm_stack'value is forwarded to the dialog and included in the update payload (targetType: 'swarm_stack'). The backend'sUpdateSynchandler will then overwritetarget_typeto"swarm_stack"on a project-type sync, causing the next sync run to callperformSwarmStackSyncInternalon a record that was never a swarm stack.Prompt To Fix With AI
Prompt To Fix All With AI
Reviews (3): Last reviewed commit: "fix: clean up duplicate sql migrations f..." | Re-trigger Greptile