/// <summary> /// Gets the console output from a Jenkins Job Build. /// </summary> /// <param name="jobName">The name of the Job.</param> /// <param name="buildNumber">The number of the build.</param> /// <exception cref="JenkinsNetException"></exception> public string GetConsoleText(string jobName, string buildNumber) { try { var cmd = new BuildTextCommand(context, jobName, buildNumber); cmd.Run(); return(cmd.Result); } catch (Exception error) { throw new JenkinsNetException($"Failed to retrieve console output from build #{buildNumber} of Jenkins Job '{jobName}'!", error); } }
/// <summary> /// Gets the console output from a Jenkins Job Build asynchronously. /// </summary> /// <param name="jobName">The name of the Job.</param> /// <param name="buildNumber">The number of the build.</param> /// <param name="token">An optional token for aborting the request.</param> /// <exception cref="JenkinsNetException"></exception> public async Task <string> GetConsoleTextAsync(string jobName, string buildNumber, CancellationToken token = default) { try { var cmd = new BuildTextCommand(context, jobName, buildNumber); await cmd.RunAsync(token); return(cmd.Result); } catch (Exception error) { throw new JenkinsNetException($"Failed to retrieve console output from build #{buildNumber} of Jenkins Job '{jobName}'!", error); } }