ashwanthkumar / gocd-janitor

Attempt at a more intelligent GoCD purge policy
16 stars 11 forks source link

Failure on moving pipeline when stages had new runs #10

Closed alivespirit closed 8 years ago

alivespirit commented 8 years ago

Hi @ashwanthkumar, again me :)
We are running janitor nightly and found an issue. Steps:
1) First janitor execution moves pipeline artifacts to backup location (e.g. build #57, 2 runs of stages) 2) Stages of build are reran (this creates build #57, 3rd run) 3) Second janitor execution tries to move 3rd run of stages and fails with error

Exception in thread "main" java.lang.RuntimeException: org.apache.commons.io.FileExistsException: Destination '/var/lib/go-server/artifacts/backup_old_pipelines/FSS/57' already exists

Here's what we have in such case:

[root@ie1gos004 ~]# ll /var/lib/go-server/artifacts/backup_old_pipelines/FSS/57/deploy_group1/
total 8
drwxr-x--- 3 go go 4096 Jun  8 08:39 1
drwxr-x--- 3 go go 4096 Jun  8 08:47 2
[root@ie1gos004 ~]# ll /var/lib/go-server/artifacts/pipelines/FSS/57/deploy_group1/
total 4
drwxr-x--- 3 go go 4096 Jun 29 07:21 3

Would be best to fail only if directory with current run # of stage already exists in destination.

ashwanthkumar commented 8 years ago

@alivespirit Hello 😄 ! Good catch. In our setup, we don't use MoveAction at all 😛 . I've fixed it now and made a release v0.2.1-RC2. Please do give it a spin and let me know.

alivespirit commented 8 years ago

@ashwanthkumar Thanks a lot for a quick response! I've tested new version on our setup this night and it works quite fine :)