feat: implement ps-set-scale trigger

This commit is contained in:
Jose Diaz-Gonzalez
2021-08-01 16:11:09 -04:00
parent 247698fea6
commit 46d333df4b
4 changed files with 26 additions and 2 deletions

View File

@@ -1815,6 +1815,21 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `ps-set-scale`
- Description: Sets the scale for an app based on a specified formation (process-type=quantity). Any unspecified process types will be left as is.
- Invoked by:
- Arguments: `$APP $SKIP_DEPLOY [$PROCESS_TUPLE...]`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `receive-app`
- Description: Allows you to customize what occurs when an app is received. Normally just triggers an app build.

View File

@@ -496,7 +496,7 @@ func setScale(appName string, image string) error {
return err
}
args := []string{appName}
args := []string{appName, "true"}
for processType, formation := range appJSON.Formation {
args = append(args, fmt.Sprintf("%s=%d", processType, formation.Quantity))
}
@@ -509,7 +509,7 @@ func setScale(appName string, image string) error {
return err
}
return common.PlugnTrigger("ps-scale-set", args...)
return common.PlugnTrigger("ps-set-scale", args...)
}
func injectDokkuScale(appName string, image string) error {

View File

@@ -75,6 +75,11 @@ func main() {
case "procfile-remove":
appName := flag.Arg(0)
err = ps.TriggerProcfileRemove(appName)
case "ps-set-scale":
appName := flag.Arg(0)
appName, args := common.ShiftString(flag.Args())
skipDeploy, processTuples := common.ShiftString(args)
err = ps.TriggerPsSetScale(appName, common.ToBool(skipDeploy), processTuples)
case "ps-current-scale":
appName := flag.Arg(0)
err = ps.TriggerPsCurrentScale(appName)

View File

@@ -282,3 +282,7 @@ func TriggerPsCurrentScale(appName string) error {
return nil
}
func TriggerPsSetScale(appName string, skipDeploy bool, processTuples []string) error {
return scaleSet(appName, skipDeploy, processTuples)
}