Skip to content
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

Support custom packages path #525

Merged
merged 15 commits into from
Jun 23, 2020

Conversation

mtojek
Copy link
Contributor

@mtojek mtojek commented Jun 18, 2020

This PR add support for multiple paths with packages.

Issue: #505

@mtojek mtojek requested a review from ruflin June 18, 2020 10:02
@mtojek mtojek self-assigned this Jun 18, 2020
@mtojek mtojek marked this pull request as draft June 18, 2020 10:02
@elasticmachine
Copy link

elasticmachine commented Jun 18, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #525 updated]

  • Start Time: 2020-06-23T07:24:00.754+0000

  • Duration: 8 min 53 sec

Test stats 🧪

Test Results
Failed 0
Passed 105
Skipped 0
Total 105

@mtojek mtojek marked this pull request as ready for review June 18, 2020 13:27
Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change LGTM. We can still iterated on my comments below later.

One thing I don't like too much is that the multiple paths add complexity in too many different places but I'm sure we find ways moving forward to simplify / unify it.

Also as a follow up, it could be worth adding a test case for the multi path support so we don't break it.

@@ -0,0 +1,7 @@
public_dir: ./public
packages_paths:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm torn if we should call it package_paths?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed.

)

func Build() error {
packagePathsEnv := os.Getenv("PACKAGE_PATHS")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to support this in the future directly in the registry to pass in an env variable for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add it in the future, but the goal is to use the config file. If you prefer, we can create a new issue to read same configuration from environment variables, but not sure if there is a specific use case. In all cases I'm aware you can depend on the config.yml file.

@@ -37,7 +38,7 @@ var (
configPath = "config.yml"

defaultConfig = Config{
PublicDir: "public",
PublicDir: "./public", // left for legacy purposes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious which legacy part you are referring to here? Do we need it somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every piece of software that mounts directory for packages, e.g. all testing environments where package path is mounted as /public.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume we should update these accordingly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's for legacy purposes. Thanks for this line, I will work for configuration files defining /public directory.

The package directory is appended here: https://github.com/elastic/package-registry/blob/master/main.go#L126

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I miss what legacy purpose means in this context. All the registries and builds which are run are currently under our control so we can get rid of the public path there and remove it. But I assume I miss something?

My goal is that as soon as we hit 7.9, we don't have legacy code inside as we will build up more then enough in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means that we need to remove all references to public from these places:
https://github.com/elastic/integrations/blob/master/testing/environments/snapshot.yml#L47
https://github.com/elastic/package-storage/blob/master/testing/environments/snapshot.yml#L43

and notify people to update their workplaces, because the package-registry will not support this anymore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will open PR's to adjust these accordingly. I expect that all devs building packages at the moment update to the most recent changes at least with the updates of the snapshot build.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the missing bit on my end. We don't provide any other default at the moment. My proposal would be to use ./packages as default?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened #551 as an alternative proposal.

@mtojek mtojek merged commit af39b96 into elastic:master Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants