Skip to content

Commit

Permalink
feat(pipeline): Add pipeline execution cancellation entrypoint. (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Duftler authored and Eric Wiseblatt committed Sep 1, 2017
1 parent 5344e21 commit 1e6a5cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;
Expand Down Expand Up @@ -88,6 +90,15 @@ List<ExecutionLogEntry> logs(@PathVariable String executionId) {
return executionLogRepository.getAllByExecutionId(executionId);
}

@ApiOperation(value = "Cancel a pipeline execution")
@RequestMapping(value = "/{executionId}/cancel", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.ACCEPTED)
void cancel(@PathVariable String executionId) {
log.info("Cancelling pipeline execution {}...", executionId);

executionRepository.cancel(executionId);
}

private static class FeatureNotEnabledException extends RuntimeException {
public FeatureNotEnabledException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public CanaryController(String currentInstanceId,
}
}

// TODO(duftler): Allow for user to be passed in.
@ApiOperation(value = "Initiate a canary pipeline")
@RequestMapping(consumes = "application/json", method = RequestMethod.POST)
public String initiateCanary(@RequestParam(required = false) final String metricsAccountName,
Expand Down

0 comments on commit 1e6a5cb

Please sign in to comment.