-
Notifications
You must be signed in to change notification settings - Fork 117
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
Add location library to elastic-package #303
Add location library to elastic-package #303
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪 |
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.
I also chose not to touch internal/install/install.go here, as that file is particularly tied up with the newer profile library, and if I update that in the next PR with internal/profile, I won't have an ugly merge operation on my hands.
I understand your concerns regarding hard merge operation, but unfortunately this is the way how we should perform refactoring operations - it's not just about breaking the bigger PR into pieces. I think you should remove the refactored code as part of this PR.
Please remember that the PR shouldn't just introduce a dead code, but it must provide an added value for the end-user or at least be used by other internals.
internal/cleanup/service_logs.go
Outdated
@@ -8,15 +8,15 @@ import ( | |||
"github.com/pkg/errors" | |||
|
|||
"github.com/elastic/elastic-package/internal/files" | |||
"github.com/elastic/elastic-package/internal/install" | |||
"github.com/elastic/elastic-package/internal/locations" |
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.
I'm not sure if internal/locations
is the correct place for this feature. This is a configuration that's strongly related to app configuration. I would be for placing it all together under internal/configuration
, so we may have:
internal/configuration/locations
internal/configuration/profiles
internal/configuration/stack
In this case the goal would be transforming the internal/install
into something more sophisticated that can deal with profiles and config extensions.
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.
That makes sense. Should we do that as part of this PR, or later?
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.
As you're adding locations
, I think you can adapt it already.
…tic-package into locations-refactor
I'm not sure what you're referring to @mtojek ? Just keep |
internal/cleanup/service_logs.go
Outdated
@@ -8,15 +8,15 @@ import ( | |||
"github.com/pkg/errors" | |||
|
|||
"github.com/elastic/elastic-package/internal/files" | |||
"github.com/elastic/elastic-package/internal/install" | |||
"github.com/elastic/elastic-package/internal/locations" |
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.
As you're adding locations
, I think you can adapt it already.
Currently |
@mtojek I moved around |
Cool! Please address also other comments and let me know when it's ready for re-review. |
Alright, that should be everything. |
You might need to run |
Figured I was forgetting something... |
@ycombinator can you tell if the CI issues are something I did? I'm trying to replicate it, the development files are there. |
@fearful-symmetry It looks like one of the system tests for the |
I tried to reproduce the failure locally by building
And the tests passed. So I'm going to tickle CI on this PR again and see what happens. |
jenkins, run the tests please |
Same test failed again. I'm going to try and dig into it more deeply locally and see if something turns up. |
Ok, it seems that it's related to this PR, will try to reproduce it locally. |
I think I found the problem, it seems to be related with volume's source. Take a look at paths. The
The elastic-agent's container has the following definition:
The volume's source is relative. I suspect that this path can't be found. |
That's odd. That path makes sense, and nothing in the code that would change it. |
Okay, I'm still baffled by the kibana errors. The path that @mtojek pointed to seems fine, the mount and files all exist and are pointing to the correct location. I can't see anything weird in the kibana install itself. |
I think you can ignore these Kibana errors: Regarding failed tests - I did a short test:
The directory exists.
The mounted directory will disappear, but it should be present and contain log files:
|
@mtojek I can't seem to reproduce that. |
I meant the directory inside the agent's container ( |
Yah, that's what I was referring to. I assume whatever is removing that directory isn't being run because the |
The system test runner fails because it expects some access logs to be present in that directory. Unfortunately the entire directory is deleted, but in fact the tool should delete only it's content. You can compare the behavior and paths in your PR and master build. This can be a reference point: https://github.com/elastic/elastic-package/blob/master/internal/testrunner/runners/system/servicedeployer/compose.go#L55 EDIT: Maybe the path which is passed doesn't exist. Sounds to me like something to debug. |
Well, I'm still not sure what's up with the Here's what the mounts look like:
and
|
So you can see that |
Yah, something odd is going on inside that directory. Whatever I add from the docker host in I assume this is a config issue with docker-compose somehow, gonna tinker around after I get lunch. |
@mtojek so, I did some more tinkering around, and it seems like the |
So, after the second container spins up, the link of the directory seems to get nuked: before:
After:
|
The weird part is I can't reproduce this by manually starting up the docker container for apache:
|
Okay, think I figured it out. I was passing the wrong directory to the version check, so it was re-installing elastic-package every time. |
return filepath.Join(loc.stackPath, serviceLogsDir) | ||
} | ||
|
||
// ConfigurationDir returns the configuration directory location |
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.
// ConfigurationDir returns the configuration directory location | |
// configurationDir returns the configuration directory location |
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.
LGTM but please wait for @mtojek's review as well as he was actively reviewing this PR. Thanks!
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.
Nice! I think you can proceed with the next PR.
@fearful-symmetry Once this PR is merged could you please open a PR to elastic/integrations to get this change in (update dependency on elastic-package)? We need to be sure that it doesn't affect integrations. |
This is my attempt at "breaking up" #301 into more manageable parts. This is the first part, which is breaking up
internal/install
to create a locations library.Right now,
internal/install
is taking on the role of managing the locations of all the files thatelastic-package
cares about. In an attempt to limit the duties ofinstall
to just installing things, and also to prepare for theinternal/profile
package that'll come right after this, we're adding ainternal/location
library that's solely responsible for owning where things are on the filesystem.The fact that we have multiple methods for accessing some of the file paths is due to
internal/install/install.go
, which is the only library that cares about numerous file locations throughout~/.elastic-package
, so I decided to give it a provider.I also chose not to touch
internal/install/install.go
here, as that file is particularly tied up with the newerprofile
library, and if I update that in the next PR withinternal/profile
, I won't have an ugly merge operation on my hands.