From 0087aae0f40f6926c5c5281a7f9d7560f9c58d1a Mon Sep 17 00:00:00 2001 From: AbdulRahman AlHamali Date: Wed, 24 Mar 2021 23:10:19 -0400 Subject: [PATCH] add ignore stage failure endpoint --- .../spinnaker/gate/services/internal/OrcaService.java | 7 +++++++ .../spinnaker/gate/controllers/PipelineController.groovy | 6 ++++++ .../netflix/spinnaker/gate/services/PipelineService.groovy | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/gate-core/src/main/java/com/netflix/spinnaker/gate/services/internal/OrcaService.java b/gate-core/src/main/java/com/netflix/spinnaker/gate/services/internal/OrcaService.java index d37601842b..c1f2c6be88 100644 --- a/gate-core/src/main/java/com/netflix/spinnaker/gate/services/internal/OrcaService.java +++ b/gate-core/src/main/java/com/netflix/spinnaker/gate/services/internal/OrcaService.java @@ -106,6 +106,13 @@ Map restartPipelineStage( @Path("stageId") String stageId, @Body Map restartDetails); + @Headers("Accept: application/json") + @PUT("/pipelines/{executionId}/stages/{stageId}/ignoreFailure") + Map ignorePipelineStageFailure( + @Path("executionId") String executionId, + @Path("stageId") String stageId, + @Body Map ignoreFailureDetails); + @Headers("Accept: application/json") @POST("/orchestrate") Map startPipeline(@Body Map pipelineConfig, @Query("user") String user); diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineController.groovy index 9dd75d40d5..65702275d5 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/PipelineController.groovy @@ -177,6 +177,12 @@ class PipelineController { pipelineService.restartPipelineStage(id, stageId, context) } + @ApiOperation(value = "Ignore the failure of a stage", response = HashMap.class) + @PutMapping("/{id}/stages/{stageId}/ignoreFailure") + Map ignoreStageFailure(@PathVariable("id") String id, @PathVariable("stageId") String stageId, @RequestBody Map context) { + pipelineService.ignorePipelineStageFailure(id, stageId, context) + } + @ApiOperation(value = "Delete a pipeline execution", response = HashMap.class) @DeleteMapping("{id}") Map deletePipeline(@PathVariable("id") String id) { diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/services/PipelineService.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/services/PipelineService.groovy index 5366c9f3a9..58c6180999 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/services/PipelineService.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/services/PipelineService.groovy @@ -153,6 +153,11 @@ class PipelineService { orcaServiceSelector.select().restartPipelineStage(executionId, stageId, context) } + Map ignorePipelineStageFailure(String executionId, String stageId, Map context) { + setApplicationForExecution(executionId) + orcaServiceSelector.select().ignorePipelineStageFailure(executionId, stageId, context) + } + Map evaluateExpressionForExecution(String executionId, String pipelineExpression) { orcaServiceSelector.select().evaluateExpressionForExecution(executionId, pipelineExpression) }