Skip to content

Commit fc28049

Browse files
committed
Add per-deployment GraphQL retry in release phase
The release phase runs 8+ deployments in parallel via runNamedParallel, which can overwhelm the Dagger engine and cause transient GraphQL errors. Wrap each deployment with withDeployRetry (2 retries) so individual failures are retried without rerunning the entire pipeline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c522cb0 commit fc28049

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

.dagger/src/index-release-helpers.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,26 @@ type DeployTask = {
129129
deploy: () => Promise<string>;
130130
};
131131

132+
async function withDeployRetry(
133+
name: string,
134+
fn: () => Promise<string>,
135+
maxRetries = 2,
136+
): Promise<string> {
137+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
138+
try {
139+
return await fn();
140+
} catch (error) {
141+
const msg = error instanceof Error ? error.message : String(error);
142+
const isGraphqlError = msg.includes("unknown error while requesting data via graphql");
143+
if (!isGraphqlError || attempt === maxRetries) {
144+
throw error;
145+
}
146+
console.log(`⟳ ${name}: graphql error on attempt ${String(attempt + 1)}, retrying...`);
147+
}
148+
}
149+
throw new Error("unreachable");
150+
}
151+
132152
export async function runAppDeployments(
133153
options: ReleasePhaseOptions,
134154
): Promise<{ outputs: string[]; errors: string[]; appVersions: Record<string, string> }> {
@@ -204,10 +224,10 @@ export async function runAppDeployments(
204224
}
205225
}
206226

207-
// Run all deployment tasks in parallel
227+
// Run all deployment tasks in parallel, with per-task GraphQL error retry
208228
const results = await runNamedParallel(tasks.map(t => ({
209229
name: t.name,
210-
operation: t.deploy,
230+
operation: () => withDeployRetry(t.name, t.deploy),
211231
})));
212232

213233
// Collect results and build appVersions from SUCCESSFUL deployments only

0 commit comments

Comments
 (0)