public async Task DownloadSingleArtifactAsync(PipelineArtifactDownloadParameters downloadParameters, BuildArtifact buildArtifact, CancellationToken cancellationToken) { var manifestId = DedupIdentifier.Create(buildArtifact.Resource.Data); var options = DownloadPipelineArtifactOptions.CreateWithManifestId( manifestId, downloadParameters.TargetDirectory, proxyUri: null, minimatchPatterns: downloadParameters.MinimatchFilters); await buildDropManager.DownloadAsync(options, cancellationToken); }
private Task DownloadPipelineArtifacts( BuildDropManager buildDropManager, IEnumerable <BuildArtifact> buildArtifacts, string targetDirectory, string[] minimatchFilters, CancellationToken cancellationToken) { IDictionary <string, DedupIdentifier> artifactNameAndManifestId = new Dictionary <string, DedupIdentifier>(); foreach (var buildArtifact in buildArtifacts) { if (buildArtifact.Resource.Type != PipelineArtifactTypeName) { throw new ArgumentException("The artifact is not of the type Pipeline Artifact."); } artifactNameAndManifestId.Add(buildArtifact.Name, DedupIdentifier.Create(buildArtifact.Resource.Data)); } // 2) download to the target path DownloadPipelineArtifactOptions options = DownloadPipelineArtifactOptions.CreateWithMultiManifestIds( artifactNameAndManifestId, targetDirectory, proxyUri: null, minimatchPatterns: minimatchFilters); return(buildDropManager.DownloadAsync(options, cancellationToken)); }
// Download pipeline artifact from VSTS BlobStore service through BuildDropManager to a target path internal async Task DownloadAsync( AgentTaskPluginExecutionContext context, Guid projectId, int buildId, string artifactName, string targetDir, CancellationToken cancellationToken) { VssConnection connection = context.VssConnection; // 1) get manifest id from artifact data BuildServer buildHelper = new BuildServer(connection); BuildArtifact art = await buildHelper.GetArtifact(projectId, buildId, artifactName, cancellationToken); var manifestId = DedupIdentifier.Create(art.Resource.Data); // 2) download to the target path var httpclient = connection.GetClient <DedupStoreHttpClient>(); var tracer = new CallbackAppTraceSource(str => context.Output(str), System.Diagnostics.SourceLevels.Information); httpclient.SetTracer(tracer); var client = new DedupStoreClientWithDataport(httpclient, maxParallelism: 16 * Environment.ProcessorCount); var BuildDropManager = new BuildDropManager(client, tracer); await BuildDropManager.DownloadAsync(manifestId, targetDir, cancellationToken); }
private Task DownloadPipelineArtifact( BuildDropManager buildDropManager, BuildArtifact buildArtifact, string targetDirectory, string[] minimatchFilters, CancellationToken cancellationToken) { if (buildArtifact.Resource.Type != PipelineArtifactTypeName) { throw new ArgumentException("The artifact is not of the type Pipeline Artifact."); } var manifestId = DedupIdentifier.Create(buildArtifact.Resource.Data); // 2) download to the target path DownloadPipelineArtifactOptions options = DownloadPipelineArtifactOptions.CreateWithManifestId( manifestId, targetDirectory, proxyUri: null, minimatchPatterns: minimatchFilters); return(buildDropManager.DownloadAsync(options, cancellationToken)); }