Search in sources :

Example 1 with TriggeredBy

use of jetbrains.buildServer.serverSide.TriggeredBy in project teamcity-rest by JetBrains.

the class BuildRequest method restoreInQueue.

private void restoreInQueue(final SRunningBuild runningBuild, final User user) {
    // todo: TeamCity openAPI expose in the API. THis one is copy-paste from jetbrains.buildServer.controllers.actions.StopBuildAction.restoreInQueue
    final SAgentRestrictor agentRestrictor = ((RunningBuildEx) runningBuild).getQueuedAgentRestrictor();
    final TriggeredBy origTriggeredBy = runningBuild.getTriggeredBy();
    BuildPromotionEx promotionEx = (BuildPromotionEx) runningBuild.getBuildPromotion();
    TriggeredByBuilder tbb = new TriggeredByBuilder();
    tbb.addParameters(origTriggeredBy.getParameters());
    tbb.addParameter(TriggeredByBuilder.RE_ADDED_AFTER_STOP_NAME, String.valueOf(user.getId()));
    tbb.addParameter(TriggeredByBuilder.TYPE_PARAM_NAME, "reAddedOnStop");
    tbb.addParameter("origin", "rest");
    myBeanContext.getSingletonService(BuildQueueEx.class).restoreInQueue(promotionEx, agentRestrictor, tbb.toString());
}
Also used : TriggeredBy(jetbrains.buildServer.serverSide.TriggeredBy)

Aggregations

TriggeredBy (jetbrains.buildServer.serverSide.TriggeredBy)1