This page lists step-precondition scripts that are taken straight from the public JIRA site. Please note that some scripts may be snippets and probably WILL need modification to work properly for your situation. Treat these as templates that you can modify from.
// This script will run a step if the name of the workflow is "Workflow Name" import com.urbancode.anthill3.domain.workflow.*; import com.urbancode.anthill3.runtime.scripting.helpers.*; Workflow workflow = WorkflowLookup.getCurrent(); boolean isTrue = false; String name = ""; return new Criteria() { public boolean matches(Object obj) { name = workflow.getName(); if("Workflow Name".equals(name)){ isTrue = true; }else{ isTrue = false; } return isTrue; } }
// All previous steps are successful and the build type is official Logic.and( StepStatus.allPriorIn(new JobStatusEnum[] { JobStatusEnum.SUCCESS, JobStatusEnum.SUCCESS_WARN }), Property.is("buildType", "official") );
import com.urbancode.anthill3.domain.buildrequest.BuildRequest; import com.urbancode.anthill3.domain.buildrequest.*; BuildRequest request = BuildRequestLookup.getCurrent(); String scheduleName = null; return new Criteria() { public boolean matches(Object obj) { if (RequestSourceEnum.SCHEDULED.equals(request.getRequestSource())) { scheduleName = request.getRequester().getSchedule().getName(); } return "Nightly 1am (expression)".equals(scheduleName); } }