Skip to content

Commit

Permalink
fix(wait): Fix wait for up instances task (#3923)
Browse files Browse the repository at this point in the history
* fix(wait): Fix wait for up instances task

This change in clouddriver spinnaker/clouddriver#4681
added a boolean `pinned` field to the `Capacity` object in `ServerGroup`.
However there's some code in the `WaitForUpInstancesTask` in Orca that
depends on the types all being `Integer`. The end result is that the
wait task fails with a stack trace like:

```
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'true' with class 'java.lang.Boolean' to class 'java.lang.Integer'
```

This patch updates the task to just get the fields it needs to compare
and adds a test for this case.

* chore(kork): update kork dependency (now w/ moniker) (#3958)

* test(preconfigured): include integration test for preconfigured job (#3945)

* test(preconfigured): include integration test for preconfigured job with kubernetes provider

* refactor(preconfigured): refactor test

* feat(clouddriver): Look ahead region detection for "aws" can be disabled (#3959)

Similar to the bake stage, `skipRegionDetection` can be used to determine
whether or not additional regions are inferred from downstream deploy stages.

The default value is `false` which preserves the existing behavior.

```
{
  ...
  "skipRegionDetection": true
}

```

* feat(orca): Add support for Redis SSL (#3934)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* feat(queue): Add command to cleanup zombie executions (#3946)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* fix(bake): Log when bake request amiSuffix and stage context amiSuffix values are different and resolve the difference (#3960)

* chore(dependencies): Autobump spinnakerGradleVersion (#3962)

Co-authored-by: root <root@877703f80d77>

Co-authored-by: Michael Plump <plumpy@google.com>
Co-authored-by: Edgar Garcia <63310723+edgarulg@users.noreply.github.com>
Co-authored-by: Adam Jordens <adam@jordens.org>
Co-authored-by: tompiscitell <tompiscitell@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Rob Zienert <rzienert@netflix.com>
Co-authored-by: Chris Smalley <csmalley@netflix.com>
Co-authored-by: spinnakerbot <spinbot@spinnaker.io>
Co-authored-by: root <root@877703f80d77>
  • Loading branch information
10 people committed Oct 28, 2020
1 parent 6b38093 commit 7a87be2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class WaitForUpInstancesTask extends AbstractWaitingForInstancesTask {
static boolean useConfiguredCapacity(StageExecution stage, Map<String, Integer> current) {
Map<String, Integer> configured =
(stage.context.getOrDefault("capacity", [:]))
.subMap(["min", "max", "desired"])
.collectEntries { k, v -> [(k): v as Integer] } as Map<String, Integer>

if (configured.desired == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ class WaitForUpInstancesTaskSpec extends Specification {
context.capacity = [
min : configured.min,
max : configured.max,
desired: configured.desired
desired: configured.desired,
pinned : configured.pinned
]
}

Expand All @@ -381,8 +382,8 @@ class WaitForUpInstancesTaskSpec extends Specification {
result || snapshot | healthy | asg | configured
false || null | 2 | [min: 3, max: 3, desired: 3] | null
// configured is used if present and min == max == desired
true || null | 2 | [min: 3, max: 3, desired: 3] | [min: 2, max: 2, desired: 2]
true || null | 2 | [min: 3, max: 3, desired: 3] | [min: "2", max: "2", desired: "2"]
true || null | 2 | [min: 3, max: 3, desired: 3] | [min: 2, max: 2, desired: 2, pinned: true]
true || null | 2 | [min: 3, max: 3, desired: 3] | [min: "2", max: "2", desired: "2", pinned: "true"]
// configured is used if current allows autoscaling but configured doesn't
true || null | 2 | [min: 3, max: 3, desired: 3] | [min: 2, max: 500, desired: 2]
true || null | 2 | [min: 3, max: 3, desired: 3] | [min: "2", max: "500", desired: "2"]
Expand Down

0 comments on commit 7a87be2

Please sign in to comment.