public WebApiRelease UpdateRelease() { string projectName = ClientSampleHelpers.FindAnyProject(this.Context).Name; // Get a release client instance VssConnection connection = Context.Connection; ReleaseHttpClient releaseClient = connection.GetClient <ReleaseHttpClient>(); List <WebApiRelease> releases = releaseClient.GetReleasesAsync(project: projectName).Result; int releaseId = releases.FirstOrDefault().Id; WebApiRelease release = releaseClient.GetReleaseAsync(project: projectName, releaseId: releaseId).Result; IDictionary <string, ConfigurationVariableValue> varaibles = release.Variables; varaibles.Add( new KeyValuePair <string, ConfigurationVariableValue>("System.Debug", new ConfigurationVariableValue { AllowOverride = true, IsSecret = false, Value = "false" } ) ); // Update the release WebApiRelease updatedRelease = releaseClient.UpdateReleaseAsync(release: release, project: projectName, releaseId: releaseId).Result; Context.Log("{0} {1}", release.Id.ToString().PadLeft(6), updatedRelease.Name); return(release); }
static Release UpdateReleaseWithApprover(ReleaseHttpClient rmClient, Release release) { var releaseApproval = new ReleaseDefinitionApprovalStep(); IdentityRef identifyref = new IdentityRef(); identifyref.UniqueName = "*****@*****.**"; identifyref.Id = "8af33462-3b72-4a0f-bde1-815b1c12e64b"; releaseApproval.Approver = identifyref; releaseApproval.Rank = 1; releaseApproval.IsAutomated = false; release.Environments[1].PreApprovalsSnapshot.Approvals.Clear(); release.Environments[1].PreApprovalsSnapshot.Approvals.Add(releaseApproval); var updatedRelease = rmClient.UpdateReleaseAsync(release, projectName, release.Id).Result; return(updatedRelease); }
public async Task <Release> UpdateRelease(int id, Release release) { return(await _client.UpdateReleaseAsync(release, Credentials.PROJECT, id)); }
public virtual Release UpdateRelease(Release release, string projectId, int releaseId, ReleaseHttpClient rmClient) { return(rmClient.UpdateReleaseAsync(release, projectId, releaseId).Result); }