Add ability to copy files to and delete files from runner

This commit is contained in:
Jan-Eric Hellenberg
2021-05-31 16:31:15 +02:00
parent 242d0175a2
commit 02b3f52a11
23 changed files with 757 additions and 240 deletions

View File

@ -130,17 +130,20 @@ func (m *NomadRunnerManager) refreshEnvironment(id EnvironmentId) {
log.WithError(err).Printf("Failed get allocation count")
break
}
neededRunners := job.desiredIdleRunnersCount - job.idleRunners.Length() + 1
runnerCount := jobScale + neededRunners
additionallyNeededRunners := job.desiredIdleRunnersCount - job.idleRunners.Length() + 1
requiredRunnerCount := jobScale
if additionallyNeededRunners > 0 {
requiredRunnerCount += additionallyNeededRunners
}
time.Sleep(50 * time.Millisecond)
if runnerCount != lastJobScaling {
log.Printf("Set job scaling %d", runnerCount)
err = m.apiClient.SetJobScale(string(job.jobId), runnerCount, "Runner Requested")
if requiredRunnerCount != lastJobScaling {
log.Printf("Set job scaling %d", requiredRunnerCount)
err = m.apiClient.SetJobScale(string(job.jobId), requiredRunnerCount, "Runner Requested")
if err != nil {
log.WithError(err).Printf("Failed set allocation scaling")
continue
}
lastJobScaling = runnerCount
lastJobScaling = requiredRunnerCount
}
}
}