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

Method RebuildContainer

internal/codespaces/rpc/invoker.go:196–213  ·  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

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