ashwanthkumar/gocd-janitor

Issue when no pipeline runs are detected

wingZero21 opened this issue · 1 comments

Hi,

When test running this I got the below error.

Is there anyway to ignore the fact there are no pipeline runs for pipelines?

Details:

Exception in thread "main" java.lang.RuntimeException: /data/go/artefacts/pipelines/EditorialContentTool did not yield any pipeline run directories
        at in.ashwanthkumar.gocd.artifacts.Janitor.listFiles(Janitor.java:186)
        at in.ashwanthkumar.gocd.artifacts.Janitor.performAction(Janitor.java:117)
        at in.ashwanthkumar.gocd.artifacts.Janitor.run(Janitor.java:90)
        at in.ashwanthkumar.gocd.artifacts.Janitor.main(Janitor.java:63)

We handle cases where the pipeline doesn't have any runs recorded, but not when the runs are recorded but no folders being available. I guess it's an easy fix. You just need to return an empty array on this line - https://github.com/ashwanthkumar/gocd-janitor/blob/master/src/main/java/in/ashwanthkumar/gocd/artifacts/Janitor.java#L186.
Will you be interested sending in a PR?