feat: add unified Source interface with LocalFS implementation and SC…#32
Open
apuchmarcos wants to merge 2 commits intoAmadeusITGroup:mainfrom
Open
feat: add unified Source interface with LocalFS implementation and SC…#32apuchmarcos wants to merge 2 commits intoAmadeusITGroup:mainfrom
apuchmarcos wants to merge 2 commits intoAmadeusITGroup:mainfrom
Conversation
1atsavignac
requested changes
Feb 25, 2026
Contributor
|
Hi @apuchmarcos, |
f79b24a to
6815c55
Compare
1atsavignac
requested changes
Mar 2, 2026
6815c55 to
cb49427
Compare
📊 Coverage ReportTotal Coverage: 📋 Coverage DetailsGenerated by CI workflow |
1 similar comment
📊 Coverage ReportTotal Coverage: 📋 Coverage DetailsGenerated by CI workflow |
3e6ca69 to
4ce70f8
Compare
📊 Coverage ReportTotal Coverage: 📋 Coverage DetailsGenerated by CI workflow |
📊 Coverage ReportTotal Coverage: 📋 Coverage DetailsGenerated by CI workflow |
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
Introduces the
internal/sourcepackage : a unifiedSourceinterface that abstracts file and directory operations across different backends (LocalFS, SCM, Artifactory). This allows the rest of the codebase to reference files from different source types through a single contract.The package includes:
Sourceinterface with 6 methods:Type(),ReadFile(),WriteFile(),ReadDir(),Exists(),IsDir()Entrystruct (Name+IsDir) as a lightweight, cross-backend return type forReadDirSourceTypeenum:LocalFS,SCM,ArtifactorylocalSourceimplementation — fully functional, wraps the existingcos(afero) package, includes path-traversal protectionscmSourceskeleton compile-time interface check,WriteFilereturnserrNotSupported, all other methods log "Not Implemented" waiting future implementationEach backend uses explicit typed constructors (
NewLocalSource(path),NewSCMSource(url, ref)) rather than a generic factory, since callers always know the source type at call time.Related issues
Type of change
How to test
go test ./internal/source/... -v go vet ./internal/source/... go build ./...Checklist
make test(or equivalent) and it passed.make lint(if applicable) and it passed.Notes for reviewers
localSource.resolve()usesfilepath.Relto prevent escaping the base pathReadDirreturns[]Entryinstead of[]stringor[]os.FileInfo-> a deliberate design choice so all backends (including remote ones) can support it as not all may have access to full metadata while still providing info regarding entry being a file or a subdir