Skip to content

java.util.regex.PatternSyntaxException for HelmIgnorePathMatcher.addPatterns() #189

@gavinfish

Description

@gavinfish

When I use sample codes to install helm charts, I got below exception:

java.util.regex.PatternSyntaxException: Unclosed character class near index 23
^templates/\.[^\]?[^\]*$
                       ^
	at java.util.regex.Pattern.error(Pattern.java:1957)
	at java.util.regex.Pattern.clazz(Pattern.java:2550)
	at java.util.regex.Pattern.clazz(Pattern.java:2506)
	at java.util.regex.Pattern.sequence(Pattern.java:2065)
	at java.util.regex.Pattern.expr(Pattern.java:1998)
	at java.util.regex.Pattern.compile(Pattern.java:1698)
	at java.util.regex.Pattern.<init>(Pattern.java:1351)
	at java.util.regex.Pattern.compile(Pattern.java:1028)
	at org.microbean.helm.chart.HelmIgnorePathMatcher.addPatterns(HelmIgnorePathMatcher.java:274)
	at org.microbean.helm.chart.HelmIgnorePathMatcher.addPattern(HelmIgnorePathMatcher.java:189)
	at org.microbean.helm.chart.HelmIgnorePathMatcher.<init>(HelmIgnorePathMatcher.java:98)
	at org.microbean.helm.chart.HelmIgnorePathMatcher.<init>(HelmIgnorePathMatcher.java:112)
	at org.microbean.helm.chart.HelmIgnorePathMatcher.<init>(HelmIgnorePathMatcher.java:163)
	at org.microbean.helm.chart.DirectoryChartLoader$PathWalker.<init>(DirectoryChartLoader.java:186)
	at org.microbean.helm.chart.DirectoryChartLoader$PathWalker.<init>(DirectoryChartLoader.java:156)
	at org.microbean.helm.chart.DirectoryChartLoader.toNamedInputStreamEntries(DirectoryChartLoader.java:145)
	at org.microbean.helm.chart.DirectoryChartLoader.toNamedInputStreamEntries(DirectoryChartLoader.java:51)
	at org.microbean.helm.chart.StreamOrientedChartLoader.load(StreamOrientedChartLoader.java:213)
	at org.microbean.helm.chart.AbstractChartLoader.load(AbstractChartLoader.java:87)
	at com.microsoft.jenkins.devspaces.commands.DeployHelmChartCommand.execute(DeployHelmChartCommand.java:40)
	at com.microsoft.jenkins.devspaces.commands.DeployHelmChartCommand.execute(DeployHelmChartCommand.java:27)
	at com.microsoft.jenkins.azurecommons.command.CommandService.runCommand(CommandService.java:88)
	at com.microsoft.jenkins.azurecommons.command.CommandService.execute(CommandService.java:96)
	at com.microsoft.jenkins.azurecommons.command.CommandService.executeCommands(CommandService.java:75)
	at com.microsoft.jenkins.azurecommons.command.BaseCommandContext.executeCommands(BaseCommandContext.java:77)
	at com.microsoft.jenkins.devspaces.DevSpacesBuilder.perform(DevSpacesBuilder.java:91)
	at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
	at hudson.model.Build$BuildExecution.build(Build.java:205)
	at hudson.model.Build$BuildExecution.doRun(Build.java:162)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
	at hudson.model.Run.execute(Run.java:1741)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:410)

It seems that the default constructor of HelmIgnorePathMatcher will try to call addPattern("templates/.?*") method and it will generate a regex pattern like ^templates/\.[^\]?[^\]*$ which is an invalid one. Any help here?

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions