コード例 #1
0
        /// <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));
        }
コード例 #2
0
        /// <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));
        }
コード例 #3
0
        private static async Task <IIpcResult> AddDropItemsAsync(DropDaemon daemon, IEnumerable <DropItemForBuildXLFile> dropItems)
        {
            (IEnumerable <DropItemForBuildXLFile> dedupedDropItems, string error) = DedupeDropItems(dropItems);

            if (error != null)
            {
                return(new IpcResult(IpcResultStatus.ExecutionError, error));
            }

            var ipcResultTasks = dedupedDropItems.Select(d => daemon.AddFileAsync(d)).ToArray();
            var ipcResults     = await TaskUtilities.SafeWhenAll(ipcResultTasks);

            return(IpcResult.Merge(ipcResults));
        }