private async Task DownloadArtifacts(
            IExecutionContext executionContext,
            Guid teamProjectId,
            string artifactsWorkingFolder,
            int releaseId)
        {
            Trace.Entering();

            ServiceEndpoint vssEndpoint = executionContext.Endpoints.FirstOrDefault(e => string.Equals(e.Name, ServiceEndpoints.SystemVssConnection, StringComparison.OrdinalIgnoreCase));

            ArgUtil.NotNull(vssEndpoint, nameof(vssEndpoint));
            ArgUtil.NotNull(vssEndpoint.Url, nameof(vssEndpoint.Url));

            Trace.Info($"Connecting to {vssEndpoint.Url}/{teamProjectId}");
            var releaseServer = new ReleaseServer(vssEndpoint.Url, ApiUtil.GetVssCredential(vssEndpoint), teamProjectId);

            // TODO: send correct cancellation token
            List <AgentArtifactDefinition> releaseArtifacts = releaseServer.GetReleaseArtifactsFromService(releaseId).ToList();
            var filteredReleaseArtifacts = FilterArtifactDefintions(releaseArtifacts);

            filteredReleaseArtifacts.ToList().ForEach(x => Trace.Info($"Found Artifact = {x.Alias} of type {x.ArtifactType}"));

            CleanUpArtifactsFolder(executionContext, artifactsWorkingFolder);
            await DownloadArtifacts(executionContext, filteredReleaseArtifacts, artifactsWorkingFolder);
        }
Exemple #2
0
        private IList <AgentArtifactDefinition> GetReleaseArtifacts(IExecutionContext executionContext)
        {
            try
            {
                var connection    = WorkerUtilities.GetVssConnection(executionContext);
                var releaseServer = new ReleaseServer(connection, TeamProjectId);

                IList <AgentArtifactDefinition> releaseArtifacts         = releaseServer.GetReleaseArtifactsFromService(ReleaseId).ToList();
                IList <AgentArtifactDefinition> filteredReleaseArtifacts = FilterArtifactDefintions(releaseArtifacts);
                filteredReleaseArtifacts.ToList().ForEach(x => Trace.Info($"Found Artifact = {x.Alias} of type {x.ArtifactType}"));
                return(filteredReleaseArtifacts);
            }
            catch (Exception ex)
            {
                LogDownloadFailureTelemetry(executionContext, ex);
                throw;
            }
        }
Exemple #3
0
        private IList <AgentArtifactDefinition> GetReleaseArtifacts(IExecutionContext executionContext)
        {
            try
            {
                ServiceEndpoint vssEndpoint = executionContext.Endpoints.FirstOrDefault(e =>
                                                                                        string.Equals(e.Name, ServiceEndpoints.SystemVssConnection, StringComparison.OrdinalIgnoreCase));
                ArgUtil.NotNull(vssEndpoint, nameof(vssEndpoint));
                ArgUtil.NotNull(vssEndpoint.Url, nameof(vssEndpoint.Url));

                Trace.Info($"Connecting to {vssEndpoint.Url}/{TeamProjectId}");
                var releaseServer = new ReleaseServer(vssEndpoint.Url, ApiUtil.GetVssCredential(vssEndpoint), TeamProjectId);

                IList <AgentArtifactDefinition> releaseArtifacts         = releaseServer.GetReleaseArtifactsFromService(ReleaseId).ToList();
                IList <AgentArtifactDefinition> filteredReleaseArtifacts = FilterArtifactDefintions(releaseArtifacts);
                filteredReleaseArtifacts.ToList().ForEach(x => Trace.Info($"Found Artifact = {x.Alias} of type {x.ArtifactType}"));
                return(releaseArtifacts);
            }
            catch (Exception ex)
            {
                LogDownloadFailureTelemetry(executionContext, ex);
                throw;
            }
        }