Decouple repository root resolver from internal logic#2957
Merged
teresaromero merged 51 commits intoelastic:mainfrom Oct 23, 2025
Merged
Decouple repository root resolver from internal logic#2957teresaromero merged 51 commits intoelastic:mainfrom
teresaromero merged 51 commits intoelastic:mainfrom
Conversation
teresaromero
commented
Sep 25, 2025
… and update options in rally and stream runners
mrodm
reviewed
Sep 30, 2025
mrodm
reviewed
Oct 3, 2025
…factor tests and added readme note
mrodm
reviewed
Oct 7, 2025
jsoriano
reviewed
Oct 14, 2025
Member
There was a problem hiding this comment.
It looks great, it seems to solve links resolution and does a good refactor to allow injection of the path to the root repository.
I did some tests and found some issues, commented in the files, though maybe some of them can be solved in follow ups.
Many comments are nitpicking, no need to do anything about them if you prefer current code.
…use value receiver instead of pointer
… handling in tests
…th to PackageRootPath
…and update related tests
…pdate related tests
…esolve external fields
Collaborator
💚 Build Succeeded
History
|
efd6
reviewed
Oct 27, 2025
| // RootPath is the root of the package source to install. | ||
| RootPath string | ||
| // PackageRootPath is the root of the package source to install. | ||
| PackageRootPath string |
Contributor
Author
There was a problem hiding this comment.
I changed this in order to be explicit about the root this was refering too, there was the repository root and the package root.
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.
Resolves #2797
Summary
Refactored the linked files system to use explicit
os.Rootparameters for secure repository access. This change fixes a bug where linked files were copied to incorrect directories and reveals a secondary issue where external fields were resolved before linked files were included in the build bundle.Problems Fixed
Linked files copied to wrong directory: The
workDirinLinksFSwas treated inconsistently (absolute vs relative), causing incorrect path resolution. Now standardized to always be relative to repository root.External fields resolved too early: The build process resolved external fields before copying linked files, causing missing field definitions. Reordered build steps to copy linked files first.
Key Changes
Repository Root Handling:
CreateLinksFSFromPath()now requires explicit*os.Rootparameterdefer repositoryRoot.Close()API Changes:
FindPackageRoot()signature:(string, bool, error)→(string, error)ErrPackageRootNotFoundsentinel errorBuildOptions.PackageRootrenamed toPackageRootPathand addedRepositoryRootfieldOptions.RootPathrenamed toPackageRootPathand addedRepositoryRootfieldBuild Process:
ELASTIC_PACKAGE_REPOSITORY_LICENSEnow expects paths relative to repository rootBreaking Changes
Functions that previously auto-discovered repository root now require it as a parameter:
CreateLinksFSFromPath(repositoryRoot, workDir)BuildPackage()requiresRepositoryRootin optionsNewForPackage()requiresRepositoryRootin optionsTesting