Build Against Specific Gerrit Change

Version 1 by Robin Shen
on Aug 16, 2015 12:48.


 
compared with
Current by Robin Shen
on Aug 16, 2015 12:53.


 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 1 changes. View first change.

 h1. Situation
 Sometimes it is desirable to run build against specific Gerrit change.
  
  h1. Resolution
  h1. Resolution (since 6.0.25)
 # Define a variable say "change", with prompt setting set to _prompt as selection box_, with below choice:
 {code}
 ${groovy:
 // assume your Gerrit repository defined at QuickBuild side is named "gerrit"
 def repo = repositories.get("gerrit");
  
 def choices = "";
 for (each in repo.getOpenChanges()) {
  choices += each.customData.changeNo + ": " + each.customData.subject + ",";
 \}
 return choices;
 }
 {code}
 This setting will prompt user with a list of Gerrit open changes for selection.
  
 # Set up Gerrit repository at QuickBuild side and configure field _change numbers_ as below:
 {code}
 ${groovy:
 import com.pmease.quickbuild.util.StringUtils;
  
 def change = vars.getValue("change");
 if (change != null)
  return StringUtils.substringBefore(change, ":");
 else
  return "";
 }
 {code}
 This tells QB to build against selected change in above step.
 # Make sure option "Queue Changed Branches Only" in advanced configuration setting is set to _no_, as otherwise, QB will not run build even if change number is specified if a build has already been fired for a change.