Skip to content

Commit

Permalink
Merge pull request #3024 from hashicorp/f-no-revert-target
Browse files Browse the repository at this point in the history
Deployment desc  when no stable job and autorevert
  • Loading branch information
dadgar committed Aug 15, 2017
2 parents 9032c0d + acf8f67 commit 1d60f05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nomad/deploymentwatcher/deployment_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ func (w *deploymentWatcher) FailDeployment(

if rollbackJob != nil {
desc = structs.DeploymentStatusDescriptionRollback(desc, rollbackJob.Version)
} else {
desc = structs.DeploymentStatusDescriptionNoRollbackTarget(desc)
}
}

Expand Down Expand Up @@ -361,6 +363,8 @@ func (w *deploymentWatcher) watch() {
// version N
if j != nil {
desc = structs.DeploymentStatusDescriptionRollback(desc, j.Version)
} else {
desc = structs.DeploymentStatusDescriptionNoRollbackTarget(desc)
}
}

Expand Down
6 changes: 6 additions & 0 deletions nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4121,6 +4121,12 @@ func DeploymentStatusDescriptionRollback(baseDescription string, jobVersion uint
return fmt.Sprintf("%s - rolling back to job version %d", baseDescription, jobVersion)
}

// DeploymentStatusDescriptionNoRollbackTarget is used to get the status description of
// a deployment when there is no target to rollback to but autorevet is desired.
func DeploymentStatusDescriptionNoRollbackTarget(baseDescription string) string {
return fmt.Sprintf("%s - no stable job version to auto revert to", baseDescription)
}

// Deployment is the object that represents a job deployment which is used to
// transition a job between versions.
type Deployment struct {
Expand Down

0 comments on commit 1d60f05

Please sign in to comment.