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

x33g5p2x  于2022-01-19 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(173)

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

Execution.getTrigger介绍

暂无

代码示例

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

private Trigger getTrigger() {
 return stage.getExecution().getTrigger();
}

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

/**
 * Enriches stage context if it supports strategies
 */
@SuppressWarnings("unchecked")
public void resolveStrategyParams() {
 if (execution.getType() == PIPELINE) {
  Map<String, Object> parameters = Optional.ofNullable(execution.getTrigger()).map(Trigger::getParameters).orElse(emptyMap());
  boolean strategy = false;
  if (parameters.get("strategy") != null) {
   strategy = (boolean) parameters.get("strategy");
  }
  if (strategy) {
   context.put("cloudProvider", parameters.get("cloudProvider"));
   context.put("cluster", parameters.get("cluster"));
   context.put("credentials", parameters.get("credentials"));
   if (parameters.get("region") != null) {
    context.put("regions", singletonList(parameters.get("region")));
   } else if (parameters.get("zone") != null) {
    context.put("zones", singletonList(parameters.get("zone")));
   }
  }
 }
}

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

private boolean isStrategy(Execution pipeline) {
 Trigger trigger = pipeline.getTrigger();
 return "pipeline".equals(trigger.getType()) && trigger.isStrategy();
}

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

public LockManager.LockValue build() {
  final Optional<Execution> execution = Optional.ofNullable(stage).map(Stage::getExecution);
  final String application = Optional.ofNullable(this.application).orElseGet(() ->
   execution
    .map(Execution::getApplication)
    .orElse(null));
  final String type = Optional.ofNullable(this.type).orElseGet(() ->
   execution
    .map(Execution::getType)
    .map(Execution.ExecutionType::toString)
    .orElse(null));
  final String id = Optional.ofNullable(this.id).orElseGet(() -> {
   if (!execution.isPresent()) {
    return null;
   }
   Optional<Execution> next = execution;
   Execution rootExecution;
   do {
    rootExecution = next.get();
    next = next
     .filter(e -> e.getTrigger() instanceof PipelineTrigger)
     .map(e -> ((PipelineTrigger) e.getTrigger()).getParentStage())
     .map(Stage::getExecution);
   } while (next.isPresent());
   return rootExecution.getId();
  });
  return new LockManager.LockValue(application, type, id);
 }
}

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

public @Nonnull
List<Artifact> getAllArtifacts(@Nonnull Execution execution) {
 // Get all artifacts emitted by the execution's stages; we'll sort the stages topologically,
 // then reverse the result so that artifacts from later stages will appear
 // earlier in the results.
 List<Artifact> emittedArtifacts = Stage.topologicalSort(execution.getStages())
  .filter(s -> s.getOutputs().containsKey("artifacts"))
  .flatMap(
   s -> (Stream<Artifact>) ((List) s.getOutputs().get("artifacts"))
     .stream()
     .map(a -> a instanceof Map ? objectMapper.convertValue(a, Artifact.class) : a)
  ).collect(Collectors.toList());
 Collections.reverse(emittedArtifacts);
 // Get all artifacts in the parent pipeline's trigger; these artifacts go at the end of the list,
 // after any that were emitted by the pipeline
 List<Artifact> triggerArtifacts = objectMapper.convertValue(execution.getTrigger().getArtifacts(), new TypeReference<List<Artifact>>() {});
 emittedArtifacts.addAll(triggerArtifacts);
 return emittedArtifacts;
}

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

private String render(String templateString, Execution pipeline) {
 DefaultRenderContext rc = new DefaultRenderContext(pipeline.getApplication(), null, mapper.convertValue(pipeline.getTrigger(), Map.class));
 return renderer.render(templateString, rc);
}

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

public Map<String, Object> buildExecutionContext(Stage stage, boolean includeStageContext) {
 Map<String, Object> augmentedContext = new HashMap<>();
 if (includeStageContext) {
  augmentedContext.putAll(stage.getContext());
 }
 if (stage.getExecution().getType() == PIPELINE) {
  augmentedContext.put("trigger", mapper.convertValue(
    stage.getExecution().getTrigger(),
    new TypeReference<Map<String, Object>>() {})
  );
  augmentedContext.put("execution", stage.getExecution());
 }
 return augmentedContext;
}

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

public Map<String, Object> findTargetPackage(boolean allowMissingPackageInstallation) {
 Map<String, Object> stageContext = new HashMap<>();
 // copy the context since we may modify it in createAugmentedRequest
 stageContext.putAll(stage.getContext());
 if (stage.getExecution().getType() == PIPELINE) {
  Map trigger = mapper.convertValue(stage.getExecution().getTrigger(), Map.class);
  Map buildInfoCurrentExecution = null;
  if (stageContext.get("buildInfo") != null) { // package was built as part of the pipeline
   buildInfoCurrentExecution = mapper.convertValue(stageContext.get("buildInfo"), Map.class);
  }
  if (buildInfoCurrentExecution == null || (buildInfoCurrentExecution.get("artifacts") != null && !((Collection) buildInfoCurrentExecution.get("artifacts")).isEmpty())) {
   Map<String, Object> upstreamBuildInfo = findBuildInfoInUpstreamStage(stage, packageFilePatterns);
   if (!upstreamBuildInfo.isEmpty()) {
    buildInfoCurrentExecution = upstreamBuildInfo;
   }
  }
  if (buildInfoCurrentExecution == null) {
   buildInfoCurrentExecution = emptyMap();
  }
  return createAugmentedRequest(trigger, buildInfoCurrentExecution, stageContext, allowMissingPackageInstallation);
 }
 // A package could only have been produced as part of a pipeline,
 // so if this is not a pipeline return the unchanged context.
 return stageContext;
}

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

@Override
public void taskGraph(
 @Nonnull Stage stage, @Nonnull TaskNode.Builder builder) {
 builder.withTask("suspendExecutionDuringTimeWindow", SuspendExecutionDuringTimeWindowTask.class);
 try {
  JitterConfig jitter = stage.mapTo("/restrictedExecutionWindow/jitter", JitterConfig.class);
  if (jitter.enabled && jitter.maxDelay > 0) {
   if (jitter.skipManual && stage.getExecution().getTrigger().getType().equals("manual")) {
    return;
   }
   long waitTime = ThreadLocalRandom.current().nextLong(jitter.minDelay, jitter.maxDelay + 1);
   stage.setContext(contextWithWait(stage.getContext(), waitTime));
   builder.withTask("waitForJitter", WaitTask.class);
  }
 } catch (IllegalArgumentException e) {
  // Do nothing
 }
}

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

map.put("origin", execution.getOrigin());
 map.put("source", mapper.writeValueAsString(execution.getSource()));
 map.put("trigger", mapper.writeValueAsString(execution.getTrigger()));
 map.put("systemNotifications", mapper.writeValueAsString(execution.getSystemNotifications()));
} catch (JsonProcessingException e) {

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

private Execution checkForCorrelatedExecution(Execution execution) {
 if (execution.getTrigger().getCorrelationId() == null) {
  return null;
 }
 Trigger trigger = execution.getTrigger();
 try {
  Execution o = executionRepository.retrieveByCorrelationId(
   execution.getType(),
   trigger.getCorrelationId()
  );
  log.info("Found pre-existing " + execution.getType() + " by correlation id (id: " +
   o.getId() + ", correlationId: " +
   trigger.getCorrelationId() +
   ")");
  return o;
 } catch (ExecutionNotFoundException e) {
  // Swallow
 }
 return null;
}

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

String user = stage.getExecution().getTrigger().getUser();

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

});
if (execution.getTrigger().getCorrelationId() != null) {
 c.set(
  format("correlation:%s", execution.getTrigger().getCorrelationId()),
  execution.getId()
 );

相关文章