Skip to content

Commit

Permalink
(cake-contribGH-775) Add ability to skip duplicate package version du…
Browse files Browse the repository at this point in the history
…ring push

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 committed Feb 20, 2021
1 parent 265f6a8 commit c29323b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 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
2 changes: 1 addition & 1 deletion config.wyam.packages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
<package id="Wyam.Razor" version="2.2.9" targetFramework="netcoreapp2.1" />
<package id="Wyam.Sass" version="2.2.9" targetFramework="netcoreapp2.1" />
<package id="Wyam.SearchIndex" version="2.2.9" targetFramework="netcoreapp2.1" />
<package id="YamlDotNet" version="4.3.1" targetFramework="netcoreapp2.1" />
<package id="YamlDotNet" version="5.1.0" targetFramework="netcoreapp2.1" />
<package id="Wyam.Yaml" version="2.2.9" targetFramework="netcoreapp2.1" />
<package id="Wyam.Web" version="2.2.9" targetFramework="netcoreapp2.1" />
</package>
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 c29323b

Please sign in to comment.