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

Plugin refactor pt2 #71

Merged
merged 8 commits into from
Apr 20, 2018
Merged

Plugin refactor pt2 #71

merged 8 commits into from
Apr 20, 2018

Conversation

edvald
Copy link
Collaborator

@edvald edvald commented Apr 18, 2018

This is a bulky one... From the commit msg:

Plugins are now registered and loaded separately, and are now defined
as modules with an exported gardenPlugin function.

BREAKING CHANGE:
This includes some changes to the project schema and how it is resolved,
as well as how the main Garden class is instantiated. The Garden
class is now called with an environment name, which is then fixed for
the session. The env configuration is resolved by merging the specific
environment configuration with a global configuration specified on the
new global key in the project config. The schema for the providers
key also different - its keys should now match plugin names, and
contain configuration for those plugins.

@edvald edvald changed the title Plugin refactor pt2 [WIP] Plugin refactor pt2 Apr 18, 2018
edvald added 2 commits April 18, 2018 16:22
Plugins are now registered and loaded separately, and are now defined
as modules with an exported `gardenPlugin` function.

BREAKING CHANGE:
This includes some changes to the project schema and how it is resolved,
as well as how the main `Garden` class is instantiated. The `Garden`
class is now called with an environment name, which is then fixed for
the session. The env configuration is resolved by merging the specific
environment configuration with a global configuration specified on the
new `global` key in the project config. The schema for the `providers`
key also different - its keys should now match plugin names, and
contain configuration for those plugins.
@edvald edvald force-pushed the plugin-refactor-pt2 branch from 43dcb55 to 9cd85c3 Compare April 18, 2018 14:22
@edvald edvald changed the title [WIP] Plugin refactor pt2 Plugin refactor pt2 Apr 18, 2018
@@ -33,10 +33,9 @@ export const configSchema = Joi.object()
project: projectSchema,
})
.optionalKeys(["module", "project"])
.options({ allowUnknown: true })
Copy link
Collaborator

Choose a reason for hiding this comment

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

@edvald This causes an error on the module.image key since it's missing from the baseModuleSchema. Should we:

a) Allow unknown keys on the configSchema?
b) Allow unknown keys on the baseModuleSchema?
c) Add the image key to the baseModuleSchema?

Copy link
Collaborator

Choose a reason for hiding this comment

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

...I'll go for c) unless there are any objections.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This has actually been fixed in #75

We shouldn't allow unknown keys there, but rather in the individual sub-schemas. I just missed that one in this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Gotcha. I'll fix it here though so that we don't merge a broken PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can also merge #75 in here before merging this into master.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah you already did it, all good.

return <T>new Module(ctx, config)
}
// TODO: find a different way to solve type export issues
let _serviceConfig: ServiceConfig
Copy link
Collaborator

@eysi09 eysi09 Apr 20, 2018

Choose a reason for hiding this comment

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

What's this for? Also noticed it on the npm-package plugin.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's this slightly annoying thing in Typescript - if a module exports something that uses a certain type, it needs to be explicitly imported in the module. I couldn't quickly find a better way than this - just importing the type without using it raises linting errors, so I needed to put it in a dummy variable.

Deploy k8s system via sub-Garden
@edvald edvald merged commit 195f700 into master Apr 20, 2018
@edvald edvald deleted the plugin-refactor-pt2 branch April 20, 2018 08:06
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.

2 participants