Skip to content

Commit

Permalink
chore(halyard): BaseUrls need to include protocol (#1231)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwander committed Mar 17, 2017
1 parent 764745e commit 0783f94
Show file tree
Hide file tree
Showing 30 changed files with 155 additions and 78 deletions.
23 changes: 10 additions & 13 deletions halconfig/orca-bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,25 @@ server:
address: ${services.orcaBootstrap.host:localhost}

oort:
baseUrl: ${services.clouddriverBootstrap.baseUrl:localhost:7002}

front50:
baseUrl: ${services.front50Bootstrap.baseUrl:localhost:8080}
baseUrl: ${services.clouddriverBootstrap.baseUrl:http://localhost:7002}

mort:
baseUrl: ${services.clouddriverBootstrap.baseUrl:localhost:7002}
baseUrl: ${services.clouddriverBootstrap.baseUrl:http://localhost:7002}

kato:
baseUrl: ${services.clouddriverBootstrap.baseUrl:localhost:7002}

bakery:
baseUrl: ${services.bakeryBootstrap.baseUrl:localhost:8087}
extractBuildDetails: ${services.bakeryBootstrap.extractBuildDetails:true}
allowMissingPackageInstallation: ${services.bakeryBootstrap.allowMissingPackageInstallation:false}
baseUrl: ${services.clouddriverBootstrap.baseUrl:http://localhost:7002}

echo:
enabled: false
baseUrl: ${services.echoBootstrap.baseUrl:localhost:8089}

front50:
enabled: false

bakery:
enabled: false

igor:
baseUrl: ${services.igorBootstrap.baseUrl:localhost:8088}
enabled: false

redis:
connection: ${services.redisBootstrap.baseUrl:redis://localhost:6379}
Expand Down
17 changes: 10 additions & 7 deletions halconfig/orca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,31 @@ server:
address: ${services.orca.host:localhost}

oort:
baseUrl: ${services.clouddriver.baseUrl:localhost:7002}
baseUrl: ${services.clouddriver.baseUrl:http://localhost:7002}

front50:
baseUrl: ${services.front50.baseUrl:localhost:8080}
enabled: true
baseUrl: ${services.front50.baseUrl:http://localhost:8080}

mort:
baseUrl: ${services.clouddriver.baseUrl:localhost:7002}
baseUrl: ${services.clouddriver.baseUrl:http://localhost:7002}

kato:
baseUrl: ${services.clouddriver.baseUrl:localhost:7002}
baseUrl: ${services.clouddriver.baseUrl:http://localhost:7002}

bakery:
baseUrl: ${services.bakery.baseUrl:localhost:8087}
enabled: true
baseUrl: ${services.bakery.baseUrl:http://localhost:8087}
extractBuildDetails: ${services.bakery.extractBuildDetails:true}
allowMissingPackageInstallation: ${services.bakery.allowMissingPackageInstallation:false}

echo:
enabled: true
baseUrl: ${services.echo.baseUrl:localhost:8089}
baseUrl: ${services.echo.baseUrl:http://localhost:8089}

igor:
baseUrl: ${services.igor.baseUrl:localhost:8088}
enabled: true
baseUrl: ${services.igor.baseUrl:http://localhost:8088}

redis:
connection: ${services.redis.baseUrl:redis://localhost:6379}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package com.netflix.spinnaker.orca.applications.pipelines

import groovy.transform.CompileStatic
import com.netflix.spinnaker.orca.DefaultTaskResult
import com.netflix.spinnaker.orca.ExecutionStatus
import com.netflix.spinnaker.orca.Task
Expand All @@ -27,6 +26,7 @@ import com.netflix.spinnaker.orca.pipeline.StageDefinitionBuilder
import com.netflix.spinnaker.orca.pipeline.TaskNode
import com.netflix.spinnaker.orca.pipeline.model.Execution
import com.netflix.spinnaker.orca.pipeline.model.Stage
import groovy.transform.CompileStatic
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component

Expand All @@ -41,11 +41,14 @@ class DeleteProjectStage implements StageDefinitionBuilder {

@Component
static class DeleteProjectTask implements Task {
@Autowired
@Autowired(required = false)
Front50Service front50Service

@Override
TaskResult execute(Stage stage) {
if (!front50Service) {
throw new UnsupportedOperationException("Unable to modify projects, front50 has not been enabled. Fix this by setting front50.enabled: true")
}
def projectId = stage.mapTo("/project", Front50Service.Project)
front50Service.deleteProject(projectId.id)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package com.netflix.spinnaker.orca.applications.pipelines

import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import com.google.common.annotations.VisibleForTesting
import com.netflix.spinnaker.orca.DefaultTaskResult
import com.netflix.spinnaker.orca.ExecutionStatus
Expand All @@ -29,6 +27,8 @@ import com.netflix.spinnaker.orca.pipeline.StageDefinitionBuilder
import com.netflix.spinnaker.orca.pipeline.TaskNode
import com.netflix.spinnaker.orca.pipeline.model.Execution
import com.netflix.spinnaker.orca.pipeline.model.Stage
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component

Expand All @@ -45,13 +45,17 @@ class UpsertProjectStage implements StageDefinitionBuilder {
@Component
@VisibleForTesting
public static class UpsertProjectTask implements Task {
@Autowired
@Autowired(required = false)
Front50Service front50Service

UpsertProjectTask() {}

@Override
TaskResult execute(Stage stage) {
if (!front50Service) {
throw new UnsupportedOperationException("Unable to modify projects, front50 has not been enabled. Fix this by setting front50.enabled: true")
}

def projectId = stage.mapTo("/project", Front50Service.Project)
def project = stage.mapTo("/project", Map)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.netflix.spinnaker.orca.bakery.config

import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression

import java.text.SimpleDateFormat
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy
Expand Down Expand Up @@ -46,6 +48,7 @@ import static retrofit.Endpoints.newFixedEndpoint
"com.netflix.spinnaker.orca.bakery.tasks"
])
@CompileStatic
@ConditionalOnExpression('${bakery.enabled:true}')
class BakeryConfiguration {

@Autowired Client retrofitClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@

package com.netflix.spinnaker.orca.bakery.tasks

import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.orca.DefaultTaskResult
import com.netflix.spinnaker.orca.ExecutionStatus
import com.netflix.spinnaker.orca.RetryableTask
import com.netflix.spinnaker.orca.TaskResult
import com.netflix.spinnaker.orca.bakery.api.BakeRequest
import com.netflix.spinnaker.orca.bakery.api.BakeStatus
import com.netflix.spinnaker.orca.bakery.api.BakeryService
import com.netflix.spinnaker.orca.pipeline.model.Pipeline
import com.netflix.spinnaker.orca.pipeline.model.Stage
import com.netflix.spinnaker.orca.pipeline.util.OperatingSystem
import com.netflix.spinnaker.orca.pipeline.util.PackageInfo
import com.netflix.spinnaker.orca.pipeline.util.PackageType
import groovy.transform.CompileDynamic
import groovy.transform.CompileStatic
import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.orca.DefaultTaskResult
import com.netflix.spinnaker.orca.ExecutionStatus
import com.netflix.spinnaker.orca.TaskResult
import com.netflix.spinnaker.orca.bakery.api.BakeRequest
import com.netflix.spinnaker.orca.bakery.api.BakeryService
import com.netflix.spinnaker.orca.pipeline.model.Stage
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Component
Expand All @@ -43,7 +43,8 @@ class CreateBakeTask implements RetryableTask {
long backoffPeriod = 30000
long timeout = 300000

@Autowired BakeryService bakery
@Autowired(required = false)
BakeryService bakery
@Autowired ObjectMapper mapper

@Value('${bakery.extractBuildDetails:false}')
Expand All @@ -58,6 +59,9 @@ class CreateBakeTask implements RetryableTask {
@Override
TaskResult execute(Stage stage) {
String region = stage.context.region
if (!bakery) {
throw new UnsupportedOperationException("You have not enabled baking for this orca instance. Set bakery.enabled: true")
}

try {
// If the user has specified a base OS that is unrecognized by Rosco, this method will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ class CreateBakeTaskSpec extends Specification {
Pipeline pipelineWithTrigger = new Pipeline.Builder().withTrigger([buildInfo: triggerInfo]).build()
Stage stage = new PipelineStage(pipelineWithTrigger, "bake", bakeConfig)
bakeConfig.buildInfo = contextInfo
task.bakery = Mock(BakeryService)
when:
task.execute(stage)
Expand All @@ -301,6 +302,7 @@ class CreateBakeTaskSpec extends Specification {
given:
Pipeline pipelineWithTrigger = new Pipeline.Builder().withTrigger([buildInfo: buildInfo]).build()
Stage stage = new PipelineStage(pipelineWithTrigger, "bake", bakeConfig)
task.bakery = Mock(BakeryService)
bakeConfig.buildInfo = [
artifacts: [
[fileName: 'hodor_1.2_all.deb'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CustomStrategy implements Strategy, ApplicationContextAware {

final String name = "custom"

@Autowired
@Autowired(required = false)
PipelineStage pipelineStage

ApplicationContext applicationContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

Expand All @@ -42,11 +43,12 @@ public class DetermineHealthProvidersTask implements RetryableTask, CloudProvide
private static final Logger log = LoggerFactory.getLogger(DetermineHealthProvidersTask.class);

private final Front50Service front50Service;

private final Map<String, String> healthProviderNamesByPlatform;

@Autowired
public DetermineHealthProvidersTask(Front50Service front50Service, Collection<ServerGroupCreator> serverGroupCreators) {
this.front50Service = front50Service;
public DetermineHealthProvidersTask(Optional<Front50Service> front50Service, Collection<ServerGroupCreator> serverGroupCreators) {
this.front50Service = front50Service.orElse(null);
this.healthProviderNamesByPlatform = serverGroupCreators
.stream()
.filter(serverGroupCreator -> serverGroupCreator.getHealthProviderName().isPresent())
Expand Down Expand Up @@ -82,6 +84,11 @@ public TaskResult execute(Stage stage) {
applicationName = Names.parseName((String) stage.getContext().get("cluster")).getApp();
}

if (front50Service == null) {
log.warn("Unable to determine health providers for an application without front50 enabled.");
return new DefaultTaskResult(ExecutionStatus.SUCCEEDED);
}

Application application = front50Service.get(applicationName);

if (application.platformHealthOnly == Boolean.TRUE && application.platformHealthOnlyShowOverride != Boolean.TRUE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ public class MigratePipelineClustersTask extends AbstractCloudProviderAwareTask
@Autowired
KatoService katoService;

@Autowired
@Autowired(required = false)
Front50Service front50Service;

@Autowired
List<PipelineClusterExtractor> extractors;

@Override
public TaskResult execute(Stage stage) {
if (front50Service == null) {
throw new UnsupportedOperationException("Cannot migrate pipeline clusters, front50 is not enabled. Fix this by setting front50.enabled: true");
}

Map<String, Object> context = stage.getContext();
Optional<Map<String, Object>> pipelineMatch = getPipeline(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@
@Component
public class UpdateMigratedPipelineTask extends AbstractCloudProviderAwareTask {

@Autowired
@Autowired(required = false)
Front50Service front50Service;

@Autowired
List<PipelineClusterExtractor> extractors;

@Override
public TaskResult execute(Stage stage) {
if (front50Service == null) {
throw new UnsupportedOperationException("Unable to update migrated pipelines, front50 is not enabled. Fix this by setting front50.enabled: true");
}
Map<String, Object> context = stage.getContext();
Map<String, Object> pipeline = (Map<String, Object>) context.get("source.pipeline");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.netflix.spinnaker.orca.clouddriver.utils;

import com.netflix.frigga.Names;
import com.netflix.spinnaker.orca.clouddriver.FeaturesService;
import com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.support.Location;
import com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.support.TargetServerGroup;
import com.netflix.spinnaker.orca.front50.Front50Service;
Expand All @@ -27,7 +26,9 @@
import org.springframework.stereotype.Component;
import retrofit.RetrofitError;

import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;

@Component
Expand All @@ -38,9 +39,9 @@ public class TrafficGuard {
private final Front50Service front50Service;

@Autowired
public TrafficGuard(OortHelper oortHelper, Front50Service front50Service) {
public TrafficGuard(OortHelper oortHelper, Optional<Front50Service> front50Service) {
this.oortHelper = oortHelper;
this.front50Service = front50Service;
this.front50Service = front50Service.orElse(null);
}

public void verifyTrafficRemoval(String serverGroupName, String account, Location location, String cloudProvider, String operationDescriptor) {
Expand Down Expand Up @@ -74,6 +75,9 @@ public void verifyTrafficRemoval(String serverGroupName, String account, Locatio
}

public boolean hasDisableLock(String cluster, String account, Location location) {
if (front50Service == null) {
throw new UnsupportedOperationException("Front50 has not been configured, no way to check disable lock. Fix this by setting front50.enabled: true");
}
Names names = Names.parseName(cluster);
Application application;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

package com.netflix.spinnaker.orca.kato.pipeline.strategy

import groovy.transform.CompileDynamic
import groovy.transform.CompileStatic
import groovy.transform.Immutable
import com.google.common.annotations.VisibleForTesting
import com.netflix.spinnaker.orca.clouddriver.pipeline.AbstractCloudProviderAwareStage
import com.netflix.spinnaker.orca.clouddriver.pipeline.cluster.DisableClusterStage
Expand All @@ -34,7 +31,10 @@ import com.netflix.spinnaker.orca.pipeline.TaskNode
import com.netflix.spinnaker.orca.pipeline.model.Execution
import com.netflix.spinnaker.orca.pipeline.model.Stage
import com.netflix.spinnaker.orca.pipeline.model.SyntheticStageOwner
import groovy.transform.CompileDynamic
import groovy.transform.Immutable
import org.springframework.beans.factory.annotation.Autowired

import static com.netflix.spinnaker.orca.pipeline.StageDefinitionBuilder.StageDefinitionBuilderSupport.newStage

/**
Expand All @@ -47,7 +47,7 @@ abstract class DeployStrategyStage extends AbstractCloudProviderAwareStage {
@Autowired ModifyAsgLaunchConfigurationStage modifyAsgLaunchConfigurationStage
@Autowired RollingPushStage rollingPushStage
@Autowired DeprecationRegistry deprecationRegistry
@Autowired PipelineStage pipelineStage
@Autowired(required = false) PipelineStage pipelineStage

@Autowired ShrinkClusterStage shrinkClusterStage
@Autowired ScaleDownClusterStage scaleDownClusterStage
Expand Down

0 comments on commit 0783f94

Please sign in to comment.