Skip to content

Commit

Permalink
chore: Bump Kraftkit to 0.7.1 and adapt interface
Browse files Browse the repository at this point in the history
Signed-off-by: Cezar Craciunoiu <[email protected]>
  • Loading branch information
craciunoiuc committed Dec 12, 2023
1 parent ad5360c commit 321f43d
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 44 deletions.
6 changes: 4 additions & 2 deletions cmd/governctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
package main

import (
"context"
"fmt"
"os"

"github.com/MakeNowJust/heredoc"
"github.com/rancher/wrangler/pkg/signals"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"kraftkit.sh/cmdfactory"
kitcfg "kraftkit.sh/config"
"kraftkit.sh/iostreams"
Expand Down Expand Up @@ -57,8 +59,8 @@ func New() *cobra.Command {
return cmd
}

func (*GovernCtl) Run(cmd *cobra.Command, _ []string) error {
return cmd.Help()
func (*GovernCtl) Run(_ context.Context, _ []string) error {
return pflag.ErrHelp
}

func main() {
Expand Down
7 changes: 5 additions & 2 deletions cmd/governctl/pr/check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
package check

import (
"context"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"kraftkit.sh/cmdfactory"
)

Expand All @@ -31,6 +34,6 @@ func New() *cobra.Command {
return cmd
}

func (*Check) Run(cmd *cobra.Command, _ []string) error {
return cmd.Help()
func (*Check) Run(_ context.Context, _ []string) error {
return pflag.ErrHelp
}
5 changes: 2 additions & 3 deletions cmd/governctl/pr/check/merable.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package check

import (
"bytes"
"context"
"encoding/json"
"fmt"
"os"
Expand Down Expand Up @@ -68,9 +69,7 @@ func NewMergable() *cobra.Command {
return cmd
}

func (opts *Mergable) Run(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()

func (opts *Mergable) Run(ctx context.Context, args []string) error {
ghOrg, ghRepo, ghPrId, err := cmdutils.ParseOrgRepoAndPullRequestArgs(args)
if err != nil {
return err
Expand Down
5 changes: 2 additions & 3 deletions cmd/governctl/pr/check/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package check

import (
"context"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -53,7 +54,7 @@ func NewPatch() *cobra.Command {
return cmd
}

func (opts *Patch) Run(cmd *cobra.Command, args []string) error {
func (opts *Patch) Run(ctx context.Context, args []string) error {
if len(opts.Ignores) == 0 {
opts.Ignores = []string{
"FILE_PATH_CHANGES",
Expand All @@ -64,8 +65,6 @@ func (opts *Patch) Run(cmd *cobra.Command, args []string) error {
}
}

ctx := cmd.Context()

ghOrg, ghRepo, ghPrId, err := cmdutils.ParseOrgRepoAndPullRequestArgs(args)
if err != nil {
return err
Expand Down
5 changes: 2 additions & 3 deletions cmd/governctl/pr/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package pr

import (
"bytes"
"context"
"fmt"
"os"
"os/exec"
Expand Down Expand Up @@ -71,9 +72,7 @@ func NewMerge() *cobra.Command {
return cmd
}

func (opts *Merge) Run(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()

func (opts *Merge) Run(ctx context.Context, args []string) error {
ghOrg, ghRepo, ghPrId, err := cmdutils.ParseOrgRepoAndPullRequestArgs(args)
if err != nil {
return err
Expand Down
7 changes: 5 additions & 2 deletions cmd/governctl/pr/pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
package pr

import (
"context"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"kraftkit.sh/cmdfactory"

"github.com/unikraft/governance/cmd/governctl/pr/check"
Expand Down Expand Up @@ -34,6 +37,6 @@ func New() *cobra.Command {
return cmd
}

func (opts *PR) Run(cmd *cobra.Command, args []string) error {
return cmd.Help()
func (opts *PR) Run(_ context.Context, args []string) error {
return pflag.ErrHelp
}
4 changes: 2 additions & 2 deletions cmd/governctl/pr/sync/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package sync

import (
"context"
"fmt"
"os"
"path"
Expand Down Expand Up @@ -44,9 +45,8 @@ func NewLabels() *cobra.Command {
return cmd
}

func (opts *Labels) Run(cmd *cobra.Command, args []string) error {
func (opts *Labels) Run(ctx context.Context, args []string) error {
var err error
ctx := cmd.Context()

ghOrg, ghRepo, ghPrId, err := cmdutils.ParseOrgRepoAndPullRequestArgs(args)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions cmd/governctl/pr/sync/reviewers.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ func NewReviewers() *cobra.Command {
return cmd
}

func (opts *Reviewers) Run(cmd *cobra.Command, args []string) error {
func (opts *Reviewers) Run(ctx context.Context, args []string) error {
var err error
ctx := cmd.Context()

opts.ghClient, err = ghapi.NewGithubClient(
ctx,
Expand Down
7 changes: 5 additions & 2 deletions cmd/governctl/pr/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
package sync

import (
"context"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"kraftkit.sh/cmdfactory"
)

Expand All @@ -31,6 +34,6 @@ func New() *cobra.Command {
return cmd
}

func (*Sync) Run(cmd *cobra.Command, _ []string) error {
return cmd.Help()
func (*Sync) Run(_ context.Context, _ []string) error {
return pflag.ErrHelp
}
5 changes: 2 additions & 3 deletions cmd/governctl/team/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package team

import (
"context"
"fmt"
"os"

Expand Down Expand Up @@ -63,9 +64,7 @@ func (opts *Sync) Pre(cmd *cobra.Command, args []string) error {
return nil
}

func (opts *Sync) Run(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()

func (opts *Sync) Run(ctx context.Context, args []string) error {
for _, t := range opts.teams {
err := t.Sync(ctx)
if err != nil {
Expand Down
7 changes: 5 additions & 2 deletions cmd/governctl/team/team.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
package team

import (
"context"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"kraftkit.sh/cmdfactory"
)

Expand All @@ -30,6 +33,6 @@ func New() *cobra.Command {
return cmd
}

func (opts *Team) Run(cmd *cobra.Command, args []string) error {
return cmd.Help()
func (opts *Team) Run(_ context.Context, args []string) error {
return pflag.ErrHelp
}
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
golang.org/x/oauth2 v0.10.0
gopkg.in/src-d/go-git.v4 v4.13.1
gopkg.in/yaml.v2 v2.4.0
kraftkit.sh v0.6.7
kraftkit.sh v0.7.1
)

require (
Expand Down Expand Up @@ -45,7 +45,7 @@ require (
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
Expand All @@ -58,11 +58,11 @@ require (
github.com/src-d/gcfg v1.4.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/tools v0.9.3 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
Expand Down Expand Up @@ -188,8 +188,8 @@ golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU=
golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
Expand Down Expand Up @@ -229,15 +229,15 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c=
golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
Expand All @@ -246,8 +246,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
Expand Down Expand Up @@ -283,5 +283,5 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
kraftkit.sh v0.6.7 h1:p67/qjUHsDmkDyY0XYymh8vipMXN9qgHvKhH0BndFFE=
kraftkit.sh v0.6.7/go.mod h1:GtknDG1NTdmh4UuVAK9Q7Gu6jLKW92qEBNKLcFRKWeI=
kraftkit.sh v0.7.1 h1:NxQI4y5PJIiBfB7+qZODXcRNj+nQOtf4nWEjlFbokCo=
kraftkit.sh v0.7.1/go.mod h1:fKmBtMxhGRPXRSJcbtwvU3N0j8vovA9TxfXPpfPZrU4=

0 comments on commit 321f43d

Please sign in to comment.