Closed timheuer closed 5 years ago
Looks like -file-digest
is missing a dash up front --file-digest
. Same with -timestamp-rfc3161
, needs two dashes to use the long version. If you fix that, does it help?
Weird, that same failure of leading '-' wasn't a problem locally...but I changed it and still failing in the task, but now the log shows me nothing...just runs with
Waiting for console output from an agent...
for about 1.5 minutes and then fails:
2019-05-02T20:14:50.1505601Z Unhandled Exception: System.AggregateException: One or more errors occurred. (Operation returned an invalid status code 'InternalServerError') ---> Microsoft.Azure.KeyVault.Models.KeyVaultErrorException: Operation returned an invalid status code 'InternalServerError'
2019-05-02T20:14:50.1507204Z at Microsoft.Azure.KeyVault.KeyVaultClient.GetCertificateWithHttpMessagesAsync(String vaultBaseUrl, String certificateName, String certificateVersion, Dictionary`2 customHeaders, CancellationToken cancellationToken)
2019-05-02T20:14:50.1507285Z at Microsoft.Azure.KeyVault.KeyVaultClientExtensions.GetCertificateAsync(IKeyVaultClient operations, String vaultBaseUrl, String certificateName, CancellationToken cancellationToken)
2019-05-02T20:14:50.1507397Z at NuGetKeyVaultSignTool.SignCommand.SignAsync(String packagePath, String outputPath, String timestampUrl, HashAlgorithmName signatureHashAlgorithm, HashAlgorithmName timestampHashAlgorithm, SignatureType signatureType, Boolean overwrite, String keyVaultCertificateName, String keyVaultUrl, String keyVaultClientId, String keyVaultClientSecret, String keyVaultAccessToken) in D:\a\1\s\NuGetKeyVaultSignTool.Core\SignCommand.cs:line 66
2019-05-02T20:14:50.1507500Z at NuGetKeyVaultSignTool.Program.<>c__DisplayClass0_1.<<Main>b__3>d.MoveNext() in D:\a\1\s\NuGetKeyVaultSignTool\Program.cs:line 91
2019-05-02T20:14:50.1507722Z --- End of inner exception stack trace ---
2019-05-02T20:14:50.1507784Z at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
2019-05-02T20:14:50.1507855Z at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
2019-05-02T20:14:50.1507912Z at NuGetKeyVaultSignTool.Program.Main(String[] args) in D:\a\1\s\NuGetKeyVaultSignTool\Program.cs:line 155
2019-05-02T20:14:55.5888013Z ##[debug]Exit code: -532462766
2019-05-02T20:14:55.5929338Z ##[debug]Leaving Invoke-VstsTool.
2019-05-02T20:14:55.6456593Z ##[error]Cmd.exe exited with code '-532462766'.
It could definitely use a better error message, but does the service principal have the right ACL in Key Vault?
It needs certificate get and key get & sign.
Yes, when run locally:
info: NuGetKeyVaultSignTool.Program[0]
SignAsync [Alexa.NET.1.6.1.nupkg]: Begin Signing Alexa.NET\bin\Debug\Alexa.NET.1.6.1.nupkg
info: NuGetKeyVaultSignTool.Program[0]
NuGet [Alexa.NET.1.6.1.nupkg]: CreatePrimarySignatureAsync: Creating Primary signature
info: NuGetKeyVaultSignTool.Program[0]
NuGet [Alexa.NET.1.6.1.nupkg]: CreatePrimarySignatureAsync: Primary signature completed
info: NuGetKeyVaultSignTool.Program[0]
NuGet [Alexa.NET.1.6.1.nupkg]: CreatePrimarySignatureAsync: Timestamp primary signature
info: NuGetKeyVaultSignTool.Program[0]
NuGet [Alexa.NET.1.6.1.nupkg]: CreatePrimarySignatureAsync: Timestamp completed
info: NuGetKeyVaultSignTool.Program[0]
SignAsync [Alexa.NET.1.6.1.nupkg]: End Signing Alexa.NET\bin\Debug\Alexa.NET.1.6.1.nupkg
That's very odd.... could it be a long shot that something underlying the current azure outage is interfering?
I've been trying for all morning, but I'll wait to make sure :-)
I'm a bit at a loss why it'd work locally and not via a pipeline. Might need to rope in an expert or two :)
Hmm, looks like the core issue is that your tool cannot execute a sign command on *.pkg path (like the nuget sign command can)
Ah, that'd do it. I was avoiding the "hard work" of path expansion. If you know of an easy way to handle those expansions, I can incorporate that.
@onovotny here is the code that NuGet uses to resolve wildcards: https://github.com/NuGet/NuGet.Client/blob/524ec33d792d0972b8999cda0c1e297b6e23e9b4/src/NuGet.Core/NuGet.Protocol/Utility/LocalFolderUtility.cs
For some reason when run within an Azure DevOps release task it is not working, erroring out on saying KeyVault URL not specified.
As you can see from the log it is specified (also tried -kvu) but still erroring on that step: