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()
            });
        }
예제 #2
0
        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);
        }
예제 #3
0
        static Release CreateRelease(ReleaseHttpClient rmClient, ReleaseDefinition releaseDefinition)
        {
            ReleaseStartMetadata rmMetaData = new ReleaseStartMetadata();

            rmMetaData.DefinitionId = releaseDefinition.Id;

            return(rmClient.CreateReleaseAsync(rmMetaData, project: projectName).Result);
        }
예제 #4
0
        /// <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);
        }
예제 #5
0
        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);
        }
예제 #6
0
 public virtual Release CreateRelease(ReleaseStartMetadata metadata, string projectId, ReleaseHttpClient rmClient)
 {
     return(rmClient.CreateReleaseAsync(metadata, projectId).Result);
 }