Skip to content

Commit c0d6fa9

Browse files
authored
[gitpod-cli] change gp rebuild to gp validate (#16867)
* [gitpod-cli] change `gp rebuild` to `gp validate` * fix `await-port` and `forward-port` command backward compatible * Change the reference to `gp rebuild` * update `gitpod-web` extension ref gitpod-io/gitpod-code@3b076b9
1 parent ff079b9 commit c0d6fa9

File tree

26 files changed

+81
-64
lines changed

26 files changed

+81
-64
lines changed

components/dashboard/src/start/StartWorkspace.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,8 @@ function ImageBuildView(props: ImageBuildViewProps) {
778778
<>
779779
<div className="mt-6 w-11/12 lg:w-3/5">
780780
<p className="text-center text-gray-400 dark:text-gray-500">
781-
💡 You can use the <code>gp rebuild</code> command to rebuild the workspace from the editor
782-
terminal. &nbsp;
781+
💡 You can use the <code>gp validate</code> command to validate the workspace configuration
782+
from the editor terminal. &nbsp;
783783
<a
784784
href="https://www.gitpod.io/docs/configure/workspaces/workspace-image#trying-out-changes-to-your-dockerfile"
785785
target="_blank"

components/gitpod-cli/cmd/ports-await.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ var awaitPortCmdAlias = &cobra.Command{
7575
Short: awaitPortCmd.Short,
7676
Long: awaitPortCmd.Long,
7777
Args: awaitPortCmd.Args,
78-
Run: awaitPortCmd.Run,
78+
RunE: awaitPortCmd.RunE,
7979
}
8080

8181
func init() {

components/gitpod-cli/cmd/ports-expose.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ var portExposeCmdAlias = &cobra.Command{
9595
Short: portExposeCmd.Short,
9696
Long: portExposeCmd.Long,
9797
Args: portExposeCmd.Args,
98-
Run: portExposeCmd.Run,
98+
RunE: portExposeCmd.RunE,
9999
}
100100

101101
func init() {

components/gitpod-cli/cmd/rebuild.go renamed to components/gitpod-cli/cmd/validate.go

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func stopDebugContainer(ctx context.Context, dockerPath string) error {
4646
}
4747

4848
func runRebuild(ctx context.Context, supervisorClient *supervisor.SupervisorClient) error {
49-
logLevel, err := logrus.ParseLevel(rebuildOpts.LogLevel)
49+
logLevel, err := logrus.ParseLevel(validateOpts.LogLevel)
5050
if err != nil {
5151
return GpError{Err: err, OutCome: utils.Outcome_UserErr, ErrorCode: utils.RebuildErrorCode_InvaligLogLevel}
5252
}
@@ -57,7 +57,7 @@ func runRebuild(ctx context.Context, supervisorClient *supervisor.SupervisorClie
5757
return err
5858
}
5959

60-
checkoutLocation := rebuildOpts.WorkspaceFolder
60+
checkoutLocation := validateOpts.WorkspaceFolder
6161
if checkoutLocation == "" {
6262
checkoutLocation = wsInfo.CheckoutLocation
6363
}
@@ -206,11 +206,11 @@ func runRebuild(ctx context.Context, supervisorClient *supervisor.SupervisorClie
206206

207207
workspaceType := api.DebugWorkspaceType_regular
208208
contentSource := api.ContentSource_from_other
209-
if rebuildOpts.Prebuild {
209+
if validateOpts.Prebuild {
210210
workspaceType = api.DebugWorkspaceType_prebuild
211-
} else if rebuildOpts.From == "prebuild" {
211+
} else if validateOpts.From == "prebuild" {
212212
contentSource = api.ContentSource_from_prebuild
213-
} else if rebuildOpts.From == "snapshot" {
213+
} else if validateOpts.From == "snapshot" {
214214
contentSource = api.ContentSource_from_backup
215215
}
216216
debugEnvs, err := supervisorClient.Control.CreateDebugEnv(ctx, &api.CreateDebugEnvRequest{
@@ -238,7 +238,7 @@ func runRebuild(ctx context.Context, supervisorClient *supervisor.SupervisorClie
238238
for _, env := range debugEnvs.Envs {
239239
envs += env + "\n"
240240
}
241-
for _, env := range rebuildOpts.GitpodEnvs {
241+
for _, env := range validateOpts.GitpodEnvs {
242242
envs += env + "\n"
243243
}
244244
for _, env := range workspaceEnvs {
@@ -462,7 +462,7 @@ func openWindow(ctx context.Context, workspaceUrl string) error {
462462
return gpCmd.Run()
463463
}
464464

465-
var rebuildOpts struct {
465+
var validateOpts struct {
466466
WorkspaceFolder string
467467
LogLevel string
468468
From string
@@ -472,9 +472,9 @@ var rebuildOpts struct {
472472
GitpodEnvs []string
473473
}
474474

475-
var rebuildCmd = &cobra.Command{
476-
Use: "rebuild",
477-
Short: "[experimental] Re-builds the workspace (useful to debug a workspace configuration)",
475+
var validateCmd = &cobra.Command{
476+
Use: "validate",
477+
Short: "[experimental] Validates the workspace (useful to debug a workspace configuration)",
478478
Hidden: false,
479479
RunE: func(cmd *cobra.Command, args []string) error {
480480
supervisorClient, err := supervisor.New(cmd.Context())
@@ -487,6 +487,14 @@ var rebuildCmd = &cobra.Command{
487487
},
488488
}
489489

490+
var rebuildCmd = &cobra.Command{
491+
Hidden: true,
492+
Use: "rebuild",
493+
Deprecated: "please use `gp validate` instead.",
494+
Short: validateCmd.Short,
495+
RunE: validateCmd.RunE,
496+
}
497+
490498
func init() {
491499
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
492500
defer cancel()
@@ -500,13 +508,22 @@ func init() {
500508
}
501509
}
502510

503-
rootCmd.AddCommand(rebuildCmd)
504-
rebuildCmd.PersistentFlags().StringVarP(&rebuildOpts.WorkspaceFolder, "workspace-folder", "w", workspaceFolder, "Path to the workspace folder.")
505-
rebuildCmd.PersistentFlags().StringVarP(&rebuildOpts.LogLevel, "log", "", "error", "Log level to use. Allowed values are 'error', 'warn', 'info', 'debug', 'trace'.")
506-
rebuildCmd.PersistentFlags().StringVarP(&rebuildOpts.From, "from", "", "", "Starts from 'prebuild' or 'snapshot'.")
507-
rebuildCmd.PersistentFlags().BoolVarP(&rebuildOpts.Prebuild, "prebuild", "", false, "starts as a prebuild workspace (--from is ignored).")
511+
setFlags := func(cmd *cobra.Command) {
512+
cmd.PersistentFlags().BoolVarP(&validateOpts.Prebuild, "prebuild", "", false, "starts as a prebuild workspace.")
513+
cmd.PersistentFlags().StringVarP(&validateOpts.LogLevel, "log", "", "error", "Log level to use. Allowed values are 'error', 'warn', 'info', 'debug', 'trace'.")
508514

509-
// internal
510-
rebuildCmd.PersistentFlags().StringArrayVarP(&rebuildOpts.GitpodEnvs, "gitpod-env", "", nil, "")
511-
rebuildCmd.PersistentFlags().MarkHidden("gitpod-env")
515+
// internal
516+
cmd.PersistentFlags().StringArrayVarP(&validateOpts.GitpodEnvs, "gitpod-env", "", nil, "")
517+
cmd.PersistentFlags().StringVarP(&validateOpts.WorkspaceFolder, "workspace-folder", "w", workspaceFolder, "Path to the workspace folder.")
518+
cmd.PersistentFlags().StringVarP(&validateOpts.From, "from", "", "", "Starts from 'prebuild' or 'snapshot'.")
519+
_ = cmd.PersistentFlags().MarkHidden("gitpod-env")
520+
_ = cmd.PersistentFlags().MarkHidden("workspace-folder")
521+
_ = cmd.PersistentFlags().MarkHidden("from")
522+
}
523+
524+
setFlags(validateCmd)
525+
setFlags(rebuildCmd)
526+
527+
rootCmd.AddCommand(validateCmd)
528+
rootCmd.AddCommand(rebuildCmd)
512529
}

components/supervisor/validate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ sudo rm -rf /.supervisor/frontend && true
2727
sudo ln -s "$DIR/frontend/dist" /.supervisor/frontend
2828
echo "$DIR/frontend/dist linked in /.supervisor/frontend"
2929

30-
gp rebuild --workspace-folder="$ROOT_DIR/dev/ide/example/workspace" --gitpod-env "GITPOD_ANALYTICS_SEGMENT_KEY=YErmvd89wPsrCuGcVnF2XAl846W9WIGl" --gitpod-env "GP_OPEN_EDITOR=" --gitpod-env "GP_PREVIEW_BROWSER=" --gitpod-env "GP_EXTERNAL_BROWSER=" "$@"
30+
gp validate --workspace-folder="$ROOT_DIR/dev/ide/example/workspace" --gitpod-env "GITPOD_ANALYTICS_SEGMENT_KEY=YErmvd89wPsrCuGcVnF2XAl846W9WIGl" --gitpod-env "GP_OPEN_EDITOR=" --gitpod-env "GP_PREVIEW_BROWSER=" --gitpod-env "GP_EXTERNAL_BROWSER=" "$@"

install/installer/cmd/testdata/render/agent-smith/output.golden

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/installer/cmd/testdata/render/aws-setup/output.golden

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/installer/cmd/testdata/render/custom-pull-repository/output.golden

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/installer/cmd/testdata/render/customization/output.golden

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/installer/cmd/testdata/render/external-registry/output.golden

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/installer/cmd/testdata/render/gcp-setup/output.golden

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/installer/cmd/testdata/render/http-proxy/output.golden

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/installer/cmd/testdata/render/ide-config/output.golden

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/installer/cmd/testdata/render/kind-ide/output.golden

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/installer/cmd/testdata/render/kind-meta/output.golden

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/installer/cmd/testdata/render/message-bus-password/output.golden

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/installer/cmd/testdata/render/minimal/output.golden

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/installer/cmd/testdata/render/overrides-inline/output.golden

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/installer/cmd/testdata/render/pod-config/output.golden

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)