Git ChangeLog, how to change base branch it computes from?

24 views
Skip to first unread message

Eric Crahen

unread,
Aug 15, 2016, 1:10:56 PM8/15/16
to Jenkins Users
Hey,

  To support a PR-building workflow, I have a plugin which sets the branch used by the Jenkins workspace, to something I configure (which is the pr-branch).
  This happens by using the GitSCM API, a very abbreviated version of what happens is this:

   GitTool tool = GitTool.getDefaultInstallation();
   GitClient git = Git.with(listener, env).in(workspaceDir).using(tool.getGitExe()).getClient();
   git.fetch("origin", new RefSpec(refspec));
   git.checkout(localBranch);  


   What I would like to do is make the changelog that appears on the build page understand that the base branch used is not master (or whatever the default branch is that the job was configured to use). Currently, I notice the changelog is unaware the branch built from changed, and so it shows the wrong commits.

   I have tried to change the BuildData associated with the job, and that part at least makes the GitData link that shows on the build page name and link to the correct (in this case the PR branch) branch. This doesn't seem to be what ChangeLog is looking at though. I took a quick look and the changelog logic is kind of complex, so if anyone knows how this works that'd be super useful - this must be a thing we can do one way or another. thanks :)

Mark Waite

unread,
Aug 15, 2016, 3:59:02 PM8/15/16
to Jenkins Users
The git plugin has an "Additional Behaviour" which tells the plugin to calculate changes from a base branch, rather than calculating the changes from the preceding build.  Could you use that instead of writing code?

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c5041a95-874b-4bed-9130-88305f2acd36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eric Crahen

unread,
Aug 15, 2016, 4:55:55 PM8/15/16
to jenkins...@googlegroups.com
Thanks, I'll try to find that setting and figure out a way to set that programatically. My end goal is that a large number of people just install the plugin and the right thing happens w/o manually configuring lots of jobs correctly, so that why I wanted to do it in code. Thanks for the pointer.

On Mon, Aug 15, 2016 at 12:58 PM, Mark Waite <mark.ea...@gmail.com> wrote:
The git plugin has an "Additional Behaviour" which tells the plugin to calculate changes from a base branch, rather than calculating the changes from the preceding build.  Could you use that instead of writing code?

Mark Waite

On Mon, Aug 15, 2016 at 11:11 AM Eric Crahen <eric....@gmail.com> wrote:
Hey,

  To support a PR-building workflow, I have a plugin which sets the branch used by the Jenkins workspace, to something I configure (which is the pr-branch).
  This happens by using the GitSCM API, a very abbreviated version of what happens is this:

   GitTool tool = GitTool.getDefaultInstallation();
   GitClient git = Git.with(listener, env).in(workspaceDir).using(tool.getGitExe()).getClient();
   git.fetch("origin", new RefSpec(refspec));
   git.checkout(localBranch);  


   What I would like to do is make the changelog that appears on the build page understand that the base branch used is not master (or whatever the default branch is that the job was configured to use). Currently, I notice the changelog is unaware the branch built from changed, and so it shows the wrong commits.

   I have tried to change the BuildData associated with the job, and that part at least makes the GitData link that shows on the build page name and link to the correct (in this case the PR branch) branch. This doesn't seem to be what ChangeLog is looking at though. I took a quick look and the changelog logic is kind of complex, so if anyone knows how this works that'd be super useful - this must be a thing we can do one way or another. thanks :)

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/09qwlBeOQds/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFCb-vJk7s4Sv6Giw84-isubuTNU3En9J5XZZMtf5TGNQ%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
- Eric
Reply all
Reply to author
Forward
0 new messages