-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Build: Add automatic parallelism fixing in CircleCI workflows #32685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
- Introduced a `--fix` option to the script for automatically correcting parallelism counts in workflow files. - Implemented logic to read and update parallelism values in the corresponding YAML files while preserving formatting and comments. - Enhanced error messages to guide users on regenerating the main config file after fixes.
📝 WalkthroughWalkthroughAdds an optional --fix mode to the CircleCI parallelism checker: propagates a fix flag through run and checkParallelism, collects mismatched jobs, and when requested edits workflow YAML files (text-based updates) to insert/update parallelism lines; otherwise errors with guidance. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant CLI as get-template.ts
participant CP as checkParallelism()
participant FS as FileSystem
participant WF as Workflow YAMLs
U->>CLI: run (--check? --fix?)
CLI->>CP: checkParallelism(cadence?, task?, fix)
CP->>CP: compute expected vs actual parallelism
alt mismatches & fix==true
CP->>FS: read affected `WORKFLOWS_DIR` files (text)
CP->>CP: build per-workflow text patches (insert/update `parallelism:`)
CP->>FS: write patched workflow files
CP-->>CLI: return applied-fixes summary
CLI-->>U: print fixes + regen/validate prompt
else mismatches & fix==false
CP-->>CLI: throw error with instruction to rerun with --fix
CLI-->>U: display error/instructions
else no mismatches
CP-->>CLI: success (no changes)
CLI-->>U: success message
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes ✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
🧬 Code graph analysis (1)scripts/get-template.ts (2)
🪛 ast-grep (0.39.6)scripts/get-template.ts[warning] 196-196: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns. (regexp-from-variable) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
Comment |
View your CI Pipeline Execution ↗ for commit e78edc0
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
scripts/get-template.ts
(7 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Adhere to ESLint and Prettier rules across all JS/TS source files
Files:
scripts/get-template.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Fix type errors and prefer precise typings instead of using any or suppressions, consistent with strict mode
Files:
scripts/get-template.ts
🧬 Code graph analysis (1)
scripts/get-template.ts (2)
code/lib/cli-storybook/src/sandbox-templates.ts (2)
Cadence
(18-18)allTemplates
(824-828)scripts/task.ts (2)
TaskKey
(106-106)tasks
(82-105)
🪛 ast-grep (0.39.6)
scripts/get-template.ts
[warning] 196-196: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(^\\s*-\\s+${job}:\\s*$
, 'm')
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Danger JS
- GitHub Check: get-branch
- GitHub Check: normal
- GitHub Check: Core Unit Tests, windows-latest
Co-authored-by: Valentin Palkovic <valentin@chromatic.com>
Closes #
What I did
--fix
option to the check script for automatically correcting parallelism counts in workflow files.Usage (at the root):
How it looks like:

Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.ts
Make sure this PR contains one of the labels below:
Available labels
bug
: Internal changes that fixes incorrect behavior.maintenance
: User-facing maintenance tasks.dependencies
: Upgrading (sometimes downgrading) dependencies.build
: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup
: Minor cleanup style change. Will not show up in release changelog.documentation
: Documentation only changes. Will not show up in release changelog.feature request
: Introducing a new feature.BREAKING CHANGE
: Changes that break compatibility in some way with current major version.other
: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/core
team here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>
Summary by CodeRabbit
New Features
Improvements
Chores