fix: align Go-plugin :report JSON keys with bash-strip convention
Every Go-implemented plugin's `:report --format json` now emits keys without the redundant `<plugin>-` head segment, matching the shape bash plugins have always emitted. The CLI flag names and `:set` semantics are unchanged. For backwards compatibility during the 0.38.x patch series, the legacy `<plugin>-<property>` keys are emitted side-by-side with the new keys, and a future major release will drop the legacy keys. `common.ReportSingleApp` is refactored to accept a `ReportSingleAppInput` struct with a `Validate()` method so the input is checked before any work runs, which also catches the latent `"docker options"` reportType bug at the API boundary.
This commit is contained in:
@@ -31,10 +31,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("app-json", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "app-json",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func reportComputedAppjsonpath(appName string) string {
|
||||
|
||||
@@ -33,10 +33,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("app", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "app",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func reportCreatedAt(appName string) string {
|
||||
|
||||
@@ -40,10 +40,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("builder", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "builder",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func reportComputedSelected(appName string) string {
|
||||
|
||||
@@ -34,10 +34,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("buildpacks", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "buildpacks",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func reportComputedStack(appName string) string {
|
||||
|
||||
@@ -42,7 +42,17 @@ func ReportSingleApp(appName, format, infoFlag string) error {
|
||||
}
|
||||
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("builds", appName, infoFlag, infoFlags, flagKeys, format, false, true)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "builds",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func mostRecentBuild(appName string) (Build, bool) {
|
||||
|
||||
@@ -776,22 +776,99 @@ func ParseScaleOutput(b []byte) (map[string]int32, error) {
|
||||
return scale, nil
|
||||
}
|
||||
|
||||
// ReportSingleApp is an internal function that displays a report for an app
|
||||
func ReportSingleApp(reportType string, appName string, infoFlag string, infoFlags map[string]string, infoFlagKeys []string, format string, trimPrefix bool, uppercaseFirstCharacter bool) error {
|
||||
if format != "stdout" && infoFlag != "" {
|
||||
// ReportSingleAppInput configures a call to ReportSingleApp.
|
||||
type ReportSingleAppInput struct {
|
||||
// ReportType is the plugin name used as the JSON key prefix (e.g. "ps", "registry").
|
||||
// Must be non-empty, contain no whitespace, and not begin with "--".
|
||||
ReportType string
|
||||
|
||||
// AppName is the app being reported on, or "--global" for the global report.
|
||||
AppName string
|
||||
|
||||
// InfoFlag is an optional single flag to extract (e.g. "--ps-stop-timeout-seconds").
|
||||
// Only valid when Format is "stdout" (or empty, which defaults to "stdout").
|
||||
InfoFlag string
|
||||
|
||||
// InfoFlags maps flag-name to value (e.g. "--ps-stop-timeout-seconds" -> "30").
|
||||
InfoFlags map[string]string
|
||||
|
||||
// InfoFlagKeys is the list of valid flag names surfaced in InfoFlag lookup errors.
|
||||
InfoFlagKeys []string
|
||||
|
||||
// Format is "stdout" or "json". Empty defaults to "stdout".
|
||||
Format string
|
||||
|
||||
// TrimPrefix, when true, strips the "--<ReportType>-" prefix from JSON keys so
|
||||
// each report's JSON shape is independent of which plugin emitted it. Stdout
|
||||
// output is not affected by this flag.
|
||||
TrimPrefix bool
|
||||
|
||||
// UppercaseFirstCharacter capitalizes the first character of each stdout key.
|
||||
UppercaseFirstCharacter bool
|
||||
|
||||
// EmitLegacyPrefix, when true alongside TrimPrefix, also emits the legacy
|
||||
// "<ReportType>-<property>" keys in JSON output for backwards compatibility
|
||||
// during the deprecation window. Has no effect when TrimPrefix is false.
|
||||
EmitLegacyPrefix bool
|
||||
}
|
||||
|
||||
// Validate returns an error when the input is malformed.
|
||||
func (i ReportSingleAppInput) Validate() error {
|
||||
if i.ReportType == "" {
|
||||
return errors.New("ReportType is required")
|
||||
}
|
||||
if strings.ContainsAny(i.ReportType, " \t\n") {
|
||||
return fmt.Errorf("ReportType must not contain whitespace: %q", i.ReportType)
|
||||
}
|
||||
if strings.HasPrefix(i.ReportType, "--") {
|
||||
return fmt.Errorf("ReportType must not begin with --: %q", i.ReportType)
|
||||
}
|
||||
if i.AppName == "" {
|
||||
return errors.New("AppName is required (use --global for the global report)")
|
||||
}
|
||||
if i.InfoFlags == nil {
|
||||
return errors.New("InfoFlags is required")
|
||||
}
|
||||
format := i.Format
|
||||
if format == "" {
|
||||
format = "stdout"
|
||||
}
|
||||
if format != "stdout" && format != "json" {
|
||||
return fmt.Errorf("Format must be \"stdout\" or \"json\": %q", i.Format)
|
||||
}
|
||||
if format != "stdout" && i.InfoFlag != "" {
|
||||
return errors.New("--format flag cannot be specified when specifying an info flag")
|
||||
}
|
||||
if i.EmitLegacyPrefix && !i.TrimPrefix {
|
||||
return errors.New("EmitLegacyPrefix has no effect when TrimPrefix is false")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ReportSingleApp is an internal function that displays a report for an app.
|
||||
func ReportSingleApp(input ReportSingleAppInput) error {
|
||||
if err := input.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
format := input.Format
|
||||
if format == "" {
|
||||
format = "stdout"
|
||||
}
|
||||
|
||||
if format == "json" {
|
||||
data := map[string]string{}
|
||||
for key, value := range infoFlags {
|
||||
prefix := "--"
|
||||
if trimPrefix {
|
||||
prefix = fmt.Sprintf("--%v-", reportType)
|
||||
pluginPrefix := fmt.Sprintf("--%v-", input.ReportType)
|
||||
for key, value := range input.InfoFlags {
|
||||
legacyKey := strings.TrimPrefix(key, "--")
|
||||
if input.TrimPrefix && strings.HasPrefix(key, pluginPrefix) {
|
||||
data[strings.TrimPrefix(key, pluginPrefix)] = value
|
||||
if input.EmitLegacyPrefix {
|
||||
data[legacyKey] = value
|
||||
}
|
||||
} else {
|
||||
data[legacyKey] = value
|
||||
}
|
||||
|
||||
// key = strings.Replace(strings.Replace(strings.TrimPrefix(key, prefix), "-", " ", -1), ".", " ", -1)
|
||||
data[strings.TrimPrefix(key, prefix)] = value
|
||||
}
|
||||
out, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
@@ -803,7 +880,7 @@ func ReportSingleApp(reportType string, appName string, infoFlag string, infoFla
|
||||
|
||||
length := 0
|
||||
flags := []string{}
|
||||
for key := range infoFlags {
|
||||
for key := range input.InfoFlags {
|
||||
if len(key) > length {
|
||||
length = len(key)
|
||||
}
|
||||
@@ -814,22 +891,17 @@ func ReportSingleApp(reportType string, appName string, infoFlag string, infoFla
|
||||
length = 31
|
||||
}
|
||||
|
||||
if len(infoFlag) == 0 {
|
||||
LogInfo2Quiet(fmt.Sprintf("%s %v information", appName, reportType))
|
||||
if len(input.InfoFlag) == 0 {
|
||||
LogInfo2Quiet(fmt.Sprintf("%s %v information", input.AppName, input.ReportType))
|
||||
for _, k := range flags {
|
||||
v, ok := infoFlags[k]
|
||||
v, ok := input.InfoFlags[k]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
prefix := "--"
|
||||
if trimPrefix {
|
||||
prefix = fmt.Sprintf("--%v-", reportType)
|
||||
}
|
||||
key := strings.Replace(strings.Replace(strings.TrimPrefix(k, "--"), "-", " ", -1), ".", " ", -1)
|
||||
|
||||
key := strings.Replace(strings.Replace(strings.TrimPrefix(k, prefix), "-", " ", -1), ".", " ", -1)
|
||||
|
||||
if uppercaseFirstCharacter {
|
||||
if input.UppercaseFirstCharacter {
|
||||
key = UcFirst(key)
|
||||
}
|
||||
|
||||
@@ -839,8 +911,8 @@ func ReportSingleApp(reportType string, appName string, infoFlag string, infoFla
|
||||
}
|
||||
|
||||
for _, k := range flags {
|
||||
if infoFlag == k {
|
||||
v, ok := infoFlags[k]
|
||||
if input.InfoFlag == k {
|
||||
v, ok := input.InfoFlags[k]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
@@ -849,6 +921,7 @@ func ReportSingleApp(reportType string, appName string, infoFlag string, infoFla
|
||||
}
|
||||
}
|
||||
|
||||
infoFlagKeys := append([]string(nil), input.InfoFlagKeys...)
|
||||
sort.Strings(infoFlagKeys)
|
||||
return fmt.Errorf("Invalid flag passed, valid flags: %s", strings.Join(infoFlagKeys, ", "))
|
||||
}
|
||||
|
||||
275
plugins/common/report_test.go
Normal file
275
plugins/common/report_test.go
Normal file
@@ -0,0 +1,275 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestReportSingleAppInputValidate(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
baseValid := ReportSingleAppInput{
|
||||
ReportType: "ps",
|
||||
AppName: "myapp",
|
||||
InfoFlags: map[string]string{},
|
||||
Format: "stdout",
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
input ReportSingleAppInput
|
||||
wantError string
|
||||
}{
|
||||
{
|
||||
name: "valid",
|
||||
input: ReportSingleAppInput{
|
||||
ReportType: "ps",
|
||||
AppName: "myapp",
|
||||
InfoFlags: map[string]string{"--ps-restart-policy": "always"},
|
||||
Format: "stdout",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "valid empty format defaults to stdout",
|
||||
input: ReportSingleAppInput{
|
||||
ReportType: "ps",
|
||||
AppName: "myapp",
|
||||
InfoFlags: map[string]string{},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "missing ReportType",
|
||||
input: mut(baseValid, func(i *ReportSingleAppInput) { i.ReportType = "" }),
|
||||
wantError: "ReportType is required",
|
||||
},
|
||||
{
|
||||
name: "ReportType with space rejected",
|
||||
input: mut(baseValid, func(i *ReportSingleAppInput) { i.ReportType = "docker options" }),
|
||||
wantError: "ReportType must not contain whitespace",
|
||||
},
|
||||
{
|
||||
name: "ReportType with tab rejected",
|
||||
input: mut(baseValid, func(i *ReportSingleAppInput) { i.ReportType = "foo\tbar" }),
|
||||
wantError: "ReportType must not contain whitespace",
|
||||
},
|
||||
{
|
||||
name: "ReportType beginning with -- rejected",
|
||||
input: mut(baseValid, func(i *ReportSingleAppInput) { i.ReportType = "--ps" }),
|
||||
wantError: "ReportType must not begin with --",
|
||||
},
|
||||
{
|
||||
name: "missing AppName",
|
||||
input: mut(baseValid, func(i *ReportSingleAppInput) { i.AppName = "" }),
|
||||
wantError: "AppName is required",
|
||||
},
|
||||
{
|
||||
name: "nil InfoFlags",
|
||||
input: mut(baseValid, func(i *ReportSingleAppInput) { i.InfoFlags = nil }),
|
||||
wantError: "InfoFlags is required",
|
||||
},
|
||||
{
|
||||
name: "invalid Format",
|
||||
input: mut(baseValid, func(i *ReportSingleAppInput) { i.Format = "yaml" }),
|
||||
wantError: "Format must be",
|
||||
},
|
||||
{
|
||||
name: "json with info flag rejected",
|
||||
input: ReportSingleAppInput{
|
||||
ReportType: "ps",
|
||||
AppName: "myapp",
|
||||
InfoFlags: map[string]string{},
|
||||
Format: "json",
|
||||
InfoFlag: "--ps-restart-policy",
|
||||
},
|
||||
wantError: "--format flag cannot be specified when specifying an info flag",
|
||||
},
|
||||
{
|
||||
name: "EmitLegacyPrefix without TrimPrefix rejected",
|
||||
input: ReportSingleAppInput{
|
||||
ReportType: "ps",
|
||||
AppName: "myapp",
|
||||
InfoFlags: map[string]string{},
|
||||
Format: "stdout",
|
||||
EmitLegacyPrefix: true,
|
||||
TrimPrefix: false,
|
||||
},
|
||||
wantError: "EmitLegacyPrefix has no effect when TrimPrefix is false",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
err := tc.input.Validate()
|
||||
if tc.wantError == "" {
|
||||
if err != nil {
|
||||
t.Fatalf("expected no error, got %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if err == nil {
|
||||
t.Fatalf("expected error %q, got nil", tc.wantError)
|
||||
}
|
||||
if !strings.Contains(err.Error(), tc.wantError) {
|
||||
t.Fatalf("expected error to contain %q, got %q", tc.wantError, err.Error())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestReportSingleAppJSONKeys(t *testing.T) {
|
||||
infoFlags := map[string]string{
|
||||
"--ps-stop-timeout-seconds": "30",
|
||||
"--ps-restart-policy": "always",
|
||||
"--deployed": "true",
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
trimPrefix bool
|
||||
emitLegacyPrefix bool
|
||||
wantKeys map[string]string
|
||||
}{
|
||||
{
|
||||
name: "trimPrefix=false: prefixed keys only",
|
||||
trimPrefix: false,
|
||||
emitLegacyPrefix: false,
|
||||
wantKeys: map[string]string{
|
||||
"ps-stop-timeout-seconds": "30",
|
||||
"ps-restart-policy": "always",
|
||||
"deployed": "true",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "trimPrefix=true emitLegacy=false: stripped keys only",
|
||||
trimPrefix: true,
|
||||
emitLegacyPrefix: false,
|
||||
wantKeys: map[string]string{
|
||||
"stop-timeout-seconds": "30",
|
||||
"restart-policy": "always",
|
||||
"deployed": "true",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "trimPrefix=true emitLegacy=true: both shapes",
|
||||
trimPrefix: true,
|
||||
emitLegacyPrefix: true,
|
||||
wantKeys: map[string]string{
|
||||
"stop-timeout-seconds": "30",
|
||||
"restart-policy": "always",
|
||||
"deployed": "true",
|
||||
"ps-stop-timeout-seconds": "30",
|
||||
"ps-restart-policy": "always",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
out := captureStdout(t, func() {
|
||||
err := ReportSingleApp(ReportSingleAppInput{
|
||||
ReportType: "ps",
|
||||
AppName: "myapp",
|
||||
InfoFlags: infoFlags,
|
||||
Format: "json",
|
||||
TrimPrefix: tc.trimPrefix,
|
||||
EmitLegacyPrefix: tc.emitLegacyPrefix,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("ReportSingleApp returned error: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
var got map[string]string
|
||||
if err := json.Unmarshal([]byte(strings.TrimSpace(out)), &got); err != nil {
|
||||
t.Fatalf("output is not valid JSON: %v\noutput: %s", err, out)
|
||||
}
|
||||
|
||||
if len(got) != len(tc.wantKeys) {
|
||||
t.Fatalf("expected %d keys, got %d\nwant: %v\ngot: %v", len(tc.wantKeys), len(got), tc.wantKeys, got)
|
||||
}
|
||||
for k, v := range tc.wantKeys {
|
||||
if got[k] != v {
|
||||
t.Errorf("expected %q=%q, got %q=%q", k, v, k, got[k])
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestReportSingleAppJSONNonPluginPrefixKey(t *testing.T) {
|
||||
// Keys that don't start with --<reportType>- should pass through with
|
||||
// only the leading "--" stripped, regardless of TrimPrefix.
|
||||
infoFlags := map[string]string{
|
||||
"--build-id": "abc123",
|
||||
"--builds-retention": "5",
|
||||
}
|
||||
|
||||
out := captureStdout(t, func() {
|
||||
err := ReportSingleApp(ReportSingleAppInput{
|
||||
ReportType: "builds",
|
||||
AppName: "myapp",
|
||||
InfoFlags: infoFlags,
|
||||
Format: "json",
|
||||
TrimPrefix: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("ReportSingleApp returned error: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
var got map[string]string
|
||||
if err := json.Unmarshal([]byte(strings.TrimSpace(out)), &got); err != nil {
|
||||
t.Fatalf("output is not valid JSON: %v", err)
|
||||
}
|
||||
|
||||
if got["build-id"] != "abc123" {
|
||||
t.Errorf("expected build-id=abc123, got %q", got["build-id"])
|
||||
}
|
||||
if got["retention"] != "5" {
|
||||
t.Errorf("expected retention=5 (stripped), got %q", got["retention"])
|
||||
}
|
||||
if got["builds-retention"] != "5" {
|
||||
t.Errorf("expected builds-retention=5 (legacy), got %q", got["builds-retention"])
|
||||
}
|
||||
if _, present := got["uilds-retention"]; present {
|
||||
t.Error("found malformed key uilds-retention - prefix stripping was too aggressive")
|
||||
}
|
||||
}
|
||||
|
||||
func captureStdout(t *testing.T, fn func()) string {
|
||||
t.Helper()
|
||||
orig := os.Stdout
|
||||
r, w, err := os.Pipe()
|
||||
if err != nil {
|
||||
t.Fatalf("os.Pipe: %v", err)
|
||||
}
|
||||
os.Stdout = w
|
||||
|
||||
done := make(chan string)
|
||||
go func() {
|
||||
var buf bytes.Buffer
|
||||
_, _ = io.Copy(&buf, r)
|
||||
done <- buf.String()
|
||||
}()
|
||||
|
||||
fn()
|
||||
|
||||
w.Close()
|
||||
os.Stdout = orig
|
||||
return <-done
|
||||
}
|
||||
|
||||
func mut(base ReportSingleAppInput, f func(*ReportSingleAppInput)) ReportSingleAppInput {
|
||||
cp := base
|
||||
f(&cp)
|
||||
return cp
|
||||
}
|
||||
@@ -49,10 +49,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("cron", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "cron",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func addCronMaintenanceFlags(appName string, infoFlag string) map[string]common.ReportFunc {
|
||||
|
||||
@@ -46,10 +46,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("docker options", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "docker-options",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func reportBuildOptions(appName string) string {
|
||||
|
||||
@@ -54,10 +54,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("logs", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "logs",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func reportComputedAppLabelAlias(appName string) string {
|
||||
|
||||
@@ -55,10 +55,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("network", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "network",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func reportAttachPostCreate(appName string) string {
|
||||
|
||||
@@ -29,10 +29,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("ports", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "ports",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func reportPortMap(appName string) string {
|
||||
|
||||
@@ -44,10 +44,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("proxy", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "proxy",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func reportEnabled(appName string) string {
|
||||
|
||||
@@ -60,10 +60,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("ps", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "ps",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func addStatusFlags(appName string, infoFlag string) map[string]common.ReportFunc {
|
||||
|
||||
@@ -51,10 +51,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("registry", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "registry",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func reportComputedImageRepo(appName string) string {
|
||||
|
||||
@@ -41,9 +41,17 @@ func ReportSingleApp(appName, format, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := true
|
||||
uppercaseFirstCharacter := false
|
||||
return common.ReportSingleApp("resource", appName, infoFlag, flags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "resource",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: flags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: false,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
// GetResourceValue fetches a single value for a given app/process/request/key combination
|
||||
|
||||
@@ -109,10 +109,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("scheduler-k3s", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "scheduler-k3s",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
// ReportAutoscalingAuthSingleApp is an internal function that displays the scheduler-k3s autoscaling-auth report for one app
|
||||
@@ -141,9 +149,16 @@ func ReportAutoscalingAuthSingleApp(appName string, format string, includeMetada
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
return common.ReportSingleApp("scheduler-k3s", appName, "", infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "scheduler-k3s",
|
||||
AppName: appName,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func reportComputedDeployTimeout(appName string) string {
|
||||
|
||||
@@ -36,10 +36,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("scheduler", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "scheduler",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func reportComputedSelected(appName string) string {
|
||||
|
||||
@@ -25,10 +25,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
|
||||
flagKeys = append(flagKeys, flagKey)
|
||||
}
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
||||
return common.ReportSingleApp("storage", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp(common.ReportSingleAppInput{
|
||||
ReportType: "storage",
|
||||
AppName: appName,
|
||||
InfoFlag: infoFlag,
|
||||
InfoFlags: infoFlags,
|
||||
InfoFlagKeys: flagKeys,
|
||||
Format: format,
|
||||
TrimPrefix: true,
|
||||
UppercaseFirstCharacter: true,
|
||||
EmitLegacyPrefix: true,
|
||||
})
|
||||
}
|
||||
|
||||
func reportBuildMounts(appName string) string {
|
||||
|
||||
Reference in New Issue
Block a user