I have the oddest issue ever. In my jenkins build process i run a powershell script at the end to push all my nuget packages to my octopus server. Here is the script:-
$nugets = get-childitem . -include afi*.nupkg -recurse -exclude packages | where {$.FullName -match “^.\bin\.$”}
$nugets | foreach-object -process {
try{
$command = ‘Build\NuGet.exe push "’ + $.FullName + ‘" -ApiKey ******* -Source http://myserver.corp/nuget/packages -verbosity detailed’;
iex $command;
}catch{}
}
the output from jenkins console shows this:-
Pushing Afi.Client 1.4.0.3885 to ‘http://myserver.corp/nuget/packages’…
PUT http://myserver.corp/nuget/packages/
System.InvalidOperationException: Failed to process request. ‘Not Found’.
The remote server returned an error: (404) Not Found… —> System.Net.WebException: The remote server returned an error: (404) Not Found.
at System.Net.HttpWebRequest.GetResponse()
at NuGet.RequestHelper.GetResponse()
at NuGet.HttpClient.GetResponse()
at NuGet.PackageServer.EnsureSuccessfulResponse(HttpClient client, Nullable1 expectedStatusCode) --- End of inner exception stack trace --- at NuGet.PackageServer.EnsureSuccessfulResponse(HttpClient client, Nullable
1 expectedStatusCode)
at NuGet.PackageServer.PushPackageToServer(String apiKey, Func`1 packageStreamFactory, Int64 packageSize, Int32 timeout, Boolean disableBuffering)
at NuGet.PackageServer.PushPackage(String apiKey, IPackage package, Int64 packageSize, Int32 timeout, Boolean disableBuffering)
at NuGet.Commands.PushCommand.PushPackageCore(String source, String apiKey, PackageServer packageServer, String packageToPush, TimeSpan timeout)
at NuGet.Commands.PushCommand.PushPackage(String packagePath, String source, String apiKey, TimeSpan timeout)
at NuGet.Commands.PushCommand.ExecuteCommand()
at NuGet.Commands.Command.Execute()
at NuGet.Program.Main(String[] args)
and now for the odd part. If i run this exact same script from the console via a “powershell script.ps1” command it works. The library in octopus is updated with my new packages.
Any ideas?
Ta
Cedric