-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
mage: optionally mount module cache for crossbuild #16837
Merged
Merged
Conversation
This file contains 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
Introduce another mage variable, CrossBuildMountModcache, which defaults to false. When set to true, the host's module cache ($GOPATH/pkg/mod) will be mounted into the crossbuild Docker containers, read-only. To ensure the cache is up-to-date, we run "go mod download" on the host before starting the Docker containers. Also, fix buildGoDaemon to stop assuming that tsg/go-daemon is vendored. Instead, use "go list -m github.com/tsg/go-daemon" to find the directory in either the vendor directory or the module cache.
axw
force-pushed
the
mage-crossbuild-modcache
branch
from
March 6, 2020 01:58
9a07d2e
to
3b388ee
Compare
gotool.ListModulePath wipes out the GOFLAGS environment variable, to force looking in the module cache unless otherwise specified. This breaks findElasticBeatsDir for community beats that vendor libbeat. In this case, we should explicitly pass "-mod=vendor" when UseVendor is true.
4 tasks
kvch
reviewed
Mar 6, 2020
kvch
approved these changes
Mar 6, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the changes, it is ready to go.
Rather than having arguments for ListModulePath, create separate functions for listing in the module cache and vendor directory. Create an unexported function in dev-tools/mage which calls the appropriate one depending on the value of UseVendor.
axw
force-pushed
the
mage-crossbuild-modcache
branch
from
March 6, 2020 10:01
46cc306
to
95f21ec
Compare
Inline defaultConfigFileParams, otherwise the OSSBeatDir and LibbeatDir calls end up calling ElasticBeatsDir at package init time, before apm-server uas an opportunity to set UseVendor=false.
axw
commented
Mar 6, 2020
axw
commented
Mar 6, 2020
axw
added a commit
to axw/beats
that referenced
this pull request
Mar 11, 2020
* mage: optionally mount module cache for crossbuild Introduce another mage variable, CrossBuildMountModcache, which defaults to false. When set to true, the host's module cache ($GOPATH/pkg/mod) will be mounted into the crossbuild Docker containers, read-only. To ensure the cache is up-to-date, we run "go mod download" on the host before starting the Docker containers. Also, fix buildGoDaemon to stop assuming that tsg/go-daemon is vendored. Instead, use "go list -m github.com/tsg/go-daemon" to find the directory in either the vendor directory or the module cache. Rather than having arguments for ListModulePath, create separate functions for listing in the module cache and vendor directory. Create an unexported function in dev-tools/mage which calls the appropriate one depending on the value of UseVendor. We now use this in "findElasticBeatsDir". Inline defaultConfigFileParams, otherwise the OSSBeatDir and LibbeatDir calls end up calling ElasticBeatsDir at package init time, before apm-server uas an opportunity to set UseVendor=false. (cherry picked from commit bbf9d66)
2 tasks
axw
added
v7.7.0
and removed
needs_backport
PR is waiting to be backported to other branches.
labels
Mar 11, 2020
axw
added a commit
that referenced
this pull request
Mar 12, 2020
* mage: optionally mount module cache for crossbuild Introduce another mage variable, CrossBuildMountModcache, which defaults to false. When set to true, the host's module cache ($GOPATH/pkg/mod) will be mounted into the crossbuild Docker containers, read-only. To ensure the cache is up-to-date, we run "go mod download" on the host before starting the Docker containers. Also, fix buildGoDaemon to stop assuming that tsg/go-daemon is vendored. Instead, use "go list -m github.com/tsg/go-daemon" to find the directory in either the vendor directory or the module cache. Rather than having arguments for ListModulePath, create separate functions for listing in the module cache and vendor directory. Create an unexported function in dev-tools/mage which calls the appropriate one depending on the value of UseVendor. We now use this in "findElasticBeatsDir". Inline defaultConfigFileParams, otherwise the OSSBeatDir and LibbeatDir calls end up calling ElasticBeatsDir at package init time, before apm-server uas an opportunity to set UseVendor=false. (cherry picked from commit bbf9d66)
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.
What does this PR do?
Introduce another mage variable,
CrossBuildMountModcache
,which defaults to false. When set to true, the host's
module cache (
$GOPATH/pkg/mod
) will be mounted into thecrossbuild Docker containers, read-only. To ensure the
cache is up-to-date, we run
go mod download
on the hostbefore starting the Docker containers.
Also, fix
mage buildGoDaemon
to stop assuming thattsg/go-daemon is vendored. Instead, use
go list -m github.com/tsg/go-daemon
to find the moduledirectory in either the vendor directory or the module cache.
Why is it important?
This is necessary to support beats that do not use vendoring, such as apm-server.
Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration files- [ ] I have added tests that prove my fix is effective or that my feature worksHow to test this PR locally
cd filebeat && PLATFORMS=linux/amd64 mage package