-
Notifications
You must be signed in to change notification settings - Fork 473
Add support of devcontainer.user.json file #1303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,6 +82,16 @@ func NewUpCmd(f *flags.GlobalFlags) *cobra.Command { | |
Use: "up [flags] [workspace-path|workspace-name]", | ||
Short: "Starts a new workspace", | ||
RunE: func(cobraCmd *cobra.Command, args []string) error { | ||
absExtraDevContainerPaths := []string{} | ||
for _, extraPath := range cmd.ExtraDevContainerPaths { | ||
absExtraPath, err := filepath.Abs(extraPath) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
absExtraDevContainerPaths = append(absExtraDevContainerPaths, absExtraPath) | ||
} | ||
cmd.ExtraDevContainerPaths = absExtraDevContainerPaths | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These paths will only work for local providers like You can check this here via There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed it |
||
devPodConfig, err := config.LoadConfig(cmd.Context, cmd.Provider) | ||
if err != nil { | ||
return err | ||
|
@@ -98,6 +108,11 @@ func NewUpCmd(f *flags.GlobalFlags) *cobra.Command { | |
if err != nil { | ||
return fmt.Errorf("prepare workspace client: %w", err) | ||
} | ||
|
||
if len(cmd.ExtraDevContainerPaths)!=0 && client.Provider() != "docker" { | ||
return fmt.Errorf("Extra devcontainer file is only supported with local provider") | ||
} | ||
|
||
telemetry.CollectorCLI.SetClient(client) | ||
|
||
return cmd.Run(ctx, devPodConfig, client, args, logger) | ||
|
@@ -113,6 +128,7 @@ func NewUpCmd(f *flags.GlobalFlags) *cobra.Command { | |
upCmd.Flags().StringArrayVar(&cmd.IDEOptions, "ide-option", []string{}, "IDE option in the form KEY=VALUE") | ||
upCmd.Flags().StringVar(&cmd.DevContainerImage, "devcontainer-image", "", "The container image to use, this will override the devcontainer.json value in the project") | ||
upCmd.Flags().StringVar(&cmd.DevContainerPath, "devcontainer-path", "", "The path to the devcontainer.json relative to the project") | ||
upCmd.Flags().StringArrayVar(&cmd.ExtraDevContainerPaths, "extra-devcontainer-path", []string{}, "The path to additional devcontainer.json files to override original devcontainer.json") | ||
upCmd.Flags().StringArrayVar(&cmd.ProviderOptions, "provider-option", []string{}, "Provider option in the form KEY=VALUE") | ||
upCmd.Flags().BoolVar(&cmd.Reconfigure, "reconfigure", false, "Reconfigure the options for this workspace. Only supported in DevPod Pro right now.") | ||
upCmd.Flags().BoolVar(&cmd.Recreate, "recreate", false, "If true will remove any existing containers and recreate them") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a nitpick but could you move this to
RunE
please? We initialize all other options there as well and I'd like to keep it consistentThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed it