Skip to main content
Version: QB11

Chained Build Options

Situation

When prompt build options for a manually triggered build, it is often desirable to chain two or more selection boxes together so that available choices of latter selection box are calculated based on selected value of prior selection box.

Demonstration

  1. Switch to the demo configuration, and hit the run button.
  2. The build option page prompts user to select a directory and a file inside that directory.
  3. Select a directory, and available choices of the file selection box will change to reflect contained files under that directory.
  4. Run the build, and check the build log. The selected directory name and file name will be printed there as a demonstration.

Resolution

  1. Switch to variables definition of the demo configuration.
  2. The variable dir is defined to prompt as a selection box, with choices field defined as a groovy script returning all sub directory names under /home/pmease/skyagent.
  3. The variable file is defined to prompt as a selection box, with choices field defined as a groovy script returning all file names under the selected sub directory.
  4. Check the steps definition, a test step is added to print selected value of the directory and file.