Optional -SkipDuplicate doesn't work when nuget push, what's wrong? - gitlab

when I run a command to send a nupkg package to the Package Registry in myGitLab CE , i using the command nuget push "*.nupkg" -Source GitLab_packages -SkipDuplicate
I get a message about a successful completion, but shouldn’t have downloaded the package because there’s already one,but...
PS C:\_soft\devnupkg> nuget push "*.nupkg" -Source GitLab_packages -skipduplicate
Pushing anglesharp.0.17.1.nupkg to 'https://gitlab.myorg.com/api/v4/projects/149/packages/nuget'...
PUT https://gitlab.myorg.com/api/v4/projects/149/packages/nuget/
Created https://gitlab.myorg.com/api/v4/projects/149/packages/nuget/ 716ms
Your package was pushed.
In help command nuget push /help set: -SkipDuplicate If a package and version already exists, skip it and continue with the next package in the push, if any.
What's i do wrong?
THK

SkipDuplicate relies on a 409 response from the source. It is very possible that the source is not returning 409 in that case and just overwriting.
You can use fiddler or some other tool to check the HTTP resposne, but it is extremely likely that overwrite is just the server behavior.
Have you tried pushing without a -SkipDuplicate? If the package gets override then this is just the server behavior.

Related

npm Azure Artifacts feed doesn't install all dependencies from upstream source

Trying to set up a proof-of-concept for the place I work using a private npm registry to limit the packages developers can download. I set up a feed on Azure Artifacts, and set the official npm registry (https://registry.npmjs.org) as the only upstream source. This feed was set as the registry in the npmrc file, and the project is correctly identifying that as the registry source. (per npm config get registry).
When a user (with permissions to install from upstream) tries to install a package from the empty feed, it installs the package (from the upstream) correctly along with all of its dependencies. It also saves the package to the Artifacts feed, but only some of its dependencies are saved to the feed. There seems to be no rhyme or reason as to which dependencies it saves, as it changes almost every time I install the same exact package.
When a user that does not have permission to install from an upstream source tries to install that same package, it fails on one of the dependencies that wasn't saved, giving a 404 error for the artifacts feed, saying that the package was not found in the registry.
I've set up quite a few different feeds, both project-scoped and organization-scoped to see if I perhaps fiddled with the wrong settings/set something up wrong, but I get the same behavior with every feed I set up.
Are there certain criteria that determine whether or not a dependency is downloaded, and is there a way that I can make it so all dependencies are saved to the feed when a package is installed from the upstream?
Are there certain criteria that determine whether or not a dependency is downloaded
npm has a local cache. You'll want to run npm cache clean before testing. Otherwise, there's no guarantee that the package will be downloaded. It may be installed from the cache instead.
and is there a way that I can make it so all dependencies are saved to the feed when a package is installed from the upstream?
I suppose you can try disabling the cache, but that will likely greatly inflate installation times for your users. You may only want to do that while testing. That said, there are various somewhat-hacky ways to do it more permanently-ish. You can use the force config option but that has other side effects. I imagine you can set the cache to be /dev/null or something like that, although I've never tried that. There are other ideas in the answers provided to the "Disable npm cache" Stackoverflow question.

azure devops artifacts and npm repository woes

In another project I managed to setup Artifacts for NuGet and it worked better than I expected. I was able to publish my private NuGet package and use the artifacts to get the private package along with the nuget.org too:
Now I want to do the same for npm.
So I set up my artifact and then went to my pipeline and updated the task:
Notice how there is no "Use packages from npm" flag.
Anyway, I thought it would work without that flag and I ran my pipeline and I got this error:
10691 error 404 '#babel/helper-validator-identifier#7.9.5' is not in the npm registry.
Which is really annoying. It's erroring out at the first package it searches for.
I tried to be smart and had two tasks for installing packages. One for my artifact private package and the other using npm defaults but if it errors, it doesn't try to get the next package :(
Does anyone know how I can get around this.
PS: I should stipulate that I don't want to add a .npmrc file to my project. There are many many many projects that use this private package and it would be a massive ballache to have to add that file to them all.

NuGet Packager not allowing a prerelease dependency in VSTS

When NuGet creates my package I get an error for including a prerelease package and it gives me the following result:
C:\LR\Mms\Services\Mms\TaskAgentProvisioner\Tools\agents\2.109.1\externals\nuget\NuGet.exe pack "C:\a\1\s\Harvest.Auth\Harvest.Auth.csproj" -OutputDirectory "C:\a\1\s" -Properties Configuration=release -version 1.0.1
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
Attempting to build package from 'Harvest.Auth.csproj'.
Packing files from 'C:\a\1\s\Harvest.Auth\bin\Release'.
Found packages.config. Using packages listed as dependencies
A stable release of a package should not have on a prerelease dependency. Either modify the version spec of dependency "Microsoft.Experimental.IdentityModel.Clients.ActiveDirectory (≥ 4.0.209160138-alpha)" or update the version field.
System.Exception: Unexpected exit code 1 returned from tool NuGet.exe
at Microsoft.TeamFoundation.DistributedTask.Task.Internal.InvokeToolCmdlet.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
PowerShell script completed with 1 errors.
I know that I need to mark my NuGet package as prerelease, however you can see in the first line it does not pickup my tag and version correctly which is 1.0.1-alpha, it only picks up 1.0.1.
I've also tried adding [assembly: AssemblyInformationalVersion("1.0.1-alpha")] per the NuGet documentation located here, however this didn't work either.
I was hoping there would be a command line to force it to create anyway, since we use it internally, and don't really care if it's pre-release or not. Here's the pack commands.
I should also note that we are using the NuGet packager that is part of VSTS.

How to deploy an Azure Go web app via git push with private repositories as dependencies?

What would be the proper way to deploy a Go app to Azure that have private GitHub repositories as dependencies? Here's the current error from Kudu:
Resolving dependencies
# cd .; git clone https://github.com/my/privaterepo
D:\local\Temp\8d315fa89272e69\gopath\src\github.com\my\privaterepo
Cloning into 'D:\local\Temp\8d315fa89272e69\gopath\src\github.com\my\privaterepo'...
fatal: could not read Username for 'https://github.com': Bad file descriptor
package github.com/my/privaterepo/pkg1: exit status 128
package github.com/my/privaterepo/pkg2: cannot find package $GOROOT)
Building Go app to produce exe file
azureapp\file.go:8:2: cannot find package "github.com/my/privaterepo/pkg1"
in any of:
D:\Program Files\Go\1.5.1\src\github.com\my\privaterepo\pkg1 (from $GOROOT)
I was previously deploying via FTP with web.config's HttpPlatformHandler entry. But using git push is quicker especially for non-Windows team members.
Thanks
As #Not_a_Golfer and #Xiaomin said, vendoring the dependencies worked, here's what I did:
Turned the env variable on locally GO15VENDOREXPERIMENT=1
Installed godep => go get github.com/tools/godep
Making sure your app is passing a go build & go test
Ran godep save this copied all dependencies to ./vendor
On my Azure web app, I also set the environment variable GO15VENDOREXPERIMENT=1
git pushed and voila.
At first I did not set the environment variable on my Azure app, so the dependency resolver was not looking in ./vendor, turning it to 1 fixed everything.

Azure build - [error]Unable to find version '' of package

Im trying to get a solution with Syncfusion to work.
But every time I try to deploy to Azure i get the following errors
##[error]Unable to find version '13.3.0.12' of package 'Syncfusion.AspNet.Mvc5'.
##[error]Unable to find version '13.3.0.12' of package 'Syncfusion.JavaScript'.
##[error]Unable to find version '13.3.0.12' of package 'Syncfusion.Web.Base45'.
##[error]Unable to find version '13.3.0.12' of package 'Syncfusion.Web.FileFormatsBase45'.
##[error]Unexpected exit code 1 returned from tool NuGet.exe
I tried creating a NuGet.config with the link to the syncfusion but dont work.
If i check the Packages folder i can see all the packages it says it cant find
Hope somone can help
Apparently you are using private NuGet feed, as these packages are not listed on the official NuGet feed, thus the error message.
Here is confirmation that these packages are not listed on the public NuGet feed:
http://www.nuget.org/packages?q=Syncfusion.AspNet.Mvc5
http://www.nuget.org/packages?q=Syncfusion.JavaScript
http://www.nuget.org/packages?q=Syncfusion.Web.Base45
http://www.nuget.org/packages?q=Syncfusion.Web.FileFormatsBase45
Which is also confirmed by the Syncfusion docs, which describe a custom feed for their packages: http://help.syncfusion.com/extension/syncfusion-nuget-packages/nuget-install-and-configuration
To enable restore of Syncfusion packages, check this SO question and its accepted answer on how can you include custom NuGet feeds to your Azure Web app deployment.

Resources