Simplified scenario - I have a project with two steps, the first deploys a nuget package containing an IIS website (without updating IIS). The second step runs a Deploy.ps1 to update multiple IIS sites to point at step 1s website.
I have a retention policy which keeps the last 3 items.
I then deploy version 220.127.116.11 which is successful - IIS points at the correct versioned location.
If I then deploy versions 18.104.22.168, 22.214.171.124 and 126.96.36.199 and they all fail on step 2, ie IIS was never updated with the new version folder mapping.
The retention policy will then clear up version 188.8.131.52 which means all the IIS Site mappings are incorrect because they still point at the last successful deployment (version 184.108.40.206).
Any ideas how this situation can be overcome?
I could set the retention policy to the last 10 items, but what if all 10 fail…that can lead to the same situation but I then need to store large amounts of data.
I see you can also set retention by number of days… how does this setting work? If you set the number of days to 5 and you install on the 6th day will it only retain the current copy?
The best outcome would be for the retention policy to take into consideration that the deployment has failed and to keep the last successful deployment.
Thanks for your help.