-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: reorganize, fix goreleaser and update readme
- Loading branch information
Showing
40 changed files
with
260 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
build: | ||
go build -o bin/gograpple cmd/gograpple/main.go | ||
go build -o bin/gograpple main.go | ||
|
||
install: | ||
go build -o /usr/local/bin/gograpple cmd/gograpple/main.go | ||
go build -o /usr/local/bin/gograpple main.go | ||
|
||
test: | ||
go test ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/foomo/gograpple/internal/grapple" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func init() { | ||
rootCmd.AddCommand(rollbackCmd) | ||
} | ||
|
||
var ( | ||
rollbackCmd = &cobra.Command{ | ||
Use: "rollback [namespace] [deployment]", | ||
Short: "rollback the patched deployment", | ||
Args: cobra.MinimumNArgs(2), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
g, err := grapple.NewGrapple(newLogEntry(flagDebug), args[0], args[1]) | ||
if err != nil { | ||
return err | ||
} | ||
return g.Rollback() | ||
}, | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/sirupsen/logrus" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func init() { | ||
rootCmd.PersistentFlags().BoolVarP(&flagDebug, "debug", "", false, "debug mode") | ||
} | ||
|
||
var ( | ||
// flagImage string | ||
// flagDir string | ||
flagDebug bool | ||
// flagNamespace string | ||
// flagPod string | ||
// flagContainer string | ||
// flagRepo string | ||
// flagMounts []string | ||
// flagSourcePath string | ||
// flagArgs = NewStringList(" ") | ||
// flagRollback bool | ||
// flagListen = NewHostPort("127.0.0.1", 0) | ||
// flagVscode bool | ||
// flagContinue bool | ||
// flagJSONLog bool | ||
// flagDebug bool | ||
) | ||
|
||
var ( | ||
rootCmd = &cobra.Command{ | ||
Use: "gograpple", | ||
} | ||
) | ||
|
||
func Execute() { | ||
if err := rootCmd.Execute(); err != nil { | ||
le := newLogEntry(flagDebug) | ||
le.Fatal(err) | ||
} | ||
} | ||
|
||
func newLogEntry(debug bool) *logrus.Entry { | ||
logger := logrus.New() | ||
if debug { | ||
logger.SetLevel(logrus.TraceLevel) | ||
} | ||
return logrus.NewEntry(logger) | ||
} |
Oops, something went wrong.