internal FileShareProvider(AgentTaskPluginExecutionContext context, VssConnection connection, CallbackAppTraceSource tracer, IDedupManifestArtifactClientFactory factory) { this.factory = factory; this.context = context; this.tracer = tracer; this.connection = connection; }
// Upload from target path to VSTS BlobStore service through BuildDropManager, then associate it with the build internal async Task UploadAsync( AgentTaskPluginExecutionContext context, Guid projectId, int buildId, string name, string source, CancellationToken cancellationToken) { VssConnection connection = context.VssConnection; // 1) upload pipeline artifact to VSTS BlobStore 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, 16 * Environment.ProcessorCount); var BuildDropManager = new BuildDropManager(client, tracer); var result = await BuildDropManager.PublishAsync(source, cancellationToken); // 2) associate the pipeline artifact with an build artifact BuildServer buildHelper = new BuildServer(connection); Dictionary <string, string> propertiesDictionary = new Dictionary <string, string>(); propertiesDictionary.Add(RootId, result.RootId.ValueString); propertiesDictionary.Add(ProofNodes, StringUtil.ConvertToJson(result.ProofNodes.ToArray())); var artifact = await buildHelper.AssociateArtifact(projectId, buildId, name, ArtifactResourceTypes.PipelineArtifact, result.ManifestId.ValueString, propertiesDictionary, cancellationToken); context.Output(StringUtil.Loc("AssociateArtifactWithBuild", artifact.Id, buildId)); }
// 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); }
public static DedupManifestArtifactClient CreateDedupManifestClient(AgentTaskPluginExecutionContext context, VssConnection connection, out BlobStoreClientTelemetry telemetry) { var dedupStoreHttpClient = connection.GetClient <DedupStoreHttpClient>(); var tracer = new CallbackAppTraceSource(str => context.Output(str), SourceLevels.Information); dedupStoreHttpClient.SetTracer(tracer); var client = new DedupStoreClientWithDataport(dedupStoreHttpClient, PipelineArtifactProvider.GetDedupStoreClientMaxParallelism(context)); return(new DedupManifestArtifactClient(telemetry = new BlobStoreClientTelemetry(tracer, dedupStoreHttpClient.BaseAddress), client, tracer)); }
public PipelineArtifactProvider(AgentTaskPluginExecutionContext context, VssConnection connection, CallbackAppTraceSource tracer) { var dedupStoreHttpClient = connection.GetClient <DedupStoreHttpClient>(); this.tracer = tracer; dedupStoreHttpClient.SetTracer(tracer); var client = new DedupStoreClientWithDataport(dedupStoreHttpClient, 16 * Environment.ProcessorCount); buildDropManager = new BuildDropManager(client, this.tracer); }
private BuildDropManager CreateBulidDropManager(AgentTaskPluginExecutionContext context, VssConnection connection) { var dedupStoreHttpClient = connection.GetClient <DedupStoreHttpClient>(); var tracer = new CallbackAppTraceSource(str => context.Output(str), System.Diagnostics.SourceLevels.Information); dedupStoreHttpClient.SetTracer(tracer); var client = new DedupStoreClientWithDataport(dedupStoreHttpClient, 16 * Environment.ProcessorCount); var buildDropManager = new BuildDropManager(client, tracer); return(buildDropManager); }
public PipelineArtifactProvider(AgentTaskPluginExecutionContext context, VssConnection connection, CallbackAppTraceSource tracer) { var dedupStoreHttpClient = connection.GetClient <DedupStoreHttpClient>(); this.tracer = tracer; dedupStoreHttpClient.SetTracer(tracer); int parallelism = GetDedupStoreClientMaxParallelism(context); var client = new DedupStoreClientWithDataport(dedupStoreHttpClient, parallelism); dedupManifestArtifactClient = new DedupManifestArtifactClient(client, this.tracer); }
public static DedupManifestArtifactClient CreateDedupManifestClient(AgentTaskPluginExecutionContext context, VssConnection connection) { var dedupStoreHttpClient = connection.GetClient <DedupStoreHttpClient>(); var tracer = new CallbackAppTraceSource(str => context.Output(str), SourceLevels.Information); dedupStoreHttpClient.SetTracer(tracer); var client = new DedupStoreClientWithDataport(dedupStoreHttpClient, DedupStoreClientMaxParallelism); var dedupManifestClient = new DedupManifestArtifactClient(client, tracer); return(dedupManifestClient); }
private PipelineCacheClient CreateClient( AgentTaskPluginExecutionContext context, VssConnection connection) { var tracer = new CallbackAppTraceSource(str => context.Output(str), System.Diagnostics.SourceLevels.Information); IClock clock = UtcClock.Instance; var pipelineCacheHttpClient = connection.GetClient <PipelineCacheHttpClient>(); var pipelineCacheClient = new PipelineCacheClient(pipelineCacheHttpClient, clock, tracer); return(pipelineCacheClient); }
private IBlobStoreHttpClient CreateArtifactsClient(VssConnection connection, CancellationToken cancellationToken) { var tracer = new CallbackAppTraceSource(str => Trace.Info(str), System.Diagnostics.SourceLevels.Information); ArtifactHttpClientFactory factory = new ArtifactHttpClientFactory( connection.Credentials, TimeSpan.FromSeconds(50), tracer, default(CancellationToken)); return(factory.CreateVssHttpClient <IBlobStoreHttpClient, BlobStore2HttpClient>(connection.GetClient <BlobStore2HttpClient>().BaseAddress)); }
public DedupManifestArtifactClient CreateDedupManifestClient(AgentTaskPluginExecutionContext context, VssConnection connection, CancellationToken cancellationToken, out BlobStoreClientTelemetry telemetry) { var tracer = new CallbackAppTraceSource(str => context.Output(str), SourceLevels.Information); ArtifactHttpClientFactory factory = new ArtifactHttpClientFactory( connection.Credentials, TimeSpan.FromSeconds(50), tracer, cancellationToken); var dedupStoreHttpClient = factory.CreateVssHttpClient <IDedupStoreHttpClient, DedupStoreHttpClient>(connection.GetClient <DedupStoreHttpClient>().BaseAddress); var client = new DedupStoreClientWithDataport(dedupStoreHttpClient, PipelineArtifactProvider.GetDedupStoreClientMaxParallelism(context)); return(new DedupManifestArtifactClient(telemetry = new BlobStoreClientTelemetry(tracer, dedupStoreHttpClient.BaseAddress), client, tracer)); }
public FileShareProvider(AgentTaskPluginExecutionContext context, VssConnection connection, CallbackAppTraceSource tracer) : this(context, connection, tracer, DedupManifestArtifactClientFactory.Instance) { }
public FileShareProvider(AgentTaskPluginExecutionContext context, CallbackAppTraceSource tracer) { this.context = context; this.tracer = tracer; this.hostType = context.Variables.GetValueOrDefault("system.hosttype")?.Value; }
public ArtifactProviderFactory(AgentTaskPluginExecutionContext context, VssConnection connection, CallbackAppTraceSource tracer) { pipelineArtifactProvider = new PipelineArtifactProvider(context, connection, tracer); fileContainerProvider = new FileContainerProvider(connection, tracer); }
public Task RunAsync(AgentTaskPluginExecutionContext context, CancellationToken token) { this.tracer = new CallbackAppTraceSource(str => context.Output(str), System.Diagnostics.SourceLevels.Information); return(this.ProcessCommandInternalAsync(context, token)); }
private CallbackAppTraceSource CreateTracer(AgentTaskPluginExecutionContext context) { var tracer = new CallbackAppTraceSource(str => context.Output(str), System.Diagnostics.SourceLevels.Information); return(tracer); }
public FileContainerProvider(VssConnection connection, CallbackAppTraceSource tracer) { containerClient = connection.GetClient <FileContainerHttpClient>(); this.tracer = tracer; }