From 735c6b60f4d68a24f1c3d21955ce39887c4383f4 Mon Sep 17 00:00:00 2001 From: Vigneshraj Sekar Babu Date: Wed, 22 Oct 2025 18:29:12 -0700 Subject: [PATCH] exclude static envs from failed deploys check if we redeploy all components in a static env with a single failures, in large static env with 100+ services, this can trigger a herd. for static env, since we usually have separate repos for envs and the components are deployed on default branch merges we do not need this --- src/server/services/github.ts | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/server/services/github.ts b/src/server/services/github.ts index 50845508..1f29d929 100644 --- a/src/server/services/github.ts +++ b/src/server/services/github.ts @@ -333,22 +333,26 @@ export default class GithubService extends Service { if (!buildId) { logger.error(`[BUILD ${build?.uuid}][handlePushWebhook][buidIdError] No build ID found for this build!`); } + // Only check for failed deploys on PR environments, not static environments + let hasFailedDeploys = false; + if (!build.isStatic) { + const failedDeploys = await models.Deploy.query() + .where('buildId', buildId) + .where('active', true) + .whereIn('status', [DeployStatus.ERROR, DeployStatus.BUILD_FAILED, DeployStatus.DEPLOY_FAILED]); + + hasFailedDeploys = failedDeploys.length > 0; + + if (hasFailedDeploys) { + logger.info( + `[BUILD ${build?.uuid}] Detected ${failedDeploys.length} failed deploy(s). Triggering full redeploy for push on repo: ${repoName} branch: ${branchName}` + ); + } + } - // Check if any deploys for this build have failed previously - const failedDeploys = await models.Deploy.query() - .where('buildId', buildId) - .where('active', true) - .whereIn('status', [DeployStatus.ERROR, DeployStatus.BUILD_FAILED, DeployStatus.DEPLOY_FAILED]); - - const hasFailedDeploys = failedDeploys.length > 0; - - logger.info( - `[BUILD ${build?.uuid}] ${ - hasFailedDeploys - ? `Detected ${failedDeploys.length} failed deploy(s). Triggering full redeploy` - : 'Deploying build' - } for push on repo: ${repoName} branch: ${branchName}` - ); + if (!hasFailedDeploys) { + logger.info(`[BUILD ${build?.uuid}] Deploying build for push on repo: ${repoName} branch: ${branchName}`); + } await this.db.services.BuildService.resolveAndDeployBuildQueue.add('resolve-deploy', { buildId,