-
Notifications
You must be signed in to change notification settings - Fork 152
Error Recovery Example
This page describes an actual incident in which releasing to production failed and recovery steps were necessary. Each incident will be different and require analysis to determine the exact steps necessary, but this case may be useful as an example.
In publishing the what was to be NUnit-Console release 3.16.1, the step PublishToNuget
failed on AppVeyor with the following message (repeated for each package):
Pushing NUnit.Console.3.16.1.nupkg to 'https://www.nuget.org/api/v2/package'...
PUT https://www.nuget.org/api/v2/package/
Forbidden https://www.nuget.org/api/v2/package/ 969ms
Response status code does not indicate success: 403 (The specified API key is invalid, has expired, or does not have permission to access the specified package.).
Because each publishing step is allowed to run independently of the others, the PublishToChocolatey
step executed without error. However, the final CreateProductionRelease
step, which completes the GitHub release, was not executed.
In order to complete the release, the following tasks must be run locally:
Package
PublishToNuGet
CreateProductionRelease
It should be noted that this implies that the binary files uploaded to NuGet.org and to GitHub must be created in such a way that they match exactly the file, which was already successfully uploaded to Choco.org. This is a potential weakness of the approach used but it is mitigated by using extreme care that the binaries are created and packaged in exactly the same way in the local environment as was done on AppVeyor. So far, this has not been a problem but, should the issue arise,other approaches are possible.
-
In my local environment I switched to the
version3
branch and did agit pull
. This updated my local repository with the changes already merged into the branch when I had clickedPublish
in the GitHub web environment. -
I ran
build -t BuildTestAndPackage
to build the console and engine, run all the tests and create and test the packages. JustPackage
would have been enough, but I feel more confident also running the tests. These steps are exactly what is run on AppVeyor, followed there by the publishing steps where the failure occurred. So I'm confident that I now have the same packages that AppVeyor tried to publish.
-
I ran
build -t PublishToNuGet
to see if the key set in my local environment would work. It didn't: I got the same errors. -
Looking at a list of Api Keys I maintain locally I selected one to try. I used
set NUGET_API_KEY=xxxx
(substituting the key) to place it in my environment and reranbuild -t PublishToNuGet
. This time it worked.
- I next ran
build -t CreateProductionRelease
, which uploaded all the assets to GitHub and added comments to each closed issue.
-
I was now able to send out notices about the release.
-
I updated my local environment so that the correct API key will be set on startup.
-
I created a secure environment variable for the API key and updated
appveyor.yml
to use it.