public void CreateRelease()
        {
            ReleaseModel       releaseModel       = new ReleaseModel();
            ReleaseStatusModel releaseStatusModel = new ReleaseStatusModel();
            String             releaseName        = Request.Params["releaseName"];
            String             month   = Request.Params["month"];
            String             year    = Request.Params["year"];
            String             appName = Request.Params["applicationName"];
            int    day           = Convert.ToInt32(Request.Params["day"]);
            String releaseStatus = Request.Params["releaseStatus"];
            String Impacts       = Request.Params["Impacts"];
            String TFS_Url       = Request.Params["TFS_Url"];

            if (releaseName != null && month != null && year != null && appName != null)
            {
                releaseModel.Release_Name   = releaseName;
                releaseModel.Application_Id = Convert.ToInt32(appName);
                Releases releases = new Releases();
                releaseStatusModel.Month          = month;
                releaseStatusModel.Year           = year;
                releaseStatusModel.day            = day;
                releaseStatusModel.Release_Status = releaseStatus;
                releaseStatusModel.Impacts        = Impacts;
                releaseStatusModel.TFS_Url        = TFS_Url;
                releases.createRelease(releaseModel, releaseStatusModel);
                Response.Write(releaseName + month + year + appName);
            }
        }
Beispiel #2
0
 public DeployedRelease(ReleaseModel release, DeploymentModel deployment)
 {
     ReleaseId    = release.Id;
     DeploymentId = deployment.Id;
     Version      = release.Version;
     Created      = release.Created;
     DeployedAt   = deployment.DeployedAt;
 }
 public static SquirrelMacResponse ToSquirrelMac(this ReleaseModel release)
 => new SquirrelMacResponse
 {
     Date = release.Date,
     DownloadFolderUri = new Uri(release.UpdateDownloadUrl, UriKind.Absolute),
     Name  = release.Version,
     Notes = release.Notes
 };
Beispiel #4
0
        public void TagNameNoNull()
        {
            var releaseModel = new ReleaseModel {
                TagName = null
            };

            Assert.AreEqual(string.Empty, releaseModel.TagName);
        }
Beispiel #5
0
 public ActionResult UpdateRelease([Bind(Include = "TransID,CurrentRelease")] ReleaseModel rm)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rm).State = EntityState.Modified;
         db.SaveChanges();
     }
     return(View("UpdateReleaseSuccess"));
 }
        //public JsonResult GetRelease(int releaseId)
        //{
        //    ReleaseModel releaseModel = new ReleaseModel();
        //    Releases releases = new Releases();
        //    return Json(releases.getReleaseModel(releaseModel));
        //}
        public void DeleteRelease(int releaseId)
        {
            ReleaseModel releaseModel = new ReleaseModel();

            releaseModel.Release_Id = releaseId;
            Releases releases = new Releases();

            releases.deleteRelease(releaseModel);
        }
Beispiel #7
0
        private void GatherDefects(ReleaseModel release) //todo refactor...
        {
            if (release.Id == null)
            {
                return;
            }

            DefectGeneratedInput = "";
            if (_currentDefects != null)
            {
                _currentDefects.Clear();
            }

            var a = _releaseDefectResults.Data.Where(x => x.Release.Id != null && x.Release.Id == release.Id);

            foreach (var defect in a)
            {
                if ((_applicationType == "developer" && defect.WorkflowStep.Name != "Development Complete") || (_applicationType == "tester" &&
                                                                                                                (defect.WorkflowStep.Name != "Failed Testing" && defect.WorkflowStep.Name != "Passed Testing")))
                {
                    continue;
                }

                var priority = defect.Priority.Name;
                if (priority != null && priority.Split('-').Length > 1)
                {
                    priority = " - " + priority.Split('-')[1];
                }
                else
                {
                    priority = "";
                }

                var extra = "";

                switch (defect.WorkflowStep.Name)
                {
                case "Passed Testing":
                    extra = "<strong style='color:green;'>Passed Testing: </strong>";
                    break;

                case "Failed Testing":
                    extra = "<strong style='color:red;'>Failed Testing: </strong>";
                    break;
                }

                if (_currentDefects != null)
                {
                    _currentDefects.Add(new ReleaseDefectModel {
                        Content = extra + defect.Number + priority + " - " + defect.Name
                    });
                }

                DefectGeneratedInput += defect.WorkflowStep.Name + ": " + defect.Number + priority + " - " + defect.Name + "\n";
            }
        }
        public void UpdateRelease(String releaseName, String month, int year, int applicationId, int releaseId)
        {
            ReleaseModel releaseModel = new ReleaseModel();

            releaseModel.Application_Id = applicationId;
            releaseModel.Release_Name   = releaseName;
            releaseModel.Release_Id     = releaseId;
            Releases releases = new Releases();

            releases.updateRelease(releaseModel);
        }
Beispiel #9
0
        public ActionResult UpdateRelease()
        {
            ReleaseModel rm = db.CurrentRelease.First();

            if (rm == null)
            {
                return(HttpNotFound());
            }

            return(View(rm));
        }
        public PluginViewModel(
            EPlugin plugin,
            Package package,
            ReleaseModel releaseModel,
            ITaskService taskService,
            string installPath)
        {
            _taskService = taskService;
            Plugin       = plugin;

            InstallPath  = installPath;
            ReleaseModel = releaseModel;
            Package      = package;

            Name        = package.Name;
            Description = package.Description;

            InstallCommand = ReactiveCommand.Create(InstallAsync,
                                                    this.WhenAnyValue(x => x.IsBusy, x => x.ReleaseModel,
                                                                      (busy, model) => !busy && model != null));
            OpenCommand   = ReactiveCommand.Create(OpenAsync);
            RemoveCommand = ReactiveCommand.Create(RemoveAsync);


            this.WhenAnyValue(x => x.Status).Subscribe(status =>
            {
                switch (status)
                {
                case EPluginStatus.NotInstalled:
                    IsOpenEnabled  = false;
                    IsNotInstalled = true;
                    Label          = "Install";
                    break;

                case EPluginStatus.Outdated:
                    IsOpenEnabled  = true;
                    IsNotInstalled = false;
                    Label          = "Update";
                    break;

                case EPluginStatus.Latest:
                    IsOpenEnabled  = true;
                    IsNotInstalled = false;
                    Label          = "Repair";
                    break;

                default:
                    break;
                }
            });
        }
        public static string ToSquirrelWindows(this ReleaseModel release)
        {
            var match = Regex.Match(release.ReleasesContent, ReleaseEntryPattern);

            if (match?.Success != true)
            {
                throw new ArgumentException("Invalid release content", nameof(release));
            }

            string hash = match.Groups["Hash"].Value,
                   size = match.Groups["Size"].Value;

            return(string.Concat(hash, " ", release.UpdateDownloadUrl, " ", size));
        }
Beispiel #12
0
        public async Task <ActionResult <ReleaseModel> > PostReleaseModel(ReleaseModel releaseModel)
        {
            ReleaseModel newRelease = new ReleaseModel()
            {
                Name         = releaseModel.Name,
                Project      = _context.Projects.FirstOrDefault(x => x.Id == releaseModel.Project.Id),
                AddedDate    = DateTime.Today,
                DeadlineDate = releaseModel.DeadlineDate
            };

            try
            {
                _context.Releases.Add(newRelease);
                var result = await _context.SaveChangesAsync();

                return(Ok(result));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #13
0
        public async Task <List <DeploymentModel> > GetAllDeploymentsForReleaseAsync(InstanceModel instanceModel, SpaceModel space, ProjectModel project, ReleaseModel release, Dictionary <string, EnvironmentModel> environmentDictionary, Dictionary <string, TenantModel> tenantDictionary)
        {
            var startIndex    = -10;
            var returnList    = new List <DeploymentModel>();
            var continueQuery = true;
            var client        = new RestClient(instanceModel.Url);

            while (continueQuery)
            {
                startIndex += 10;
                var request = new RestRequest($"api/{space.OctopusId}/releases/{release.OctopusId}/deployments");
                request.AddQueryParameter("skip", startIndex.ToString());
                request.AddQueryParameter("task", "10");
                request.AddHeader("X-Octopus-ApiKey", instanceModel.ApiKey);

                var response = await client.ExecuteGetAsync(request);

                var pagedModel = JsonConvert.DeserializeObject <PagedOctopusModel <DeploymentOctopusModel> >(response.Content);

                foreach (var item in pagedModel.Items)
                {
                    var deploymentRequest = new RestRequest(item.Links.Task);
                    deploymentRequest.AddHeader("X-Octopus-ApiKey", instanceModel.ApiKey);

                    var deploymentResponse = await client.ExecuteGetAsync(deploymentRequest);

                    var deploymentTaskModel = JsonConvert.DeserializeObject <DeploymentOctopusTaskModel>(deploymentResponse.Content);

                    returnList.Add(_modelConverter.ConvertFromOctopusToDeploymentModel(item, deploymentTaskModel, release.Id, environmentDictionary, tenantDictionary));
                }

                continueQuery = returnList.Count < pagedModel.TotalResults && pagedModel.Items.Count > 0;
            }

            return(returnList);
        }
Beispiel #14
0
        public async Task <DeploymentModel> GetSpecificDeployment(InstanceModel instanceModel, SpaceModel space, ReleaseModel release, string deploymentId, Dictionary <string, EnvironmentModel> environmentDictionary, Dictionary <string, TenantModel> tenantDictionary)
        {
            var client  = new RestClient(instanceModel.Url);
            var request = new RestRequest($"api/{space.OctopusId}/deployments/{deploymentId}");

            request.AddHeader("X-Octopus-ApiKey", instanceModel.ApiKey);

            var response = await client.ExecuteGetAsync(request);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                var octopusModel = JsonConvert.DeserializeObject <DeploymentOctopusModel>(response.Content);

                var deploymentRequest = new RestRequest(octopusModel.Links.Task);
                deploymentRequest.AddHeader("X-Octopus-ApiKey", instanceModel.ApiKey);

                var deploymentResponse = await client.ExecuteGetAsync(deploymentRequest);

                var deploymentTaskModel = JsonConvert.DeserializeObject <DeploymentOctopusTaskModel>(deploymentResponse.Content);

                return(_modelConverter.ConvertFromOctopusToDeploymentModel(octopusModel, deploymentTaskModel, release.Id, environmentDictionary, tenantDictionary));
            }

            return(null);
        }
        public IEnumerable <ReleaseModel> Get(long seq)
        {
            var model = new ReleaseModel();

            return(model.GetReleaseUserAccessListByUserSeq(seq));
        }
        public ReleaseModel GetReleaseDetails(long seq)
        {
            var model = new ReleaseModel();

            return(model.GetReleaseDetailsBySeq(seq));
        }
Beispiel #17
0
 public Task <ReleaseModel> Update(int projectId, int id, ReleaseModel model)
 {
     model.ProjectId = projectId;
     model.Id        = id;
     return(_repository.UpdateAsync(model));
 }
Beispiel #18
0
        public Task <ReleaseModel> Insert(int projectId, ReleaseModel model)
        {
            model.ProjectId = projectId;

            return(_repository.InsertAsync(model));
        }
Beispiel #19
0
        /// <summary>
        /// Adds a release/deployment to a project/environment specific ReleaseRetentionResult object
        /// </summary>
        /// <param name="results">The results to append to</param>
        /// <param name="project">The deployment project</param>
        /// <param name="environment">The deployment environment</param>
        /// <param name="release">The release being deployed</param>
        /// <param name="deployment">The deployment event</param>
        /// <param name="limit">An optional number of recent releases to return per project/environment</param>
        protected void RetainRelease(Dictionary <string, ReleaseRetentionResult> results, ProjectModel project, EnvironmentModel environment, ReleaseModel release, DeploymentModel deployment, int?limit = null)
        {
            string projectEnvironmentKey = release.ProjectId + deployment.EnvironmentId;

            if (results.TryGetValue(projectEnvironmentKey, out var resultSet))
            {
                if (limit != null && resultSet.Releases.Count == limit)
                {
                    _logger.LogInformation($"Discarding release {release.Id} as last release deployment {deployment.Id} occurs after the most recent {limit} deployed releases.");
                    return;
                }

                // Add this release deployment to the set for the project/environment
                resultSet.Releases.Add(new DeployedRelease(release, deployment));

                _logger.LogInformation($"Keeping release {release.Id} as deployment {deployment.Id} is a recent deployment for this project/environment configuration ({resultSet.Releases.Count}/{limit}).");
            }
            else
            {
                // Add a new project/env type
                resultSet = new ReleaseRetentionResult(project, environment);
                resultSet.Releases.Add(new DeployedRelease(release, deployment));
                results.Add(projectEnvironmentKey, resultSet);

                _logger.LogInformation($"Keeping release {release.Id} as deployment {deployment.Id} is the most recent deployment for this project/environment configuration  (1/{limit}).");
            }
        }
Beispiel #20
0
        private async Task ProcessDeploymentsForProjectsRelease(SyncJobCompositeModel syncJobCompositeModel, SpaceModel space, ProjectModel project, ReleaseModel releaseModel)
        {
            await LogInformation($"Getting all the deployments for {syncJobCompositeModel.InstanceModel.Name}:{space.Name}:{project.Name}:{releaseModel.Version}", syncJobCompositeModel);

            var octopusList = await _octopusRepository.GetAllDeploymentsForReleaseAsync(syncJobCompositeModel.InstanceModel, space, project, releaseModel, syncJobCompositeModel.EnvironmentDictionary, syncJobCompositeModel.TenantDictionary);

            await LogInformation($"{octopusList.Count} deployments(s) found in {syncJobCompositeModel.InstanceModel.Name}:{space.Name}:{project.Name}:{releaseModel.Version}", syncJobCompositeModel);

            foreach (var item in octopusList)
            {
                await LogInformation($"Checking to see if deployment {item.OctopusId}:{item.Name} already exists", syncJobCompositeModel);

                var itemModel = await _deploymentRepository.GetByOctopusIdAsync(item.OctopusId, releaseModel.Id);
                await LogInformation($"{(itemModel != null ? "Deployment already exists, updating" : "Unable to find deployment, creating")}", syncJobCompositeModel);

                item.Id = itemModel?.Id ?? 0;

                await LogInformation($"Saving deployment {item.OctopusId}:{item.Name} to the database", syncJobCompositeModel);

                var modelToTrack = item.Id > 0 ? await _deploymentRepository.UpdateAsync(item) : await _deploymentRepository.InsertAsync(item);
            }
        }