public static async Task UploadArtifactAsync( IAsyncCommandContext context, VssConnection connection, Guid projectId, long containerId, string containerPath, int buildId, string name, string jobId, Dictionary <string, string> propertiesDictionary, string source, CancellationToken cancellationToken) { FileContainerServer fileContainerHelper = new FileContainerServer(connection, projectId, containerId, containerPath); long size = await fileContainerHelper.CopyToContainerAsync(context, source, cancellationToken); propertiesDictionary.Add(ArtifactUploadEventProperties.ArtifactSize, size.ToString()); string fileContainerFullPath = StringUtil.Format($"#/{containerId}/{containerPath}"); context.Output(StringUtil.Loc("UploadToFileContainer", source, fileContainerFullPath)); BuildServer buildHelper = new BuildServer(connection, projectId); var artifact = await buildHelper.AssociateArtifactAsync(buildId, name, jobId, ArtifactResourceTypes.Container, fileContainerFullPath, propertiesDictionary, cancellationToken); context.Output(StringUtil.Loc("AssociateArtifactWithBuild", artifact.Id, buildId)); }
public static async Task AssociateArtifactAsync( IAsyncCommandContext context, VssConnection connection, Guid projectId, int buildId, string name, string jobId, string type, string data, Dictionary <string, string> propertiesDictionary, CancellationToken cancellationToken) { BuildServer buildHelper = new BuildServer(connection, projectId); var artifact = await buildHelper.AssociateArtifactAsync(buildId, name, jobId, type, data, propertiesDictionary, cancellationToken); context.Output(StringUtil.Loc("AssociateArtifactWithBuild", artifact.Id, buildId)); }