diff --git a/CHANGELOG.md b/CHANGELOG.md index a907289..b05ead7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog -## Unreleased +## Version 2.13.0 + +* Support escaping placeholders with backslash e.g. `\${MY_ENV_VAR}` will no longer be expanded + +## Version 2.12.0 * Converted README and CHANGELOG to Markdown * Add option to provide additional values files diff --git a/pom.xml b/pom.xml index 24e08b8..4072fc6 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.deviceinsight.helm helm-maven-plugin - 2.12.0 + 2.13.0 maven-plugin Helm Maven Plugin @@ -12,13 +12,13 @@ https://github.com/deviceinsight/helm-maven-plugin - 1.8.10 + 1.8.20 1.8 1.8 1.8 UTF-8 - 3.6.2 + 3.8.1 2.2.1 2.14.2 @@ -28,7 +28,7 @@ 5.9.2 3.24.2 - 1.7.20 + 1.8.10 3.11.0 3.2.1 1.19.0 diff --git a/src/main/kotlin/com/deviceinsight/helm/PackageMojo.kt b/src/main/kotlin/com/deviceinsight/helm/PackageMojo.kt index 8d63167..f38363c 100644 --- a/src/main/kotlin/com/deviceinsight/helm/PackageMojo.kt +++ b/src/main/kotlin/com/deviceinsight/helm/PackageMojo.kt @@ -39,7 +39,7 @@ import java.io.IOException class PackageMojo : ResolveHelmMojo(), ServerAuthentication { companion object { - private val PLACEHOLDER_REGEX = Regex("""\$\{(.*?)}""") + private val PLACEHOLDER_REGEX = Regex("""(\\?)\$\{(.*?)}""") private val SUBSTITUTED_EXTENSIONS = setOf("json", "tpl", "yml", "yaml") } @@ -173,11 +173,17 @@ class PackageMojo : ResolveHelmMojo(), ServerAuthentication { file.useLines { lines -> lines.map { line -> PLACEHOLDER_REGEX.replace(line) { matchResult -> - val property = matchResult.groupValues[1] - when (val propertyValue = findPropertyValue(property, targetFile.absolutePath)) { - null -> matchResult.groupValues[0] - else -> propertyValue + val isEscaped = matchResult.groupValues[1] == "\\" + val property = matchResult.groupValues[2] + + if (isEscaped) { + matchResult.groupValues[0].substring(1) + } else { + when (val propertyValue = findPropertyValue(property, targetFile.absolutePath)) { + null -> matchResult.groupValues[0] + else -> propertyValue + } } } }.forEach {