[JIRA] [branch-api-plugin] (JENKINS-33274) "Base build" link for first build of branch project

6 views
Skip to first unread message

jglick@cloudbees.com (JIRA)

unread,
Mar 2, 2016, 9:52:02 AM3/2/16
to jenkinsc...@googlegroups.com
Jesse Glick created an issue
 
Jenkins / Improvement JENKINS-33274
"Base build" link for first build of branch project
Issue Type: Improvement Improvement
Assignee: stephenconnolly
Components: branch-api-plugin
Created: 02/Mar/16 2:51 PM
Labels: api
Priority: Major Major
Reporter: Jesse Glick

The first build of a branch project should have a UI link like Previous Build but pointing to the build on the project corresponding to the base branch (such as master for Git) which its SCM revision links to. Should use SCMSource.parentHeads; major SCM plugins needs to implement this API. When present, the base build should be used as a baseline for determining the SCM changelog, so that a user can see the changes made in the SCM commit initiating a branch. An API should also be introduced to core so that plugins such as junit can use this backlink rather than previousBuild for purposes of comparing test results; the same could be true of static analysis, code coverage, etc.

Merely changing Run.getPreviousBuild to return a build from another Job is unsafe; many plugins may assume that the Job pairs match, or that getNextBuild is the inverse operation, etc. Perhaps we need an API addition to Run such as

/**
 * Gets the previous build to be used for purposes of comparison of SCM commits, test results, and other reports.
 * If {@link #getPreviousBuild} is not null, that should be returned.
 * Otherwise, this may instead return a build of a {@link Job} of the same type representing a base branch from which this branch was forked.
 */
public @CheckForNull RunT getPreviousLogicalBuild() {
    return getPreviousBuild();
}

which would most closely preserve existing semantics: build-to-build comparisons.

Additionally/alternately:

/**
 * Gets a build to be used for purposes of comparison of SCM commits, test results, and other reports.
 * By default, {@link #getPreviousBuild}.
 * For a job representing a branch forked from a base branch, this should return the build of the branch point.
 * Branch points may change as a base branch is manually remerged into a feature branch.
 * And jobs may be automatically building against the proposed merge of a branch,
 * in which case the base build is likely to be the latest build of the base branch.
 */
public @CheckForNull RunT getBaseBuild() {
    return getPreviousBuild();
}

which would allow a plugin to display the cumulative changes from the base branch, which may be more relevant.
(For example, in a build of a PR you probably want to know whether there are FindBugs regressions relative to the base branch, not whether the 13th commit to the PR introduced regressions relative to the 12th commit.)

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

andrew.bayer@gmail.com (JIRA)

unread,
Jun 28, 2016, 7:01:02 PM6/28/16
to jenkinsc...@googlegroups.com
Andrew Bayer commented on Improvement JENKINS-33274
 
Re: "Base build" link for first build of branch project

I'd say implement both - I can think of more places I'd use the base build rather than previous logical build, but the semantics of the two would be different enough that they'd probably both be useful.

Where would these implementations live? In things like MultibranchJob?

This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Sep 15, 2016, 7:50:02 PM9/15/16
to jenkinsc...@googlegroups.com
Jesse Glick assigned an issue to Unassigned
 
Change By: Jesse Glick
Assignee: stephenconnolly

jdumay@cloudbees.com (JIRA)

unread,
Nov 13, 2016, 6:40:01 PM11/13/16
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Jan 4, 2019, 11:04:02 AM1/4/19
to jenkinsc...@googlegroups.com
Andrew Bayer resolved as Won't Fix
 

This is not actually that worthwhile a feature to add, in practice, and is hairier to implement than I thought two years ago when I first looked into it, so I'm closing this as won't fix.

Change By: Andrew Bayer
Status: Open Resolved
Resolution: Won't Fix
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

jnord@cloudbees.com (JIRA)

unread,
Jan 4, 2019, 12:19:02 PM1/4/19
to jenkinsc...@googlegroups.com
James Nord commented on Improvement JENKINS-33274
 
Re: "Base build" link for first build of branch project

can you define worthwhile?

I would say not introducing new spotbugs issues into a build is very worthwhile.  

given a PR build has no comparision spotbugs will treat all issues as new, which means you have to fix every single issue, or just ignore them and hope you don;t introduce new ones (when you are starting on a non greenfield project that has say 1000 spotbugs issues and you want to ratchet them down over time, or at least not allow new issues to be introduced).

 

There are other use cases as well but that above is pretty worthwhile.  (you can s/spotbugs/checkstyle/) and there are likely many other use cases too that require this support.

andrew.bayer@gmail.com (JIRA)

unread,
Jan 4, 2019, 12:26:03 PM1/4/19
to jenkinsc...@googlegroups.com
Andrew Bayer reopened an issue
 

Reopening at James Nord's request, but I don't expect that we'll be working on this at any time in the foreseeable future.

Change By: Andrew Bayer
Resolution: Won't Fix
Status: Resolved Reopened
Assignee: CloudBees Inc.

jglick@cloudbees.com (JIRA)

unread,
Jan 11, 2019, 5:00:03 PM1/11/19
to jenkinsc...@googlegroups.com
Jesse Glick commented on Improvement JENKINS-33274
 
Re: "Base build" link for first build of branch project

Yeah the only real workaround for the example James Nord gave is to use Sonar to track regressions and give up on doing it from Jenkins.

jglick@cloudbees.com (JIRA)

unread,
Jan 17, 2019, 12:21:03 PM1/17/19
to jenkinsc...@googlegroups.com

Sounds like Ulli Hafner has implemented something like this privately in warnings-ng.

jglick@cloudbees.com (JIRA)

unread,
Oct 17, 2019, 8:41:08 AM10/17/19
to jenkinsc...@googlegroups.com
Change By: Jesse Glick
Status: Reopened Open
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages