Skip to content

Commit

Permalink
fix(spring): Wire up force cancel command manually (spinnaker#2483)
Browse files Browse the repository at this point in the history
  • Loading branch information
robzienert authored and clanesf committed Dec 8, 2018
1 parent c2850c5 commit a455cf1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import com.netflix.spinnaker.orca.ExecutionStatus.NOT_STARTED
import com.netflix.spinnaker.orca.pipeline.model.Execution
import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Component
import java.time.Clock

/**
Expand All @@ -29,7 +28,6 @@ import java.time.Clock
*
* TODO(rz): Fix zombies.
*/
@Component
class ForceExecutionCancellationCommand(
private val executionRepository: ExecutionRepository,
private val clock: Clock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.spectator.api.Registry;
import com.netflix.spinnaker.kork.core.RetrySupport;
import com.netflix.spinnaker.orca.commands.ForceExecutionCancellationCommand;
import com.netflix.spinnaker.orca.events.ExecutionEvent;
import com.netflix.spinnaker.orca.events.ExecutionListenerAdapter;
import com.netflix.spinnaker.orca.exceptions.DefaultExceptionHandler;
Expand Down Expand Up @@ -177,4 +178,10 @@ public TaskScheduler taskScheduler() {
public EventListenerFactory eventListenerFactory() {
return new InspectableEventListenerFactory();
}

@Bean
public ForceExecutionCancellationCommand forceExecutionCancellationCommand(ExecutionRepository executionRepository,
Clock clock) {
return new ForceExecutionCancellationCommand(executionRepository, clock);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package com.netflix.spinnaker.orca.commands

import com.netflix.spinnaker.orca.ExecutionStatus
import com.netflix.spinnaker.orca.pipeline.model.Task
import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository
import spock.lang.Specification
Expand All @@ -24,10 +23,7 @@ import java.time.Clock
import java.time.Instant
import java.time.ZoneId

import static com.netflix.spinnaker.orca.ExecutionStatus.CANCELED
import static com.netflix.spinnaker.orca.ExecutionStatus.NOT_STARTED
import static com.netflix.spinnaker.orca.ExecutionStatus.RUNNING
import static com.netflix.spinnaker.orca.ExecutionStatus.SUCCEEDED
import static com.netflix.spinnaker.orca.ExecutionStatus.*
import static com.netflix.spinnaker.orca.pipeline.model.Execution.ExecutionType.PIPELINE
import static com.netflix.spinnaker.orca.test.model.ExecutionBuilder.pipeline
import static com.netflix.spinnaker.orca.test.model.ExecutionBuilder.stage
Expand All @@ -45,7 +41,7 @@ class ForceExecutionCancellationCommandSpec extends Specification {
status = RUNNING
stage {
id = "s1"
status = ExecutionStatus.SUCCEEDED
status = SUCCEEDED
}
stage {
id = "s2"
Expand All @@ -54,7 +50,7 @@ class ForceExecutionCancellationCommandSpec extends Specification {
}
stage {
id = "s3"
status = ExecutionStatus.NOT_STARTED
status = NOT_STARTED
}
}

Expand Down

0 comments on commit a455cf1

Please sign in to comment.