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:
1 parent
b1223cd6cc
commit
f87cd22340
5 files changed
+42
-5
No files matched your search
@@ -74,6 +74,21 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
# TODO
|
# 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`
|
### `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.
|
- 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
|
// DokkuApps returns a list of all local apps
|
||||||
func DokkuApps() ([]string, error) {
|
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{}
|
apps := []string{}
|
||||||
dokkuRoot := MustGetEnv("DOKKU_ROOT")
|
dokkuRoot := MustGetEnv("DOKKU_ROOT")
|
||||||
files, err := ioutil.ReadDir(dokkuRoot)
|
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 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
|
// GetAppImageName returns image identifier for a given app, tag tuple. validate if tag is presented
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ has_tty() {
|
|||||||
|
|
||||||
dokku_apps() {
|
dokku_apps() {
|
||||||
declare desc="prints list of all local 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
|
if [[ -z "$INSTALLED_APPS" ]]; then
|
||||||
dokku_log_fail "You haven't deployed any applications yet"
|
dokku_log_fail "You haven't deployed any applications yet"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -18,7 +18,12 @@ func main() {
|
|||||||
var err error
|
var err error
|
||||||
switch trigger {
|
switch trigger {
|
||||||
case "app-list":
|
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":
|
case "core-post-deploy":
|
||||||
appName := flag.Arg(0)
|
appName := flag.Arg(0)
|
||||||
err = common.TriggerCorePostDeploy(appName)
|
err = common.TriggerCorePostDeploy(appName)
|
||||||
|
|||||||
@@ -6,8 +6,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// TriggerAppList outputs each app name to stdout on a newline
|
// TriggerAppList outputs each app name to stdout on a newline
|
||||||
func TriggerAppList() error {
|
func TriggerAppList(filtered bool) error {
|
||||||
apps, _ := DokkuApps()
|
var apps []string
|
||||||
|
if filtered {
|
||||||
|
apps, _ = DokkuApps()
|
||||||
|
} else {
|
||||||
|
apps, _ = UnfilteredDokkuApps()
|
||||||
|
}
|
||||||
|
|
||||||
for _, app := range apps {
|
for _, app := range apps {
|
||||||
Log(app)
|
Log(app)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user