public static async Task <string> DownloadAndImportAsync(IVsoConnectionInfo connectionInfo, ILogSink logger, string teamProject, string buildNumber, string buildDefinitionName, IOperationExecutionContext context, string artifactName) { var downloader = new ArtifactDownloader(connectionInfo, logger); using (var artifact = await downloader.DownloadAsync(teamProject, buildNumber, buildDefinitionName, artifactName).ConfigureAwait(false)) { logger.LogInformation("Downloading artifact file from VSO and importing into BuildMaster artifact library..."); var shim = new BuildMasterContextShim(context); await SDK.CreateArtifactAsync( applicationId : shim.ApplicationId, releaseNumber : shim.ReleaseNumber, buildNumber : shim.BuildNumber, deployableId : shim.DeployableId, executionId : null, artifactName : artifact.Name, artifactData : artifact.Content, overwrite : true ).ConfigureAwait(false); logger.LogInformation($"{artifact.Name} artifact imported."); return(artifact.BuildNumber); } }
public JenkinsArtifactImporter(IJenkinsConnectionInfo connectionInfo, ILogSink logger, IOperationExecutionContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } var shim = new BuildMasterContextShim(context); if (shim.ApplicationId == null) { throw new InvalidOperationException("context requires a valid application ID"); } this.ConnectionInfo = connectionInfo ?? throw new ArgumentNullException(nameof(connectionInfo)); this.Logger = logger ?? throw new ArgumentNullException(nameof(logger)); this.Context = shim; }
public JenkinsArtifactImporter(string username, SecureString password, string serverUrl, bool csrfProtectionEnabled, ILogSink logger, IOperationExecutionContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } var shim = new BuildMasterContextShim(context); if (shim.ApplicationId == null) { throw new InvalidOperationException("context requires a valid application ID"); } this.username = username; this.password = password; this.serverUrl = serverUrl; this.csrfProtectionEnabled = csrfProtectionEnabled; this.Logger = logger ?? throw new ArgumentNullException(nameof(logger)); this.Context = shim; }