-
Notifications
You must be signed in to change notification settings - Fork 2
fix(delivery): cleanup build files for mounted volume #615
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
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d9f767d
fix(delivery): stop seed from polluting the workspace tree
skevetter 0233e84
refactor(devcontainer): centralize build-artifact handling and clean …
skevetter 948f8a8
docs: trim build-artifact handling comments to concise intent
skevetter ac30020
fix(build): skip eager artifact cleanup for dockerless builds
skevetter a7b1134
refactor(build): make artifact exclusion idempotent, drop eager cleanup
skevetter f709c89
chore: trim verbose comments added on this branch
skevetter 3c04833
fix(delivery): handle legacy seeded volumes and surface seed cleanup …
skevetter 0cc9c64
revert(delivery): drop legacy seeded-volume sentinel fallback
skevetter fe87390
chore: remove comments
skevetter 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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,25 @@ | ||
| package config | ||
|
|
||
| import ( | ||
| "os" | ||
| "path/filepath" | ||
|
|
||
| "github.com/devsy-org/devsy/pkg/log" | ||
| ) | ||
|
|
||
| var buildArtifactNames = []string{ | ||
| DevsyContextFeatureFolder, | ||
| } | ||
|
|
||
| func BuildArtifactExcludes() []string { | ||
| return append([]string(nil), buildArtifactNames...) | ||
| } | ||
|
|
||
| func RemoveBuildArtifacts(contextPath string) { | ||
| for _, name := range buildArtifactNames { | ||
| path := filepath.Join(contextPath, name) | ||
| if err := os.RemoveAll(path); err != nil { | ||
| log.Debugf("failed to remove build artifact %s: %v", path, err) | ||
| } | ||
| } | ||
| } |
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,53 @@ | ||
| package config | ||
|
|
||
| import ( | ||
| "os" | ||
| "path/filepath" | ||
| "slices" | ||
| "testing" | ||
| ) | ||
|
|
||
| func TestBuildArtifactExcludesIncludesFeatureFolder(t *testing.T) { | ||
| got := BuildArtifactExcludes() | ||
| if !slices.Contains(got, DevsyContextFeatureFolder) { | ||
| t.Errorf("expected %q in excludes, got %v", DevsyContextFeatureFolder, got) | ||
| } | ||
| } | ||
|
|
||
| func TestBuildArtifactExcludesReturnsCopy(t *testing.T) { | ||
| got := BuildArtifactExcludes() | ||
| if len(got) == 0 { | ||
| t.Fatal("expected at least one artifact") | ||
| } | ||
| got[0] = "mutated" | ||
| if BuildArtifactExcludes()[0] == "mutated" { | ||
| t.Error("BuildArtifactExcludes must return a defensive copy") | ||
| } | ||
| } | ||
|
|
||
| func TestRemoveBuildArtifacts(t *testing.T) { | ||
| contextPath := t.TempDir() | ||
| artifactDir := filepath.Join(contextPath, DevsyContextFeatureFolder) | ||
| // #nosec G301 -- test fixture | ||
| if err := os.MkdirAll(filepath.Join(artifactDir, "0"), 0o755); err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| keep := filepath.Join(contextPath, "keep.txt") | ||
| // #nosec G306 -- test fixture | ||
| if err := os.WriteFile(keep, []byte("x"), 0o644); err != nil { | ||
| t.Fatal(err) | ||
| } | ||
|
|
||
| RemoveBuildArtifacts(contextPath) | ||
|
|
||
| if _, err := os.Stat(artifactDir); !os.IsNotExist(err) { | ||
| t.Errorf("expected artifact dir removed, stat err = %v", err) | ||
| } | ||
| if _, err := os.Stat(keep); err != nil { | ||
| t.Errorf("workspace file should survive, got %v", err) | ||
| } | ||
| } | ||
|
|
||
| func TestRemoveBuildArtifactsAbsentIsNoError(t *testing.T) { | ||
| RemoveBuildArtifacts(t.TempDir()) | ||
| } |
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.