Skip to content

Commit 767aafa

Browse files
authored
fix(core): do not print flaky tasks guidance when nx cloud is already enabled (#33149)
## Current Behavior When there are flaky tasks in a local run for a workspace that has Nx Cloud enabled, a help message is displayed, advising users to use Nx Cloud and pointing them to documentation on how to do so. Given that the workspace is already using Nx Cloud, the message is redundant. ## Expected Behavior When there are flaky tasks in a local run for a workspace that has Nx Cloud enabled, no help message should be shown advising users to use Nx Cloud and pointing them to documentation on how to do so. If the workspace doesn't have Nx Cloud set up, the message should still be shown.
1 parent 64fefe2 commit 767aafa

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

packages/nx/src/tasks-runner/life-cycles/task-history-life-cycle-old.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import { readNxJson } from '../../config/nx-json';
12
import { Task } from '../../config/task-graph';
23
import {
34
getHistoryForHashes,
45
TaskRun,
56
writeTaskRunsToHistory,
67
} from '../../utils/legacy-task-history';
8+
import { isNxCloudUsed } from '../../utils/nx-cloud-utils';
79
import { output } from '../../utils/output';
810
import { serializeTarget } from '../../utils/serialize-target';
911
import { isTuiEnabled } from '../is-tui-enabled';
@@ -72,8 +74,12 @@ export class LegacyTaskHistoryLifeCycle implements LifeCycle {
7274
bodyLines: [
7375
,
7476
...this.flakyTasks.map((t) => ` ${t}`),
75-
'',
76-
`Flaky tasks can disrupt your CI pipeline. Automatically retry them with Nx Cloud. Learn more at https://nx.dev/ci/features/flaky-tasks`,
77+
...(isNxCloudUsed(readNxJson())
78+
? []
79+
: [
80+
'',
81+
`Flaky tasks can disrupt your CI pipeline. Automatically retry them with Nx Cloud. Learn more at https://nx.dev/ci/features/flaky-tasks`,
82+
]),
7783
],
7884
});
7985
}

packages/nx/src/tasks-runner/life-cycles/task-history-life-cycle.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import { readNxJson } from '../../config/nx-json';
12
import { Task } from '../../config/task-graph';
23
import { IS_WASM, type TaskRun as NativeTaskRun } from '../../native';
4+
import { isNxCloudUsed } from '../../utils/nx-cloud-utils';
35
import { output } from '../../utils/output';
46
import { serializeTarget } from '../../utils/serialize-target';
57
import { getTaskHistory, TaskHistory } from '../../utils/task-history';
@@ -94,8 +96,12 @@ export class TaskHistoryLifeCycle implements LifeCycle {
9496
taskRun.target.configuration
9597
)}`;
9698
}),
97-
'',
98-
`Flaky tasks can disrupt your CI pipeline. Automatically retry them with Nx Cloud. Learn more at https://nx.dev/ci/features/flaky-tasks`,
99+
...(isNxCloudUsed(readNxJson())
100+
? []
101+
: [
102+
'',
103+
`Flaky tasks can disrupt your CI pipeline. Automatically retry them with Nx Cloud. Learn more at https://nx.dev/ci/features/flaky-tasks`,
104+
]),
99105
],
100106
});
101107
}

0 commit comments

Comments
 (0)