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

add ability to publish java based plugins #95

Open
jsvd opened this issue Apr 30, 2019 · 3 comments
Open

add ability to publish java based plugins #95

jsvd opened this issue Apr 30, 2019 · 3 comments
Assignees

Comments

@jsvd
Copy link
Member

jsvd commented Apr 30, 2019

Currently jarvis executes a set of commands in order to publish a plugin:

  TASKS = { "bundle install" => ALWAYS_RUN,
            "bundle exec rake vendor" => ALWAYS_RUN,
            "bundle exec rake publish_gem" => ALWAYS_RUN }.freeze

However, for a java based plugin there are different commands that need to executed.

So the publish command needs to:

  1. detect if the plugin is ruby or java based
    a) If ruby => execute current set of tasks
    b) If java => execute new set of tasks
@jsvd jsvd self-assigned this Apr 30, 2019
@jsvd
Copy link
Member Author

jsvd commented Apr 30, 2019

@danhermann what would be the list of actions for java?
for building and publish gem we can either use a local jruby or use one from a logstash distribution.

@danhermann
Copy link
Contributor

danhermann commented Apr 30, 2019

There is a gradle task named gem for Java plugins that produces a gem file with all of the Java plugin's code after bootstrapping all of the necessary JRuby dependencies. Once the gem file has been produced, I presume the steps to publish it to rubygems.org remain the same.

As you point out, there needs to be a way to detect whether the plugin is a Ruby or Java plugin. I propose to do that by looking for a gemspec file in the root of the plugin's repo. All Ruby plugins contain a gemspec file whereas the gemspec file for Java plugins is auto-generated only at packaging time.

Assuming the above works for distinguishing between Ruby and Java plugins, the one other thing that Java plugins need is a logstash-core-x.y.z.jar containing the actual plugin API in the co.elastic.logstash.api package. At some point, we may be able to publish that to Maven, but right now, it needs to be built from the Logstash repo. It also needs to be built from a specific branch of the Logstash repo so that plugins can be built against any version of the plugin API. I propose that version be read from a PLUGIN_API_VERSION file in the root of the plugin's repo though I am certainly open to other ideas for that. If that file is not present, it would default to 7.2, the Logstash branch containing the GA/1.0 version of the Java plugin API.

Assuming all of the above works, I think the following commands are all that would be necessary to accommodate Java plugins:

# starting from a directory containing the git repo for the plugin
git clone https://github.com/elastic/logstash/ --branch $PLUGIN_API_VERSION --single-branch ../logstash
cd ../logstash
./gradlew assemble # no need to bootstrap as only the logstash-core-x.y.z.jar is needed here
cd -
echo "LOGSTASH_CORE_PATH=../logstash/logstash-core" > gradle.properties
./gradlew gem
# once the gem is produced in the line above, the remaining steps to publish should be the same

@jsvd
Copy link
Member Author

jsvd commented May 7, 2019

this is now in a feature branch being used by Jarvis https://github.com/elastic/jarvis/tree/java_plugins_publish
once we have enough confidence we can merge it to master and have Jarvis use master again.

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

2 participants