Skip to content
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

NuGetSetApiKey with Verbosity set to Quiet causes an exception. #2733

Closed
escarls opened this issue Mar 18, 2020 · 3 comments · Fixed by #2738
Closed

NuGetSetApiKey with Verbosity set to Quiet causes an exception. #2733

escarls opened this issue Mar 18, 2020 · 3 comments · Fixed by #2738
Milestone

Comments

@escarls
Copy link

escarls commented Mar 18, 2020

What You Are Seeing?

When calling NuGetSetApiKey with NuGetSetApiKeySettings where Verbosity is set to NuGetVerbosity.Quiet, I get an error message for the task and the script exits.
The error message say:
"SetApiKey returned unexpected response"

What is Expected?

That the call should not throw an exception.

What version of Cake are you using?

Tested with multiple versions of Cake (0.30.0, 0.34.x, 0.36.0 and 0.37.0) and Cake.Tool 0.36.0 and 0.37.0
Also tested with older versions of NuGet.CommandLine as tool in the script.

Are you running on a 32 or 64 bit system?

64 bit

What environment are you running on? Windows? Linux? Mac?

Windows 10

Are you running on a CI Server? If so, which one?

No, local build, but I'm pretty sure I can reproduce on the CI server also

How Did You Get This To Happen? (Steps to Reproduce)

build.cake.txt
To reproduce with the attached build.cake script:
dotnet cake -Target="Quiet"
To test with Verbosity.Normal (the working one):
dotnet cake -Target="Normal"

Output Log

error.log

@escarls
Copy link
Author

escarls commented Mar 18, 2020

The issue seems to be here in the code.
As when you set verbosity to Quiet, the variable "output" is empty, making the first part of the if condition true.
I am not sure if the original plan was to thrown an exception if "output" was empty or not.

@gitfool
Copy link
Contributor

gitfool commented Mar 20, 2020

@escarls you're right. It looks to me like the whole block is redundant, since any failure should be reflected in the process exit code, and brittle, since it expects output and it must conform to a particular shape.

In fact, the process wrapper should redact the api key in the output anyway, so intercepting the output itself seems redundant too, unless I'm missing something.

FWIW, NuGetSetProxy also checks the process output, expecting it to be effectively blank in this case, but probably doesn't need to.

@cake-build-bot
Copy link

🎉 This issue has been resolved in version v0.38.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants