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.

How to set "Pause System" flag via script (within quickbuild)? #3961

grecht ·
  • solved #2
  • replies 4
  • views 767
  • stars 1
robinshen ADMIN ·

This can be done via below script:

groovy:
import com.pmease.quickbuild.entitymanager.SettingManager;
import com.pmease.quickbuild.setting.system.PauseSystem;
 
def systemSetting = SettingManager.instance.getSystemSettingDef();
def pauseSystem = new PauseSystem();
//pauseSystem.setUser("qbMaintenance");
pauseSystem.setReason("System Maintenance is running.  Please wait until maintenance process is complete.");
systemSetting.setPauseSystem(pauseSystem);
SettingManager.instance.saveSystemSetting(systemSetting);
grecht ·

Thank you, that's a big help. I do have one followup-question though: I want to restart the QB-Server after setting "Pause System", and when the reboot process is finished reset the flag so builds can run again.
So far I'm doing this via a scheduled script on the server itself using the REST api. Is there a workaround to run a script while "Pause System" is enabled?

robinshen ADMIN ·

Unfortunately this is not possible as by definition the system is paused, and no any builds will be able to run.

rpallares ·

Hi, to be able to start and stop the system we wrote some scripts that pause the system via the REST API, then restart the server.
Finally when the server is up, our script unpause the system.
It's working well, but a native feature to do all that could be useful.