com.netflix.spinnaker.orca.pipeline.model.Stage.resolveStrategyParams()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中com.netflix.spinnaker.orca.pipeline.model.Stage.resolveStrategyParams()方法的一些代码示例,展示了Stage.resolveStrategyParams()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stage.resolveStrategyParams()方法的具体详情如下:
包路径:com.netflix.spinnaker.orca.pipeline.model.Stage
类名称:Stage
方法名:resolveStrategyParams

Stage.resolveStrategyParams介绍

[英]Enriches stage context if it supports strategies
[中]如果支持策略,则丰富舞台环境

代码示例

代码示例来源:origin: com.netflix.spinnaker.orca/orca-core

@SuppressWarnings("unchecked")
 private Collection<Map<String, Object>> parallelContexts(Stage stage) {
  stage.resolveStrategyParams();
  Map<String, Object> baseContext = new HashMap<>(stage.getContext());
  List<Map<String, Object>> preconditions = (List<Map<String, Object>>) baseContext.remove("preconditions");
  return preconditions
   .stream()
   .map(preconditionConfig -> {
    Map<String, Object> context = new HashMap<>(baseContext);
    context.putAll(preconditionConfig);
    context.put("type", PIPELINE_CONFIG_TYPE);
    context.put("preconditionType", preconditionConfig.get("type"));

    context.putIfAbsent("context", new HashMap<String, Object>());
    ((Map<String, Object>) context.get("context")).putIfAbsent("cluster", baseContext.get("cluster"));
    ((Map<String, Object>) context.get("context")).putIfAbsent("regions", baseContext.get("regions"));
    ((Map<String, Object>) context.get("context")).putIfAbsent("credentials", baseContext.get("credentials"));
    ((Map<String, Object>) context.get("context")).putIfAbsent("zones", baseContext.get("zoned"));

    return context;
   })
   .collect(toList());
 }
}

代码示例来源:origin: com.netflix.spinnaker.orca/orca-clouddriver

@Override
 public void taskGraph(Stage stage, TaskNode.Builder builder) {
  stage.resolveStrategyParams();
  Class<? extends AbstractClusterWideClouddriverTask> operationTask = getClusterOperationTask();
  String name = getStepName(operationTask.getSimpleName());
  String opName = Introspector.decapitalize(name);
  Class<? extends AbstractWaitForClusterWideClouddriverTask> waitTask = getWaitForTask();
  String waitName = Introspector.decapitalize(getStepName(waitTask.getSimpleName()));

  builder
   .withTask("determineHealthProviders", DetermineHealthProvidersTask.class)
   .withTask(opName, operationTask)
   .withTask("monitor" + name, MonitorKatoTask.class);

  if (isForceCacheRefreshEnabled(dynamicConfigService)) {
   builder.withTask("forceCacheRefresh", ServerGroupCacheForceRefreshTask.class);
  }

  builder
   .withTask(waitName, waitTask);

  if (isForceCacheRefreshEnabled(dynamicConfigService)) {
   builder.withTask("forceCacheRefresh", ServerGroupCacheForceRefreshTask.class);
  }
 }
}

相关文章