From 07f507a1622f8635de7da997421de46c2191a268 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Wed, 29 May 2024 08:30:27 +1000 Subject: [PATCH] Exclude weird helm_deployment, deploy_jar backticked blocks from processing --- reference_codegen/generate.mjs | 15 +++++++++++- .../reference/targets/helm_deployment.mdx | 22 ++++++++--------- .../reference/targets/helm_deployment.mdx | 22 ++++++++--------- .../reference/targets/deploy_jar.mdx | 24 +++++++++---------- .../reference/targets/helm_deployment.mdx | 22 ++++++++--------- 5 files changed, 59 insertions(+), 46 deletions(-) diff --git a/reference_codegen/generate.mjs b/reference_codegen/generate.mjs index d61fa4628..3aef70d43 100644 --- a/reference_codegen/generate.mjs +++ b/reference_codegen/generate.mjs @@ -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; @@ -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; diff --git a/versioned_docs/version-2.14/reference/targets/helm_deployment.mdx b/versioned_docs/version-2.14/reference/targets/helm_deployment.mdx index fa2c93a0c..70b9323fd 100644 --- a/versioned_docs/version-2.14/reference/targets/helm_deployment.mdx +++ b/versioned_docs/version-2.14/reference/targets/helm_deployment.mdx @@ -150,18 +150,19 @@ 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. @@ -169,4 +170,3 @@ Check the Helm backend documentation on what are the options available and its c -```` diff --git a/versioned_docs/version-2.15/reference/targets/helm_deployment.mdx b/versioned_docs/version-2.15/reference/targets/helm_deployment.mdx index c3f030f26..d46e0a3c8 100644 --- a/versioned_docs/version-2.15/reference/targets/helm_deployment.mdx +++ b/versioned_docs/version-2.15/reference/targets/helm_deployment.mdx @@ -165,18 +165,19 @@ 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. @@ -184,4 +185,3 @@ Check the Helm backend documentation on what are the options available and its c -```` diff --git a/versioned_docs/version-2.16/reference/targets/deploy_jar.mdx b/versioned_docs/version-2.16/reference/targets/deploy_jar.mdx index 5fc4ab8b3..6fd232ced 100644 --- a/versioned_docs/version-2.16/reference/targets/deploy_jar.mdx +++ b/versioned_docs/version-2.16/reference/targets/deploy_jar.mdx @@ -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"), -] ``` +``` 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"), +] ``` 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 ['skip', 'replace', 'concat', 'concat_text', 'throw']. Note that the order in which the rules are listed is relevant. @@ -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. @@ -174,4 +175,3 @@ For example, you may tag some test targets with 'integration_test' so -```` diff --git a/versioned_docs/version-2.16/reference/targets/helm_deployment.mdx b/versioned_docs/version-2.16/reference/targets/helm_deployment.mdx index b03a60147..e8ac44550 100644 --- a/versioned_docs/version-2.16/reference/targets/helm_deployment.mdx +++ b/versioned_docs/version-2.16/reference/targets/helm_deployment.mdx @@ -165,18 +165,19 @@ 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. @@ -184,4 +185,3 @@ Check the Helm backend documentation on what are the options available and its c -````