Skip to content

Commit

Permalink
Exclude weird helm_deployment, deploy_jar backticked blocks from proc…
Browse files Browse the repository at this point in the history
…essing
  • Loading branch information
huonw committed May 28, 2024
1 parent 532d4fd commit 07f507a
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 46 deletions.
15 changes: 14 additions & 1 deletion reference_codegen/generate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,19 @@ function unescape(val) {
.replaceAll("}", "}");
}

function backtickStartingLineToIgnore(line) {
// There's a few places with weird syntax that intefere with our naive line-by-line processing
// of the markdown, so, for now, we just hard-code them to keep things working.
//
// Using a proper markdown parser would help solve this.
return [
// `helm_deployment` target, `values` field
"``` helm_deployment(",
// `deploy_jar` target, `duplicate_policy` field
"``` duplicate_policy=[",
].includes(line);
}

function convertDescription(val) {
const lines = [];
let tabbedBlock = false;
Expand Down Expand Up @@ -145,7 +158,7 @@ function convertDescription(val) {
}
}
// If we're starting or ending a backticked block
else if (line.startsWith("```")) {
else if (line.startsWith("```") && !backtickStartingLineToIgnore(line)) {
// The line is fine as is, but we need to toggle in or out of the backticks
lines.push(line);
backtickedBlock = !backtickedBlock;
Expand Down
22 changes: 11 additions & 11 deletions versioned_docs/version-2.14/reference/targets/helm_deployment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -150,23 +150,23 @@ Individual values to use when rendering a given deployment.

Value names should be defined using dot-syntax as in the following example:

````helm_deployment(
values={
"nameOverride": "my_custom_name",
"image.pullPolicy": "Always",
},
) ```
``` helm_deployment(
values={
"nameOverride": "my_custom_name",
"image.pullPolicy": "Always",
},
) ```

Values can be dynamically calculated using interpolation as shown in the following example:
``` helm_deployment(
values={
"configmap.deployedAt": "{env.DEPLOY_TIME}",
},

``` helm_deployment(
values={
"configmap.deployedAt": "{env.DEPLOY_TIME}",
},
) ```

Check the Helm backend documentation on what are the options available and its caveats when making usage of dynamic values in your deployments.

</Field>

</span>
````
22 changes: 11 additions & 11 deletions versioned_docs/version-2.15/reference/targets/helm_deployment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -165,23 +165,23 @@ Individual values to use when rendering a given deployment.

Value names should be defined using dot-syntax as in the following example:

````helm_deployment(
values={
"nameOverride": "my_custom_name",
"image.pullPolicy": "Always",
},
) ```
`&#x60;` helm_deployment(
values=&#123;
&#x22;nameOverride&#x22;: &#x22;my_custom_name&#x22;,
&#x22;image.pullPolicy&#x22;: &#x22;Always&#x22;,
&#125;,
) `&#x60;`

Values can be dynamically calculated using interpolation as shown in the following example:
``` helm_deployment(
values=&#123;
&#x22;configmap.deployedAt&#x22;: &#x22;&#123;env.DEPLOY_TIME&#125;&#x22;,
&#125;,

`&#x60;` helm_deployment(
values=&#123;
&#x22;configmap.deployedAt&#x22;: &#x22;&#123;env.DEPLOY_TIME&#125;&#x22;,
&#125;,
) `&#x60;`

Check the Helm backend documentation on what are the options available and its caveats when making usage of dynamic values in your deployments.

</Field>

</span>
````
24 changes: 12 additions & 12 deletions versioned_docs/version-2.16/reference/targets/deploy_jar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ When defining a duplicate policy, just add `duplicate_rule` directives to this f

Example:

````duplicate_policy=[
duplicate_rule(pattern="^META-INF/services", action="concat_text"),
duplicate_rule(pattern="^reference\.conf", action="concat_text"),
duplicate_rule(pattern="^org/apache/commons", action="throw"),
] ```
`&#x60;` duplicate_policy=[
duplicate_rule(pattern=&#x22;^META-INF/services&#x22;, action=&#x22;concat_text&#x22;),
duplicate_rule(pattern=&#x22;^reference\.conf&#x22;, action=&#x22;concat_text&#x22;),
duplicate_rule(pattern=&#x22;^org/apache/commons&#x22;, action=&#x22;throw&#x22;),
] `&#x60;`

Where:

* The `pattern` field is treated as a regular expression
* The `action` field must be one of ['skip', 'replace', 'concat', 'concat_text', 'throw'].
- The `pattern` field is treated as a regular expression
- The `action` field must be one of [&#x27;skip&#x27;, &#x27;replace&#x27;, &#x27;concat&#x27;, &#x27;concat_text&#x27;, &#x27;throw&#x27;].

Note that the order in which the rules are listed is relevant.

Expand Down Expand Up @@ -151,10 +151,11 @@ If true, runs of this target with the `run` goal may be interrupted and restarte
Shading rules to be applied to the final JAR artifact.

There are 4 possible shading rules available, which are as follows:
* `shading_relocate`: Relocates the classes under the given `package` into the new package name. The default target package is `__shaded_by_pants__` if none provided in the `into` parameter.
* `shading_rename`: Renames all occurrences of the given `pattern` by the `replacement`.
* `shading_zap`: Removes from the final artifact the occurrences of the `pattern`.
* `shading_keep`: Keeps in the final artifact the occurrences of the `pattern` (and removes anything else).

- `shading_relocate`: Relocates the classes under the given `package` into the new package name. The default target package is `__shaded_by_pants__` if none provided in the `into` parameter.
- `shading_rename`: Renames all occurrences of the given `pattern` by the `replacement`.
- `shading_zap`: Removes from the final artifact the occurrences of the `pattern`.
- `shading_keep`: Keeps in the final artifact the occurrences of the `pattern` (and removes anything else).

When defining shading rules, just add them in this field using the previously listed rule alias and passing along the required parameters.

Expand All @@ -174,4 +175,3 @@ For example, you may tag some test targets with &#x27;integration_test&#x27; so
</Field>

</span>
````
22 changes: 11 additions & 11 deletions versioned_docs/version-2.16/reference/targets/helm_deployment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -165,23 +165,23 @@ Individual values to use when rendering a given deployment.

Value names should be defined using dot-syntax as in the following example:

````helm_deployment(
values={
"nameOverride": "my_custom_name",
"image.pullPolicy": "Always",
},
) ```
`&#x60;` helm_deployment(
values=&#123;
&#x22;nameOverride&#x22;: &#x22;my_custom_name&#x22;,
&#x22;image.pullPolicy&#x22;: &#x22;Always&#x22;,
&#125;,
) `&#x60;`

Values can be dynamically calculated using interpolation as shown in the following example:
``` helm_deployment(
values=&#123;
&#x22;configmap.deployedAt&#x22;: &#x22;&#123;env.DEPLOY_TIME&#125;&#x22;,
&#125;,

`&#x60;` helm_deployment(
values=&#123;
&#x22;configmap.deployedAt&#x22;: &#x22;&#123;env.DEPLOY_TIME&#125;&#x22;,
&#125;,
) `&#x60;`

Check the Helm backend documentation on what are the options available and its caveats when making usage of dynamic values in your deployments.

</Field>

</span>
````

0 comments on commit 07f507a

Please sign in to comment.