Skip to content

Commit f5f74fe

Browse files
Users/tafadnav/artifac output variable (#5133)
* Update contribute.md * Emit ResourceTypes variable with set of resource types downloaded --------- Co-authored-by: Katy DeCorah <[email protected]>
1 parent 3e9e77d commit f5f74fe

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

docs/contribute.md

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ cd ./src
3030
./dev.(sh/cmd) test # run unit tests before git commit/push
3131
```
3232

33+
To test the agent in a pipeline, follow the [self-hosted agent installation steps](https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/windows-agent?view=azure-devops). You will use the agent built from source in the `_layout` folder at the repository root to run the `config` and `run` commands.
34+
3335
## Debugging
3436

3537
The agent can be run in debug mode by providing the parameter `--debug` to the `run` command.

src/Agent.Plugins/Artifact/PipelineArtifactServer.cs

+8
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ internal async Task DownloadAsyncV2(
233233
{
234234
VssConnection connection = context.VssConnection;
235235
BuildServer buildServer = new BuildServer(connection);
236+
HashSet<string> resourceTypes = new HashSet<string>();
236237

237238
// download all pipeline artifacts if artifact name is missing
238239
if (downloadOptions == DownloadOptions.MultiDownload)
@@ -264,18 +265,21 @@ internal async Task DownloadAsyncV2(
264265

265266
if (buildArtifacts.Any())
266267
{
268+
resourceTypes.Add(PipelineArtifactConstants.Container);
267269
FileContainerProvider provider = new FileContainerProvider(connection, this.tracer);
268270
await provider.DownloadMultipleArtifactsAsync(downloadParameters, buildArtifacts, cancellationToken, context);
269271
}
270272

271273
if (pipelineArtifacts.Any())
272274
{
275+
resourceTypes.Add(PipelineArtifactConstants.PipelineArtifact);
273276
PipelineArtifactProvider provider = new PipelineArtifactProvider(context, connection, this.tracer);
274277
await provider.DownloadMultipleArtifactsAsync(downloadParameters, pipelineArtifacts, cancellationToken, context);
275278
}
276279

277280
if (fileShareArtifacts.Any())
278281
{
282+
resourceTypes.Add(PipelineArtifactConstants.FileShareArtifact);
279283
FileShareProvider provider = new FileShareProvider(context, connection, this.tracer, DedupManifestArtifactClientFactory.Instance);
280284
await provider.DownloadMultipleArtifactsAsync(downloadParameters, fileShareArtifacts, cancellationToken, context);
281285
}
@@ -306,13 +310,17 @@ internal async Task DownloadAsyncV2(
306310

307311
ArtifactProviderFactory factory = new ArtifactProviderFactory(context, connection, this.tracer);
308312
IArtifactProvider provider = factory.GetProvider(buildArtifact);
313+
resourceTypes.Add(buildArtifact.Resource.Type);
309314

310315
await provider.DownloadSingleArtifactAsync(downloadParameters, buildArtifact, cancellationToken, context);
311316
}
312317
else
313318
{
314319
throw new InvalidOperationException($"Invalid {nameof(downloadOptions)}!");
315320
}
321+
322+
// Create a variable to store the resource types of the downloaded artifacts
323+
context.SetVariable("DownloadPipelineArtifactResourceTypes", string.Join(",", resourceTypes));
316324
}
317325
}
318326

0 commit comments

Comments
 (0)