Skip to content

Commit ee7910f

Browse files
author
Derek Smart
committed
wait 30 seconds if there is a job conflict
Signed-off-by: Derek Smart <derek.smart@delphix.com>
1 parent f5b6a14 commit ee7910f

File tree

1 file changed

+16
-0
lines changed
  • src/main/kotlin/com/delphix/yamlparser

1 file changed

+16
-0
lines changed

src/main/kotlin/com/delphix/yamlparser/Runner.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,25 @@ class Runner (
5454
}
5555
}
5656

57+
58+
fun jobConflictExists(datapod: String): Boolean {
59+
delphix.login(env["delphixUser"]?: "", env["delphixPass"]?: "")
60+
val container = delphix.selfServiceContainer().getRefByName(datapod)
61+
var jobs = delphix.job().getWhereRunning()
62+
for(job in jobs) {
63+
if (job.target == container.reference) return true
64+
}
65+
return false
66+
}
67+
68+
5769
fun execActionPhase(environment: Environment) {
5870
for (action in environment.actions) {
5971
if (action.event == env["gitEvent"]) {
72+
while(jobConflictExists(environment.datapod)) {
73+
println("Job Conflict Exists. Waiting 30 seconds to try again.")
74+
Thread.sleep(30000)
75+
}
6076
callDelphix(environment.datapod, environment.name, action.action)
6177
outputStatus(environment.name, action.event, action.action)
6278
} else {

0 commit comments

Comments
 (0)