Repository navigation
fix(scaffold): preserve source in scaffold config #2869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Erik Osterman (Cloud Posse) (osterman)
merged 3 commits into
cloudposse:main
from
jorrite:fix-scaffold-source
Aug 11, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
docs/fixes/2026-08-10-scaffold-remote-source-provenance.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Fix: remote scaffold sources no longer record a dangling temp-dir path in `spec.source` | ||
|
|
||
| **Date:** 2026-08-10 | ||
|
|
||
| ## Summary | ||
|
|
||
| `atmos scaffold generate`/`atmos init` recorded a dangling, already-deleted temp-directory path in | ||
| `spec.source` of `.atmos/scaffold.yaml` whenever the template source was remote (`git::...` or a bare | ||
| `https://...` URL). `resolveRemote()` in `pkg/generator/source/resolver.go` now restores | ||
| `Configuration.Source` to the original source string the caller passed in after loading the template | ||
| config from the temporary download directory. | ||
|
|
||
| ## Context | ||
|
|
||
| - For a remote scaffold source, `resolveRemote()` downloads the template into | ||
| `os.MkdirTemp("", "atmos-scaffold-")`, then loads the config with that temp dir passed in as the | ||
| "source." `Configuration.Source` — and therefore the persisted `spec.source` — ended up holding | ||
| something like `/var/folders/xx/.../atmos-scaffold-1234567890`. `cleanup()` removes that directory | ||
| immediately after the command finishes, so the recorded provenance was a dangling reference to nothing | ||
| as soon as generation completed, contradicting `SaveProjectRecord`'s own doc comment: "spec.source and | ||
| spec.baseRef record provenance for future updates." | ||
| - Local sources (a relative/absolute path, or `file://...`) were already correct, but only by accident of | ||
| `resolveLocal` having no temp-dir indirection step, not because anything special-cased provenance for | ||
| them. | ||
| - Reproduced directly: `atmos scaffold generate "git::https://.../scaffold-template.git" ./out --defaults`, | ||
| then `cat ./out/.atmos/scaffold.yaml` showed a `/var/folders/...`/`/tmp/...` path for `spec.source` that | ||
| no longer existed on disk. | ||
| - No upstream GitHub issue; PR https://github.com/cloudposse/atmos/pull/2869 was opened directly. | ||
|
|
||
| ## Changes | ||
|
|
||
| - `pkg/generator/source/resolver.go`: in `resolveRemote()`, set `conf.Source = src` (the original source | ||
| string the caller passed in) after loading the template configuration from the temporary download | ||
| directory, instead of leaving `Configuration.Source` as whatever `LoadConfigurationFromDir` was given | ||
| (the temp dir itself). No change to `resolveLocal`, which already recorded the correct value. | ||
| - `pkg/generator/source/resolver_test.go`: added assertions that `Configuration.Source` holds the original | ||
| source for both local (`TestResolve_LocalPath`, `TestHydrate_LocalStub`) and remote paths, plus a | ||
| dedicated regression test, `TestResolve_RemoteRecordsOriginalSource`, that fails on the pre-fix code and | ||
| passes after. The remote case is exercised by serving an in-memory ZIP archive from an `httptest.Server` | ||
| rather than a git fixture — go-getter's HTTP getter unpacks the `.zip` extension on its own, so the test | ||
| never shells out to git or any other external binary and stays hermetic/cross-platform. | ||
|
|
||
| ## Validation | ||
|
|
||
| - `go test ./pkg/generator/source/...` — passes, including `TestResolve_RemoteRecordsOriginalSource`. | ||
| - Manual repro: `atmos scaffold generate "git::https://.../scaffold-template.git" ./out --defaults` followed | ||
| by `cat ./out/.atmos/scaffold.yaml` now shows the original `git::...` source string in `spec.source` | ||
| instead of the removed temp directory. | ||
|
|
||
| ## Follow-ups | ||
|
|
||
| None. |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.