From 5fa449f2a2653b933ad6f0a4bb932bd8fa37b7c6 Mon Sep 17 00:00:00 2001 From: Asher Feldman Date: Fri, 3 Nov 2017 14:35:57 -0700 Subject: [PATCH] fix(canary): fix wait task after baseline asg disable --- .../netflix/spinnaker/orca/kato/tasks/WaitTaskSpec.groovy | 4 +++- .../netflix/spinnaker/orca/pipeline/tasks/WaitTask.groovy | 5 +++-- .../spinnaker/orca/mine/tasks/DisableCanaryTask.groovy | 1 - 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/kato/tasks/WaitTaskSpec.groovy b/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/kato/tasks/WaitTaskSpec.groovy index 5fdb4cb23e..0d5140dfe7 100644 --- a/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/kato/tasks/WaitTaskSpec.groovy +++ b/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/kato/tasks/WaitTaskSpec.groovy @@ -38,7 +38,8 @@ class WaitTaskSpec extends Specification { then: result.status == ExecutionStatus.RUNNING - stage.context.putAll(result.context) + result.context.waitTaskState.startTime > 1 + stage.context.putAll(result.context) when: timeProvider.millis = System.currentTimeMillis() + 10000 @@ -48,6 +49,7 @@ class WaitTaskSpec extends Specification { then: result.status == ExecutionStatus.SUCCEEDED + result.context.waitTaskState.size() == 0 } diff --git a/orca-core/src/main/groovy/com/netflix/spinnaker/orca/pipeline/tasks/WaitTask.groovy b/orca-core/src/main/groovy/com/netflix/spinnaker/orca/pipeline/tasks/WaitTask.groovy index 803dbdf312..9ebba2ae54 100644 --- a/orca-core/src/main/groovy/com/netflix/spinnaker/orca/pipeline/tasks/WaitTask.groovy +++ b/orca-core/src/main/groovy/com/netflix/spinnaker/orca/pipeline/tasks/WaitTask.groovy @@ -48,9 +48,10 @@ class WaitTask implements RetryableTask { if (!waitTaskState || !waitTaskState instanceof Map) { new TaskResult(RUNNING, [waitTaskState: [startTime: now]]) } else if (now - ((Long) ((Map) stage.context.waitTaskState).startTime) > waitTimeMs) { - new TaskResult(SUCCEEDED) + new TaskResult(SUCCEEDED, [waitTaskState: [:]]) } else if (stage.context.skipRemainingWait) { - new TaskResult(SUCCEEDED) + // leaving skipRemainingWait unchanged since added to context elsewhere + new TaskResult(SUCCEEDED, [waitTaskState: [:]]) } else { new TaskResult(RUNNING) } diff --git a/orca-mine/src/main/groovy/com/netflix/spinnaker/orca/mine/tasks/DisableCanaryTask.groovy b/orca-mine/src/main/groovy/com/netflix/spinnaker/orca/mine/tasks/DisableCanaryTask.groovy index 87a9a62e25..3dcfb95e24 100644 --- a/orca-mine/src/main/groovy/com/netflix/spinnaker/orca/mine/tasks/DisableCanaryTask.groovy +++ b/orca-mine/src/main/groovy/com/netflix/spinnaker/orca/mine/tasks/DisableCanaryTask.groovy @@ -47,7 +47,6 @@ class DisableCanaryTask extends AbstractCloudProviderAwareTask implements Task { String cloudProvider = ops && !ops.empty ? ops.first()?.values().first()?.cloudProvider : getCloudProvider(stage) ?: 'aws' def taskId = katoService.requestOperations(cloudProvider, ops).toBlocking().first() - stage.context.remove('waitTaskState') return new TaskResult(ExecutionStatus.SUCCEEDED, [ 'kato.last.task.id' : taskId, 'deploy.server.groups' : dSG,