refactor(workspace): split CI workflow commands into separate functions#31833
Conversation
Extract command generation logic into dedicated functions for better maintainability: - getNxCloudRecordCommand() for Nx Cloud record instructions - getNxTasksCommand() for main nx affected/run-many commands - getNxCloudFixCiCommand() for nx-cloud fix-ci command This makes the code more modular and easier to test.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
View your CI Pipeline Execution ↗ for commit a488577
☁️ Nx Cloud last updated this comment at |
…e manager variables - Replace npx nx-cloud start-ci-run with ./nx start-ci-run in CI templates - Remove unused packageManager and packageManagerPrefix variables from generator - Update snapshots to reflect the command changes This ensures consistency with the nx wrapper approach across all CI templates.
- Create nx-cloud directory structure for better organization - Move existing commands (login, logout, connect) to nx-cloud subdirectory - Add new nx-cloud commands: record, start-ci-run, fix-ci - Extract shared utility function to reduce code duplication - Update CI workflow generator to use new fix-ci command - Remove old command directories after successful migration All nx-cloud commands now follow consistent patterns and use shared utilities.
🐳 We have a release for that!This PR has a release associated with it. You can try it out using this command: npx create-nx-workspace@0.0.0-pr-31833-c24a922 my-workspaceOr just copy this version and use it in your own command: 0.0.0-pr-31833-c24a922
To request a new release for this pull request, mention someone from the Nx team or the |
Add comprehensive documentation for nx record, start-ci-run, and fix-ci commands. Update all tutorial CI workflow examples to include nx fix-ci command. Add nx fix-ci to Gradle CI workflow generator templates. Ensure consistency across all CI documentation and examples. Update test snapshots to match new Gradle workflow output. 🤖 Generated with [Claude Code](https://claude.ai/code)
🐳 We have a release for that!This PR has a release associated with it. You can try it out using this command: npx create-nx-workspace@0.0.0-pr-31833-2080c63 my-workspaceOr just copy this version and use it in your own command: 0.0.0-pr-31833-2080c63
To request a new release for this pull request, mention someone from the Nx team or the |
Add alwaysRun property to Command type to make fix-ci always execute even if other steps fail. Update all CI platform templates to support this property.
…directory reorganization
…orkflows - Add alwaysRun property to Command type in Gradle CI generator - Update fix-ci command to always run regardless of previous step failures - Add conditional execution logic to GitHub Actions and CircleCI templates - Update all framework tutorials to include if: always() condition for fix-ci - Ensures users get AI-powered CI recommendations even when builds fail 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🐳 We have a release for that!This PR has a release associated with it. You can try it out using this command: npx create-nx-workspace@0.0.0-pr-31833-a488577 my-workspaceOr just copy this version and use it in your own command: 0.0.0-pr-31833-a488577
To request a new release for this pull request, mention someone from the Nx team or the |
## Current Behavior Nx-cloud commands are scattered across different directories in the command-line structure, making them harder to find and maintain. Commands like `record`, `start-ci-run`, and `fix-ci` don't exist as direct nx commands. The fix-ci command in CI workflows doesn't run when previous steps fail. ## Expected Behavior All nx-cloud related commands are organized in a dedicated directory with consistent patterns and shared utilities. New commands provide better CI/CD integration. The fix-ci command always runs to provide AI-powered recommendations even when builds fail. ## Related Issue(s) Improves code organization and adds missing CI workflow commands for better developer experience. ## Changes Made ### 🏗️ **Reorganized nx-cloud commands** - Created `/packages/nx/src/command-line/nx-cloud/` directory structure - Moved existing commands (`login`, `logout`, `connect`) to new location - Extracted shared utility function to eliminate code duplication ### 🆕 **Added new nx-cloud commands** - `nx record` - Records command execution for distributed task execution - `nx start-ci-run` - Starts new CI run for distributed execution - `nx fix-ci` - Fixes CI configuration issues with AI-powered suggestions ### 🔧 **Code quality improvements** - Reduced code duplication by 80+ lines across command implementations - All commands now follow consistent patterns using shared utilities - Fixed import paths throughout codebase after reorganization ### 🚀 **Enhanced CI workflow support** - **Gradle Generator**: Added `alwaysRun` property to Command type for conditional execution - **Template Updates**: GitHub Actions and CircleCI templates now handle `alwaysRun` property - **Fix-CI Integration**: The `fix-ci` command now always runs regardless of previous step failures ### 📚 **Comprehensive documentation updates** - Updated all CI provider documentation (GitHub Actions, Azure DevOps, GitLab, Bitbucket, CircleCI, Jenkins) - Updated Nx Cloud tutorial documentation (GitHub Actions, CircleCI) - **Framework Tutorials**: Added `if: always()` condition to fix-ci commands in: - Gradle tutorial (`/docs/shared/tutorials/gradle.md`) - Angular monorepo tutorial (`/docs/shared/tutorials/angular-monorepo.md`) - React monorepo tutorial (`/docs/shared/tutorials/react-monorepo.md`) - TypeScript packages tutorial (`/docs/shared/tutorials/typescript-packages.md`) - Added proper documentation linking for all new commands - All validation passes (TypeScript, formatting, documentation) ### 🎯 **Key Technical Improvements** - **Always-Run Logic**: Fix-ci command uses platform-specific conditional execution: - GitHub Actions: `if: always()` - CircleCI: `when: always` - Azure DevOps: `condition: always()` - **Consistent Patterns**: All nx-cloud commands follow unified implementation approach - **Backward Compatibility**: All existing functionality preserved during reorganization All nx-cloud commands now provide a more cohesive experience with better CI integration, ensuring users get AI-powered recommendations even when builds fail. --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com> (cherry picked from commit 13551c9)
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
Nx-cloud commands are scattered across different directories in the command-line structure, making them harder to find and maintain. Commands like
record,start-ci-run, andfix-cidon't exist as direct nx commands. The fix-ci command in CI workflows doesn't run when previous steps fail.Expected Behavior
All nx-cloud related commands are organized in a dedicated directory with consistent patterns and shared utilities. New commands provide better CI/CD integration. The fix-ci command always runs to provide AI-powered recommendations even when builds fail.
Related Issue(s)
Improves code organization and adds missing CI workflow commands for better developer experience.
Changes Made
🏗️ Reorganized nx-cloud commands
/packages/nx/src/command-line/nx-cloud/directory structurelogin,logout,connect) to new location🆕 Added new nx-cloud commands
nx record- Records command execution for distributed task executionnx start-ci-run- Starts new CI run for distributed executionnx fix-ci- Fixes CI configuration issues with AI-powered suggestions🔧 Code quality improvements
🚀 Enhanced CI workflow support
alwaysRunproperty to Command type for conditional executionalwaysRunpropertyfix-cicommand now always runs regardless of previous step failures📚 Comprehensive documentation updates
if: always()condition to fix-ci commands in:/docs/shared/tutorials/gradle.md)/docs/shared/tutorials/angular-monorepo.md)/docs/shared/tutorials/react-monorepo.md)/docs/shared/tutorials/typescript-packages.md)🎯 Key Technical Improvements
if: always()when: alwayscondition: always()All nx-cloud commands now provide a more cohesive experience with better CI integration, ensuring users get AI-powered recommendations even when builds fail.