/// <summary> /// Generates and uploads the Manifest.json on the master using all file hashes computed and stored /// by workers using <see cref="VsoClient.RegisterFilesForBuildManifestAsync"/> for the given drop. /// Should be called only when DropConfig.EnableBuildManifestCreation is true. /// </summary> public async static Task <IIpcResult> GenerateAndUploadBuildManifestFileAsync(DropDaemon daemon) { Contract.Requires(daemon.DropConfig.EnableBuildManifestCreation == true, "GenerateBuildManifestData API called even though Build Manifest Generation is Disabled in DropConfig"); var bxlResult = await daemon.ApiClient.GenerateBuildManifestData( daemon.DropName, daemon.DropConfig.Repo, daemon.DropConfig.Branch, daemon.DropConfig.CommitId, daemon.DropConfig.CloudBuildId); if (!bxlResult.Succeeded) { return(new IpcResult(IpcResultStatus.ExecutionError, $"GenerateBuildManifestData API call failed for Drop: {daemon.DropName}. Failure: {bxlResult.Failure}")); } string localFilePath; string buildManifestJsonStr = BuildManifestData.GenerateBuildManifestJsonString(bxlResult.Result); try { localFilePath = Path.GetTempFileName(); System.IO.File.WriteAllText(localFilePath, buildManifestJsonStr); } catch (Exception ex) { return(new IpcResult(IpcResultStatus.ExecutionError, $"Exception while trying to store Build Manifest locally before drop upload: {ex}")); } var dropItem = new DropItemForFile(localFilePath, relativeDropPath: DropBuildManifestPath); return(await daemon.AddFileAsync(dropItem)); }
/// <summary> /// Uploads the bsi.json for the given drop. /// Should be called only when DropConfig.EnableBuildManifestCreation is true. /// </summary> public async static Task <IIpcResult> UploadBsiFileAsync(DropDaemon daemon) { Contract.Requires(daemon.DropConfig.EnableBuildManifestCreation == true, "GenerateBuildManifestData API called even though Build Manifest Generation is Disabled in DropConfig"); if (!System.IO.File.Exists(daemon.DropConfig.BsiFileLocation)) { return(new IpcResult(IpcResultStatus.ExecutionError, $"BuildSessionInfo not found at provided BsiFileLocation: '{daemon.DropConfig.BsiFileLocation}'")); } var bsiDropItem = new DropItemForFile(daemon.DropConfig.BsiFileLocation, relativeDropPath: DropBsiPath); return(await daemon.AddFileAsync(bsiDropItem)); }
private async Task <FileBlobDescriptor> ComputeFileBlobDescriptorForUploadAsync(bool chunkDedup, CancellationToken cancellationToken) { FileInfo fileInfo = await m_dropItem.EnsureMaterialized(); if (m_dropItem.BlobIdentifier != null) { #if DEBUG // in debug builds: recompute blob identifier from file and assert it's the same as the provided one await DropItemForFile.ComputeAndDoubleCheckBlobIdentifierAsync(m_dropItem.BlobIdentifier, fileInfo.FullName, fileInfo.Length, chunkDedup, phase : "CalculateFullFileBlobDescriptor", cancellationToken : cancellationToken); #endif // avoid recomputing blob identifier from file var dropFile = new DropFile(m_dropItem.RelativeDropPath, fileInfo.Length, m_dropItem.BlobIdentifier); return(new FileBlobDescriptor(dropFile, fileInfo.FullName)); } else { return(await DropItemForFile.ComputeFileDescriptorFromFileAsync(fileInfo.FullName, chunkDedup, m_dropItem.RelativeDropPath, cancellationToken)); } }