-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into 3299-runtime-deprecat…
…e-runtimeserverexportgo-migrate-frontend-to-use-the-new-export-api
- Loading branch information
Showing
150 changed files
with
4,940 additions
and
2,347 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
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 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,67 @@ | ||
package project | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/rilldata/rill/cli/pkg/cmdutil" | ||
"github.com/rilldata/rill/cli/pkg/config" | ||
adminv1 "github.com/rilldata/rill/proto/gen/rill/admin/v1" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func RefreshCmd(cfg *config.Config) *cobra.Command { | ||
var project, path string | ||
var source []string | ||
|
||
refreshCmd := &cobra.Command{ | ||
Use: "refresh [<project-name>]", | ||
Args: cobra.MaximumNArgs(1), | ||
Short: "Refresh project", | ||
PersistentPreRunE: cmdutil.CheckChain(cmdutil.CheckAuth(cfg), cmdutil.CheckOrganization(cfg)), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
ctx := cmd.Context() | ||
|
||
client, err := cmdutil.Client(cfg) | ||
if err != nil { | ||
return err | ||
} | ||
defer client.Close() | ||
|
||
if len(args) > 0 { | ||
project = args[0] | ||
} | ||
|
||
if !cmd.Flags().Changed("project") && len(args) == 0 && cfg.Interactive { | ||
var err error | ||
project, err = inferProjectName(ctx, client, cfg.Org, path) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
resp, err := client.GetProject(ctx, &adminv1.GetProjectRequest{ | ||
OrganizationName: cfg.Org, | ||
Name: project, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
_, err = client.TriggerRefreshSources(ctx, &adminv1.TriggerRefreshSourcesRequest{DeploymentId: resp.ProdDeployment.Id, Sources: source}) | ||
if err != nil { | ||
return fmt.Errorf("failed to trigger refresh: %w", err) | ||
} | ||
|
||
fmt.Printf("Triggered refresh. To see status, run `rill project status --project %s`.\n", project) | ||
|
||
return nil | ||
}, | ||
} | ||
|
||
refreshCmd.Flags().SortFlags = false | ||
refreshCmd.Flags().StringVar(&project, "project", "", "Project name") | ||
refreshCmd.Flags().StringVar(&path, "path", ".", "Project directory") | ||
refreshCmd.Flags().StringSliceVar(&source, "source", nil, "Refresh specific source(s)") | ||
|
||
return refreshCmd | ||
} |
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,65 @@ | ||
package project | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/rilldata/rill/cli/pkg/cmdutil" | ||
"github.com/rilldata/rill/cli/pkg/config" | ||
adminv1 "github.com/rilldata/rill/proto/gen/rill/admin/v1" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func ResetCmd(cfg *config.Config) *cobra.Command { | ||
var project, path string | ||
var force bool | ||
|
||
resetCmd := &cobra.Command{ | ||
Use: "reset [<project-name>]", | ||
Args: cobra.MaximumNArgs(1), | ||
Short: "Reset project", | ||
PersistentPreRunE: cmdutil.CheckChain(cmdutil.CheckAuth(cfg), cmdutil.CheckOrganization(cfg)), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
ctx := cmd.Context() | ||
|
||
client, err := cmdutil.Client(cfg) | ||
if err != nil { | ||
return err | ||
} | ||
defer client.Close() | ||
|
||
if len(args) > 0 { | ||
project = args[0] | ||
} | ||
|
||
if !cmd.Flags().Changed("project") && len(args) == 0 && cfg.Interactive { | ||
var err error | ||
project, err = inferProjectName(ctx, client, cfg.Org, path) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
if !force { | ||
msg := "This will create a new deployment, causing downtime as data sources are reloaded from scratch. If you just need to refresh data, use `rill project refresh`. Do you want to continue?" | ||
if !cmdutil.ConfirmPrompt(msg, "", false) { | ||
return nil | ||
} | ||
} | ||
|
||
_, err = client.TriggerRedeploy(ctx, &adminv1.TriggerRedeployRequest{Organization: cfg.Org, Project: project}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
fmt.Printf("Triggered project reset. To see status, run `rill project status --project %s`.\n", project) | ||
|
||
return nil | ||
}, | ||
} | ||
|
||
resetCmd.Flags().SortFlags = false | ||
resetCmd.Flags().StringVar(&project, "project", "", "Project name") | ||
resetCmd.Flags().StringVar(&path, "path", ".", "Project directory") | ||
resetCmd.Flags().BoolVar(&force, "force", false, "Force reset even if project is already deployed") | ||
return resetCmd | ||
} |
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
Oops, something went wrong.