本文整理了Java中com.netflix.spinnaker.orca.pipeline.model.Stage.getId()
方法的一些代码示例,展示了Stage.getId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stage.getId()
方法的具体详情如下:
包路径:com.netflix.spinnaker.orca.pipeline.model.Stage
类名称:Stage
方法名:getId
暂无
代码示例来源:origin: spinnaker/kayenta
stage.getId(), stage.getExecution().getId(), canaryPipelineExecutionId, stage.getContext());
} catch (Exception e) {
log.error("Failed to cancel stage (stageId: {}, executionId: {}), e: {}",
stage.getId(), stage.getExecution().getId(), e.getMessage(), e);
stage.getId(), stage.getExecution().getId(), stage.getContext());
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
public Result(Stage stage, Map details) {
this.stageId = stage.getId();
this.details = details;
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
@Nonnull
public Stage stageById(String stageId) {
return stages
.stream()
.filter(it -> it.getId().equals(stageId))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException(String.format("No stage with id %s exists", stageId)));
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
/**
* Returns the top-most stage.
*/
@JsonIgnore public Stage getTopLevelStage() {
Stage topLevelStage = this;
while (topLevelStage.parentStageId != null) {
String sid = topLevelStage.parentStageId;
Optional<Stage> stage = execution.getStages().stream().filter(s -> s.id.equals(sid)).findFirst();
if (stage.isPresent()) {
topLevelStage = stage.get();
} else {
throw new IllegalStateException("Could not find stage by parentStageId (stage: " + topLevelStage.getId() + ", parentStageId:" + sid + ")");
}
}
return topLevelStage;
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
@Deprecated
static @Nonnull Stage newStage(
@Nonnull Execution execution,
@Nonnull String type,
@Nullable String name,
@Nonnull Map<String, Object> context,
@Nullable Stage parent,
@Nullable SyntheticStageOwner stageOwner
) {
Stage stage = new Stage(execution, type, name, context);
if (parent != null) {
stage.setParentStageId(parent.getId());
}
stage.setSyntheticStageOwner(stageOwner);
return stage;
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-clouddriver
default Map<String, List<String>> manifestNamesByNamespace(Stage stage) {
Map<String, List<String>> result = (Map<String, List<String>>) stage.getContext().get("outputs.manifestNamesByNamespace");
if (result != null) {
return result;
}
result = new HashMap<>();
String name = (String) stage.getContext().get("manifest.name");
String location = (String) stage.getContext().get("manifest.location");
if (name != null && location != null) {
result.put(location, Collections.singletonList(name));
} else {
Logger.getLogger(this.getClass().getName()).warning("No manifests found in stage " + stage.getId());
}
return result;
}
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
private void onStageStarted(StageStarted event) {
Execution execution = retrieve(event);
List<Stage> stages = execution.getStages();
stages
.stream()
.filter(it -> it.getId().equals(event.getStageId()))
.findFirst()
.ifPresent(stage -> delegate.beforeStage(persister, stage));
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
private void onStageComplete(StageComplete event) {
Execution execution = retrieve(event);
List<Stage> stages = execution.getStages();
stages
.stream()
.filter(it -> it.getId().equals(event.getStageId()))
.findFirst()
.ifPresent(stage -> delegate.afterStage(persister, stage));
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
/**
* Checks existence of a Stage by id
* @param obj #root.execution
* @param id the name or id of the stage to check existence
* @return W
*/
static boolean stageExists(Object obj, String id) {
if (obj instanceof Execution) {
Execution execution = (Execution) obj;
return execution.getStages()
.stream()
.anyMatch(i -> id != null && (id.equals(i.getName()) || id.equals(i.getId())));
}
throw new SpelHelperFunctionException(String.format("Invalid first param to #stage(%s). must be an execution", id));
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
@Override
public void taskGraph(
@Nonnull Stage stage, @Nonnull TaskNode.Builder builder) {
if (!isTopLevelStage(stage)) {
String preconditionType = stage.getContext().get("preconditionType").toString();
if (preconditionType == null) {
throw new IllegalStateException(format("no preconditionType specified for stage %s", stage.getId()));
}
Task preconditionTask = preconditionTasks
.stream()
.filter(it -> it.getPreconditionType().equals(preconditionType))
.findFirst()
.orElseThrow(() ->
new IllegalStateException(format("no Precondition implementation for type %s", preconditionType))
);
builder.withTask("checkPrecondition", preconditionTask.getClass());
}
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
private static Predicate<Stage> matchesDeployedStage(String ...id) {
List<String> idsOrNames = Arrays.asList(id);
if (!idsOrNames.isEmpty()){
return stage -> DEPLOY_STAGE_NAMES.contains(stage.getType()) &&
stage.getContext().containsKey("deploy.server.groups") &&
stage.getStatus() == ExecutionStatus.SUCCEEDED &&
(idsOrNames.contains(stage.getName()) || idsOrNames.contains(stage.getId()));
} else {
return stage -> DEPLOY_STAGE_NAMES.contains(stage.getType()) &&
stage.getContext().containsKey("deploy.server.groups") && stage.getStatus() == ExecutionStatus.SUCCEEDED;
}
}
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
private void onTaskStarted(TaskStarted event) {
Execution execution = retrieve(event);
List<Stage> stages = execution.getStages();
stages
.stream()
.filter(it -> it.getId().equals(event.getStageId()))
.findFirst()
.ifPresent(stage ->
delegate.beforeTask(
persister,
stage,
stage.getTasks().stream().filter(it -> it.getId().equals(event.getTaskId())).findFirst().get()
)
);
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
private String generateRefId() {
long offset = parent
.getExecution()
.getStages()
.stream()
.filter(i -> parent.getId().equals(i.getParentStageId()) && type == i.getSyntheticStageOwner())
.count();
return format(
"%s%s%d",
parent.getRefId(),
type == STAGE_BEFORE ? "<" : ">",
offset + graph.nodes().size()
);
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis
private void storeStageInternal(RedisClientDelegate delegate, Stage stage, Boolean updateIndex) {
String key = executionKey(stage);
String indexKey = format("%s:stageIndex", key);
Map<String, String> serializedStage = serializeStage(stage);
List<String> keysToRemove = serializedStage.entrySet().stream()
.filter(e -> e.getValue() == null)
.map(Map.Entry::getKey)
.collect(Collectors.toList());
serializedStage.values().removeIf(Objects::isNull);
delegate.withTransaction(tx -> {
tx.hmset(key, serializedStage);
if (!keysToRemove.isEmpty()) {
tx.hdel(key, keysToRemove.toArray(new String[0]));
}
if (updateIndex) {
BinaryClient.LIST_POSITION pos = stage.getSyntheticStageOwner() == STAGE_BEFORE ? BEFORE : AFTER;
tx.linsert(indexKey, pos, stage.getParentStageId(), stage.getId());
}
tx.exec();
});
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
private void onTaskComplete(TaskComplete event) {
Execution execution = retrieve(event);
List<Stage> stages = execution.getStages();
ExecutionStatus status = event.getStatus();
stages
.stream()
.filter(it -> it.getId().equals(event.getStageId()))
.findFirst()
.ifPresent(stage ->
delegate.afterTask(persister,
stage,
stage.getTasks().stream().filter(it -> it.getId().equals(event.getTaskId())).findFirst().get(),
status,
// TODO: not sure if status.isSuccessful covers all the weird cases here
status.isSuccessful()
)
);
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis
@Override
public void updateStageContext(@Nonnull Stage stage) {
RedisClientDelegate delegate = getRedisDelegate(stage);
String key = executionKey(stage);
String contextKey = format("stage.%s.context", stage.getId());
delegate.withCommandsClient(c -> {
try {
c.hset(key, contextKey, mapper.writeValueAsString(stage.getContext()));
} catch (JsonProcessingException e) {
throw new StageSerializationException(
format("Failed serializing stage, executionId: %s, stageId: %s", stage.getExecution().getId(), stage.getId()),
e
);
}
});
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
public StageStarted(
@Nonnull Object source,
@Nonnull Stage stage
) {
this(source, stage.getExecution().getType(), stage.getExecution().getId(), stage.getId(), stage.getType(), stage.getName());
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
public StageComplete(
@Nonnull Object source,
@Nonnull Stage stage
) {
this(source, stage.getExecution().getType(), stage.getExecution().getId(), stage.getId(), stage.getType(), stage.getName(), stage.getStatus());
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
public TaskStarted(
@Nonnull Object source,
@Nonnull Stage stage,
@Nonnull Task task
) {
this(
source,
stage.getExecution().getType(),
stage.getExecution().getId(),
stage.getId(),
stage.getType(),
stage.getName(),
task.getId(),
task.getImplementingClass(),
task.getName()
);
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-core
/**
* Adds a new stage to the graph. By default the new stage is not dependent on any
* others. Use {@link #connect(Stage, Stage)} to make it depend on other stages or
* have other stages depend on it.
*/
public void add(@Nonnull Stage stage) {
stage.setExecution(parent.getExecution());
stage.setParentStageId(parent.getId());
stage.setSyntheticStageOwner(type);
if (graph.addNode(stage)) {
stage.setRefId(generateRefId());
}
lastAdded = stage;
}
内容来源于网络,如有侵权,请联系作者删除!