You are viewing an old version (v. 1) of this page.
The latest version is v. 2, last edited on Aug 16, 2015
(view differences
|
)
view page history | view next version >>
view page history | view next version >>
Situation
Sometimes it is desirable to run build against specific Gerrit change.
Resolution
- Define a variable say "change", with prompt setting set to prompt as selection box, with below choice:
${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; }
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:
${groovy: import com.pmease.quickbuild.util.StringUtils; def change = vars.getValue("change"); if (change != null) return StringUtils.substringBefore(change, ":"); else return ""; }
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.