MCPcopy Index your code
hub / github.com/devspace-sh/devspace / LoadCommandsConfig

Method LoadCommandsConfig

cmd/run.go:239–274  ·  view source on GitHub ↗

LoadCommandsConfig loads the commands config

(f factory.Factory, configLoader loader.ConfigLoader, configOptions *loader.ConfigOptions, log log.Logger)

Source from the content-addressed store, hash-verified

237
238// LoadCommandsConfig loads the commands config
239func (cmd *RunCmd) LoadCommandsConfig(f factory.Factory, configLoader loader.ConfigLoader, configOptions *loader.ConfigOptions, log log.Logger) (devspacecontext.Context, error) {
240 // load generated
241 localCache, err := configLoader.LoadLocalCache()
242 if err != nil {
243 return nil, err
244 }
245
246 // try to load client
247 client, err := f.NewKubeClientFromContext(cmd.KubeContext, cmd.Namespace)
248 if err != nil {
249 log.Debugf("Unable to create new kubectl client: %v", err)
250 client = nil
251 }
252
253 // verify client connectivity / authn / authz
254 if client != nil {
255 // If the current kube context or namespace is different than old,
256 // show warnings and reset kube client if necessary
257 client, err = kubectl.CheckKubeContext(client, localCache, cmd.NoWarn, cmd.SwitchContext, false, log)
258 if err != nil {
259 log.Debugf("Unable to verify kube context %v", err)
260 client = nil
261 }
262 }
263
264 // Parse commands
265 commandsInterface, err := configLoader.LoadWithParser(context.Background(), localCache, client, loader.NewCommandsParser(), configOptions, log)
266 if err != nil {
267 return nil, err
268 }
269
270 // create context
271 return devspacecontext.NewContext(context.Background(), commandsInterface.Variables(), log).
272 WithKubeClient(client).
273 WithConfig(commandsInterface), nil
274}
275
276func executeShellCommand(ctx context.Context, shellCommand string, variables map[string]interface{}, args []string, dir string, stdout io.Writer, stderr io.Writer, stdin io.Reader) error {
277 extraEnv := map[string]string{}

Callers 1

RunRunMethod · 0.95

Calls 9

CheckKubeContextFunction · 0.92
NewCommandsParserFunction · 0.92
LoadLocalCacheMethod · 0.65
LoadWithParserMethod · 0.65
WithConfigMethod · 0.65
WithKubeClientMethod · 0.65
VariablesMethod · 0.65
DebugfMethod · 0.45

Tested by

no test coverage detected