Skip to content

Commit

Permalink
added helm client dependency update
Browse files Browse the repository at this point in the history
Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>
  • Loading branch information
jeromy-cannon committed Oct 2, 2023
1 parent 5f4d57c commit 7fe0aae
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ default Release installChart(String releaseName, Chart chart) {
*/
void testChart(String releaseName, TestChartOptions options);

/**
* Executes the Helm CLI {@code dependency update} sub-command and updates the dependencies of the specified Helm
* chart.
*
* @param chartName the name of the chart to update.
*/
void dependencyUpdate(String chartName);

/**
* Creates a new {@link HelmClientBuilder} instance with the default configuration.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.hedera.fullstack.helm.client.model.test.TestChartOptions;
import com.hedera.fullstack.helm.client.proxy.request.HelmRequest;
import com.hedera.fullstack.helm.client.proxy.request.authentication.KubeAuthentication;
import com.hedera.fullstack.helm.client.proxy.request.chart.ChartDependencyUpdateRequest;
import com.hedera.fullstack.helm.client.proxy.request.chart.ChartInstallRequest;
import com.hedera.fullstack.helm.client.proxy.request.chart.ChartTestRequest;
import com.hedera.fullstack.helm.client.proxy.request.chart.ChartUninstallRequest;
Expand Down Expand Up @@ -130,6 +131,14 @@ public void testChart(final String releaseName, final TestChartOptions options)
});
}

@Override
public void dependencyUpdate(final String chartName) {
executeInternal(new ChartDependencyUpdateRequest(chartName), Void.class, (b, c) -> {
b.call();
return null;
});
}

/**
* Applies the default namespace and authentication configuration to the given builder.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (C) 2023 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.hedera.fullstack.helm.client.proxy.request.chart;

import com.hedera.fullstack.helm.client.execution.HelmExecutionBuilder;
import com.hedera.fullstack.helm.client.proxy.request.HelmRequest;
import java.util.Objects;

/**
* A request to do a dependency update on a chart.
*
* @param chartName the name of the chart to update.
*/
public record ChartDependencyUpdateRequest(String chartName) implements HelmRequest {
public ChartDependencyUpdateRequest {
Objects.requireNonNull(chartName, "chartName must not be null");
if (chartName.isBlank()) {
throw new IllegalArgumentException("chartName must not be blank");
}
}

@Override
public void apply(HelmExecutionBuilder builder) {
builder.subcommands("dependency update");
builder.positional(chartName);
}
}

0 comments on commit 7fe0aae

Please sign in to comment.