Hello all, this is a topic that has come up a few times in the past, I believe I have a solution but I would like to get feedback from others
What we currently do
In Katello, we duplicate many packages from Foreman and the foreman-js meta packages. This is because we only
npm install in Katello in our CI testing environment, and we don’t install packages from Foreman. The same may be true of other plugins.
This is an issue for two reasons:
- In production and a development environment, the runtime dependencies come from Foreman, so what we are using for testing could be a different version than what is used in production. We are specifying the same dependency twice and can be hard to keep the versions in-sync
- More time spent installing packages locally for developers since many are duplicated in Katello’s
- In general we would like to Katello to function as a plugin and not an independent application
We can use packages from Foreman with some changes to our jest configuration. We already use code from Foreman in the React tests with the changed resulting from the linked discussion. So it is easy to point jest (the React test runner) at Foreman’s node_modules.
So in CI this looks like:
- checkout both Foreman and Katello
npm iin Foreman
- Run tests in Katello
This will allow us to remove the duplicated packages from Katello.
The changes that would have to happen:
- Modify the jenkins job to checkout katello and foreman as siblings in a directory
- side note on this: Is there any reason we checkout Foreman inside of Katello in CI today?
npm ionly in Foreman (at least for the React portion of things) in the jenkins job
- Make this update to Katello (will clean it up, it’s just a POC now) that updates the testing config and remove the duplicate packages.
I think this will be another step towards having our plugin ecosystem working well with the modern JS code we are using. It’s a pretty small change that we can implement to test Katello the same way we use it in a production environment and not duplicate packages.