protected async Task BuildCreationFailedAsync(Product product, BuildResponse buildEngineBuild) { ClearRecurringJob(product.Id); await SaveArtifacts(product, buildEngineBuild, false); var buildEngineEndpoint = GetBuildEngineEndpoint(product.Project.Organization); var endpointUrl = buildEngineEndpoint.IsValid() ? buildEngineEndpoint.Url : ""; var buildEngineUrl = endpointUrl + "/build-admin/view?id=" + product.WorkflowBuildId.ToString(); // If there was an errror while starting the process, then the consoleText will not be produced. var consoleTextUrl = ""; buildEngineBuild.Artifacts.TryGetValue("consoleText", out consoleTextUrl); var messageParms = new Dictionary <string, object>() { { "projectName", product.Project.Name }, { "productName", product.ProductDefinition.Name }, { "buildStatus", buildEngineBuild.Status }, { "buildError", buildEngineBuild.Error }, { "buildEngineUrl", buildEngineUrl }, { "consoleText", consoleTextUrl }, { "projectId", product.ProjectId }, { "jobId", product.WorkflowJobId }, { "buildId", product.WorkflowBuildId }, { "projectUrl", product.Project.WorkflowAppProjectUrl } }; await SendNotificationSvc.SendNotificationToOrgAdminsAndOwnerAsync(product.Project.Organization, product.Project.Owner, "buildFailedOwner", "buildFailedAdmin", messageParms, consoleTextUrl); await UpdateProductBuild(buildEngineBuild, product, false); }
public async Task CheckBuildAsync(Guid productId) { var product = await ProductRepository.Get() .Where(p => p.Id == productId) .Include(p => p.ProductDefinition) .Include(p => p.Project) .ThenInclude(pr => pr.Organization) .Include(p => p.Project) .ThenInclude(pr => pr.Owner) .FirstOrDefaultAsync(); if ((product == null) || (product.WorkflowJobId == 0)) { // Can't find the product record associated with // this process or there is no job created for this product. // Exception will trigger retry // Don't send exception because there doesn't seem to be a point in retrying var messageParms = new Dictionary <string, object>() { { "productId", productId.ToString() } }; await SendNotificationSvc.SendNotificationToSuperAdminsAsync("buildProductRecordNotFound", messageParms); ClearRecurringJob(productId); return; } // Since this is a recurring task, there is no need to throw an exception // if the link is unavailable. It will retry if (BuildEngineLinkAvailable(product.Project.Organization)) { await CheckExistingBuildAsync(product); } return; }
protected async Task BuildCompletedAsync(Product product, BuildResponse buildEngineBuild) { Log.Information($"BuildCompletedAsync: product={product.Id}, response:Id={buildEngineBuild.Id},Status={buildEngineBuild.Status},Result={buildEngineBuild.Result},Date={buildEngineBuild.Updated}"); ClearRecurringJob(product.Id); await SaveArtifacts(product, buildEngineBuild, true); var messageParms = new Dictionary <string, object>() { { "projectName", product.Project.Name }, { "productName", product.ProductDefinition.Name } }; await SendNotificationSvc.SendNotificationToUserAsync(product.Project.Owner, "buildCompletedSuccessfully", messageParms); await UpdateProductBuild(buildEngineBuild, product, true); }
public async Task CreateBuildAsync(Guid productId, Dictionary <string, object> parmsDictionary, PerformContext context) { var product = await ProductRepository.Get() .Where(p => p.Id == productId) .Include(p => p.ProductDefinition) .Include(p => p.Project) .ThenInclude(pr => pr.Organization) .Include(p => p.Project) .ThenInclude(pr => pr.Owner) .FirstOrDefaultAsync(); if ((product == null) || (product.WorkflowJobId == 0)) { // Can't find the product record associated with // this process or there is no job created for this product. // Exception will trigger retry // Don't send exception because there doesn't seem to be a point in retrying var messageParms = new Dictionary <string, object> { { "productId", productId.ToString() } }; await SendNotificationSvc.SendNotificationToSuperAdminsAsync("buildProductRecordNotFound", messageParms); return; } if (!BuildEngineLinkAvailable(product.Project.Organization)) { // If the build engine isn't available, there is no point in continuing var messageParms = new Dictionary <string, object>() { { "projectName", product.Project.Name }, { "productName", product.ProductDefinition.Name } }; await SendNotificationOnFinalRetryAsync(context, product.Project.Organization, product.Project.Owner, "buildFailedUnableToConnect", messageParms); // Throw exception to retry throw new Exception("Connection not available"); } // Clear current BuildId used by Workflow product.WorkflowBuildId = 0; await ProductRepository.UpdateAsync(product); await CreateBuildEngineBuildAsync(product, parmsDictionary, context); }
protected async Task BuildCreationFailedAsync(Product product, BuildResponse buildEngineBuild) { ClearRecurringJob(product.Id); await SaveArtifacts(product, buildEngineBuild, false); var buildEngineUrl = product.Project.Organization.BuildEngineUrl + "/build-admin/view?id=" + product.WorkflowBuildId.ToString(); var consoleTextUrl = buildEngineBuild.Artifacts["consoleText"]; var messageParms = new Dictionary <string, object>() { { "projectName", product.Project.Name }, { "productName", product.ProductDefinition.Name }, { "buildStatus", buildEngineBuild.Status }, { "buildError", buildEngineBuild.Error }, { "buildEngineUrl", buildEngineUrl }, { "consoleText", consoleTextUrl }, { "projectId", product.ProjectId }, { "jobId", product.WorkflowJobId }, { "buildId", product.WorkflowBuildId } }; await SendNotificationSvc.SendNotificationToOrgAdminsAndOwnerAsync(product.Project.Organization, product.Project.Owner, "buildFailedOwner", "buildFailedAdmin", messageParms, consoleTextUrl); await UpdateProductBuild(buildEngineBuild, product, false); }