From aa4198bee39c4b64954c3151d18a2a9d352407a1 Mon Sep 17 00:00:00 2001 From: Matt Duftler Date: Mon, 30 Oct 2017 16:05:35 -0400 Subject: [PATCH] chore(canary-v2): Update to new json-based initiate canary entrypoint. --- .../orca/kayenta/KayentaService.groovy | 18 +++------ .../orca/kayenta/tasks/RunCanaryTask.groovy | 37 +++++++++++++------ 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/orca-kayenta/src/main/groovy/com/netflix/spinnaker/orca/kayenta/KayentaService.groovy b/orca-kayenta/src/main/groovy/com/netflix/spinnaker/orca/kayenta/KayentaService.groovy index 00a44cbcc37..6df069778e0 100644 --- a/orca-kayenta/src/main/groovy/com/netflix/spinnaker/orca/kayenta/KayentaService.groovy +++ b/orca-kayenta/src/main/groovy/com/netflix/spinnaker/orca/kayenta/KayentaService.groovy @@ -22,18 +22,12 @@ import retrofit.http.* interface KayentaService { - @POST("/canary") - Response create(@Query("metricsAccountName") String metricsAccountName, - @Query("storageAccountName") String storageAccountName, - @Query("canaryConfigId") String canaryConfigId, - @Query("controlScope") String controlScope, - @Query("experimentScope") String experimentScope, - @Query("startTimeIso") String startTimeIso, - @Query("endTimeIso") String endTimeIso, - @Query("step") String step, - @Body Map extendedScopeParams, - @Query("scoreThresholdPass") String scoreThresholdPass, - @Query("scoreThresholdMarginal") String scoreThresholdMarginal) + @POST("/canary/{canaryConfigId}") + Map create(@Path("canaryConfigId") String canaryConfigId, + @Query("metricsAccountName") String metricsAccountName, + @Query("configurationAccountName") String configurationAccountName, + @Query("storageAccountName") String storageAccountName, + @Body Map canaryExecutionRequest) @GET("/pipelines/{executionId}") Pipeline getPipelineExecution(@Path("executionId") String executionId) diff --git a/orca-kayenta/src/main/groovy/com/netflix/spinnaker/orca/kayenta/tasks/RunCanaryTask.groovy b/orca-kayenta/src/main/groovy/com/netflix/spinnaker/orca/kayenta/tasks/RunCanaryTask.groovy index 1936c5f264f..db16fce5db1 100644 --- a/orca-kayenta/src/main/groovy/com/netflix/spinnaker/orca/kayenta/tasks/RunCanaryTask.groovy +++ b/orca-kayenta/src/main/groovy/com/netflix/spinnaker/orca/kayenta/tasks/RunCanaryTask.groovy @@ -49,18 +49,31 @@ class RunCanaryTask implements Task { String step = (String)context.get("step") Map extendedScopeParams = (Map)context.get("extendedScopeParams") Map scoreThresholds = (Map)context.get("scoreThresholds") - Response response = kayentaService.create(metricsAccountName, - storageAccountName, - canaryConfigId, - controlScope, - experimentScope, - startTimeIso, - endTimeIso, - step, - extendedScopeParams, - scoreThresholds?.pass, - scoreThresholds?.marginal) - String canaryPipelineExecutionId = new String(((TypedByteArray)response.getBody()).getBytes()) + Map canaryExecutionRequest = [ + controlScope: [ + scope: controlScope, + start: startTimeIso, + end: endTimeIso, + step: step, + extendedScopeParams: extendedScopeParams + ], + experimentScope: [ + scope: experimentScope, + start: startTimeIso, + end: endTimeIso, + step: step, + extendedScopeParams: extendedScopeParams + ], + thresholds: [ + pass: scoreThresholds?.pass, + marginal: scoreThresholds?.marginal + ] + ] + String canaryPipelineExecutionId = kayentaService.create(canaryConfigId, + metricsAccountName, + storageAccountName /* configurationAccountName */, // TODO(duftler): Propagate configurationAccountName properly. + storageAccountName, + canaryExecutionRequest).canaryExecutionId return new TaskResult(ExecutionStatus.SUCCEEDED, [canaryPipelineExecutionId: canaryPipelineExecutionId]) }