Exemple #1
0
        /// <summary>
        /// Creates a release for the passed Project.
        /// </summary>
        /// <param name="octRepository">The repository to call against.</param>
        /// <param name="project">Project to create release for.</param>
        /// <param name="channel">Channel to create release for.</param>
        /// <param name="releaseVersion">Release version to create.</param>
        /// <param name="stepAndVersionDictionary">StepName and Version for package steps.</param>
        /// <param name="releaseNotes">Release Notes.</param>
        /// <returns>Newly Created ReleaseResource</returns>
        public static ReleaseResource CreateProjectRelease(OctopusRepository octRepository, ProjectResource project, ChannelResource channel, string releaseVersion, Dictionary <string, SemanticVersion> stepAndVersionDictionary, string releaseNotes)
        {
            var release = new ReleaseResource();
            var projectDeploymentProcess = DeploymentProcessHelper.GetDeploymentProcessFromProject(octRepository, project);
            var packageSteps             = DeploymentProcessHelper.GetPackageSteps(projectDeploymentProcess);
            var package = new List <SelectedPackage>();

            foreach (var step in packageSteps)
            {
                if (stepAndVersionDictionary.ContainsKey(step))
                {
                    package.Add(new SelectedPackage(step, stepAndVersionDictionary[step].ToString()));
                }
                else
                {
                    throw new ArgumentException(string.Format(ErrorStrings.MissingPackageStep, step), "stepAndVersionDictionary");
                }
            }
            release.ChannelId        = channel.Id;
            release.SelectedPackages = package;
            release.ReleaseNotes     = releaseNotes;
            release.Version          = releaseVersion;
            release.ProjectId        = project.Id;
            return(octRepository.Releases.Create(release));
        }
Exemple #2
0
        /// <summary>
        /// Creates a release for the passed Project.
        /// </summary>
        /// <param name="octRepository">The repository to call against.</param>
        /// <param name="project">Project to create release for.</param>
        /// <param name="releaseVersion">Release version to create.</param>
        /// <param name="releaseNotes">Release Notes.</param>
        /// <returns>Newly Created ReleaseResource</returns>
        public static ReleaseResource CreateProjectRelease(OctopusRepository octRepository, ProjectResource project, string releaseVersion, string releaseNotes)
        {
            var release = new ReleaseResource();
            var projectDeploymentProcess = DeploymentProcessHelper.GetDeploymentProcessFromProject(octRepository, project);

            release.ReleaseNotes = releaseNotes;
            release.Version      = releaseVersion;
            release.ProjectId    = project.Id;
            return(octRepository.Releases.Create(release));
        }
Exemple #3
0
        /// <summary>
        /// Creates a dummy release and deletes it on the passed Project for deployment process updating.
        /// This is an old way of doing it.  Its been replaced by updating the SQL database: https://g.rrrather.com/img/q/31410a.jpg
        /// </summary>
        /// <param name="octRepository">The repository to call against.</param>
        /// <param name="project">Project to create dummy release.</param>
        public static void CreateDeleteDummyReleaseForProject(OctopusRepository octRepository, ProjectResource project)
        {
            var release = new ReleaseResource();
            var projectDeploymentProcess = DeploymentProcessHelper.GetDeploymentProcessFromProject(octRepository, project);
            var packageSteps             = DeploymentProcessHelper.GetPackageSteps(projectDeploymentProcess);
            var package = new List <SelectedPackage>();

            foreach (var step in packageSteps)
            {
                package.Add(new SelectedPackage(step, ResourceStrings.DummyPackageVersion));
            }
            release.SelectedPackages = package;
            release.ReleaseNotes     = ResourceStrings.DummyPackageVersion;
            release.Version          = ResourceStrings.DummyReleaseVersion;
            release.ProjectId        = project.Id;
            var dummyRelease = octRepository.Releases.Create(release);

            DeleteRelease(octRepository, dummyRelease);
        }