-
Notifications
You must be signed in to change notification settings - Fork 124
'gh ado2gh rewire-pipeline': support test rewiring mode before actual rewiring #1417
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
'gh ado2gh rewire-pipeline': support test rewiring mode before actual rewiring #1417
Conversation
- Introduced `--dry-run` option for single pipeline testing, allowing temporary rewiring to GitHub and build execution. - Implemented `test-pipelines` command for batch testing of multiple Azure DevOps pipelines with concurrency control. - Added `PipelineTestResult` and `PipelineTestSummary` models for detailed reporting of test results. - Enhanced `RewirePipelineCommand` to include new options for dry-run and monitoring timeout. - Created comprehensive documentation for pipeline testing feature, including usage examples and error handling. - Implemented logging and error handling for restoration processes during testing.
… GitHub integration
…functionality - Merged AdoPipelineTriggerService from main for comprehensive pipeline trigger management - Preserved dry-run functionality with PipelineTestService - Updated RewirePipelineCommandHandler to support both regular rewiring and dry-run testing - Constructor now accepts AdoPipelineTriggerService for trigger preservation logic - Dry-run mode uses PipelineTestService for temporary testing workflow
…mproved pipeline rewiring logic and update related tests for better integration
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.
Pull Request Overview
This PR adds comprehensive test mode functionality to the gh ado2gh rewire-pipeline command that allows validation of Azure DevOps pipelines before permanently migrating them to GitHub.
- Adds
--dry-runflag to therewire-pipelinecommand for single pipeline testing - Introduces new
test-pipelinescommand for batch testing multiple pipelines concurrently - Implements pipeline test monitoring with automatic restoration to ensure pipelines are always restored to their original ADO repositories
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ado2gh/Program.cs | Registers new AdoPipelineTriggerServiceFactory dependency |
| src/ado2gh/Factories/AdoPipelineTriggerServiceFactory.cs | Factory for creating AdoPipelineTriggerService instances |
| src/ado2gh/Commands/TestPipelines/* | New command implementation for batch pipeline testing |
| src/ado2gh/Commands/RewirePipeline/* | Updates to support dry-run mode and use new trigger service |
| src/Octoshift/Services/PipelineTestService.cs | Service for testing individual pipelines |
| src/Octoshift/Services/AdoPipelineTriggerService.cs | Service for managing pipeline trigger configurations |
| src/Octoshift/Services/AdoApi.cs | Adds new API methods for pipeline testing operations |
| src/Octoshift/Models/* | New models for pipeline test results and ADO branch policies |
| test files | Comprehensive test coverage for new functionality |
| docs/pipeline-testing.md | Documentation for the new testing features |
Comments suppressed due to low confidence (3)
src/Octoshift/Services/AdoPipelineTriggerService.cs:431
- The method returns 'triggers' instead of 'result' which is the variable being built up in this method. This will return the original triggers array instead of the new YAML-controlled triggers.
}
src/Octoshift/Services/AdoPipelineTriggerService.cs:192
- Same issue as line 162 - the URL is missing the base URL prefix. It should use
$"{_adoBaseUrl}/{adoOrg.EscapeDataString()}..."to match the pattern used in other API calls.
{
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
src/OctoshiftCLI.Tests/Octoshift/Services/AdoPipelineTriggerService_BranchPolicyTests.cs
Show resolved
Hide resolved
Unit Test Results 1 files 1 suites 10m 25s ⏱️ Results for commit 0bfd38d. ♻️ This comment has been updated with latest results. |
|
Need to finish #1412 first |
|
@begonaguereca please review this next |
|
@boylejj can I get Integration Tests scheduled and validated so PR can be merged? |
brianaj
left a comment
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.
What is the value add on test-pipelines command, is this still calling the rewire pipeline logic?
My only concern is it says Pipelines are always restored to ADO, even if tests fail but then says Manual restoration may be required. I am okay with dry-run behavior otherwise but that seems like a risk we should make very clear.
@begonaguereca might be good for you to take a look at this too.
Yes, it does rewire from ADO to GitHub, schedule pipeline, rewire back to ADO and monitor build status. We need this exercise to ensure rewiring works as expected. For bulk migrations (100+ repos) this automation helpful to report any deviations found |
|
@begonaguereca, @brianaj can I get pipelines scheduled for validation and review? |
brianaj
left a comment
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.
Good with this change, with the noted caveat, a user might have to manually revert back after rewiring in dry-run mode.
|
@georgy-gorelko I will be out of office soon so @begonaguereca or whatever team member has bandwidth will have to take this over the finish line. |
No manual rewiring required. Sorry for confusion, I will update the description |
|
@begonaguereca please schedule Integration Tests and if all good, please proceed with merging |
|
@offbyone any chance you may know how to trigger Integration Test pipelines pending and required by policy? |
|
@begonaguereca can you help with validation pipelines to be scheduled? |
|
@georgy-gorelko its triggered here https://github.com/github/gh-gei/actions/runs/17864476137 |
Is there a way to debug/repro failures locally? Logs provided do not emit much details of the failures. Not sure if known or new failures appear. |
|
@begonaguereca any hints on Integration tests debuging/scheduling? |
|
@georgy-gorelko do you have access to slack at all? we have chatops commands to look more deeply at the failed migration ids eg: |
not in Slack |
|
Ok you can query failure reason this way as well https://docs.github.com/en/graphql/reference/objects#repositorymigration |
|
A comprehensive test mode for the
gh ado2gh rewire-pipelinecommand that covers the scenarios below:Overview
The pipeline testing feature allows to validate Azure DevOps pipelines before permanently migrating them to GitHub. It provides two testing modes:
--dry-run): Test a specific pipelinetest-pipelinescommand): Test multiple pipelines concurrentlySingle Pipeline Testing
Usage
Parameters
--dry-run: Enables test mode (temporarily rewires, tests, then restores)--monitor-timeout-minutes: How long to wait for build completion (default: 30 minutes)Process Flow
Sample Output
Batch Pipeline Testing
Usage
Parameters
--pipeline-filter: Wildcard pattern to filter pipelines (e.g., "CI-", "-Deploy", "*")--max-concurrent-tests: Maximum number of concurrent tests (default: 3)--report-path: Path to save detailed JSON report (default: pipeline-test-report.json)--monitor-timeout-minutes: Timeout for each pipeline test (default: 30 minutes)Process Flow
Sample Output
Report Structure
JSON Report Format
{ "TotalPipelines": 15, "SuccessfulBuilds": 12, "FailedBuilds": 2, "TimedOutBuilds": 1, "ErrorsRewiring": 0, "ErrorsRestoring": 0, "TotalTestTime": "01:45:32", "SuccessRate": 80.0, "Results": [ { "AdoOrg": "MyOrg", "AdoTeamProject": "MyProject", "AdoRepoName": "MyAdoRepo", "PipelineName": "CI-Frontend", "PipelineId": 101, "PipelineUrl": "https://dev.azure.com/MyOrg/MyProject/_build/definition?definitionId=101", "BuildId": 201, "BuildUrl": "https://dev.azure.com/MyOrg/MyProject/_build/results?buildId=201", "Status": "completed", "Result": "succeeded", "StartTime": "2025-01-01T10:00:00Z", "EndTime": "2025-01-01T10:15:00Z", "BuildDuration": "00:15:00", "RewiredSuccessfully": true, "RestoredSuccessfully": true, "IsSuccessful": true } ] }Error Handling and Recovery
Automatic Recovery
The testing system is designed to be resilient:
Manual Recovery
If automatic restoration fails:
Best Practices
Before Testing
During Testing
After Testing
Troubleshooting
Common Issues
Build Failures
Restoration Failures
Timeout Issues
--monitor-timeout-minutesfor longer buildsSupport Information
For issues or questions about pipeline testing: