Skip to content

Commit

Permalink
bump console client go version to be compatible w/ provider
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljguarino committed Jan 4, 2024
1 parent e508505 commit 72ef3f7
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 16 deletions.
4 changes: 2 additions & 2 deletions cmd/plural/cd_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (p *Plural) handleCreateClusterService(c *cli.Context) error {
}

headers := []string{"Id", "Name", "Namespace", "Git Ref", "Git Folder", "Repo"}
return utils.PrintTable([]*gqlclient.ServiceDeploymentFragment{sd}, headers, func(sd *gqlclient.ServiceDeploymentFragment) ([]string, error) {
return utils.PrintTable([]*gqlclient.ServiceDeploymentExtended{sd}, headers, func(sd *gqlclient.ServiceDeploymentExtended) ([]string, error) {
return []string{sd.ID, sd.Name, sd.Namespace, sd.Git.Ref, sd.Git.Folder, sd.Repository.URL}, nil
})
}
Expand Down Expand Up @@ -321,7 +321,7 @@ func (p *Plural) handleUpdateClusterService(c *cli.Context) error {
}

headers := []string{"Id", "Name", "Namespace", "Git Ref", "Git Folder", "Repo"}
return utils.PrintTable([]*gqlclient.ServiceDeploymentFragment{sd}, headers, func(sd *gqlclient.ServiceDeploymentFragment) ([]string, error) {
return utils.PrintTable([]*gqlclient.ServiceDeploymentExtended{sd}, headers, func(sd *gqlclient.ServiceDeploymentExtended) ([]string, error) {
return []string{sd.ID, sd.Name, sd.Namespace, sd.Git.Ref, sd.Git.Folder, sd.Repository.URL}, nil
})
}
Expand Down
16 changes: 8 additions & 8 deletions cmd/plural/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ func (p *Plural) handleUp(c *cli.Context) error {
return fmt.Errorf("cancelled deploy")
}

if err := ctx.Deploy(); err != nil {
if err := ctx.Deploy(func() error {
utils.Highlight("\n==> Commit and push your configuration\n\n")
if commit := commitMsg(c); commit != "" {
utils.Highlight("Pushing upstream...\n")
return git.Sync(repoRoot, commit, c.Bool("force"))
}
return nil
}); err != nil {
return err
}

utils.Highlight("\n==> Commit and push your configuration\n\n")

if commit := commitMsg(c); commit != "" {
utils.Highlight("Pushing upstream...\n")
return git.Sync(repoRoot, commit, c.Bool("force"))
}

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ require (
github.com/packethost/packngo v0.29.0
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
github.com/pluralsh/cluster-api-migration v0.2.15
github.com/pluralsh/console-client-go v0.0.60
github.com/pluralsh/console-client-go v0.0.70
github.com/pluralsh/gqlclient v1.11.0
github.com/pluralsh/plural-operator v0.5.5
github.com/pluralsh/polly v0.1.1
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1429,6 +1429,10 @@ github.com/pluralsh/cluster-api-migration v0.2.15 h1:TIfusD+wnhZTGmwNfIlKlKJOT2d
github.com/pluralsh/cluster-api-migration v0.2.15/go.mod h1:J6lEvC/70KouikX16mE331cxc3y3sBwtmfHGwZqu06w=
github.com/pluralsh/console-client-go v0.0.60 h1:hvZV5WsXEN/bd9leid56FxVXXqCOhOdczQd7CC5qri0=
github.com/pluralsh/console-client-go v0.0.60/go.mod h1:u/RjzXE3wtl3L6wiWxwhQHSpxFX46+EYvpkss2mALN4=
github.com/pluralsh/console-client-go v0.0.68 h1:b2GZU0nw7UcnXvVakcH4QEBuhtiYWYa5cCmpGkKxM2Q=
github.com/pluralsh/console-client-go v0.0.68/go.mod h1:u/RjzXE3wtl3L6wiWxwhQHSpxFX46+EYvpkss2mALN4=
github.com/pluralsh/console-client-go v0.0.70 h1:itLfOGpIpt+sASS+X0FTmB/OF3vUY6YnUGx9a+j34So=
github.com/pluralsh/console-client-go v0.0.70/go.mod h1:u/RjzXE3wtl3L6wiWxwhQHSpxFX46+EYvpkss2mALN4=
github.com/pluralsh/controller-reconcile-helper v0.0.4 h1:1o+7qYSyoeqKFjx+WgQTxDz4Q2VMpzprJIIKShxqG0E=
github.com/pluralsh/controller-reconcile-helper v0.0.4/go.mod h1:AfY0gtteD6veBjmB6jiRx/aR4yevEf6K0M13/pGan/s=
github.com/pluralsh/gqlclient v1.11.0 h1:FfXW7FiEJLHOfTAa7NxDb8jb3aMZNIpCAcG+bg8uHYA=
Expand Down
4 changes: 2 additions & 2 deletions pkg/console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ type ConsoleClient interface {
CreateRepository(url string, privateKey, passphrase, username, password *string) (*consoleclient.CreateGitRepository, error)
ListRepositories() (*consoleclient.ListGitRepositories, error)
UpdateRepository(id string, attrs consoleclient.GitAttributes) (*consoleclient.UpdateGitRepository, error)
CreateClusterService(clusterId, clusterName *string, attr consoleclient.ServiceDeploymentAttributes) (*consoleclient.ServiceDeploymentFragment, error)
UpdateClusterService(serviceId, serviceName, clusterName *string, attributes consoleclient.ServiceUpdateAttributes) (*consoleclient.ServiceDeploymentFragment, error)
CreateClusterService(clusterId, clusterName *string, attr consoleclient.ServiceDeploymentAttributes) (*consoleclient.ServiceDeploymentExtended, error)
UpdateClusterService(serviceId, serviceName, clusterName *string, attributes consoleclient.ServiceUpdateAttributes) (*consoleclient.ServiceDeploymentExtended, error)
CloneService(clusterId string, serviceId, serviceName, clusterName *string, attributes consoleclient.ServiceCloneAttributes) (*consoleclient.ServiceDeploymentFragment, error)
GetClusterService(serviceId, serviceName, clusterName *string) (*consoleclient.ServiceDeploymentExtended, error)
DeleteClusterService(serviceId string) (*consoleclient.DeleteServiceDeployment, error)
Expand Down
4 changes: 2 additions & 2 deletions pkg/console/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (c *consoleClient) ListClusterServices(clusterId, clusterName *string) ([]*
return result.ServiceDeployments.Edges, nil
}

func (c *consoleClient) CreateClusterService(clusterId, clusterName *string, attributes gqlclient.ServiceDeploymentAttributes) (*gqlclient.ServiceDeploymentFragment, error) {
func (c *consoleClient) CreateClusterService(clusterId, clusterName *string, attributes gqlclient.ServiceDeploymentAttributes) (*gqlclient.ServiceDeploymentExtended, error) {
if clusterId == nil && clusterName == nil {
return nil, fmt.Errorf("clusterId and clusterName can not be null")
}
Expand All @@ -57,7 +57,7 @@ func (c *consoleClient) CreateClusterService(clusterId, clusterName *string, att
return result.CreateServiceDeployment, nil
}

func (c *consoleClient) UpdateClusterService(serviceId, serviceName, clusterName *string, attributes gqlclient.ServiceUpdateAttributes) (*gqlclient.ServiceDeploymentFragment, error) {
func (c *consoleClient) UpdateClusterService(serviceId, serviceName, clusterName *string, attributes gqlclient.ServiceUpdateAttributes) (*gqlclient.ServiceDeploymentExtended, error) {
if serviceId == nil && serviceName == nil && clusterName == nil {
return nil, fmt.Errorf("serviceId, serviceName and clusterName can not be null")
}
Expand Down
8 changes: 7 additions & 1 deletion pkg/up/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type terraformCmd struct {
retries int
}

func (ctx *Context) Deploy() error {
func (ctx *Context) Deploy(commit func() error) error {
if err := ctx.Provider.CreateBucket(); err != nil {
return err
}
Expand All @@ -32,6 +32,12 @@ func (ctx *Context) Deploy() error {
return err
}

if err := commit(); err != nil {
return err
}

utils.Highlight("\nSetting up gitops management...\n")

return runAll([]terraformCmd{
{dir: "./apps/terraform", cmd: "init", args: []string{"-upgrade"}},
{dir: "./apps/terraform", cmd: "apply", args: []string{"-auto-approve"}, retries: 1},
Expand Down

0 comments on commit 72ef3f7

Please sign in to comment.