Skip to content

Commit

Permalink
fix(core): handle incoming non-parallelized pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
robfletcher committed Aug 30, 2017
1 parent 4569b5d commit d541815
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 20 deletions.
1 change: 0 additions & 1 deletion orca-loadtest/src/main/resources/request-bodies/wait.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
}
],
"limitConcurrent": true,
"parallel": true,
"appConfig": {},
"executionEngine": "v3"
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,13 @@
*/
package com.netflix.spinnaker.orca.pipelinetemplate.v1schema;

import java.util.*;
import java.util.stream.Collectors;
import com.netflix.spinnaker.orca.pipelinetemplate.generator.ExecutionGenerator;
import com.netflix.spinnaker.orca.pipelinetemplate.v1schema.model.PipelineTemplate;
import com.netflix.spinnaker.orca.pipelinetemplate.v1schema.model.PipelineTemplate.Configuration;
import com.netflix.spinnaker.orca.pipelinetemplate.v1schema.model.TemplateConfiguration;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;

public class V1SchemaExecutionGenerator implements ExecutionGenerator {

@Override
Expand All @@ -43,11 +38,9 @@ public Map<String, Object> generate(PipelineTemplate template, TemplateConfigura
// TODO rz - Ehhhh
Configuration c = template.getConfiguration();
if (template.getConfiguration() == null) {
pipeline.put("parallel", true);
pipeline.put("limitConcurrent", true);
pipeline.put("keepWaitingPipelines", false);
} else {
pipeline.put("parallel", c.getConcurrentExecutions().getOrDefault("parallel", true));
pipeline.put("limitConcurrent", c.getConcurrentExecutions().getOrDefault("limitConcurrent", true));
pipeline.put("keepWaitingPipelines", c.getConcurrentExecutions().getOrDefault("keepWaitingPipelines", false));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import org.yaml.snakeyaml.Yaml
import spock.lang.Specification
import spock.lang.Subject
import spock.lang.Unroll

import static org.unitils.reflectionassert.ReflectionAssert.assertReflectionEquals

class PipelineTemplatePipelinePreprocessorSpec extends Specification {
Expand Down Expand Up @@ -110,7 +109,6 @@ class PipelineTemplatePipelinePreprocessorSpec extends Specification {
name: 'Unnamed Execution',
keepWaitingPipelines: false,
limitConcurrent: true,
parallel: true,
notifications: [],
stages: [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ class TemplatedPipelineModelMutatorSpec extends Specification {
)
)]}
pipeline.triggers.size() == 1
pipeline.parallel == null
pipeline.parameters == null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class V1SchemaExecutionGeneratorSpec extends Specification {
result.id != null
result.application == 'orca'
result.name == 'My Template'
result.parallel == true
result.limitConcurrent == true
result.keepWaitingPipelines == false
result.stages*.type == ['bake', 'tagImage']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.netflix.spinnaker.orca.controllers

import javax.servlet.http.HttpServletResponse
import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.kork.web.exceptions.InvalidRequestException
import com.netflix.spinnaker.kork.web.exceptions.ValidationException
Expand All @@ -36,8 +37,6 @@ import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestMethod
import org.springframework.web.bind.annotation.RestController

import javax.servlet.http.HttpServletResponse

@RestController
@Slf4j
class OperationsController {
Expand Down Expand Up @@ -87,8 +86,8 @@ class OperationsController {
throw new InvalidRequestException("Pipeline is disabled and cannot be started.")
}

def parallel = pipeline.parallel as Boolean
if (!parallel) {
def linear = pipeline.stages.every { it.refId == null }
if (linear) {
convertLinearToParallel(pipeline)
}

Expand Down Expand Up @@ -212,8 +211,6 @@ class OperationsController {
stage.put("requisiteStageRefIds", Collections.emptyList())
}
}

pipelineConfig.parallel = Boolean.TRUE
}

private Map<String, String> startPipeline(Map config) {
Expand Down

0 comments on commit d541815

Please sign in to comment.