Skip to content

Commit

Permalink
review + a few more changes related to runners
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-z committed Dec 16, 2024
1 parent 77c6af9 commit 1b4db01
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 36 deletions.
5 changes: 0 additions & 5 deletions NGitLab.Mock/Clients/RunnerClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,6 @@ public Models.Runner Update(long runnerId, RunnerUpdate runnerUpdate)
return GitLabCollectionResponse.Create(OfProject(projectId));
}

public IEnumerable<Models.Job> GetJobs(long runnerId, JobScope jobScope)
{
throw new NotImplementedException();
}

public IEnumerable<Models.Job> GetJobs(long runnerId, JobStatus? status = null)
{
throw new NotImplementedException();
Expand Down
2 changes: 1 addition & 1 deletion NGitLab.Mock/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ public Runner AddRunner(string name, string description, bool paused, bool locke
};

RegisteredRunners.Add(runner);
if (paused)
if (!paused)
{
EnabledRunners.Add(new RunnerRef(runner));
}
Expand Down
11 changes: 1 addition & 10 deletions NGitLab/IRunnerClient.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using NGitLab.Models;
Expand Down Expand Up @@ -59,16 +57,9 @@ public interface IRunnerClient

GitLabCollectionResponse<Runner> OfProjectAsync(long projectId);

/// <summary>
/// List all jobs of the given runner that meet the specified scope
/// </summary>
[Obsolete("Use GetJobs(int, JobStatus?) instead")]
IEnumerable<Job> GetJobs(long runnerId, JobScope jobScope);

/// <summary>
/// List all jobs of the given runner that meet the specified status
/// </summary>
[SuppressMessage("ApiDesign", "RS0027:Public API with optional parameter(s) should have the most parameters amongst its public overloads", Justification = "Keep compatibility")]
IEnumerable<Job> GetJobs(long runnerId, JobStatus? status = null);

/// <summary>
Expand Down
18 changes: 1 addition & 17 deletions NGitLab/Impl/RunnerClient.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using NGitLab.Extensions;
Expand Down Expand Up @@ -63,20 +61,6 @@ public Runner Update(long runnerId, RunnerUpdate runnerUpdate)
return _api.Put().With(runnerUpdate).To<Runner>(url);
}

[Obsolete("Use GetJobs(int, JobStatus?) instead")]
public IEnumerable<Job> GetJobs(long runnerId, JobScope scope)
{
var url = $"{Runner.Url}/{runnerId.ToStringInvariant()}/jobs";

if (scope != JobScope.All)
{
url = Utils.AddParameter(url, "status", scope.ToString().ToLowerInvariant());
}

return _api.Get().GetAll<Job>(url);
}

[SuppressMessage("ApiDesign", "RS0027:Public API with optional parameter(s) should have the most parameters amongst its public overloads", Justification = "Keep compatibility")]
public IEnumerable<Job> GetJobs(long runnerId, JobStatus? status = null)
{
var url = $"{Runner.Url}/{runnerId.ToStringInvariant()}/jobs";
Expand Down
4 changes: 1 addition & 3 deletions NGitLab/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,6 @@ NGitLab.Impl.RunnerClient.EnableRunner(long projectId, NGitLab.Models.RunnerId r
NGitLab.Impl.RunnerClient.EnableRunnerAsync(long projectId, NGitLab.Models.RunnerId runnerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<NGitLab.Models.Runner>
NGitLab.Impl.RunnerClient.GetAllRunnersWithScope(NGitLab.Models.RunnerScope scope) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Runner>
NGitLab.Impl.RunnerClient.GetJobs(long runnerId, NGitLab.JobStatus? status = null) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Job>
NGitLab.Impl.RunnerClient.GetJobs(long runnerId, NGitLab.Models.JobScope scope) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Job>
NGitLab.Impl.RunnerClient.OfGroup(long groupId) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Runner>
NGitLab.Impl.RunnerClient.OfGroupAsync(long groupId) -> NGitLab.GitLabCollectionResponse<NGitLab.Models.Runner>
NGitLab.Impl.RunnerClient.OfProject(long projectId) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Runner>
Expand Down Expand Up @@ -1112,7 +1111,6 @@ NGitLab.IRunnerClient.EnableRunnerAsync(long projectId, NGitLab.Models.RunnerId
NGitLab.IRunnerClient.GetAllRunnersWithScope(NGitLab.Models.RunnerScope scope) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Runner>
NGitLab.IRunnerClient.GetAvailableRunners(long projectId) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Runner>
NGitLab.IRunnerClient.GetJobs(long runnerId, NGitLab.JobStatus? status = null) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Job>
NGitLab.IRunnerClient.GetJobs(long runnerId, NGitLab.Models.JobScope jobScope) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Job>
NGitLab.IRunnerClient.OfGroup(long groupId) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Runner>
NGitLab.IRunnerClient.OfGroupAsync(long groupId) -> NGitLab.GitLabCollectionResponse<NGitLab.Models.Runner>
NGitLab.IRunnerClient.OfProject(long projectId) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Runner>
Expand Down Expand Up @@ -4139,4 +4137,4 @@ virtual NGitLab.Impl.HttpRequestor.To<T>(string tailAPIUrl) -> T
virtual NGitLab.Impl.HttpRequestor.ToAsync<T>(string tailAPIUrl, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<T>
virtual NGitLab.RequestOptions.GetResponse(System.Net.HttpWebRequest request) -> System.Net.WebResponse
virtual NGitLab.RequestOptions.GetResponseAsync(System.Net.HttpWebRequest request, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Net.WebResponse>
virtual NGitLab.RequestOptions.ShouldRetry(System.Exception ex, int retryNumber) -> bool
virtual NGitLab.RequestOptions.ShouldRetry(System.Exception ex, int retryNumber) -> bool

0 comments on commit 1b4db01

Please sign in to comment.