Skip to content

Commit 02b2ddb

Browse files
committed
Merge remote-tracking branch 'root/main' into feat_branch
2 parents 02c3171 + 271300b commit 02b2ddb

File tree

11 files changed

+111
-118
lines changed

11 files changed

+111
-118
lines changed

.config/nextest.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
[test-groups]
22
serial-integration = { max-threads = 1 }
33

4+
[profile.unit-test]
5+
build-threads = 2
6+
run-threads = 0
47

58
[[profile.default.overrides]]
69
filter = 'package(databend-meta)'
710
test-group = 'serial-integration'
811

12+
[[profile.unit-test.overrides]]
13+
filter = 'package(databend-meta)'
14+
test-group = 'serial-integration'

.github/actions/build_linux/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ runs:
7777
for artifact in ${artifacts//,/ }; do
7878
binaries="${binaries} --bin databend-$artifact"
7979
done
80-
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --profile ${{ env.BUILD_PROFILE }} ${binaries}
80+
cargo build --target ${{ inputs.target }} --features ${{ inputs.features }} --profile ${{ env.BUILD_PROFILE }} ${binaries}
8181
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-*
8282
8383
- name: Build Release for specific artifacts
@@ -87,7 +87,7 @@ runs:
8787
artifacts="${{ inputs.artifacts }}"
8888
for artifact in ${artifacts//,/ }; do
8989
echo "==> building databend-$artifact ..."
90-
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --profile ${{ env.BUILD_PROFILE }} --bin databend-$artifact
90+
cargo build --target ${{ inputs.target }} --features ${{ inputs.features }} --profile ${{ env.BUILD_PROFILE }} --bin databend-$artifact
9191
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-$artifact
9292
done
9393

.github/actions/build_macos/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ runs:
4545
run: |
4646
artifacts="${{ inputs.artifacts }}"
4747
echo "==> building libs ..."
48-
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --profile ${{ env.BUILD_PROFILE }} --lib
48+
cargo build --target ${{ inputs.target }} --profile ${{ env.BUILD_PROFILE }} --lib
4949
for artifact in ${artifacts//,/ }; do
5050
echo "==> building databend-$artifact ..."
51-
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --profile ${{ env.BUILD_PROFILE }} --bin databend-$artifact
51+
cargo build --target ${{ inputs.target }} --profile ${{ env.BUILD_PROFILE }} --bin databend-$artifact
5252
done
5353
5454
- name: Upload artifact

.github/actions/check/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ runs:
4040
4141
- name: Clippy
4242
shell: bash
43-
run: cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps clippy --workspace --all-targets --all-features -- -D warnings
43+
run: cargo clippy --workspace --all-targets --all-features -- -D warnings

.github/actions/test_unit/action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ runs:
1818

1919
- shell: bash
2020
run: |
21-
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps nextest run --no-fail-fast --hide-progress-bar
21+
cargo nextest run --profile unit-test --no-fail-fast --hide-progress-bar
2222
grep ' Compiled in ' target/sccache.log || true
2323
env:
24-
RUST_TEST_THREADS: 4
2524
RUST_LOG: ERROR
2625
# 1GiB
2726
# RUST_MIN_STACK: 1073741824

.github/scripts/retry_failed_jobs.js

Lines changed: 20 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -317,44 +317,19 @@ async function findExistingRetryComment(github, context, core, pr) {
317317
}
318318
}
319319

320-
async function getRetryCountFromAPI(github, context, core, workflowRun) {
321-
try {
322-
// Get workflow runs for the same branch/commit
323-
const { data: workflowRuns } = await github.rest.actions.listWorkflowRuns({
324-
owner: context.repo.owner,
325-
repo: context.repo.repo,
326-
workflow_id: workflowRun.workflow_id,
327-
branch: workflowRun.head_branch,
328-
per_page: 100
329-
});
330-
331-
// Count runs that were retries (have the same head_sha)
332-
let retryCount = 0;
333-
const currentSha = workflowRun.head_sha;
334-
335-
for (const run of workflowRuns.workflow_runs) {
336-
if (run.head_sha === currentSha && run.id !== workflowRun.id) {
337-
// This is a previous run with the same commit SHA
338-
retryCount++;
339-
}
340-
}
341-
342-
core.info(`Found ${retryCount} previous workflow runs for the same commit`);
343-
return retryCount;
344-
} catch (error) {
345-
core.warning(`Failed to get retry count from API: ${error.message}`);
320+
function getCurrentRetryCount(workflowRun) {
321+
if (!workflowRun || typeof workflowRun.run_attempt !== 'number') {
346322
return 0;
347323
}
324+
return Math.max(0, workflowRun.run_attempt - 1);
348325
}
349326

350-
async function addCommentToPR(github, context, core, runID, runURL, jobData, priorityCancelled, maxRetriesReached = false) {
327+
async function addCommentToPR(github, context, core, workflowRun, runURL, jobData, priorityCancelled, maxRetriesReached = false) {
351328
try {
352-
// Get workflow run to find the branch
353-
const { data: workflowRun } = await github.rest.actions.getWorkflowRun({
354-
owner: context.repo.owner,
355-
repo: context.repo.repo,
356-
run_id: runID
357-
});
329+
const runID = workflowRun.id;
330+
const currentRetryCount = getCurrentRetryCount(workflowRun);
331+
const newRetryCount = jobData.retryableJobsCount > 0 ? currentRetryCount + 1 : currentRetryCount;
332+
const displayRunURL = runURL || workflowRun.html_url;
358333

359334
// Find related PR
360335
const pr = await findRelatedPR(github, context, core, workflowRun);
@@ -367,10 +342,6 @@ async function addCommentToPR(github, context, core, runID, runURL, jobData, pri
367342
// Try to find existing retry comment
368343
const existingComment = await findExistingRetryComment(github, context, core, pr);
369344

370-
// Get current retry count from API
371-
const currentRetryCount = await getRetryCountFromAPI(github, context, core, workflowRun);
372-
const newRetryCount = jobData.retryableJobsCount > 0 ? currentRetryCount + 1 : currentRetryCount;
373-
374345
// Build title with retry count
375346
const titleSuffix = newRetryCount > 0 ? ` (Retry ${newRetryCount})` : '';
376347

@@ -383,17 +354,17 @@ async function addCommentToPR(github, context, core, runID, runURL, jobData, pri
383354
// Simplified comment for priority cancelled workflow
384355
comment = `${TITLE}${titleSuffix}
385356
386-
> **Workflow:** [\`${runID}\`](${runURL})
357+
> **Workflow:** [\`${runID}\`](${displayRunURL})
387358
388359
### ⛔️ **CANCELLED**
389360
Higher priority request detected - retry cancelled to avoid conflicts.
390361
391-
[View Workflow](${runURL})`;
362+
[View Workflow](${displayRunURL})`;
392363
} else if (maxRetriesReached) {
393364
// Comment for when max retries reached
394365
comment = `${TITLE}${titleSuffix}
395366
396-
> **Workflow:** [\`${runID}\`](${runURL})
367+
> **Workflow:** [\`${runID}\`](${displayRunURL})
397368
398369
### 📊 Summary
399370
- **Total Jobs:** ${jobData.totalJobs}
@@ -404,7 +375,7 @@ Higher priority request detected - retry cancelled to avoid conflicts.
404375
### 🚫 **MAX RETRIES REACHED**
405376
Maximum retry count (3) has been reached. Manual intervention required.
406377
407-
[View Workflow](${runURL})`;
378+
[View Workflow](${displayRunURL})`;
408379

409380
comment += `
410381
@@ -440,7 +411,7 @@ Automated analysis using job annotations to distinguish infrastructure issues (a
440411
// Full comment for normal analysis
441412
comment = `${TITLE}${titleSuffix}
442413
443-
> **Workflow:** [\`${runID}\`](${runURL})
414+
> **Workflow:** [\`${runID}\`](${displayRunURL})
444415
445416
### 📊 Summary
446417
- **Total Jobs:** ${jobData.totalJobs}
@@ -454,7 +425,7 @@ Automated analysis using job annotations to distinguish infrastructure issues (a
454425
### ✅ **AUTO-RETRY INITIATED**
455426
**${jobData.retryableJobsCount} job(s)** retried due to infrastructure issues (runner failures, timeouts, etc.)
456427
457-
[View Progress](${runURL})`;
428+
[View Progress](${displayRunURL})`;
458429
} else {
459430
comment += `
460431
@@ -579,32 +550,33 @@ module.exports = async ({ github, context, core }) => {
579550
// Handle priority cancellation
580551
if (priorityCancelled) {
581552
core.info('Cancelling retry since a higher priority request was made');
582-
await addCommentToPR(github, context, core, runID, runURL, { failedJobs, analyzedJobs, totalJobs, retryableJobsCount: 0 }, true);
553+
await addCommentToPR(github, context, core, workflowRun, runURL, { failedJobs, analyzedJobs, totalJobs, retryableJobsCount: 0 }, true);
583554
return;
584555
}
585556

586557
// Check retry count limit (max 3 retries)
587-
const currentRetryCount = await getRetryCountFromAPI(github, context, core, workflowRun);
558+
const currentRetryCount = getCurrentRetryCount(workflowRun);
559+
core.info(`Current retry attempt: ${workflowRun.run_attempt || 1} (previous retries: ${currentRetryCount})`);
588560
const maxRetries = 3;
589561

590562
if (currentRetryCount >= maxRetries) {
591563
core.info(`Maximum retry count (${maxRetries}) reached. Skipping retry.`);
592-
await addCommentToPR(github, context, core, runID, runURL, { failedJobs, analyzedJobs, totalJobs, retryableJobsCount: 0 }, false, true);
564+
await addCommentToPR(github, context, core, workflowRun, runURL, { failedJobs, analyzedJobs, totalJobs, retryableJobsCount: 0 }, false, true);
593565
return;
594566
}
595567

596568
// Handle no retryable jobs
597569
if (jobsToRetry.length === 0) {
598570
core.info('No jobs found with retryable errors. Skipping retry.');
599-
await addCommentToPR(github, context, core, runID, runURL, { failedJobs, analyzedJobs, totalJobs, retryableJobsCount: 0 }, false);
571+
await addCommentToPR(github, context, core, workflowRun, runURL, { failedJobs, analyzedJobs, totalJobs, retryableJobsCount: 0 }, false);
600572
return;
601573
}
602574

603575
// Retry failed jobs
604576
await retryFailedJobs(github, context, core, runID, jobsToRetry);
605577

606578
// Add comment to PR
607-
await addCommentToPR(github, context, core, runID, runURL, { failedJobs, analyzedJobs, totalJobs, retryableJobsCount: jobsToRetry.length }, false);
579+
await addCommentToPR(github, context, core, workflowRun, runURL, { failedJobs, analyzedJobs, totalJobs, retryableJobsCount: jobsToRetry.length }, false);
608580

609581
core.info('Retry process completed');
610582
};

0 commit comments

Comments
 (0)