indix / gocd-s3-artifacts

Set of GoCD plugins to publish and fetch artifacts from Amazon S3
http://oss.indix.com/gocd-s3-artifacts
Apache License 2.0
37 stars 18 forks source link

plugin does not work with java 11 currently bundled in with gocd agent #70

Closed dlethin closed 5 years ago

dlethin commented 5 years ago

It seems there is a problem trying to run this plugin on an agent using the embedded java 11 version. I get the following error message

[go] Task: Plugin with ID: indix.s3publishtook: 0.572s
    Pushing /var/lib/go-agent/pipelines/XXX to s3://YYY/XXX
    Error: javax/xml/bind/JAXBException
    [go] Task status: failed, took: 0.572s

I had to install openjdk 8 and setup the agent to run that instead. With GoCD dropping support for Java 8 going forward, is there a recommended way to handle this? Can the missing dependencies be packaged into the plugin with an update to the dependencies in build.gradle?

Thanks.

dlethin commented 5 years ago

I should add that we are using v5.2.1 -- the latest released version and we were running GoCD Agent 19.7

ashwanthkumar commented 5 years ago

@dlethin Thanks for reporting this. This is being worked upon in #71, we should be able to get a release out soon and it would be great if you can help us test it.

dlethin commented 5 years ago

Thanks for the fast turnaround time. I will try to test this out early next week on an agent running 8 and one running 11 and see what happens.

dlethin commented 5 years ago

My initial attempt to test this out was not successful, though its possible I did something in haste. I built a copy of the the plugin jar off the specific branch and uploaded it into my server's plugins/external directory ( commenting out the existing v5.2.1 copy) and restarted the server.

However, when I then navigated in the UI to a template that was configured to use the publish task supplied by this plugin, the task was greyed out and in italics, as if the plugin definition was not found. I couldn't find an error message in the in the log files. Unpacking the plugin jar I see that the required plugin.xml file is present and appears correct with the expected "id" attribute. Not sure what's going on, but I will try to set up some more time to troubleshoot this.

I'm currently running GoCD 19.6.0

dlethin commented 5 years ago

I tracked down the error message causing the plugin not to load in the go-server.log:

2019-10-01 02:00:27,531 ERROR [Thread-82] FelixGoPluginOSGiFramework:145 - Failed to load plugin: plugins_work/s3publish-assembly-1.0.0-1569580357-SNAPSHOT.jar. Plugin is invalid. Reasons [Class [module-info] could not be loaded. Message: [module-info is not a class because access_flag ACC_MODULE is set].]

Not sure what that means, but I'll keep digging. Also not sure if I built this right, as I'm new to sbt I think I essentially ran sbt clean test assemble

dlethin commented 5 years ago

I guess there is something in the new dependendencies that is getting bundled into the jar that gets produced that is tripping up java. Is it possible to change how the structure of the jar file to match the guidelines specified by gocd -- https://developer.gocd.org/current/writing_go_plugins/go_plugins_basics.html

It seems that all the dependent jar files are getting all unjarred and packaged up with the projects class files, as opposed to just embedding the jar files directly under the /lib path. I don't know much about sbt. It looks like there is a onejar plugin which might be able to solve the problem, but I couldn't get it to even load.

ashwanthkumar commented 5 years ago

Thank you so much @dlethin for the detailed analysis. Let me take a look and get back in here.

dlethin commented 5 years ago

Any thoughts on this? This problem is preventing us from picking up the latest versions of the GoCD which no longer support Java 8.

I don't have any experience with SBT to help much with this, but I could possibly help with setting up a build.gradle file to drive the build of the jars if that was a direction you wanted to consider, but I don't know if your scripts are doing anything else like publishing release artifacts to GitHub.

Thanks.

ashwanthkumar commented 5 years ago

@dlethin Sorry about the delay. We still use Java8 in our organization so it's kinda hard to check this from my end. I did some more debugging and realised the module-info.class which is the descriptor for java modules got added by some java library which is probably causing the issue. On top, scala also doesn't support Java Module system yet so the tooling in the ecosystem is still not mature.

Please check out the below ZIP file and let us know if it works.

s3publish-assembly-1.0.0-1573023580-SNAPSHOT.jar.zip

dlethin commented 5 years ago

Thanks for the quick turn around. I'll schedule some time hopefully within a day to test this out and get back to you.

dlethin commented 5 years ago

@ashwanthkumar - While I have yet to test this out in my production system, I did download the latest GoCD server/agent and installed a build of your plugin off the associated branch and I was able to publish an artifact to s3. This was using the embedded openjdk 13. So I think things look good. Thanks for the quick turnaround time on this. Cheers.

ashwanthkumar commented 5 years ago

Awesome. That's good to know. I'll cut out a release sometime soon.