Skip to content

Commit

Permalink
Mark YamlTemplate as GA
Browse files Browse the repository at this point in the history
Signed-off-by: Jeffrey Kinard <jeff@thekinards.com>
  • Loading branch information
Polber committed May 7, 2024
1 parent 92a6433 commit 84517c9
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ public static String readmeMarkdown(ImageSpec imageSpec) throws IOException, Tem
parameters.put("flex", imageSpec.getMetadata().isFlexTemplate());
parameters.put("statics", BeansWrapper.getDefaultInstance().getStaticModels());
parameters.put("language", imageSpec.getSdkInfo().getLanguage());
parameters.put(
"appendTemplate",
!imageSpec
.getMetadata()
.getName()
.substring(Math.max(0, imageSpec.getMetadata().getName().length() - 8))
.equalsIgnoreCase("template"));

Template template = freemarkerConfig.getTemplate("README-template.md");

Expand Down Expand Up @@ -78,6 +85,13 @@ public static String siteMarkdown(ImageSpec imageSpec) throws IOException, Templ
parameters.put("flex", imageSpec.getMetadata().isFlexTemplate());
parameters.put("statics", BeansWrapper.getDefaultInstance().getStaticModels());
parameters.put("base_include", "dataflow");
parameters.put(
"appendTemplate",
!imageSpec
.getMetadata()
.getName()
.substring(Math.max(0, imageSpec.getMetadata().getName().length() - 8))
.equalsIgnoreCase("template"));

Template template = freemarkerConfig.getTemplate("site-template.md");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@ public ImageSpec buildSpecModel(boolean validateFlag) {
block.name(), Arrays.asList(block.content())))
.collect(Collectors.toList()));

if (templateAnnotation.type().equals(TemplateType.YAML)) {
metadata.setMainClass("");
} else if (templateAnnotation.placeholderClass() != null
if (templateAnnotation.placeholderClass() != null
&& templateAnnotation.placeholderClass() != void.class) {
metadata.setMainClass(templateAnnotation.placeholderClass().getName());
} else {
Expand Down
4 changes: 2 additions & 2 deletions plugins/core-plugin/src/main/resources/README-template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<#assign TemplateDocsUtils=statics['com.google.cloud.teleport.plugin.docs.TemplateDocsUtils']>

${spec.metadata.name} template
${spec.metadata.name}<#if appendTemplate> template</#if>
---
<#list spec.metadata.description?split("\n\n") as paragraph>
${TemplateDocsUtils.wrapText(paragraph!?trim, 80, "", false)?ensure_ends_with(".")}
Expand Down Expand Up @@ -95,7 +95,7 @@ mvn clean package -PtemplatesStage \
-DbucketName="$BUCKET_NAME" \
-DstagePrefix="templates" \
-DtemplateName="${spec.metadata.internalName}" \
<#if language == 'PYTHON'>
<#if language == 'PYTHON' || language == 'YAML'>
-f python
<#elseif flex>
-f v2/${spec.metadata.module!}
Expand Down
4 changes: 2 additions & 2 deletions plugins/core-plugin/src/main/resources/site-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
{% extends "${base_include}/_base.html" %}
{% include "${base_include}/_local_variables.html" %}
{% include "${base_include}/docs/guides/templates/_provided-templates-vars.html" %}
{% block page_title %}${TemplateDocsUtils.replaceVariableInterpolationNames(spec.metadata.name)} template{% endblock %}
{% block page_title %}${TemplateDocsUtils.replaceVariableInterpolationNames(spec.metadata.name)}<#if appendTemplate> template</#if>{% endblock %}

{% block body %}

<section id="${spec.metadata.internalName?lower_case?replace("_", "")}">

{% dynamic setvar launch_name %}the <b>${TemplateDocsUtils.replaceVariableInterpolationNames(spec.metadata.name)}</b> template{% dynamic endsetvar %}
{% dynamic setvar launch_name %}the <b>${TemplateDocsUtils.replaceVariableInterpolationNames(spec.metadata.name)}</b><#if appendTemplate> template</#if>{% dynamic endsetvar %}
{% dynamic setvar gcs_template_name %}${spec.metadata.internalName}{% dynamic endsetvar %}
<#if spec.metadata.preview!false>
{% dynamic setvar launch_stage %}beta{% dynamic endsetvar %}
Expand Down
16 changes: 12 additions & 4 deletions python/README_Yaml_Template.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@

YAML Template (Experimental) template
YAML Template
---
YAML pipeline. Reads YAML from Cloud Storage and dynamically expands YAML into
Beam pipeline graph.
The YAML Template is used to run Dataflow pipelines written in Beam YAML. The
YAML pipeline can be passed to the template directly as a raw string or the
location of a Beam YAML pipeline file stored in Google Cloud Storage can
optionally be passed.

For launching a Beam YAML pipeline directly from the gcloud command line, see
https://cloud.google.com/sdk/gcloud/reference/dataflow/yaml.

For more information on Beam YAML, see
https://beam.apache.org/documentation/sdks/yaml/.



Expand Down Expand Up @@ -139,7 +147,7 @@ mvn clean package -PtemplatesRun \
-DjobName="yaml-template-job" \
-DtemplateName="Yaml_Template" \
-Dparameters="yaml_pipeline=$YAML_PIPELINE,yaml_pipeline_file=$YAML_PIPELINE_FILE" \
-f python
-f v2/python
```

## Terraform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,21 @@
name = "Yaml_Template",
category = TemplateCategory.GET_STARTED,
type = Template.TemplateType.YAML,
displayName = "YAML Template (Experimental)",
displayName = "YAML Template",
description =
"YAML pipeline. Reads YAML from Cloud Storage and dynamically expands YAML into "
+ "Beam pipeline graph.",
"The YAML Template is used to run Dataflow pipelines written in Beam YAML. "
+ "The YAML pipeline can be passed to the template directly as a raw string or the location "
+ "of a Beam YAML pipeline file stored in Google Cloud Storage can optionally be passed."
+ "\n\n"
+ "For launching a Beam YAML pipeline directly from the gcloud command line, see "
+ "https://cloud.google.com/sdk/gcloud/reference/dataflow/yaml"
+ "\n\n"
+ "For more information on Beam YAML, see https://beam.apache.org/documentation/sdks/yaml/",
flexContainerName = "yaml-template",
contactInformation = "https://cloud.google.com/support")
contactInformation = "https://cloud.google.com/support",
requirements = {
"A valid Beam YAML pipeline.",
})
public interface YAMLTemplate {
@TemplateParameter.Text(
order = 1,
Expand Down

0 comments on commit 84517c9

Please sign in to comment.