@@ -20,11 +20,13 @@ import (
2020)
2121
2222type virtualBuildDirectoryOptions struct {
23- directoryFetcher cas.DirectoryFetcher
24- contentAddressableStorage blobstore.BlobAccess
25- symlinkFactory virtual.SymlinkFactory
26- characterDeviceFactory virtual.CharacterDeviceFactory
27- handleAllocator virtual.StatefulHandleAllocator
23+ directoryFetcher cas.DirectoryFetcher
24+ contentAddressableStorage blobstore.BlobAccess
25+ symlinkFactory virtual.SymlinkFactory
26+ characterDeviceFactory virtual.CharacterDeviceFactory
27+ handleAllocator virtual.StatefulHandleAllocator
28+ buildDirectoryOwnerUserID uint32
29+ buildDirectoryOwnerGroupID uint32
2830}
2931
3032type virtualBuildDirectory struct {
@@ -37,15 +39,17 @@ type virtualBuildDirectory struct {
3739// input root explicitly, it calls PrepopulatedDirectory.CreateChildren
3840// to add special file and directory nodes whose contents are read on
3941// demand.
40- func NewVirtualBuildDirectory (directory virtual.PrepopulatedDirectory , directoryFetcher cas.DirectoryFetcher , contentAddressableStorage blobstore.BlobAccess , symlinkFactory virtual.SymlinkFactory , characterDeviceFactory virtual.CharacterDeviceFactory , handleAllocator virtual.StatefulHandleAllocator ) BuildDirectory {
42+ func NewVirtualBuildDirectory (directory virtual.PrepopulatedDirectory , directoryFetcher cas.DirectoryFetcher , contentAddressableStorage blobstore.BlobAccess , symlinkFactory virtual.SymlinkFactory , characterDeviceFactory virtual.CharacterDeviceFactory , handleAllocator virtual.StatefulHandleAllocator , buildDirectoryOwnerUserID , buildDirectoryOwnerGroupID uint32 ) BuildDirectory {
4143 return & virtualBuildDirectory {
4244 PrepopulatedDirectory : directory ,
4345 options : & virtualBuildDirectoryOptions {
44- directoryFetcher : directoryFetcher ,
45- contentAddressableStorage : contentAddressableStorage ,
46- symlinkFactory : symlinkFactory ,
47- characterDeviceFactory : characterDeviceFactory ,
48- handleAllocator : handleAllocator ,
46+ directoryFetcher : directoryFetcher ,
47+ contentAddressableStorage : contentAddressableStorage ,
48+ symlinkFactory : symlinkFactory ,
49+ characterDeviceFactory : characterDeviceFactory ,
50+ handleAllocator : handleAllocator ,
51+ buildDirectoryOwnerUserID : buildDirectoryOwnerUserID ,
52+ buildDirectoryOwnerGroupID : buildDirectoryOwnerGroupID ,
4953 },
5054 }
5155}
@@ -85,9 +89,8 @@ func (d *virtualBuildDirectory) InstallHooks(filePool pool.FilePool, errorLogger
8589 d .options .handleAllocator ),
8690 errorLogger ,
8791 /* defaultAttributesSetter = */ func (requested virtual.AttributesMask , attributes * virtual.Attributes ) {
88- // TODO: Do we want to provide the ability to
89- // let build directories be owned by the user
90- // running the build actions?
92+ attributes .SetOwnerUserID (d .options .buildDirectoryOwnerUserID )
93+ attributes .SetOwnerGroupID (d .options .buildDirectoryOwnerGroupID )
9194 },
9295 )
9396}
0 commit comments