Skip to content

Commit

Permalink
fix main
Browse files Browse the repository at this point in the history
  • Loading branch information
fcomte committed Dec 18, 2024
1 parent 8d3498c commit 81fcba3
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ public HelmInstaller installChart(

public int uninstaller(HelmConfiguration configuration, String name, String namespace)
throws InvalidExitValueException, IOException, InterruptedException, TimeoutException {
if (name.length() > 53 || !rfc1123Pattern.matcher(name).matches()) {
throw new IllegalArgumentException(
"Invalid release "
+ name
+ ". Must be 53 or fewer characters and be a valid RFC 1123 string.");
}
StringBuilder command = new StringBuilder("helm uninstall ");
safeConcat(command, name);
command.append(" -n ");
Expand Down Expand Up @@ -241,6 +247,12 @@ public String getNotes(HelmConfiguration configuration, String id, String namesp

public HelmReleaseInfo getAll(HelmConfiguration configuration, String id, String namespace) {
StringBuilder command = new StringBuilder("helm get all ");
if (id.length() > 53 || !rfc1123Pattern.matcher(id).matches()) {
throw new IllegalArgumentException(
"Invalid release "
+ id
+ ". Must be 53 or fewer characters and be a valid RFC 1123 string.");
}
safeConcat(command, id);
command.append(" --namespace ");
safeConcat(command, namespace);
Expand All @@ -260,6 +272,12 @@ private String getReleaseInfo(
throw new IllegalArgumentException(
"Invalid info type " + infoType + ", should be manifest, notes or values");
}
if (id.length() > 53 || !rfc1123Pattern.matcher(id).matches()) {
throw new IllegalArgumentException(
"Invalid release "
+ id
+ ". Must be 53 or fewer characters and be a valid RFC 1123 string.");
}
StringBuilder command = new StringBuilder("helm get " + infoType + " ");
try {
safeConcat(command, id);
Expand Down Expand Up @@ -306,7 +324,6 @@ public HelmLs getAppById(HelmConfiguration configuration, String appId, String n
+ appId
+ ". Must be 53 or fewer characters and be a valid RFC 1123 string.");
}

StringBuilder command = new StringBuilder("helm list --filter ");
safeConcat(command, appId);
command.append(" -n ");
Expand Down

0 comments on commit 81fcba3

Please sign in to comment.