Skip to content

Commit

Permalink
feat(container): Refactor handling of Docker push command (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
prom3theu5 authored Jun 20, 2024
1 parent 66b0e5c commit 19f5dfb
Showing 1 changed file with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,32 @@ private async Task<ShellCommandResult> PushContainer(string builder, string? reg
{
if (!string.IsNullOrEmpty(registry))
{
var pushArgumentBuilder = ArgumentsBuilder
.Create()
.AppendArgument(DockerLiterals.PushCommand, string.Empty, quoteValue: false);
ShellCommandResult? result = null;

foreach (var fullImage in fullImages)
{
var pushArgumentBuilder = ArgumentsBuilder
.Create()
.AppendArgument(DockerLiterals.PushCommand, string.Empty, quoteValue: false);

pushArgumentBuilder.AppendArgument(fullImage.ToLower(), string.Empty, quoteValue: false, allowDuplicates: true);
}

return await shellExecutionService.ExecuteCommand(
new()
result = await shellExecutionService.ExecuteCommand(
new()
{
Command = builder,
ArgumentsBuilder = pushArgumentBuilder,
NonInteractive = nonInteractive.GetValueOrDefault(),
ShowOutput = true,
});

if (!result.Success)
{
Command = builder,
ArgumentsBuilder = pushArgumentBuilder,
NonInteractive = nonInteractive.GetValueOrDefault(),
ShowOutput = true,
});
break;
}
}

return result;
}

return new ShellCommandResult(true, string.Empty, string.Empty, 0);
Expand Down

0 comments on commit 19f5dfb

Please sign in to comment.