public JobStatusReportingHelper(VstsMessage vstsMessage, ILogger logger, string timelineRecordName = null) { this.vstsMessage = vstsMessage; this.logger = logger; this.timelineRecordName = timelineRecordName; this.eventProperties = this.vstsMessage.GetMessageProperties(); }
public static VstsArtifactsHelper CreateArtifactsHelper(VstsMessage vstsContext) { var buildHttpClientWrapper = new BuildClient(vstsContext.VstsUri, new VssBasicCredential(string.Empty, vstsContext.AuthToken)); var gitClient = new GitClient(vstsContext.VstsUri, new VssBasicCredential(string.Empty, vstsContext.AuthToken)); var releaseClient = new ReleaseClient(vstsContext.VstsPlanUri, new VssBasicCredential(string.Empty, vstsContext.AuthToken)); var repositoryName = vstsContext.BuildProperties != null ? vstsContext.BuildProperties.RepositoryName : string.Empty; return(new VstsArtifactsHelper(buildHttpClientWrapper, releaseClient, gitClient, vstsContext.ProjectId, repositoryName)); }
public VstsReportingHelper(VstsMessage vstsContext, IBrokerInstrumentation baseInstrumentation, IDictionary <string, string> eventProperties, string timelineRecordName = null) { this.vstsContext = vstsContext; this.baseInstrumentation = baseInstrumentation; this.timelineRecordName = timelineRecordName; this.eventProperties = this.vstsContext.GetMessageProperties().AddRange(eventProperties); this.CreateTaskHttpClient = (uri, authToken, instrumentationHelper, skipRaisePlanEvents) => TaskClientFactory.GetTaskClient(uri, authToken, instrumentationHelper, skipRaisePlanEvents); this.CreateBuildClient = (uri, authToken) => new BuildClient(uri, new VssBasicCredential(string.Empty, authToken)); this.CreateReleaseClient = (uri, authToken) => new ReleaseClient(uri, new VssBasicCredential(string.Empty, authToken)); }
internal static async Task <bool> IsSessionValid(VstsMessage vstsMessage, IBuildClient buildClient, IReleaseClient releaseClient, CancellationToken cancellationToken) { var projectId = vstsMessage.ProjectId; if (vstsMessage.VstsHub == HubType.Build) { var buildId = vstsMessage.BuildProperties.BuildId; return(await BuildClient.IsBuildValid(buildClient, projectId, buildId, cancellationToken).ConfigureAwait(false)); } if (vstsMessage.VstsHub == HubType.Release) { var releaseId = vstsMessage.ReleaseProperties.ReleaseId; return(await ReleaseClient.IsReleaseValid(releaseClient, projectId, releaseId, cancellationToken).ConfigureAwait(false)); } throw new NotSupportedException(string.Format("VstsHub {0} is not supported", vstsMessage.VstsHub)); }
public MockVstsReportingHelper(VstsMessage vstsContext) { this.VstsMessage = vstsContext; this.JobStatusReceived = new List <JobStatusEnum>(); }
protected virtual IJobStatusReportingHelper GetVstsJobStatusReportingHelper(VstsMessage vstsMessage, ILogger inst) { return(new JobStatusReportingHelper(vstsMessage, inst)); }