Add symlink copy force option at CopyCommand#203
Add symlink copy force option at CopyCommand#203americanomin wants to merge 1 commit intoaws:masterfrom
Conversation
0f5cb2a to
5ede9b6
Compare
|
We encountered this issue recently. I want to add that if a symlink file is deployed through any means other than the exact same CodeDeploy project/deployment group that is attempting to refresh it, the deployment will fail. Also, if the CodeDeploy project is set to automatically rollback the deployment group to the last successful version, the rollback is able to remove one, and only one offending symlink. In our case, we had 3 symlinks that were deployed by a CodeDeploy project. After we replaced the project with one that was configured identically, it failed exactly 3 times (once for each symlink) and then succeeded on the 4th attempt. This took a lot of time to diagnose so while it may be an edge-case, it's an expensive one. |
|
any status update on this one? currently affected by this issue in current official version.
|
Issue #143:
TL;DR
To fix an error that occurs when the target location is not a regular file, Add symlink copy force option to CopyCommand.
A long story why OVERWRITE option doesn't work correctly
When creating a deployment, codedeploy handles files that already exist in a deployment target location but weren't part of the previous successful deployment with fileExistsBehavior option. If the option is OVERWRITE, the deployment should replace files in the target location to the source files.
However, OVERWRITE doesn't work as expected when some conditions are met.
Suppose my source file is source and destination is target_dir/source. Since I set fileExistsBehavior as OVERWRITE, I want to have a result of target_dir/source regardless of existence of the destination file. But if target_dir/source already exists, only 1 out of 4 cases works correctly.
That is, only case (1) is accidentally handled without a problem due to default behavior of FileUtils.copy. But since other cases are rare, it has not been a big problem.
If the target location was a directory (2, 4 Case), I didn't think it was the intended situation. So in this instance, explicitly exception was generated.