feat: allow specifying a single process type to restart

This changes restarts to drop the 'release' part that currently gets triggered, which also helps reduce the possibility that a new image layer will be added due to predeploy deploy triggers.

Note that the old method essentially halfway-rebuilt the app (which was what added the extra layer). This refactor removes that, which is a bc-break.

Additionally, scaling processes will result in deploying _only_ restarting the processes being scaled.

Closes #2184
This commit is contained in:
Jose Diaz-Gonzalez
2021-09-05 00:02:46 -04:00
parent 8f7f03a7d8
commit b48b79f5ca
13 changed files with 115 additions and 36 deletions

View File

@@ -57,7 +57,37 @@ func Restart(appName string) error {
return nil
}
return common.PlugnTrigger("release-and-deploy", []string{appName}...)
imageTag, err := common.GetRunningImageTag(appName, "")
if err != nil {
return err
}
if imageTag == "" {
common.LogWarn("No deployed-image-tag property saved, falling back to full release-and-deploy")
return common.PlugnTrigger("release-and-deploy", []string{appName}...)
}
return common.PlugnTrigger("deploy", []string{appName, imageTag}...)
}
// RestartProcess restarts a process type within an app
func RestartProcess(appName string, processName string) error {
if !common.IsDeployed(appName) {
common.LogWarn(fmt.Sprintf("App %s has not been deployed", appName))
return nil
}
imageTag, err := common.GetRunningImageTag(appName, "")
if err != nil {
return err
}
if imageTag == "" {
common.LogWarn("No deployed-image-tag property saved, falling back to full release-and-deploy")
return common.PlugnTrigger("release-and-deploy", []string{appName}...)
}
return common.PlugnTrigger("deploy", []string{appName, imageTag, processName}...)
}
// Restore ensures an app that should be running is running on boot
@@ -90,7 +120,7 @@ func Restore(appName string) error {
// Start starts the app
func Start(appName string) error {
imageTag, _ := common.GetRunningImageTag(appName)
imageTag, _ := common.GetRunningImageTag(appName, "")
if !common.IsDeployed(appName) {
common.LogWarn(fmt.Sprintf("App %s has not been deployed", appName))