public override async ValueTask ExecuteAsync(IConsole console) { var pipeMethods = PipeCtx.PipeMethods(); var runId = RunId.HasValue() ? PipeRunId.FromString(RunId) : new(); if (RunId.NullOrEmpty()) { throw new CommandException($"Provide one of the following pipes to run: {pipeMethods.Join(", ", m => m.Method.Name)}"); } if (!pipeMethods.ContainsKey(runId.Name)) { throw new CommandException($"Pipe {runId.Name} not found. Available: {pipeMethods.Join(", ", m => m.Method.Name)}"); } var log = Log.ForContext("RunId", runId); log.Information("Pipe Run Command Started {RunId}", RunId); if (runId.HasGroup) { await PipeCtx.DoPipeWork(runId, console.GetCancellationToken()); } else { var res = await PipeCtx.Run(runId.Name, new() { Location = Location ?? PipeRunLocation.Local }, log : log, cancel : console.GetCancellationToken()); if (res.Error) { throw new CommandException(res.ErrorMessage); } } }
public static string ContainerGroupName(this PipeRunId runId, bool exclusive, SemVersion version) => new[] { runId.Name, version.Prerelease == "" ? null : version.Prerelease, exclusive ? null : runId.GroupId, runId.Num > 0 ? runId.Num.ToString() : null }.NotNull().Join("-", p => p !.ToLowerInvariant());