feat: allow returning an unfiltered list of users
This is useful for upgrades or commands that _must_ perform against all apps.
This commit is contained in:
@@ -74,6 +74,21 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `app-list`
|
||||
|
||||
- Description: Lists all apps in available to the currently logged in user. Optionally disables filtering by user if the first argument is `false`.
|
||||
- Invoked by:
|
||||
- Arguments: `$FILTER`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `app-json-process-deploy-parallelism`
|
||||
|
||||
- Description: Decides the parallelism to use when deploying a given process type. The default is 1 process entry at a type.
|
||||
|
||||
@@ -245,6 +245,16 @@ func GetRunningImageTag(appName string, imageTag string) (string, error) {
|
||||
|
||||
// DokkuApps returns a list of all local apps
|
||||
func DokkuApps() ([]string, error) {
|
||||
apps, err := UnfilteredDokkuApps()
|
||||
if err != nil {
|
||||
return apps, err
|
||||
}
|
||||
|
||||
return filterApps(apps)
|
||||
}
|
||||
|
||||
// UnfilteredDokkuApps returns an unfiltered list of all local apps
|
||||
func UnfilteredDokkuApps() ([]string, error) {
|
||||
apps := []string{}
|
||||
dokkuRoot := MustGetEnv("DOKKU_ROOT")
|
||||
files, err := ioutil.ReadDir(dokkuRoot)
|
||||
@@ -267,7 +277,7 @@ func DokkuApps() ([]string, error) {
|
||||
return apps, fmt.Errorf("You haven't deployed any applications yet")
|
||||
}
|
||||
|
||||
return filterApps(apps)
|
||||
return apps, nil
|
||||
}
|
||||
|
||||
// GetAppImageName returns image identifier for a given app, tag tuple. validate if tag is presented
|
||||
|
||||
@@ -17,7 +17,8 @@ has_tty() {
|
||||
|
||||
dokku_apps() {
|
||||
declare desc="prints list of all local apps"
|
||||
local INSTALLED_APPS="$(plugn trigger app-list)"
|
||||
declare FILTER="$1"
|
||||
local INSTALLED_APPS="$(plugn trigger app-list "$FILTER")"
|
||||
if [[ -z "$INSTALLED_APPS" ]]; then
|
||||
dokku_log_fail "You haven't deployed any applications yet"
|
||||
fi
|
||||
|
||||
@@ -18,7 +18,12 @@ func main() {
|
||||
var err error
|
||||
switch trigger {
|
||||
case "app-list":
|
||||
err = common.TriggerAppList()
|
||||
filtered := flag.Arg(0)
|
||||
if filtered == "" {
|
||||
filtered = "true"
|
||||
}
|
||||
filter := common.ToBool(filtered)
|
||||
err = common.TriggerAppList(filter)
|
||||
case "core-post-deploy":
|
||||
appName := flag.Arg(0)
|
||||
err = common.TriggerCorePostDeploy(appName)
|
||||
|
||||
@@ -6,8 +6,14 @@ import (
|
||||
)
|
||||
|
||||
// TriggerAppList outputs each app name to stdout on a newline
|
||||
func TriggerAppList() error {
|
||||
apps, _ := DokkuApps()
|
||||
func TriggerAppList(filtered bool) error {
|
||||
var apps []string
|
||||
if filtered {
|
||||
apps, _ = DokkuApps()
|
||||
} else {
|
||||
apps, _ = UnfilteredDokkuApps()
|
||||
}
|
||||
|
||||
for _, app := range apps {
|
||||
Log(app)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user