Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Display alert from pre-queue script? #3882

prgross ·

Is it possible to display an alert (or provide some other feedback) from a pre-queue groovy script?

Presently I have a build that does data validation as the first build step. This means users have to wait for their build to run before getting feedback that the input data was invalid.

I'd like to validate the data before queuing the build request, and I need to tell the user what's wrong. I'd envisioned being able to display an alert, but don't know if that's possible.

Writing to the system log is not acceptable (too hard to find an entry, and most users don't know about it).

  • replies 4
  • views 2035
  • stars 0
robinshen ADMIN ·

You may consider to send email to build requester if something abnormal happens. Something like below:
import com.pmease.quickbuild.util.MiscUtils;
import com.pmease.quickbuild.entitymanager.SettingManager;

if (request.requesterId != null) {
def requester = system.userManager.load(request.requesterId);
def mailSetting = SettingManager.instance.getEmailSetting();
MiscUtils.sendMail(, null, null, "email subject", "email body", null, mailSetting, "text/html");

drdt ·

Has there been any improvement in this area since? We are looking for a way to validate the inputs to a build.

For text prompts. there is an option to specify a regex pattern, and for numbers I can specify a range. However, it would be good to be able to validate more fully, for example by comparing the input to a list of valid values (like usernames).

In my specific case, I have a configuration picker, but I want to fail if the user selects a configuration that is disabled, or is outside of a specific tree structure. Right now I am doing it in a pre-queue script, but as the previous poster observed, the error message shows only "Build request is ignored [because] pre-queue script evaluates to false.".

It would be awesome to be able to configure this message.

robinshen ADMIN ·

You may just throw exception in pre-queue script, for instance:

if (...)
  throw new QuickbuildException("Something is wrong");

It will be displayed in UI.

drdt ·

Okay, this will do for now. I will submit an enhancement request for better input validation.