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

[JENKINS-27120] Adding Workflow support for JaCoCo publisher #66

Merged
merged 11 commits into from
May 30, 2016

Conversation

centic9
Copy link
Member

@centic9 centic9 commented Jan 20, 2016

Continued from PR #63 without all the whitespace changes...

@jenkinsadmin
Copy link
Member

Thank you for this pull request! Please check this document for how the Jenkins project handles pull requests.

@andresrc
Copy link

👎 not keeping the original authorship. Not polite and discourages contribution.

@lordofthejars
Copy link
Contributor

oh please, I would like to have this issue fixed and released by Thursday, anyone with permissions think it is going to be possible?

@portenez
Copy link

portenez commented Feb 2, 2016

Is there any chance this could be pulled/merged in the near future?

@andresrc, I think @lordofthejars is more concerned with getting this released than with the authorship, and I could also use this fix. Also, there's the link to the original PR, which will show the original authorship. (@lordofthejars)

In any case, thanks all.

@lordofthejars
Copy link
Contributor

Exactly, I don t care the authorship I want that people can improve how
they are working.
El 2/2/2016 9:22 p. m., "Victor Garcia" [email protected] escribió:

Is there any chance this could be pulled/merged in the near future?

@andresrc https://github.com/andresrc, I think @lordofthejars
https://github.com/lordofthejars is more concerned with getting this
released than with the authorship, and I could also use this fix. Also,
there's the link to the original PR, which will show the original
authorship. (@lordofthejars https://github.com/lordofthejars)

In any case, thanks all.


Reply to this email directly or view it on GitHub
#66 (comment)
.


@Override
public void onAttached(Run<?, ?> run) {
this.owner = run;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this means you could delete the owner parameter from the constructor (assuming it is not used within the dynamic scope of the constructor).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jglick so I can remove the first parameter of this constructor: public JacocoBuildAction(Run<?,?> owner, Map<CoverageElement.Type, Coverage> ratios, ...) without worrying about any side effect. Other plugins currently are not using JaCoCo API.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Note that the load method will return an action whose getBuild() would at that time return null, but once you call someBuild.add(theNewAction) it gets initialized.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@jglick
Copy link
Member

jglick commented Feb 4, 2016

Other than the incorrect use of checkRoles, looks basically good. Seems it need a remerge with master though.

@lordofthejars
Copy link
Contributor

@centic9 are you going to continue with this issue or you prefer I get it again and apply the changes suggested by @jglick

@centic9
Copy link
Member Author

centic9 commented Feb 5, 2016

Just go ahead please, I actually lack the insight into the Jenkins internals necessary here anyway, just let me know when it is ready to merge

@lordofthejars
Copy link
Contributor

@centic9 @jglick The changes you mention has been merged to this PR. Do we need bees or are not necessary since the PR was not originated by me. Of course a review about I have done the cahnges correctly would be much appreciated.

@@ -92,6 +92,7 @@ THE SOFTWARE.
<project.build.outputEncoding>UTF-8</project.build.outputEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jacoco.version>0.7.5.201505241946</jacoco.version>
<workflow.version>1.12</workflow.version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here? Seems unused. (Of course you would use it if you wanted to add automated tests.)

@lordofthejars
Copy link
Contributor

@jglick ok I think that now it is ready to be merged into master. If you agree let's put a bee and I talk with James for the same.

@lordofthejars
Copy link
Contributor

@reviewbybees

@ghost
Copy link

ghost commented Feb 17, 2016

This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation.

Conflicts:
	src/main/java/hudson/plugins/jacoco/JacocoPublisher.java
@jmvanryn
Copy link

Is there any update on this? @reviewbybees ?

@lordofthejars
Copy link
Contributor

For me it is ok, but after pushing hard for trying to release this and after the time I decided to give it up.

@isubuz
Copy link

isubuz commented Apr 4, 2016

Are there any plans to merge this soon?

@centic9
Copy link
Member Author

centic9 commented Apr 15, 2016

Sure, just let me know when you think it is ready for merge so we can finally release this.

@faheem-nadeem
Copy link

faheem-nadeem commented Apr 25, 2016

Hi guys any ETA on this... we are also migrating to pipeline plugin, and it seems this essential plugin is still missing :(

@lordofthejars
Copy link
Contributor

@jglick must review the last changes.

@ben-gineer
Copy link

I'm also moving to the Pipelne plugin and this PR would be a big help.i

@centic9
Copy link
Member Author

centic9 commented May 8, 2016

In order to allow others to give feedback more easily I have published a pre-release with these changes at https://github.com/jenkinsci/jacoco-plugin/releases/tag/2.1.0-beta1, please give it a try by manually installing the .hpi file in the Jenkins installation via "manage jenkins - plugins - advanced options - upload plugin" and report here if it works for you or not.

@centic9
Copy link
Member Author

centic9 commented May 8, 2016

BTW, a local build fails for me with the following on 1.638, seems the onAttached() is not called there? The changes set the required jenkins version to 1.609.3.

ERROR: Build step failed with exception
java.lang.NullPointerException
at hudson.plugins.jacoco.JacocoBuildAction.getJacocoReport(JacocoBuildAction.java:204)
at hudson.plugins.jacoco.JacocoBuildAction.getResult(JacocoBuildAction.java:219)
at hudson.plugins.jacoco.JacocoPublisher.perform(JacocoPublisher.java:490)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:76)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
at hudson.model.Run.execute(Run.java:1763)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)

@leifbladt
Copy link

I can confirm the mentioned NullPointerException with Jenkins 2.2

@mheinzerling
Copy link
Collaborator

mheinzerling commented May 30, 2016

Created #73 to fix the NPE.

@centic9 centic9 merged commit adc858d into master May 30, 2016
@centic9
Copy link
Member Author

centic9 commented May 30, 2016

After the NPE was fixed via #73 I have now merged these changes onto trunk. Please test it some more by running "mvn package" and then importing the resulting target/jacoco.hpi manually in Jenkins -> Manage -> Plugins -> Advanced.

@centic9 centic9 deleted the pr63_manualmerge branch May 30, 2016 21:10
@anyone-can-test
Copy link

I tested the latest jacoco plugin (mvn package in my local pc) and the pipeline functionality.
The coverage result was good.
But, there was no Code Coverage Trend in the main screen of a job.

@mheinzerling
Copy link
Collaborator

mheinzerling commented Jun 2, 2016

Might be related to JENKINS-31202.

@mscharp
Copy link

mscharp commented Jul 15, 2016

Could someone post, or link to a post that shows, what the syntax would be in order to use the JacocoPublisher?

@mheinzerling
Copy link
Collaborator

Just run the current master or even mheinzerling_2.1.0 with a current jenkins and you will get the pipeline configuration util for free. You can configure your step with the usual graphical interface.

@mpchlets
Copy link

@mheinzerling - when using pipeline from a Jenkinsfile, you cannot use the graphical interface to configure.

@mheinzerling
Copy link
Collaborator

mheinzerling commented Jul 29, 2016

@mpchlets, more details please. I was talking about the pipeline snippet page.

@jreimone
Copy link

jreimone commented Sep 26, 2016

How to use the JacocoPublisher in a pipeline script? I cannot find any syntactical descriptions. I just tried to add step([$class: 'JaCoCoPublisher']) into my script but I get java.lang.UnsupportedOperationException: no known implementation of interface jenkins.tasks.SimpleBuildStep is named JaCoCoPublisher with JaCoCo plugin v.2.0.1

@thatsIch
Copy link

@jreimone This is not supported in 2.0.1. Update at least to 2.1.0-beta

@jreimone
Copy link

@thatsIch, thank you very much. With 2.1.0-beta release I got an NPE but it worked successfully with the latest master I Built locally. Is there a possibility to display the trend of the coverage in the job's overview, as it is also done by the JUnit test results?

@thatsIch
Copy link

You can use the Jacocopublisher to do that, this allows to display it in each build (in #1, #2 etc on the left side). Sadly the overview on the dashboard is not working since some integration is not working.

@tadgh
Copy link

tadgh commented Sep 30, 2016

Would really like the ability to have it in dashboard, but in build is good enough for now! I'm in the same place as Jreimone

@thatsIch
Copy link

thatsIch commented Oct 1, 2016

You can also use the html publisher to publish the index.html of JaCoCo and give you a quick link to the latest one. Every solution sadly sub-optimal, but better than every dev stalling his IDE waiting for his coverage

@vladdu
Copy link

vladdu commented Dec 16, 2016

I just tried step([$class: 'JaCoCoPublisher']) with 2.1.0 and I get "no known implementation of interface jenkins.tasks.SimpleBuildStep is named JaCoCoPublisher"... Should it work?

@thatsIch
Copy link

It is called JacocoPublisher

@vladdu
Copy link

vladdu commented Dec 16, 2016

Oh, silly me, I just copied from a comment above and didn't check... Thanks!

@thatsIch
Copy link

Always look into the source :P it is actually easier than to rely on hear-say. That is how I know about the class name.

You are welcome :)

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

Successfully merging this pull request may close these issues.