drone-plugins / drone-npm

Drone plugin for publishing packages to NPM
http://plugins.drone.io/drone-plugins/drone-npm
Apache License 2.0
20 stars 18 forks source link

Issue with Nexus 3.0.0.0 #6

Closed Salimlou closed 8 years ago

Salimlou commented 8 years ago

Hi Drone team.

So I have an issue with publishing npm artefacts to nexus3. When the plugin requests the Package, it uses the following URL

Requesting https://nexus-repo/repository/repo-name/artefact-name/artefact-version

Which produces a 400 error code in my browser and a simple 'Package already published' in logs.

What do you think?

Thanks.

bradrydzewski commented 8 years ago

@Salimlou plugins are community managed and we rely on community members to troubleshoot as much as possible. I don't use node (or nexus) so not sure how much help I can really provide.

You can run plugins directly from the command line to isolate the issue. You can also build from source and add debugging if needed. For more details see https://github.com/drone-plugins/drone-npm#example

donny-dont commented 8 years ago

@Salimlou I'm not familiar with nexus3. We use sinopia at work so it works fine with that. Is there something different with nexus3 in terms of API than npm proper? Is it a different version of the API? Any more info will help here especially since I have to get around to updating this plugin for 0.5.

Salimlou commented 8 years ago

Hi @donny-dont!

sorry for the delay!!

Actually, I ended up "writing" a little plugin. What i did is taking the source of the drone-npm plugin, and adjust the calling to suit nexus API.

basically this line does the job :

packageUrl := fmt.Sprintf("%s/%s/-/%s-%s.tgz", vargs.Registry, npmPackage.Name, npmPackage.Name, npmPackage.Version)

I also added skipSSL for self signed certificate and letsencrypt,...

I can push it to github, if you want! but I'm really not a GO expert, it was reading tutorials and writing code :)!!

Concerning the API, I'm not sur why it changed, in version 2 it was the same than npm.

donny-dont commented 8 years ago

Hi @Salimlou.

So I'm working on an update for 0.5 and if you could test it against Nexus that'd be greatly appreciated.

git clone https://github.com/drone-plugins/drone-npm.git
cd drone-npm
git checkout feature/0.5-update
docker build --file=Dockerfile.alpine --rm=true -t plugins/npm .

Then follow the README.md for instructions on running the plugin in isolation on that branch.

Salimlou commented 8 years ago

okay @donny-dont, I will first thing in the morning (my morning in morocco ) :)

Salimlou commented 8 years ago

So i tried to publish a package with your branch, and ...... it doesn't work!

the response status for the requested url, is 400, apparently we cannot request package info for a specific version.

the Url that worked is htttp://registryURL/pkg-name, but as you know it returns the info for all versions!

Conclusion : I think i'm gonna switch to Sinopia :)!

Just an idea : why not use

npm info pkg@version version

it returns the version in case it exists, and nothing in case it doesn't.

donny-dont commented 8 years ago

I can take a look at that @Salimlou . Just a heads up there are issues with Sinopia currently and its been forked see https://github.com/rlidwka/sinopia/issues/376

adamlc commented 8 years ago

I also seem to be having the same problem with nexus :(

donny-dont commented 8 years ago

@adamlc can you check with the 0.5 version? Or @Salimlou can you take another look?

I just changed up how the plugin works. All requests go through the NPM CLI so if you can publish with that it should work.

donny-dont commented 8 years ago

I haven't heard anything with regards to the 0.5 implementation so closing. 0.5 changed how things work and now uses the npm cli completely. So if you can push with npm then you should be fine. If there's still problems then reopen. I have not used nexus but have tested on sinopia and NPM on-prem.