Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

FailOnGitError added #1104

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
887532a
Fix yaml code blocks
KuraiAndras Jul 29, 2020
27ab225
Merge branch 'master' into patch-1
KuraiAndras Aug 31, 2020
a6a8050
FailOnGitError added
MartinDembergerR9 Mar 25, 2021
0859855
Ignore empty commit
MartinDembergerR9 Apr 14, 2021
6e19b07
Add nuget restore CLI PackagesDirectory for package.config (#1113)
Jamie-Clayton Sep 20, 2021
be66f3e
:package: Automatic update of coverlet.collector to 3.1.0 (#1120)
skolima Sep 20, 2021
1cf3548
:package: Automatic update of NUnit to 3.13.2 (#1122)
skolima Sep 20, 2021
102d762
:package: Automatic update of NUnit3TestAdapter to 4.0.0 (#1123)
skolima Sep 20, 2021
038a9c8
Merge pull request #1007 from KuraiAndras/patch-1
msallin Sep 20, 2021
dc8c324
:package: Automatic update of Microsoft.NET.Test.Sdk to 16.11.0 (#1125)
skolima Sep 20, 2021
468dcf8
:package: Automatic update of Newtonsoft.Json to 13.0.1 (#1124)
skolima Sep 20, 2021
a87453e
:package: Automatic update of Octokit to 0.50.0 (#1126)
skolima Sep 20, 2021
fd7b5e5
Fix issue when project filenames contains whitespaces (#1093)
kwlin Sep 20, 2021
0287d8c
Fix BitBucketLocal not respecting target branch parameter (#1107)
arikalish Sep 20, 2021
39bdcd5
Add relevant reviewers to PRs to local BitBucket repositories instead…
arikalish Sep 20, 2021
9677914
:package: Automatic update of SimpleInjector to 5.3.2 (#1128)
skolima Sep 20, 2021
7e9ec11
:package: Automatic update of McMaster.Extensions.CommandLineUtils to…
skolima Sep 20, 2021
c6757be
Bump our linux build agent to ubuntu-latest as suggested (#1119)
skolima Sep 20, 2021
e3880db
:package: Automatic update of NuGet.Credentials to 5.11.0 (#1134)
skolima Sep 20, 2021
ab8bd60
:package: Automatic update of NuGet.Protocol to 5.11.0 (#1133)
skolima Sep 20, 2021
51beeb2
:package: Automatic update of SimpleInjector.Integration.ServiceColle…
skolima Sep 20, 2021
eadf5cd
Automatic update of NuGet.CommandLine to 5.11.0 (#1135)
skolima Sep 20, 2021
886b5b7
Fix target-branch for azure devops client. (#1077)
kwlin Sep 20, 2021
224ae20
Drop netcoreapp2.1 target, it's no longer supported (#1127)
skolima Sep 20, 2021
3a7eb56
FailOnGitError added
MartinDembergerR9 Mar 25, 2021
85637b3
Ignore empty commit
MartinDembergerR9 Apr 14, 2021
d7df51a
Merge branch 'Issue930' of https://github.com/MartinDemberger/NuKeepe…
MartinDembergerR9 Sep 21, 2021
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
2 changes: 1 addition & 1 deletion .azure-build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
strategy:
matrix:
Linux:
imageName: 'ubuntu-16.04'
imageName: 'ubuntu-latest'
Windows:
imageName: 'windows-2019'
Mac:
Expand Down
2 changes: 1 addition & 1 deletion Docker/SDK2.1/Dockerfile → Docker/SDK5.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/core/sdk:2.1
FROM mcr.microsoft.com/dotnet/sdk:5.0-focal
ARG NUKEEPER_VERSION=0.34.0
RUN dotnet tool install --global NuKeeper --version $NUKEEPER_VERSION
ENV PATH="${PATH}:/root/.dotnet/tools"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
<ProjectReference Include="..\NuKeeper.Abstractions\NuKeeper.Abstractions.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="NSubstitute" Version="4.2.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
7 changes: 7 additions & 0 deletions NuKeeper.Abstractions/Configuration/AuthSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ namespace NuKeeper.Abstractions.Configuration
{
public class AuthSettings
{
/// <summary>
/// Provide the credentials required to authenticate against a different repository providers.
/// </summary>
/// <param name="apiBase">Repository URLs e.g. https://dev.azure.com/ or https://api.github.com/ or https://developer.atlassian.com/bitbucket/api/2/reference/</param>
/// <param name="token">Personal Access Tokens or Client Secret. The GitHub client with use anonymous authentication it the token is blank. I.e. public repositories</param>
/// <param name="username"></param>
/// <remarks>See <seealso cref="NuKeeper.Abstractions.CollaborationPlatform.CollaborationPlatformSettings"/> for a similar model.</remarks>
public AuthSettings(Uri apiBase, string token, string username = null)
{
ApiBase = apiBase;
Expand Down
1 change: 1 addition & 0 deletions NuKeeper.Abstractions/Configuration/FileSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class FileSettings

public string GitCliPath { get; set; }
public int? MaxOpenPullRequests { get; set; }
public bool? ThrowOnGitError { get; set; }

public static FileSettings Empty()
{
Expand Down
1 change: 1 addition & 0 deletions NuKeeper.Abstractions/Configuration/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class UserSettings

public UsePrerelease UsePrerelease { get; set; }

public bool ThrowOnGitError { get; set; }

public OutputFormat OutputFormat { get; set; }
public OutputDestination OutputDestination { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions NuKeeper.Abstractions/NuKeeper.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="3.0.0" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
<PackageReference Include="NuGet.Protocol" Version="5.8.0" />
<PackageReference Include="NuGet.Protocol" Version="5.11.0" />
</ItemGroup>

</Project>
12 changes: 6 additions & 6 deletions NuKeeper.AzureDevOps/AzureDevOpsSettingsReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public override async Task<RepositorySettings> RepositorySettings(Uri repository

var settings = repositoryUri.IsFile
? await CreateSettingsFromLocal(repositoryUri, targetBranch)
: CreateSettingsFromRemote(repositoryUri);
: CreateSettingsFromRemote(repositoryUri, targetBranch);

if (settings == null)
{
Expand All @@ -59,7 +59,7 @@ public override async Task<RepositorySettings> RepositorySettings(Uri repository
return settings;
}

private static RepositorySettings CreateSettingsFromRemote(Uri repositoryUri)
private static RepositorySettings CreateSettingsFromRemote(Uri repositoryUri, string targetBranch)
{
// URL pattern is
// https://dev.azure.com/{org}/{project}/_git/{repo}/
Expand All @@ -80,17 +80,17 @@ private static RepositorySettings CreateSettingsFromRemote(Uri repositoryUri)
pathParts[0], //org
repositoryUri, //uri
Uri.UnescapeDataString(pathParts[1]), // project
Uri.UnescapeDataString(pathParts[3]) // reponame
);
Uri.UnescapeDataString(pathParts[3]), // reponame
new RemoteInfo { BranchName = targetBranch });
}
else if (indexOfGit == 1 && pathParts.Length == 3)
{
return CreateRepositorySettings(
null, //org
repositoryUri, //uri
Uri.UnescapeDataString(pathParts[0]), // project
Uri.UnescapeDataString(pathParts[2]) // reponame
);
Uri.UnescapeDataString(pathParts[2]), // reponame
new RemoteInfo { BranchName = targetBranch });
}
return null;
}
Expand Down
8 changes: 4 additions & 4 deletions NuKeeper.Git.Tests/NuKeeper.Git.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="NSubstitute" Version="4.2.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
17 changes: 12 additions & 5 deletions NuKeeper.Git/LibGit2SharpDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,19 @@ public Task Commit(string message)
{
return Task.Run(() =>
{
_logger.Detailed($"Git commit with message '{message}'");
using (var repo = MakeRepo())
try
{
_logger.Detailed($"Git commit with message '{message}'");
using (var repo = MakeRepo())
{
var signature = GetSignature(repo);
GitCommands.Stage(repo, "*");
repo.Commit(message, signature, signature);
}
}
catch (EmptyCommitException)
{
var signature = GetSignature(repo);
GitCommands.Stage(repo, "*");
repo.Commit(message, signature, signature);
_logger.Normal($"Empty commit with message '{message}' is ignored");
}
});
}
Expand Down
8 changes: 4 additions & 4 deletions NuKeeper.GitHub.Tests/NuKeeper.GitHub.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="NSubstitute" Version="4.2.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion NuKeeper.GitHub/NuKeeper.GitHub.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Octokit" Version="0.48.0" />
<PackageReference Include="Octokit" Version="0.50.0" />
</ItemGroup>

<ItemGroup>
Expand Down
13 changes: 10 additions & 3 deletions NuKeeper.GitHub/OctokitClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,20 @@ public void Initialise(AuthSettings settings)
}

_apiBase = settings.ApiBase;
Credentials creds;
if (string.IsNullOrWhiteSpace(settings.Token))
{
creds = Credentials.Anonymous;
}
else
{
creds = new Credentials(settings.Token, AuthenticationType.Oauth);
}

_client = new GitHubClient(new ProductHeaderValue("NuKeeper"), _apiBase)
{
Credentials = new Credentials(settings.Token)
Credentials = creds
};

_initialised = true;
}

Expand Down Expand Up @@ -206,7 +214,6 @@ public async Task<SearchCodeResult> Search(SearchCodeRequest search)
{
repos.Add(repo.Owner, repo.Name);
}

var result = await _client.Search.SearchCode(
new Octokit.SearchCodeRequest()
{
Expand Down
8 changes: 4 additions & 4 deletions NuKeeper.Gitea.Tests/NuKeeper.Gitea.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="NSubstitute" Version="4.2.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
8 changes: 4 additions & 4 deletions NuKeeper.Gitlab.Tests/NuKeeper.Gitlab.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="NSubstitute" Version="4.2.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
17 changes: 11 additions & 6 deletions NuKeeper.Inspection.Tests/NuGetApi/ApiPackageLookupTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public async Task WhenNoPackagesAreFound()
CurrentVersion123("TestPackage"),
NuGetSources.GlobalFeed,
VersionChange.Major,
UsePrerelease.FromPrerelease);
UsePrerelease.FromPrerelease,
true);

Assert.That(updates, Is.Not.Null);
Assert.That(updates.Major, Is.Null);
Expand All @@ -48,7 +49,8 @@ public async Task WhenThereIsOnlyOneVersion()
CurrentVersion123("TestPackage"),
NuGetSources.GlobalFeed,
VersionChange.Major,
UsePrerelease.FromPrerelease);
UsePrerelease.FromPrerelease,
true);

Assert.That(updates, Is.Not.Null);

Expand All @@ -74,7 +76,8 @@ public async Task WhenMajorVersionChangesAreAllowed(VersionChange dataRange,
CurrentVersion123("TestPackage"),
NuGetSources.GlobalFeed,
VersionChange.Major,
UsePrerelease.FromPrerelease);
UsePrerelease.FromPrerelease,
true);

AssertPackagesIdentityIs(updates, "TestPackage");
Assert.That(updates.Selected().Identity.Version, Is.EqualTo(expectedUpdate));
Expand All @@ -98,7 +101,8 @@ public async Task WhenMinorVersionChangesAreAllowed(VersionChange dataRange,
CurrentVersion123("TestPackage"),
NuGetSources.GlobalFeed,
VersionChange.Minor,
UsePrerelease.FromPrerelease);
UsePrerelease.FromPrerelease,
true);

AssertPackagesIdentityIs(updates, "TestPackage");
Assert.That(updates.Selected().Identity.Version, Is.EqualTo(expectedUpdate));
Expand All @@ -122,7 +126,8 @@ public async Task WhenPatchVersionChangesAreAllowed(VersionChange dataRange,
CurrentVersion123("TestPackage"),
NuGetSources.GlobalFeed,
VersionChange.Patch,
UsePrerelease.FromPrerelease);
UsePrerelease.FromPrerelease,
true);

AssertPackagesIdentityIs(updates, "TestPackage");
Assert.That(updates.Selected().Identity.Version, Is.EqualTo(expectedUpdate));
Expand All @@ -132,7 +137,7 @@ public async Task WhenPatchVersionChangesAreAllowed(VersionChange dataRange,
private static IPackageVersionsLookup MockVersionLookup(List<PackageSearchMetadata> actualResults)
{
var allVersions = Substitute.For<IPackageVersionsLookup>();
allVersions.Lookup(Arg.Any<string>(), Arg.Any<bool>(), Arg.Any<NuGetSources>())
allVersions.Lookup(Arg.Any<string>(), Arg.Any<bool>(), Arg.Any<bool>(), Arg.Any<NuGetSources>())
.Returns(actualResults);
return allVersions;
}
Expand Down
Loading