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-43183 Can't see pipeline jobs in Global Build Stats #14

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

rafal-prasal
Copy link

No description provided.

@mdelapenya
Copy link

Is there anybody reviewing this PR? I see interest in displaying pipelines in the graph, even more critical if we use Blue Ocean plugin extensively

@ajpaton
Copy link

ajpaton commented Jan 24, 2019

@rafal-prasal @mdelapenya I too am interested in seeing this function added into the Global Build Stats plugin, as our project has started to use Pipeline jobs alongside freestyle ones and we have lost a valuable ability to see how much build work is happening.

Given the community guidance in https://wiki.jenkins.io/display/JENKINS/Pull+Request+to+Repositories I wonder if the previous committers to this repo are still available and working on this? It would be a pity to lose the ability to continue to evolve this useful plugin which seems to still have 1000s of downloads per month.

I know @dhinske is the most active contributor here and is listed as the issue owner in the Jenkins repo but not sure if he's able to look at this? (Noting there is another proposed change from @mdelapenya also proposed last year which hasn't been reviewed either)

@tjanson
Copy link

tjanson commented Aug 13, 2019

FYI for anyone else desperate enough to attempt to run this Jenkins plugin: In addition to this PR, you also need to change the build stats discovery to recurse (if you have more than a single level of folders).

I’m not confident that this will catch all build types – I don’t know enough about Jenkins’ internals. But this should be a start:

diff --git a/src/main/java/hudson/plugins/global_build_stats/business/GlobalBuildStatsBusiness.java b/src/main/java/hudson/plugins/global_build_stats/b
usiness/GlobalBuildStatsBusiness.java
index 10dff89..b245699 100644
--- a/src/main/java/hudson/plugins/global_build_stats/business/GlobalBuildStatsBusiness.java
+++ b/src/main/java/hudson/plugins/global_build_stats/business/GlobalBuildStatsBusiness.java
@@ -2,7 +2,6 @@ package hudson.plugins.global_build_stats.business;

 import hudson.model.TopLevelItem;
 import hudson.model.Hudson;
-import hudson.model.Item;
 import hudson.model.Job;
 import hudson.model.Run;
 import hudson.plugins.global_build_stats.GlobalBuildStatsPlugin;
@@ -34,6 +33,7 @@ import org.jfree.chart.title.LegendTitle;
 import org.jfree.ui.RectangleEdge;
 import org.jfree.ui.RectangleInsets;

+import org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject;
 import com.cloudbees.hudson.plugins.folder.Folder;

 public class GlobalBuildStatsBusiness {
@@ -96,15 +96,7 @@ public class GlobalBuildStatsBusiness {

                 List<JobBuildResult> jobBuildResultsRead = new ArrayList<JobBuildResult>();
                 for (TopLevelItem item : Hudson.getInstance().getItems()) {
-                       if (item instanceof Folder){
-                               Folder f = (Folder)item;
-                               for (TopLevelItem i : f.getItems()){
-                                       handleItem(jobBuildResultsRead,i);
-                               }
-                       }
-                    if (item instanceof Job) {
-                       handleItem(jobBuildResultsRead, item);
-                    }
+                    recursivelyAddBuilds(jobBuildResultsRead, item);
                 }

                 plugin.getJobBuildResultsSharder().queueResultsToAdd(
@@ -113,13 +105,28 @@ public class GlobalBuildStatsBusiness {
         });
        }

-       public void handleItem(List<JobBuildResult> results, TopLevelItem item){
+       public void recursivelyAddBuilds(List<JobBuildResult> results, TopLevelItem item){
                if (item instanceof Job){
-                       addBuildsFrom(results, (Job)item);
+                       addBuildsFrom(results, (Job) item);
                }
-       }
+        if (item instanceof Folder){
+            Folder f = (Folder) item;
+            for (TopLevelItem i : f.getItems()){
+                recursivelyAddBuilds(results, i);
+            }
+        }
+
+        if (item instanceof WorkflowMultiBranchProject) {
+            WorkflowMultiBranchProject w = (WorkflowMultiBranchProject) item;
+            for (TopLevelItem i : w.getItems()) {
+                recursivelyAddBuilds(results, i);
+            }
+        }
+    }

With this change, it *seems* to catch all of *our* builds (but again no guarantees – I would not be surprised if there’s still cases falling through the cracks).

presPetkov pushed a commit to presPetkov/global-build-stats-plugin that referenced this pull request Oct 7, 2019
@yewenhai99999
Copy link

The plugin does not seem to support pipeline

@ishallbethat
Copy link

heart-breaking to see this feature requested in 2018 and still not completed. I think lots of people using pipeline jobs they need to see build stats.

@YuviGold
Copy link

YuviGold commented Oct 1, 2020

@daniel-beck Can this be merged?
A lot of people use only pipelines jobs

@brneto
Copy link

brneto commented Mar 22, 2021

Hi @daniel-beck, any plan date when this will be merged?

@daniel-beck
Copy link
Member

While the latest commit in this repo is mine, that was a single change on behalf of the Jenkins security team: #16

Please ask maintainers for reviews and releases of pull requests, or if they're unresponsive (which it appears is the case here), consider taking over maintainership: https://www.jenkins.io/doc/developer/plugin-governance/adopt-a-plugin/

@sharpSteff
Copy link

Any plans to integrate this?

@MarkEWaite
Copy link
Contributor

Any plans to integrate this?

No plans to integrate it until someone adopts the plugin. There are conflicts that need to be resolved. There are additional comments in #14 (comment) that need to be addressed. There is no active maintainer of this plugin.

If you depend on this plugin, ask your company to allow you to adopt it and become a maintainer. You can then resolve the conflicts, address the comments, test the new version, and release it. The "Improve a plugin" tutorial is a good place to start. The "Contributing to open source" document provides even more ideas of things to improve.

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.