Skip to content

Commit

Permalink
add retry to deploy command
Browse files Browse the repository at this point in the history
  • Loading branch information
cwensel committed Sep 27, 2023
1 parent 12589d5 commit 839f957
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
*/
@CommandLine.Command(description = "Deploy the given project files.")
public class DeployCommandOptions extends ProjectCommandOptions {
@CommandLine.Option(names = "--retry", description = "Retry the operation.")
private boolean retry = false;
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
@CommandLine.Option(
names = "--approve",
Expand All @@ -29,6 +31,10 @@ public class DeployCommandOptions extends ProjectCommandOptions {
)
Optional<Boolean> approve;

public boolean retry() {
return retry;
}

public Optional<Boolean> approve() {
return approve;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public TaskResult execute(Task task) {
String workingDirectory = Objects.toString(inputData.get("workingDirectory"), null);
Map<String, String> placement = (Map<String, String>) inputData.get("placement");

ClusterlessBootstrapExecutor deploy = ClusterlessBootstrapExecutor.Builder.builder()
ClusterlessBootstrapExecutor executor = ClusterlessBootstrapExecutor.Builder.builder()
.withClsApp(options.clsApp())
.withDryRun(getDryRun())
.withPlacement(placement)
Expand All @@ -48,7 +48,7 @@ public TaskResult execute(Task task) {

LOG.info("worker executing bootstrap, placement: {}, destroy: {}", placement, destroy);

int exitCode = deploy.exec();
int exitCode = executor.exec();

LOG.info("worker executed bootstrap, with exit: {}", exitCode);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class DeployerProjectWorker extends ClusterlessProjectWorker {

public DeployerProjectWorker(Options options) {
super("deploy", options);
super("deploy", options, "--retry");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Deploy extends BaseCDKCommand implements Callable<Integer> {
@CommandLine.Mixin
DeployCommandOptions commandOptions = new DeployCommandOptions();
@CommandLine.Mixin
CDKProcessExec processExec = new CDKProcessExec(commandOptions::dryRun, this::verbosityLevel);
CDKProcessExec processExec = new CDKProcessExec(commandOptions::dryRun, commandOptions::retry, this::verbosityLevel);

@Override
public Integer call() throws Exception {
Expand Down

0 comments on commit 839f957

Please sign in to comment.