Skip to content

Commit

Permalink
(GH-775) Add ability to skip duplicate package version during push
Browse files Browse the repository at this point in the history
This allows duplicate NuGet packages to not throw
any errors when there is a duplicate package version
in the upstream repository, and instead allow the
build to continue without any failures
  • Loading branch information
AdmiringWorm authored and gep13 committed Feb 23, 2021
1 parent 1e7d418 commit 019708a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Cake.Recipe/Content/packages.cake
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ public void PushNuGetPackages(ICakeContext context, bool isRelease, List<Package

var nugetPushSettings = new NuGetPushSettings
{
Source = nugetSource.PushUrl
Source = nugetSource.PushUrl,
SkipDuplicate = ToolSettings.SkipDuplicatePackages
};

var canPushToNuGetSource = false;
Expand Down
4 changes: 3 additions & 1 deletion Cake.Recipe/Content/toolsettings.cake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static class ToolSettings
public static MSBuildToolVersion BuildMSBuildToolVersion { get; private set; }
public static int MaxCpuCount { get; private set; }
public static string TargetFrameworkPathOverride { get; private set; }
public static bool SkipDuplicatePackages { get; private set; }

public static string CodecovTool { get; private set; }
public static string CoverallsTool { get; private set; }
Expand Down Expand Up @@ -99,7 +100,8 @@ public static class ToolSettings
DirectoryPath targetFrameworkPathOverride = null,
string[] dupFinderExcludeFilesByStartingCommentSubstring = null,
int? dupFinderDiscardCost = null,
bool? dupFinderThrowExceptionOnFindingDuplicates = null
bool? dupFinderThrowExceptionOnFindingDuplicates = null,
bool skipDuplicatePackages = false
)
{
context.Information("Setting up tools...");
Expand Down
8 changes: 8 additions & 0 deletions docs/input/docs/fundamentals/set-tool-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,11 @@ This is used when executing the DupFinder command line tool. If set to true, an
Type: `bool?`

Default Value: `null`

### skipDuplicatesPackages

This is used to tell NuGet to ignore issues with trying to push package versions when the version already exist upstream, instead of failing the build.

Type: `bool`

Default Value: `false`

0 comments on commit 019708a

Please sign in to comment.