Skip to content

Commit

Permalink
Merge branch 'main' into dash
Browse files Browse the repository at this point in the history
  • Loading branch information
ipmb committed Jul 22, 2022
2 parents e0b6766 + ea58cab commit d3bb11e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
--allocated-storage 10 \
--max-allocated-storage 20 \
aurora-mysql
timeout-minutes: 25
timeout-minutes: 35
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down
5 changes: 3 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -891,11 +891,12 @@ func (a *App) SetScaleParameter(processType string, minProcessCount, maxProcessC
var parameterName string
if a.IsReviewApp() {
parameterName = fmt.Sprintf("/apppack/pipelines/%s/review-apps/pr/%s/scaling", a.Name, *a.ReviewApp)
} else if a.Pipeline {
return fmt.Errorf("scaling/resizing is not supported directly on pipelines")
} else {
parameterName = fmt.Sprintf("/apppack/apps/%s/scaling", a.Name)
}
if a.Pipeline && *maxProcessCount != *minProcessCount {
return fmt.Errorf("auto-scaling is not supported on pipelines")
}
parameterOutput, err := ssmSvc.GetParameter(&ssm.GetParameterInput{
Name: &parameterName,
})
Expand Down
25 changes: 17 additions & 8 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import (
"os"
"strings"

"github.com/juju/ansiterm/tabwriter"
"github.com/juju/ansiterm"
"github.com/mattn/go-isatty"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
Expand All @@ -32,7 +33,6 @@ import (
"github.com/apppackio/apppack/app"
"github.com/apppackio/apppack/bridge"
"github.com/apppackio/apppack/ui"
"github.com/logrusorgru/aurora"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -110,16 +110,25 @@ var unsetCmd = &cobra.Command{
},
}

func printRow(w *ansiterm.TabWriter, name, value string) {
w.SetForeground(ansiterm.Green)
fmt.Fprintf(w, "%s:", name)
w.SetForeground(ansiterm.Default)
fmt.Fprintf(w, "\t%s\n", value)
}

// listCmd represents the list command
var listCmd = &cobra.Command{
Use: "list",
Short: "list all config variables and values",
DisableFlagsInUseLine: true,
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
w := new(tabwriter.Writer)
// minwidth, tabwidth, padding, padchar, flags
w.Init(os.Stdout, 8, 8, 0, '\t', 0)
w := ansiterm.NewTabWriter(os.Stdout, 8, 8, 0, '\t', 0)
if isatty.IsTerminal(os.Stdout.Fd()) {
w.SetColorCapable(true)
}
ui.StartSpinner()
a, err := app.Init(AppName, UseAWSCredentials, SessionDurationSeconds)
checkErr(err)
Expand All @@ -130,10 +139,10 @@ var listCmd = &cobra.Command{
for _, value := range parameters {
parts := strings.Split(*value.Name, "/")
varname := parts[len(parts)-1]
fmt.Fprintf(w, "%s\t%s\t\n", aurora.Green(fmt.Sprintf("%s:", varname)), *value.Value)
printRow(w, varname, *value.Value)
}
ui.PrintHeaderln(fmt.Sprintf("%s Config Vars", AppName))
w.Flush()
checkErr(w.Flush())
if a.IsReviewApp() {
fmt.Println()
a.ReviewApp = nil
Expand All @@ -144,10 +153,10 @@ var listCmd = &cobra.Command{
for _, value := range parameters {
parts := strings.Split(*value.Name, "/")
varname := parts[len(parts)-1]
fmt.Fprintf(w, "%s\t%s\t\n", aurora.Green(fmt.Sprintf("%s:", varname)), *value.Value)
printRow(w, varname, *value.Value)
}
ui.PrintHeaderln(fmt.Sprintf("%s Config Vars (inherited)", a.Name))
w.Flush()
checkErr(w.Flush())
}
},
}
Expand Down
6 changes: 5 additions & 1 deletion cmd/ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ var psResizeCmd = &cobra.Command{
checkErr(a.ValidateECSTaskSize(*size))
err = a.ResizeProcess(processType, size.CPU, size.Memory)
checkErr(err)
printSuccess(fmt.Sprintf("resizing %s", processType))
if a.Pipeline {
printSuccess(fmt.Sprintf("set default size for %s processes on review apps", processType))
} else {
printSuccess(fmt.Sprintf("resizing %s", processType))
}
},
}

Expand Down

0 comments on commit d3bb11e

Please sign in to comment.