Conversation
- Added a new command `simulate` to simulate GitLab CI pipeline execution based on variables and rules. - Introduced `PipelineSimulator` class to handle the simulation logic, including job evaluation based on rules and context. - Created `RuleEvaluator` class to evaluate rules against the provided context. - Enhanced job definitions to support rules for conditional execution. - Updated types to accommodate new simulation features, including support for multiple job inputs and outputs. - Added comprehensive unit tests to validate simulation behavior under various scenarios, including rules evaluation and job execution order.
commit: |
…d template validation - Introduced tests for remote job extends normalization to ensure string extends are handled correctly. - Added tests for variable and job merge order, verifying child definitions override parent definitions. - Implemented tests for rule evaluator, covering AND operator and not-equal operator scenarios. - Enhanced simulation tests to cover file existence checks, variable interpolation, and various rule conditions. - Created tests for template extends chain resolution and lenient validation of templates. - Updated visualization tests to ensure graceful handling of missing includes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Motivation
GitLab CI pipelines often have complex rules that determine which jobs run based on branches, variables, and other conditions. Understanding which jobs will execute before pushing commits or triggering pipelines is challenging without actually running the pipeline.
💡 Solution
Added a new
simulatecommand that evaluates GitLab CI rules locally to predict which jobs will run without executing the actual pipeline. This helps developers:✨ Features
CLI Command:
gitlab-ci-builder simulate <path-or-url>with comprehensive optionssummary,text,table,json,yamlCore Functionality:
PipelineSimulatorclass for rule evaluationif,when,rules, andonly/exceptlogicOptions:
-b, --branch- Simulate for specific branch--tag- Simulate for specific tag--mr- Simulate merge request pipeline-v, --variable- Set custom variables-f, --format- Choose output format--show-skipped- Display skipped jobs--verbose- Show detailed rule evaluation📝 Examples
Example Output:
🧪 Testing
13 Integration Tests - API-level tests for
PipelineSimulatorclass15 E2E Tests - CLI interface tests with tuistory
Total Test Coverage: 28 tests (all passing ✅)
📚 Documentation
simulatecommand documentation🚨 Breaking Changes
None - this is a purely additive feature.
📦 Dependencies
tuistory(dev) - Terminal emulation for E2E testsnode-pty(dev) - Required by tuistory for pseudo-terminal support