Skip to content

Release 1.0.5 #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ deploy:
provider: releases
api_key: $GITHUB_APIKEY
file: "Jenkins.Net/bin/jenkinsnet.*.nupkg"
file_glob: true
skip_cleanup: true
on:
tags: true
Expand Down
4 changes: 2 additions & 2 deletions Jenkins.Net/IJenkinsContext.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using JenkinsNET.Models;
using JenkinsNET.Models;
using System;

namespace JenkinsNET
{
Expand Down
10 changes: 2 additions & 8 deletions Jenkins.Net/Internal/Commands/ArtifactGetCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ internal class ArtifactGetCommand : JenkinsHttpCommand
public MemoryStream Result {get; private set;}


public ArtifactGetCommand(IJenkinsContext context, string jobName, string buildNumber, string filename)
public ArtifactGetCommand(JenkinsClient client, string jobName, string buildNumber, string filename) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

if (string.IsNullOrEmpty(jobName))
throw new ArgumentException("'jobName' cannot be empty!");

Expand All @@ -23,10 +20,7 @@ public ArtifactGetCommand(IJenkinsContext context, string jobName, string buildN
throw new ArgumentException("'filename' cannot be empty!");

var urlFilename = filename.Replace('\\', '/');
Url = NetPath.Combine(context.BaseUrl, "job", jobName, buildNumber, "artifact", urlFilename);
UserName = context.UserName;
Password = context.Password;
Crumb = context.Crumb;
Path = $"job/{jobName}/{buildNumber}/artifact/{urlFilename}";

OnWrite = request => {
request.Method = "POST";
Expand Down
10 changes: 2 additions & 8 deletions Jenkins.Net/Internal/Commands/BuildGetCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,15 @@ internal class BuildGetCommand<T> : JenkinsHttpCommand where T : class, IJenkins
public T Result {get; private set;}


public BuildGetCommand(IJenkinsContext context, string jobName, string buildNumber)
public BuildGetCommand(JenkinsClient client, string jobName, string buildNumber) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

if (string.IsNullOrEmpty(jobName))
throw new ArgumentException("'jobName' cannot be empty!");

if (string.IsNullOrEmpty(buildNumber))
throw new ArgumentException("'buildNumber' cannot be empty!");

Url = NetPath.Combine(context.BaseUrl, "job", jobName, buildNumber, "api/xml");
UserName = context.UserName;
Password = context.Password;
Crumb = context.Crumb;
Path = $"job/{jobName}/{buildNumber}/api/xml";

OnWrite = request => {
request.Method = "POST";
Expand Down
10 changes: 2 additions & 8 deletions Jenkins.Net/Internal/Commands/BuildHtmlCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,15 @@ internal class BuildHtmlCommand : JenkinsHttpCommand
public string Result {get; private set;}


public BuildHtmlCommand(IJenkinsContext context, string jobName, string buildNumber)
public BuildHtmlCommand(JenkinsClient client, string jobName, string buildNumber) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

if (string.IsNullOrEmpty(jobName))
throw new ArgumentException("'jobName' cannot be empty!");

if (string.IsNullOrEmpty(buildNumber))
throw new ArgumentException("'buildNumber' cannot be empty!");

Url = NetPath.Combine(context.BaseUrl, "job", jobName, buildNumber, "consoleFull");
UserName = context.UserName;
Password = context.Password;
Crumb = context.Crumb;
Path = $"job/{jobName}/{buildNumber}/consoleFull";

OnRead = response => {
using (var stream = response.GetResponseStream()) {
Expand Down
10 changes: 2 additions & 8 deletions Jenkins.Net/Internal/Commands/BuildProgressiveHtmlCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,15 @@ internal class BuildProgressiveHtmlCommand : JenkinsHttpCommand
public JenkinsProgressiveHtmlResponse Result {get; private set;}


public BuildProgressiveHtmlCommand(IJenkinsContext context, string jobName, string buildNumber, int start)
public BuildProgressiveHtmlCommand(JenkinsClient client, string jobName, string buildNumber, int start) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

if (string.IsNullOrEmpty(jobName))
throw new ArgumentException("'jobName' cannot be empty!");

if (string.IsNullOrEmpty(buildNumber))
throw new ArgumentException("'buildNumber' cannot be empty!");

Url = NetPath.Combine(context.BaseUrl, "job", jobName, buildNumber, "logText/progressiveHtml");
UserName = context.UserName;
Password = context.Password;
Crumb = context.Crumb;
Path = $"job/{jobName}/{buildNumber}/logText/progressiveHtml";

OnWrite = request => {
request.Method = "POST";
Expand Down
10 changes: 2 additions & 8 deletions Jenkins.Net/Internal/Commands/BuildProgressiveTextCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,15 @@ internal class BuildProgressiveTextCommand : JenkinsHttpCommand
public JenkinsProgressiveTextResponse Result {get; private set;}


public BuildProgressiveTextCommand(IJenkinsContext context, string jobName, string buildNumber, int start)
public BuildProgressiveTextCommand(JenkinsClient client, string jobName, string buildNumber, int start) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

if (string.IsNullOrEmpty(jobName))
throw new ArgumentException("'jobName' cannot be empty!");

if (string.IsNullOrEmpty(buildNumber))
throw new ArgumentException("'buildNumber' cannot be empty!");

Url = NetPath.Combine(context.BaseUrl, "job", jobName, buildNumber, "logText/progressiveText");
UserName = context.UserName;
Password = context.Password;
Crumb = context.Crumb;
Path = $"job/{jobName}/{buildNumber}/logText/progressiveText";

OnWrite = request => {
request.Method = "POST";
Expand Down
10 changes: 2 additions & 8 deletions Jenkins.Net/Internal/Commands/BuildTextCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,15 @@ internal class BuildTextCommand : JenkinsHttpCommand
public string Result {get; private set;}


public BuildTextCommand(IJenkinsContext context, string jobName, string buildNumber)
public BuildTextCommand(JenkinsClient client, string jobName, string buildNumber) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

if (string.IsNullOrEmpty(jobName))
throw new ArgumentException("'jobName' cannot be empty!");

if (string.IsNullOrEmpty(buildNumber))
throw new ArgumentException("'buildNumber' cannot be empty!");

Url = NetPath.Combine(context.BaseUrl, "job", jobName, buildNumber, "consoleText");
UserName = context.UserName;
Password = context.Password;
Crumb = context.Crumb;
Path = $"job/{jobName}/{buildNumber}/consoleText";

OnRead = response => {
using (var stream = response.GetResponseStream()) {
Expand Down
9 changes: 2 additions & 7 deletions Jenkins.Net/Internal/Commands/CrumbGetCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,9 @@ internal class CrumbGetCommand : JenkinsHttpCommand
public JenkinsCrumb Result {get; private set;}


public CrumbGetCommand(IJenkinsContext context)
public CrumbGetCommand(JenkinsClient client) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

Url = NetPath.Combine(context.BaseUrl, "crumbIssuer/api/xml");
UserName = context.UserName;
Password = context.Password;
Path = $"crumbIssuer/api/xml";

OnWrite = request => {
request.Method = "GET";
Expand Down
12 changes: 2 additions & 10 deletions Jenkins.Net/Internal/Commands/JenkinsGetCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using JenkinsNET.Models;
using System;

namespace JenkinsNET.Internal.Commands
{
Expand All @@ -8,16 +7,9 @@ internal class JenkinsGetCommand : JenkinsHttpCommand
public Jenkins Result {get; private set;}


public JenkinsGetCommand(IJenkinsContext context)
public JenkinsGetCommand(JenkinsClient client) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

Url = NetPath.Combine(context.BaseUrl, "api/xml");

UserName = context.UserName;
Password = context.Password;
Crumb = context.Crumb;
Path = "api/xml";

OnWrite = request => {
request.Method = "GET";
Expand Down
10 changes: 2 additions & 8 deletions Jenkins.Net/Internal/Commands/JobBuildCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@ internal class JobBuildCommand : JenkinsHttpCommand
{
public JenkinsBuildResult Result {get; internal set;}

public JobBuildCommand(IJenkinsContext context, string jobName)
public JobBuildCommand(JenkinsClient client, string jobName) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

if (string.IsNullOrEmpty(jobName))
throw new ArgumentException("'jobName' cannot be empty!");

Url = NetPath.Combine(context.BaseUrl, "job", jobName, "build?delay=0sec");
UserName = context.UserName;
Password = context.Password;
Crumb = context.Crumb;
Path = $"job/{jobName}/build?delay=0sec";

OnWrite = request => {
request.Method = "POST";
Expand Down
10 changes: 2 additions & 8 deletions Jenkins.Net/Internal/Commands/JobBuildWithParametersCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ internal class JobBuildWithParametersCommand : JenkinsHttpCommand
{
public JenkinsBuildResult Result {get; internal set;}

public JobBuildWithParametersCommand(IJenkinsContext context, string jobName, IDictionary<string, string> jobParameters)
public JobBuildWithParametersCommand(JenkinsClient client, string jobName, IDictionary<string, string> jobParameters) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

if (string.IsNullOrEmpty(jobName))
throw new ArgumentException("'jobName' cannot be empty!");

Expand All @@ -28,10 +25,7 @@ public JobBuildWithParametersCommand(IJenkinsContext context, string jobName, ID
var query = new StringWriter();
WriteJobParameters(query, _params);

Url = NetPath.Combine(context.BaseUrl, "job", jobName, $"buildWithParameters?{query}");
UserName = context.UserName;
Password = context.Password;
Crumb = context.Crumb;
Path = $"job/{jobName}/buildWithParameters?{query}";

OnWrite = request => {
request.Method = "POST";
Expand Down
13 changes: 3 additions & 10 deletions Jenkins.Net/Internal/Commands/JobCreateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,16 @@ namespace JenkinsNET.Internal.Commands
{
internal class JobCreateCommand : JenkinsHttpCommand
{
public JobCreateCommand(IJenkinsContext context, string jobName, JenkinsProject job)
public JobCreateCommand(JenkinsClient client, string jobName, JenkinsProject job) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

if (string.IsNullOrEmpty(jobName))
throw new ArgumentException("Value cannot be empty!", nameof(jobName));

if (job == null)
throw new ArgumentNullException(nameof(job));

Url = NetPath.Combine(context.BaseUrl, "createItem")
+ NetPath.Query(new {name = jobName});

UserName = context.UserName;
Password = context.Password;
Crumb = context.Crumb;
var query = NetPath.Query(new {name = jobName});
Path = $"createItem{query}";

OnWrite = request => {
request.Method = "POST";
Expand Down
10 changes: 2 additions & 8 deletions Jenkins.Net/Internal/Commands/JobDeleteCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@ namespace JenkinsNET.Internal.Commands
{
internal class JobDeleteCommand : JenkinsHttpCommand
{
public JobDeleteCommand(IJenkinsContext context, string jobName)
public JobDeleteCommand(JenkinsClient client, string jobName) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

if (string.IsNullOrEmpty(jobName))
throw new ArgumentException("'jobName' cannot be empty!");

Url = NetPath.Combine(context.BaseUrl, "job", jobName, "doDelete");
UserName = context.UserName;
Password = context.Password;
Crumb = context.Crumb;
Path = $"job/{jobName}/doDelete";

OnWrite = request => {
request.Method = "POST";
Expand Down
11 changes: 2 additions & 9 deletions Jenkins.Net/Internal/Commands/JobGetCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,12 @@ internal class JobGetCommand<T> : JenkinsHttpCommand where T : class, IJenkinsJo
public T Result {get; private set;}


public JobGetCommand(IJenkinsContext context, string jobName)
public JobGetCommand(JenkinsClient client, string jobName) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

if (string.IsNullOrEmpty(jobName))
throw new ArgumentException("Value cannot be empty!", nameof(jobName));

Url = NetPath.Combine(context.BaseUrl, "job", jobName, "api/xml");

UserName = context.UserName;
Password = context.Password;
Crumb = context.Crumb;
Path = $"job/{jobName}/api/xml";

OnWrite = request => {
request.Method = "GET";
Expand Down
11 changes: 2 additions & 9 deletions Jenkins.Net/Internal/Commands/JobGetConfigCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,12 @@ internal class JobGetConfigCommand : JenkinsHttpCommand
public JenkinsProject Result {get; private set;}


public JobGetConfigCommand(IJenkinsContext context, string jobName)
public JobGetConfigCommand(JenkinsClient client, string jobName) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

if (string.IsNullOrEmpty(jobName))
throw new ArgumentException("Value cannot be empty!", nameof(jobName));

Url = NetPath.Combine(context.BaseUrl, "job", jobName, "config.xml");

UserName = context.UserName;
Password = context.Password;
Crumb = context.Crumb;
Path = $"job/{jobName}/config.xml";

OnWrite = request => {
request.Method = "GET";
Expand Down
11 changes: 2 additions & 9 deletions Jenkins.Net/Internal/Commands/JobUpdateConfigurationCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,15 @@ namespace JenkinsNET.Internal.Commands
{
internal class JobUpdateConfigurationCommand : JenkinsHttpCommand
{
public JobUpdateConfigurationCommand(IJenkinsContext context, string jobName, JenkinsProject job)
public JobUpdateConfigurationCommand(JenkinsClient client, string jobName, JenkinsProject job) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

if (string.IsNullOrEmpty(jobName))
throw new ArgumentException("Value cannot be empty!", nameof(jobName));

if (job == null)
throw new ArgumentNullException(nameof(job));

Url = NetPath.Combine(context.BaseUrl, "job", jobName, "config.xml");

UserName = context.UserName;
Password = context.Password;
Crumb = context.Crumb;
Path = $"job/{jobName}/config.xml";

OnWrite = request => {
request.Method = "POST";
Expand Down
10 changes: 2 additions & 8 deletions Jenkins.Net/Internal/Commands/QueueGetItemCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ internal class QueueGetItemCommand : JenkinsHttpCommand
public JenkinsQueueItem Result {get; private set;}


public QueueGetItemCommand(IJenkinsContext context, int itemNumber)
public QueueGetItemCommand(JenkinsClient client, int itemNumber) : base(client)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

Url = NetPath.Combine(context.BaseUrl, "queue/item", itemNumber.ToString(), "api/xml");
UserName = context.UserName;
Password = context.Password;
Crumb = context.Crumb;
Path = $"queue/item/{itemNumber}/api/xml";

OnWrite = request => {
request.Method = "POST";
Expand Down
Loading