Repository navigation
feat: keep compose edits on Apply with a 3-way merge - #112
Merged
Merged
Conversation
Apply used to overwrite the deployed compose file, so an operator lost every edit. This ports the behavior of the ScaleTail stack update script (tailscale-dev/ScaleTail#404) into Tailarr. - Deploy and Apply record the catalog compose file as .tailarr.compose.base.yaml. Apply merges the catalog change into the deployed file with git merge-file, run with the hardened git setup and without user or system git config. - A conflict refuses Apply before any write and never writes conflict markers. The error says how to get past it. - A deployment without a base (older Tailarr) gets the catalog file once, and the output names the backup that holds the old file and says whether settings or only comments differed. - The base is part of the Apply snapshot, so a failed Apply rolls it back and the next Apply still sees the catalog change. - The compose file is still written in place, so its inode survives. - The preview shows the diff to the merged result, labels the file as merged, replaced, or conflict, and names .env keys the catalog dropped. - New .env keys bring the template comment lines above them. A key the operator commented out is not added again.
Every ScaleTail template ships optional keys as commented-out lines, so skipping a key that the deployed .env has only commented out would block the catalog from ever turning one on. Drop that rule and keep the template comments for new keys. Make the first-Apply notice and the preview note conditional on the operator having edited the file.
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
Brings the behavior of the ScaleTail stack update script (tailscale-dev/ScaleTail#404, still open) into Tailarr. Before this change, Apply
overwrote the deployed compose file, and the README told operators to copy their edits to a safe place first.
Mapping of ScaleTail #404 to Tailarr
Ported:
git merge-file: your file, the saved upstream copy, the new upstream file. Deploy and Apply save the catalog composefile as
.tailarr.compose.base.yaml. Git runs with the hardened setup (own process group, timeout, interrupt context, filtered env) andwithout user or system git config.
old file.
.envkeys come with the template comment lines above them.Already in Tailarr:
## Upgradingnotes, the list of new.envkeys, and validation bypullandupwithrollback.
Different on purpose:
compose upright after the merge, so it never writes conflict markers. The errorsays how to get past it: undo the edit in those lines, or delete the base file to take the catalog file.
SERVICErename keeps the deployed value (MergeEnv keeps a local non-empty value), so no--forceis needed. A test covers it..envhas only commented out. All 135 catalog templates ship commented-out keys, so that rulewould block the catalog from ever turning one on. A test guards this.
Safety
(
TestApplyFailureRollsBackComposeBase).merged,replaced,conflict, ormode. It also names deployed.envkeys that the template does not have.Verification
go test -race ./...andgo test -race -tags integration ./...(live Docker 29.9.1): pass.go vet,gofmt -l,golangci-lint run(0 issues),rumdl check .,go mod tidydiff: clean.govulncheck ./...withGOTOOLCHAIN=go1.27.3(the CIGO_VERSION): no vulnerabilities. The local 1.27.1 toolchain reports twostdlib CVEs that 1.27.3 fixes.
version.gois not changed.