Skip to content

Commit

Permalink
Fix panic when a job without update stanza fails deployment
Browse files Browse the repository at this point in the history
Currently levant panics if there's a failed deployment for a job without
an update stanza.
  • Loading branch information
Mongey committed Apr 22, 2021
1 parent e48c439 commit 41bf62d
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions levant/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,17 @@ func (l *levantDeployment) deploy() (success bool) {
return
}

// If the job is not a canary job, then run the auto-revert checker, the
// current checking mechanism is slightly hacky and should be updated.
// The reason for this is currently the config.Job is populate from the
// rendered job and so a user could potentially not set canary meaning
// the field shows a null.
if l.config.Template.Job.Update.Canary == nil {
l.checkAutoRevert(dep)
} else if *l.config.Template.Job.Update.Canary == 0 {
l.checkAutoRevert(dep)
if l.config.Template.Job.Update != nil {
// If the job is not a canary job, then run the auto-revert checker, the
// current checking mechanism is slightly hacky and should be updated.
// The reason for this is currently the config.Job is populates from the
// rendered job and so a user could potentially not set canary meaning
// the field shows a null.
if l.config.Template.Job.Update.Canary == nil {
l.checkAutoRevert(dep)
} else if *l.config.Template.Job.Update.Canary == 0 {
l.checkAutoRevert(dep)
}
}

case nomad.JobTypeBatch:
Expand Down

0 comments on commit 41bf62d

Please sign in to comment.