View Source

h1. Situation
Sometimes it is desirable to run build against specific Gerrit change.

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.