MCPcopy Create free account
hub / github.com/bufbuild/buf / getWorkspaceForSourceRef

Method getWorkspaceForSourceRef

private/buf/bufctl/controller.go:1032–1066  ·  view source on GitHub ↗
(
	ctx context.Context,
	sourceRef buffetch.SourceRef,
	functionOptions *functionOptions,
)

Source from the content-addressed store, hash-verified

1030}
1031
1032func (c *controller) getWorkspaceForSourceRef(
1033 ctx context.Context,
1034 sourceRef buffetch.SourceRef,
1035 functionOptions *functionOptions,
1036) (_ bufworkspace.Workspace, retErr error) {
1037 readBucketCloser, bucketTargeting, err := c.buffetchReader.GetSourceReadBucketCloser(
1038 ctx,
1039 c.container,
1040 sourceRef,
1041 functionOptions.getGetReadBucketCloserOptions()...,
1042 )
1043 if err != nil {
1044 return nil, err
1045 }
1046 defer func() {
1047 retErr = errors.Join(retErr, readBucketCloser.Close())
1048 }()
1049 options := []bufworkspace.WorkspaceBucketOption{
1050 bufworkspace.WithConfigOverride(
1051 functionOptions.configOverride,
1052 ),
1053 }
1054 if functionOptions.ignoreAndDisallowV1BufWorkYAMLs {
1055 options = append(
1056 options,
1057 bufworkspace.WithIgnoreAndDisallowV1BufWorkYAMLs(),
1058 )
1059 }
1060 return c.workspaceProvider.GetWorkspaceForBucket(
1061 ctx,
1062 readBucketCloser,
1063 bucketTargeting,
1064 options...,
1065 )
1066}
1067
1068func (c *controller) getWorkspaceDepManagerForDirRef(
1069 ctx context.Context,

Callers 4

GetWorkspaceMethod · 0.95
getImageForRefMethod · 0.95

Calls 6

WithConfigOverrideFunction · 0.92
CloseMethod · 0.65
GetWorkspaceForBucketMethod · 0.65

Tested by

no test coverage detected