use of com.redhat.devtools.intellij.tektoncd.Constants.KIND_PIPELINERUN in project intellij-tekton by redhat-developer.
the class YAMLBuilder method createRunInternal.
public static ObjectNode createRunInternal(String kind, ConfigurationModel model, boolean toDebug) {
ObjectNode rootNode = YAML_MAPPER.createObjectNode();
rootNode.put("apiVersion", "tekton.dev/v1beta1");
rootNode.put("kind", kind);
ObjectNode metadataNode = YAML_MAPPER.createObjectNode();
metadataNode.put("generateName", model.getName() + "-");
rootNode.set("metadata", metadataNode);
ObjectNode spec = YAML_MAPPER.createObjectNode();
if (model instanceof ActionToRunModel) {
ActionToRunModel actionModel = (ActionToRunModel) model;
if (kind.equalsIgnoreCase(KIND_PIPELINERUN)) {
spec = createPipelineRunSpec(actionModel);
} else {
spec = createTaskRunSpec(actionModel.getResource().getName(), actionModel.getParams(), actionModel.getInputResources(), actionModel.getOutputResources(), actionModel.getWorkspaces(), actionModel.getServiceAccount().isEmpty() ? null : actionModel.getServiceAccount(), toDebug);
}
} else if (model instanceof TaskConfigurationModel) {
Map<String, Workspace> workspaces = new HashMap<>();
((TaskConfigurationModel) model).getWorkspaces().stream().forEach(workspace -> {
workspace.setKind(Workspace.Kind.EMPTYDIR);
workspaces.put(workspace.getName(), workspace);
});
spec = createTaskRunSpec(model.getName(), ((TaskConfigurationModel) model).getParams(), ((TaskConfigurationModel) model).getInputResources(), ((TaskConfigurationModel) model).getOutputResources(), workspaces, "", toDebug);
}
rootNode.set("spec", spec);
return rootNode;
}
Aggregations