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

[meta] defaults plugins migration to new Event interface and plugin-api 2.0 #5227

Closed
colinsurprenant opened this issue Apr 29, 2016 · 20 comments

Comments

@colinsurprenant
Copy link
Contributor

colinsurprenant commented Apr 29, 2016

This is a meta issue to track progress for refactoring the defaults plugins. Core plugins migration has been completed per #5170. Related #5140.

This migration recipe goals are:

  • avoid publishing any core plugins for the refactor
  • be able to test refactored plugins within their refactor branch in Travis
  • be able to test/build logstash using the refactored plugins within their branches

Plugin Migration Recipe

  • create branch feature/plugin-api-2_0

  • this branch should be published upstream in the logstash-plugins repo.

  • .travis.yml should be updated to

    sudo: false
    jdk:
     - oraclejdk8
    language: ruby
    cache: bundler
    rvm:
     - jruby-1.7.25
    before_install:
     - git clone -b feature/event_interface https://github.com/elastic/logstash
    script:
     - bundle exec rspec spec
    
  • minimally these gems need to be added to the plugin Gemfile

    # this is temporary for the feature/plugin-api-2_0 branch and is meant for travis testing
    gem "logstash-core", :path => "./logstash/logstash-core"
    gem "logstash-core-plugin-api", :path => "./logstash/logstash-core-plugin-api"
    gem "logstash-core-event-java", :path => "./logstash/logstash-core-event-java"
    gem "logstash-devutils", :github => "elastic/logstash-devutils", :branch => "feature/plugin-api-2_0"
    
  • add any other plugins in the gemspec required by this plugin, for example, if logstash-codec-plain is a required plugin add this:

    gem "logstash-codec-plain", :github => "logstash-plugins/logstash-codec-plain", :branch => "feature/plugin-api-2_0"
    
  • modify the gemspec to bump the plugin-api version constrain to 2.0:

    s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
    
  • and finally, refactor code and specs for new Event interface

Running local specs

  • if you want to test locally you will have to create a symbolic link to the logstash code base with the feature/event_interface shared branch

    ln -s /you/path/to/logstash .
    bundle
    bundle exec rspec spec
    

Helpful Scripts

@ph has added this ruby script to automate much of the initial work: https://gist.github.com/e28dddccfbe32c3985ab51d6f9b9ec41

Plugins for core specs

@ph
Copy link
Contributor

ph commented Apr 29, 2016

We can automate all of the heavy work minus the actual code/spec?
Are we fine doing that?

@suyograo
Copy link
Contributor

@ph +1 for automating..

@colinsurprenant
Copy link
Contributor Author

it might be tricky to automate the addition of dependent plugins from the gemspec but the basic block

# this is temporary for the feature/plugin-api-2_0 branch and is meant for travis testing
gem "logstash-core", :path => "./logstash/logstash-core"
gem "logstash-core-plugin-api", :path => "./logstash/logstash-core-plugin-api"
gem "logstash-core-event-java", :path => "./logstash/logstash-core-event-java"
gem "logstash-devutils", :github => "elastic/logstash-devutils", :branch => "feature/plugin-api-2_0"

can be easily automated

@colinsurprenant
Copy link
Contributor Author

also I've seen a bit different .travis.yml, with the integration tests flag?

@suyograo
Copy link
Contributor

Btw, all plugins should have the integration flag set if its not already there..

@colinsurprenant
Copy link
Contributor Author

I added the list of plugins done so far for passing core specs.

@ph
Copy link
Contributor

ph commented May 4, 2016

@suyograo logstash-codec-oldlogstashjson is marked as completed but I can't find the PR.

@suyograo
Copy link
Contributor

suyograo commented May 4, 2016

Here's the merge plan:

  • Review PRs for all plugins (@tal, @ph, @suyograo)
  • merge [WIP] refactor Ruby Event getter and setter #5170 to master and 5.0 after cleaning up temp stuff in there (@colinsurprenant)
  • release new 5.0.0-beta1.snapshot1 core plugins (@suyograo)
  • Create new branches (plugin-api-v1) off master in all plugins repo for 2.x development (@ph)
  • Delete core-api-v2 (@ph)
  • Script merge of feature/plugin-api-2_0 to master in all plugins (@ph)
  • Update plugins .travis.yml, Gemfile via mass update (@ph)
  • Bump major version for all default plugins, add CHANGELOG entry (@ph)
  • Make sure tests are green for all plugins (@ph)
  • and mass publish (@ph)
  • Generate new lock file for master & 5.0 (@colinsurprenant)
  • Generate new lock file for 5.0 with newly published plugins, and release new 5.0.0-beta1.snapshot1 packages for testing (@suyograo)

@colinsurprenant
Copy link
Contributor Author

@suyograo

  • the plugins branches off master will be 2.x ?
  • we need to revert both .travis.yml and Gemfile in mass update
  • you mean new 5.0.0-beta1.snapshot2 ?

@suyograo
Copy link
Contributor

suyograo commented May 4, 2016

@colinsurprenant updated.

@colinsurprenant
Copy link
Contributor Author

@suyograo @ph also, .travis.yml should not be updated to old state, we certainly want to keep the Java 8 selection?

@colinsurprenant
Copy link
Contributor Author

@suyograo @ph core-api-v1 (not v2) branch for LS 2.x development.

@ph
Copy link
Contributor

ph commented May 4, 2016

@colinsurprenant We already have v1, it was before the shutdown change, and used to target LS 1.5?

@colinsurprenant
Copy link
Contributor Author

@ph how is that possible? we only recently introduced the plugin-core-api gem recently
ah yes, ok, I think I remember - it's core-api, we need to create plugin-api-v1

@suyograo
Copy link
Contributor

suyograo commented May 4, 2016

@colinsurprenant core-api-v1 branch already exists and was created to continue development of plugins under v1 core API (pre shutdown changes, < LS 2.0). core-api-v2 once branched will match v2 of plugin APIs and continue development for them (pre Java Event, < LS 2.0).

Also, here is a .travis.yml we can mass update with: https://gist.github.com/suyograo/331f6384e143b147c09db51a854540c4

Includes Java 8 and --integration tags

@ph
Copy link
Contributor

ph commented May 5, 2016

Also, here is a .travis.yml we can mass update with: https://gist.github.com/suyograo/331f6384e143b147c09db51a854540c4

I am not sure we should mass update with the bundle exec rspec --tag integration, since integration usually mean that we need to add some steps in the travis file to make sure the environment is ready to be used for integration testing. Like installing redis, rabbitmq or supporting libraries.

But this could be a good way to find which plugins are failling and change their travis.yml manually.

@colinsurprenant @suyograo core-api-v2 I agree is a weird name, another option would be to make it explicit and rename them logstash-1.5.x and logstash-2.x ;)

@ph
Copy link
Contributor

ph commented May 5, 2016

@suyograo After discussing on slack zoom I am ok to move ahead with the core-api-v2, its only a branch name, if we change our mind in the future we can always rename it/them.

@colinsurprenant Can we move forward?

@colinsurprenant
Copy link
Contributor Author

colinsurprenant commented May 5, 2016

@ph @suyograo it is still confused.

  • core-api-v1 branch was introduced for supporting the pre-shutdown changes for the 1.5 series. At this point we had no notion of plugin-api, we came up with that ad-hoc branch name at the time.
  • we need a branch to be able to continue to support le LS versions that are using the plugin-api v1 which are all pre-5.0 releases. if we use the name "v2" in that branch name it will be extremely confusing.
  • since we now have a concept of plugin-api formal versioning I think we need to use that concept to name branches and use corresponding names and versions numbers.
  • in that respect, the problem here is the original "core-api-v1" branch name which does not make sense with the new plugin-api concept.

For this I suggest we simply leave the core-api-v1 branch name as-is, for legacy reasons, which anyway will not be needed anymore, and introduce branches with the plugin-api name and versions.

@suyograo
Copy link
Contributor

suyograo commented May 5, 2016

For this I suggest we simply leave the core-api-v1 branch name as-is, for legacy reasons, which anyway will not be needed anymore, and introduce branches with the plugin-api name and versions.

@colinsurprenant @ph I am fine with naming the branch based on plugin API version. Good with plugin-api-v1

@colinsurprenant
Copy link
Contributor Author

@suyograo, @ph and myself just reviewed the tasks sequence and Houston, all engines go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants