-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NPM Publish Allow specifying tags or lack of for latest #9743
Comments
As a workaround, you could set the build variable/environment variable npm_config_tag to the desired value before running the publish. Keep in mind that internal@release and internal@prerelease refer to views, not tags. Packages of any package type need to be promoted into those views, npm packages are not added to the views just by being tagged. |
I revisited this issue today, and you can't set environment variables against the npm task. I set npm_config_tag as a pipeline variable and it was ignored, I read that variables set in the pipeline can be used by subsequent tasks, so I set it in a command line task before the publish and it was still ignored. I added publishConfig: { tag: "prerelease" } to the package.json and tried it again, I see it listed in the log under "; environment configs" with "tag: "prerelease"" but an npm install still picked up the prerelease tagged package as the latest. I'm not sure if I'm going about it the wrong way, but it feels like the task ignores any config you provide and sticks latest on everything? |
I removed the NPM task from the equation and just used the NPM authenticate task and manually set the package feed in .npmrc running the npm publish --tag=prerelease in command line afterwards and it -still- ends up being tagged as latest despite explicitly stating a different tag. So this isn't specifically a problem with the NPM task, but a fundamental problem with NPM feeds in Azure DevOps, unless I'm doing something wrong? I would think tagging packages is a fairly commonplace thing, so I'm inclined to think I'm doing something wrong. Attempted:
|
It looks like you're doing it right, it works for me. If this is the first time the package is getting pushed, it will be tagged with both latest and the tag, and all subsequent versions with just the tag.
Which version of node/npm are you using? |
I was running the publish from the Hosted Ubuntu agent (https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/linux/Ubuntu1604-README.md) so it has Nodejs v10.15.1, not sure which version of npm it has. I tried Trying to publish from my own machine appears to work fine. This is bizarre, would you be able to check a publish via the hosted ubuntu agent with your own setup? The same command that works from my own machine doesn't appear to be tagging correctly via the release process on VSO. |
Can you email me (removed) with the name of your organization (dev.azure.com/organization) and the feed name/package name. I'd like to look at the logs to see if there's something unexpected going on. |
@alexmullans The original request for specifying tags on an npm publish is still a valid feature request. My specific issue landed on situational issue between multiple feeds, tags between an upstream feed and a source feed are lost and everything is marked as latest. So it's somewhat of a bug / a known technical debt during implementation of feeds in Azure DevOps. There isn't a clean solution to my specific issue as discussed in this, best workaround is to publish directly to the source feed which will keep any tags intact, though hardly ideal. |
@jotaylo any news on this? I have connected the npm service under Service Connections but I'm not able to publish a npm package to npm public registry with a tag like this: task: Npm@1
inputs:
command: 'custom'
workingDir: 'lib/dist'
verbose: true
customCommand: 'publish --tag alpha'
customRegistry: 'useNpmrc'
publishEndpoint: 'NpmJs' It seems that this is working just if the command is 'publish' instead of 'custom', but nothing is tagged and the package is going to be published as latest. I think you should include an option for the inputs to tag a version when the command is 'publish'. |
@Lokiem i was facing the same issue. what i wound up with in my debugging was this:
this was not working which lead me to this thread. upon seeing the comment by @jotaylo, i noticed that the only real difference was the missing seemingly working:
|
@Lokiem Where did you get this info? We're experiencing the same thing in our company and it's really bugging our process here... This thread is the only place where I can find something that looks alike our issue. Currently it seems the only way to move forward is by directly pushing to our "merge feed" that merges everything we develop ourselves and the packages coming from npmjs.... |
we are experiencing the same issue and have also reported this at https://developercommunity.visualstudio.com/content/problem/783921/published-npm-package-in-upstream-internal-feed-lo.html |
Yes, views/upstreams don't support dist-tags. The most recently added package will be tagged as 'latest', but no other dist-tags are maintained. This is partially due to a limitation with our current implementation of views - we would need a redesign to be able to support the additional metadata required for dist-tag support at view level. We originally discussed simply passing through dist-tags to views, however that lead to all sorts of issues. A dist-tag could disappear from a view if the dist-tag was moved to a version that isn't in the view. If a feed has multiple upstream sources, how should different versions with the same dist-tag be resolved. We've had some discussions on these issues, but do not plan any changes in the short term. |
Edit: So I've figured out how this works now. The views are treated as separate registries. To use the prerelease view for example, the registry looks like: To find this, you click on the view you want to use first, then select connect to feed. |
This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days |
This issue is not fixed, it still not possible to add tag. So it's currently impossible with azure artifact do to something like |
In order to consolidate to fewer feedback channels, we've moved suggestions and issue reporting to Developer Community. |
+1 for this feature. We also need to add tags to our packages in our feed, such as stable, dev, next, etc. This would make our publishing process much easier and consistent with other teams. Right now, we have to use workarounds to distinguish our releases. Please add this feature soon. Thanks. |
+1 for this feature in 2024. I've searched a lot for this feature in Azure DevOps but still haven't found out if it has been released or not, so I assume it has not been released. |
+1 for this, for any bigger public package correct handling of latest tag is must. |
+1 for this feature. Same issue also opened a feature request with Azure Artifacts team. need the support to see dist-tags of upstream feeds. Able to read dist-tags from upstream sources like npmjs.com, but not other local connected feeds |
+1 for this feature, This feature is essential. |
Currently anything getting published to an private internal feed will get the "latest" tag creating a problem when allowing for prerelease and release versions.
My current setup has an internal feed which local repos publish to, and a second feed with an upstream to the internal feed and to npmjs, if I use the upstream internal@local then latest will usually be a prerelease, internal@release and I can't install prerelease, using both internal@prerelease and internal@release then I have to specify exact versions to avoid prerelease versions.
I think this would be solved by allowing us to set the tag/s on the task.
The text was updated successfully, but these errors were encountered: