public async Task <VstsRelease> CreateRelease(ReleaseHttpClient releaseClient, int releaseDefinitionId, string projectName, Dictionary <string, ConfigurationVariableValue> overrideVaraibles = null) { ReleaseStartMetadata releaseStartMetaData = new ReleaseStartMetadata(); releaseStartMetaData.DefinitionId = releaseDefinitionId; releaseStartMetaData.Description = "Release created by das-self-service"; if (overrideVaraibles != null) { // If you want to override varaibles at release create time, 'AllowOverride' on variable should be set while creating RD. // You can override environment level variables using releaseStartMetaData.EnvironmentsMetadata.Variables. releaseStartMetaData.Variables = overrideVaraibles; } // Create a release var release = await releaseClient.CreateReleaseAsync(project : projectName, releaseStartMetadata : releaseStartMetaData); return(new VstsRelease { Id = release.Id, ReleaseName = release.Name, ReleaseDefininitionId = release.ReleaseDefinitionReference.Id, ReleaseEnvironments = release.Environments.Select(x => new VstsEnvironment { DefinitionId = x.DefinitionEnvironmentId, EnvironmentReleaseId = x.Id, Name = x.Name }).ToList() }); }
public static WebApiRelease CreateRelease(ReleaseHttpClient releaseClient, int releaseDefinitionId, string projectName, Dictionary <string, ConfigurationVariableValue> overrideVaraibles = null) { BuildVersion instanceReference = new BuildVersion { Id = "2" }; ArtifactMetadata artifact = new ArtifactMetadata { Alias = "Fabrikam.CI", InstanceReference = instanceReference }; ReleaseStartMetadata releaseStartMetaData = new ReleaseStartMetadata(); releaseStartMetaData.DefinitionId = releaseDefinitionId; releaseStartMetaData.Description = "Creating Sample release"; if (overrideVaraibles != null) { // If you want to override varaibles at release create time, 'AllowOverride' on variable should be set while creating RD. // You can override environment level variables using releaseStartMetaData.EnvironmentsMetadata.Variables. releaseStartMetaData.Variables = overrideVaraibles; } releaseStartMetaData.Artifacts = new[] { artifact }; // Create a release WebApiRelease release = releaseClient.CreateReleaseAsync(project: projectName, releaseStartMetadata: releaseStartMetaData).Result; return(release); }
static Release CreateRelease(ReleaseHttpClient rmClient, ReleaseDefinition releaseDefinition) { ReleaseStartMetadata rmMetaData = new ReleaseStartMetadata(); rmMetaData.DefinitionId = releaseDefinition.Id; return(rmClient.CreateReleaseAsync(rmMetaData, project: projectName).Result); }
/// <summary> /// Create release for release definition /// </summary> /// <param name="teamProjectName"></param> /// <param name="releaseDefId"></param> /// <returns></returns> private static int CreateRelease(string teamProjectName, int releaseDefId) { ReleaseStartMetadata startMetadata = new ReleaseStartMetadata(); startMetadata.DefinitionId = releaseDefId; startMetadata.Description = "Start from command line"; var release = ReleaseClient.CreateReleaseAsync(startMetadata, teamProjectName).Result; return(release.Id); }
private static WebApiRelease CreateRelease(ReleaseHttpClient releaseClient, int releaseDefinitionId, string projectName) { BuildVersion instanceReference = new BuildVersion { Id = "2" }; ArtifactMetadata artifact = new ArtifactMetadata { Alias = "Fabrikam.CI", InstanceReference = instanceReference }; ReleaseStartMetadata releaseStartMetaData = new ReleaseStartMetadata(); releaseStartMetaData.DefinitionId = releaseDefinitionId; releaseStartMetaData.Description = "Creating Sample release"; releaseStartMetaData.Artifacts = new[] { artifact }; // Create a release WebApiRelease release = releaseClient.CreateReleaseAsync(project: projectName, releaseStartMetadata: releaseStartMetaData).Result; return(release); }
public virtual Release CreateRelease(ReleaseStartMetadata metadata, string projectId, ReleaseHttpClient rmClient) { return(rmClient.CreateReleaseAsync(metadata, projectId).Result); }