jenkinsci / fabric-beta-publisher-plugin

DEPRECATED: A Jenkins plugin that lets you publish Android apps to Fabric Beta
MIT License
24 stars 17 forks source link

Jenkins Pipeline support #17

Closed solevic closed 7 years ago

solevic commented 7 years ago

Enables support for plugin jenkinsFile usage.

TODO: We need to find a way to get or generate the changelog through Run instead of AbstractBuild.

solevic commented 7 years ago

Here's some insight on how we could proceed to rebuild the ChangeSet

https://stackoverflow.com/questions/31247149/get-changeset-function-from-run-class-jenkins

egor-n commented 7 years ago

@solevic seems like this is the only way to get changelog from Run. HockeyApp plugin does it too.

solevic commented 7 years ago

@egor-n I tried adding the described method to the code, but my pipeline job is not an instance of AbstractProject so I cannot get the changeSet of my last build.

Here are the super types of my job.

Job test-fabric is not AbstractProject class org.jenkinsci.plugins.workflow.job.WorkflowJob class hudson.model.Job class hudson.model.AbstractItem class hudson.model.Actionable class hudson.model.AbstractModelObject class java.lang.Object

EDIT: Oh well, the git checkout process is being done in my jenkinsFile, that might be why it's not being recognized as an AbstractProject. The method should work fine if you checkout your repository through the jenkins VCS plugin.

I'll add the code to the PR.

solevic commented 7 years ago

Ok it's done, you might want to squash these nasty commits though.

egor-n commented 7 years ago

Looks fine to me – can you add a "Pipeline usage" section to the readme file?

egor-n commented 7 years ago

@solevic the pipeline snippet generator doesn't want to generate the step. Instead, it outputs step <object of type fabric.beta.publisher.FabricBetaPublisher>. Can you take a look at this? If it's a simple fix, then we might want to include it into this PR.

Here's the exception I get:

WARNING: failed to uncoerce fabric.beta.publisher.FabricBetaPublisher@2c538f4
java.lang.UnsupportedOperationException: no public field ‘releaseNotesType’ (or getter method) found in class fabric.beta.publisher.FabricBetaPublisher
    at org.jenkinsci.plugins.workflow.structs.DescribableHelper.inspect(DescribableHelper.java:749)
    at org.jenkinsci.plugins.workflow.structs.DescribableHelper.inspect(DescribableHelper.java:674)
egor-n commented 7 years ago

Also, do we have to build.setResult(Result.FAILURE) if we encounter any exceptions? Right now, it seems like if uploading fails then the build is still marked as SUCCESS.

solevic commented 7 years ago

@egor-n The pipeline snippet generator bug is fixed. I also added the build result state in case of upload failure.

I'm not sure quite sure what to add to the README, could you take care of that part?

egor-n commented 7 years ago

Thank you!

jlcvp commented 5 years ago

Hi @egor-n and @solevic!

Could you please give us a short description on how to use the plugin on pipeline scripts?