public async Task <ActionResult> ResendDeploymentNotification( [FromForm(Name = "deploymentId")] Guid deploymentId ) { var deployment = await _deploymentService.GetDeployment(deploymentId); await _deploymentNotificationService.CreateNotification(deployment); return(Ok()); }
public async Task <Deployment> AddDeployment( Application application, ApplicationImage image, string newTag, DeploymentType type = DeploymentType.ImageUpdate, string instanceId = "", IReadOnlyDictionary <string, string>?parameters = null) { var currentTagInStore = await _applicationImageInstanceService.GetCurrentTag(application, image, instanceId); var currentTag = currentTagInStore.available ? currentTagInStore.tag : ""; var deployments = _deploymentsDbContextConfigurator.Set <Dao.Deployment>(); var deploymentExists = await IsDeploymentPresent( application, image, newTag, type, instanceId ); if (deploymentExists) { _log.LogInformation( "Image tag update operation already in queue for '{Repository}' with {Tag} for application {Application} with new tag {NewTag}", image.Repository, currentTag, application.Name, newTag ); throw new Exception($"Deployment for {image} with {newTag} on application '{application.Name}' already exists."); } var entity = await CreateAndStoreDeploymentDao( deployments, application, image, type == DeploymentType.ImageUpdate?DaoDeploymentType.ImageUpdate : DaoDeploymentType.PreviewRelease, newTag, currentTag, string.Empty, instanceId, parameters ); _log.LogInformation( "Adding image tag update operation for '{Repository}' with {Tag} for application {Application} with new tag {NewTag}", image.Repository, currentTag, application.Name, newTag ); await _deploymentsDbContextConfigurator.SaveChangesAsync(); var deployment = entity.Entity.ConvertToDeploymentModel(); await _deploymentNotificationService.CreateNotification(deployment); return(deployment); }