MCPcopy Index your code
hub / github.com/cli/cli / RebuildContainer

Method RebuildContainer

internal/codespaces/rpc/invoker.go:191–208  ·  view source on GitHub ↗

Rebuilds the container using cached layers by default or from scratch if full is true

(ctx context.Context, full bool)

Source from the content-addressed store, hash-verified

189
190// Rebuilds the container using cached layers by default or from scratch if full is true
191func (i *invoker) RebuildContainer(ctx context.Context, full bool) error {
192 ctx = i.appendMetadata(ctx)
193 ctx, cancel := context.WithTimeout(ctx, requestTimeout)
194 defer cancel()
195
196 // If full is true, we want to pass false to the RPC call to indicate that we want to do a full rebuild
197 incremental := !full
198 response, err := i.codespaceClient.RebuildContainerAsync(ctx, &codespace.RebuildContainerRequest{Incremental: &incremental})
199 if err != nil {
200 return fmt.Errorf("failed to invoke rebuild RPC: %w", err)
201 }
202
203 if !response.RebuildContainer {
204 return fmt.Errorf("couldn't rebuild codespace")
205 }
206
207 return nil
208}
209
210// Starts a remote SSH server to allow the user to connect to the codespace via SSH
211func (i *invoker) StartSSHServer(ctx context.Context) (int, string, error) {

Callers

nothing calls this directly

Calls 3

appendMetadataMethod · 0.95
RebuildContainerAsyncMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected