0
votes

I'm using Artifactory REST API to upload tarballs to Artifactory NPM repository:

curl -X PUT \
 -H "Authorization: Bearer <token>" \
 -T path-to-tarball.tgz \
 "http://<server>/artifactory/<repo>/<scope>/<package>/<package>-<version>.tgz"

It works, but it looks like the recently uploaded artifact is always marked as latest when you query this repository. Usually it's fine, but not always.

I tried to use URL Properties by appending ;tag=other to the target URL, but with no luck.

Anybody managed to tag NPM versions uploaded to Artifactory via REST API?

1

1 Answers

1
votes

Apparently, you cannot manage NPM tags in Artifactory through the REST API.

There is a default handling for the latest tag, and it can be handled in one of the two modes - either by semantic version (the highest published version is marked as latest) or by publishing time (the most recently uploaded package is marked as latest). This setting is system-wide, so you cannot change it per repository. Source

On top of that, you can use npm dist-tags CLI command (reference) with custom --registry that points to your Artifactory repository to manage tags on the packages that you upload. Note that it must point to the real ("local") repo and not to the virtual repository.