Search in sources :

Example 1 with TimeService

use of jetbrains.buildServer.util.TimeService in project teamcity-rest by JetBrains.

the class BuildRequest method setFinishedTime.

/**
 * Experimental support for finishing the build. The actual build finish process can be long and can finish after the request has returned.
 * Use with caution: this API is not yet stable and is subject to change.
 */
@PUT
@Path("/{buildLocator}/finishDate")
@Consumes({ MediaType.TEXT_PLAIN })
@Produces({ MediaType.TEXT_PLAIN })
@ApiOperation(value = "Marks the running build as finished by passing agent the current time of the build to finish.", nickname = "setBuildFinishDate")
public String setFinishedTime(@ApiParam(format = LocatorName.BUILD) @PathParam("buildLocator") String buildLocator, final String date) {
    if (StringUtil.isEmpty(date)) {
        throw new BadRequestException("Body should contain finish date");
    }
    TimeService timeService = myBeanContext.getSingletonService(TimeService.class);
    Date finishTime = !StringUtil.isEmpty(date) ? TimeWithPrecision.parse(date, timeService).getTime() : new Date(timeService.now());
    return finishBuild(buildLocator, finishTime);
}
Also used : TimeService(jetbrains.buildServer.util.TimeService) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)1 TimeService (jetbrains.buildServer.util.TimeService)1