Deployment failed while purging Directory

Issue: During deployment of IIS App, deployment use to fail on purging directory step if any file open on server by anyone.

Step to Produce the issue:

  1. Open Application Installation Directory On server > Open any config file > update anything in file > save it.
  2. Try to deploy through Octopus, deployment will fail.

Conclusion : if config file version mismatch and open at server then deployment will fail.

Need to check on Octopus Forum : If we are trying to delete files manually in above scenario,we will be able to delete files.

Do we have any solution to avoid this kind of failure. Thanks

Hi Vivek,

Thank you for reaching out to us with your query about purging directories.

This sounds like the file has been locked for editing. This is a protection mechanism built into Windows (and other operating systems) intended to prevent multiple people or applications from changing the same file at the same time. This means that, as the file is open for editing, Octopus Deploy won’t be able to change or delete it and the task will fail. It is unlikely that anyone else will be able to delete the file either until the editor has been closed and the file lock released.

The ideal solution is to avoid editing files manually and instead use a tool like Octopus Deploy to manage these changes. You may alternatively be able to create a pre-release script using Powershell to force all locks to be released but this does risk overwriting changes or creating conflicts.

I hope this is helpful. Please get back to us if you have any questions.

Best Regards,

Charles

Hi Charles,

Thanks for your response…

As I explained in my previous question, files are not locked. If we are trying to delete those files manually, I’m able to delete. So I dont think we can consider those files as locked.
The only thing is, Octopus treating those files as locked when it was open in editing mode whenever the same file I’m able to delete by login in server.
Can we handle this scenario without including any separate script for this.

Thanks,
Vivek Rai

Hi Vivek,

Thank you for the reply.

This does sound like a lock issue, but it’d be good for us to investigate further to make sure. Could you please provide me with a screenshot/attachment of the relevant task log where this fails? In addition, could you please also confirm that my understanding is correct in that the deployment fails if a file in open in an editor but the deployment works if no editors are open at all?

Best Regards,

Charles

Hi Charles,

I will provide screenshot as in sometime.

Yes, your understanding is absolutely correct. Deployment get failed if file is open in editor for editing and have updated something in that.
But there is no any issue in deployment if there is no any file open in editor and nothing has changed into that.
Hope, now the scenario is bit clear to you.

Thanks
Vivek Rai