-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
A new option to allow dotnet tool install should return exit code 0 if tool is already installed #10310
Comments
@KathleenDollard @natemcmaster @Shoh thoughts on having different command to do similar work? |
A new option!!? This should be the default behaviour. Everyone back to https://github.com/dotnet/cli/issues/9482 please. |
That would be a breaking change. We would need be to be more careful about it |
Who does it break and how? |
The break would be that someone is running a script that depends on 1 as the return value. I'm not sure we got this right, but will need a bit of convincing that no one is relying on the 1 return value. |
If it's not possible to invert the current behaviour I am supporting the additional flag like |
What |
I wonder how about adding
|
What is the timeline for this option? It's really surprising that multiple installations exits with code 1. |
Sorry I don't have a timeline |
Would creating a separate command make it easier to get this implemented sooner? E.g.
e.g. dotnet tool ensure --global Cake.Tool --version 0.38.5
All cases would return A common scenario is CI builds where you just want to make sure that the tools you depend on for the build are present. |
Any news on this? The option has been discussed for almost two years. |
@rafaelrruiz you should use dotnet tool restore instead, it will install if deps is missed and skip if already installed. |
@Lonli-Lokli This is really not the same thing that is being asked. To use |
@augustoproiete it cannot be idempotent even by your definition - first installation should not only install dep, but create tools manifest, while second run not. There is no silver bullet for now, there was a discussion before and honestly speaking it's better to install dependency first with dotnet install locally, save manifest in git and use dotnet restore after. |
@Lonli-Lokli I'm not sure I follow. Creating the manifest automatically (if installing as local tool) is one of the possible missing steps that would make it idempotent - which is the end goal. And, of course, if installing as a global tool, no manifest needed - but still fails today if tool already exists so another missing piece.
The current state leave us with poor a UX:
You should be able to copy/paste the instructions on how to install a .NET tool, and it should work on any machine regardless if the tool is installed or not, manifest or not... But that's not where we are today. |
It's deeply disappointing that all of these related issues have been present, discussed, and unaddressed for two or more years. The scenarios outlined appear to be legitimate use-cases for tooling. The Cake example is a perfect one. As I come to finally try and get off the ancient and now-unsupported Cake bootstrapper, I immediately run into the problems outlined in this and the linked issues (and frankly have no idea which one to comment on - they all describe the same pain - so apologies if this belongs elsewhere).
I believe this misses the point - nobody wants to update countless Git repos with tooling versions, that's a maintenance nightmare - CI is typically centrally managed, has to be local, and due to the unique way tool manifests are designed, can't just be copied in at CI build time either, as usual build tools would be. I just want my NET tools installed locally for CI. I don't want to update & maintain 200+ repos with manifest files that can get out of sync in yet another tooling ecosystem. I don't want to pollute build agents with global state, and global tools also just don't work for some cases. I just want the tool installed idempotently. Why is this challenging? The NET SDK itself recognised this immediately, and gave us If I have an existing Git repo with zero or more tool manifests
I would ask the question more generally as to why the wheel has been reinvented here (again). With NuGet & PackageReference, for example, there's a nice standard convention of 'request package, package gets cached in location that is either global or specified by environment variable, package is installed where requested if it isn't already present'. |
This behavior also breaks Azure Pipelines if you're using Task Groups several times in one job (with different parameters) which has a tool install step |
We had to tell our Azure Pipeline to ignore errors in this task because it returns an error code =( - task: DotNetCoreCLI@2
displayName: install sqlpackage
# dotnet tool install returns error code 1 if the package is already installed =(
# https://github.com/dotnet/sdk/issues/10310
continueOnError: true
inputs:
command: custom
custom: tool
arguments: install -g microsoft.sqlpackage I would be fine with there being an option to ignore this error to prevent it from being a breaking change, but it really should just be the default behavior. The flag should be if you want it to throw if already installed... |
#35088 return exit code 0 if tool is installed when using |
I'm going to close this one because the linked PR merged in 8.0.2xx. Thanks for the feedback! |
Continue of https://github.com/dotnet/cli/issues/11259 to make the topic more specific. Even thought "dotnet update" with "--version" could solve the similar issue, but it is hard to discover.
The text was updated successfully, but these errors were encountered: