Add forcePull option
* Add forcePull option for pulling the image when the execution environment gets updated * Apply suggestions from code review Co-authored-by: Sebastian Serth <MrSerth@users.noreply.github.com> * Add unit tests * Clean up and implement option two Co-authored-by: Sebastian Serth <MrSerth@users.noreply.github.com>
This commit is contained in:
@@ -130,6 +130,13 @@ func FindOrCreateDefaultTask(taskGroup *nomadApi.TaskGroup) *nomadApi.Task {
|
||||
return task
|
||||
}
|
||||
|
||||
// SetForcePullFlag sets the flag of a job if the image should be pulled again.
|
||||
func SetForcePullFlag(job *nomadApi.Job, value bool) {
|
||||
taskGroup := FindOrCreateDefaultTaskGroup(job)
|
||||
task := FindOrCreateDefaultTask(taskGroup)
|
||||
task.Config["force_pull"] = value
|
||||
}
|
||||
|
||||
// IsEnvironmentTemplateID checks if the passed job id belongs to a template job.
|
||||
func IsEnvironmentTemplateID(jobID string) bool {
|
||||
parts := strings.Split(jobID, "-")
|
||||
|
Reference in New Issue
Block a user