Skip to content

Conversation

georgy-gorelko
Copy link

Pipeline ID Support

  • Added new --ado-pipeline-id option to support optional numeric pipeline IDs
  • Added comprehensive validation logic ensuring mutual exclusivity of pipeline name vs ID parameters
  • Added [GetPipelineId] helper method that returns provided ID directly or looks up ID by name
  • Updated both dry-run and regular execution paths to use the new resolution logic
  • Updated unit tests: Added tests for the new functionality and fixed existing tests to account for the new option

Key Features Implemented:

  1. Mutual Exclusion Validation: The command now properly validates that users specify either --ado-pipeline OR --ado-pipeline-id, but not both or neither

  2. Backward Compatibility: Existing functionality with --ado-pipeline continues to work exactly as before

  3. Enhanced Help Text: The help output clearly explains both options and their usage

  4. Robust Testing: Added comprehensive unit tests for all validation scenarios and functionality paths

  5. Improved Reliability: Using pipeline IDs eliminates the need for name-based lookups, making pipeline identification more reliable

Georgy Gorelko added 14 commits August 8, 2025 11:28
… the migration process.

1. Enhanced Branch Policy Failure Logging
✅ Added detailed logging to CheckBranchPolicyRequirement method:

Logs when repository name is not available
Logs specific error messages for each type of failure:
Network/HTTP errors
Timeout errors
JSON parsing errors
Invalid argument errors
Invalid operation errors
Each log includes the pipeline ID, organization, team project, and repository for easy identification
✅ Enhanced IsPipelineRequiredByBranchPolicy method with verbose logging:

Logs when repository ID cannot be found
Logs when no branch policies exist (verbose)
Logs when a pipeline IS required by branch policy (verbose)
Logs when a pipeline is NOT required by branch policy (verbose)
Logs specific error details for HTTP, JSON, and argument errors
✅ Added migration summary logging to ChangePipelineRepo method:

Provides clear, informational messages about branch policy check results
Explains the trigger configuration decision being made
Helps users understand whether their branch policies were preserved.
- 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.
@Copilot Copilot AI review requested due to automatic review settings August 13, 2025 17:55
Copy link
Contributor

@Copilot Copilot AI left a 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 enhances the rewire-pipeline command to support optional pipeline ID vs pipeline name identification, along with several substantial improvements to pipeline testing and trigger preservation functionality. The changes add a new --ado-pipeline-id option that provides a more reliable way to identify pipelines by their numeric ID, eliminating the need for name-based lookups which can be unreliable.

Key changes include:

  • Added optional --ado-pipeline-id parameter with proper validation ensuring mutual exclusivity with --ado-pipeline
  • Enhanced trigger preservation logic with branch policy awareness and YAML-controlled configurations
  • Added comprehensive dry-run testing capabilities for single pipeline validation

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
RewirePipelineCommandArgs.cs Added AdoPipelineId property and dry-run/monitoring options
RewirePipelineCommand.cs Added new command options and updated help text for pipeline ID support
RewirePipelineCommandHandler.cs Enhanced with validation logic, pipeline ID resolution, and comprehensive dry-run functionality
AdoApi.cs Extensive trigger preservation improvements with branch policy checks and YAML control
Test files Updated existing tests and added comprehensive new test coverage
TestPipelinesCommand*.cs New batch testing command implementation
PipelineTestResult.cs New model classes for test result tracking
Comments suppressed due to low confidence (1)

src/ado2gh/Commands/RewirePipeline/RewirePipelineCommandHandler.cs:236

  • Catching all exceptions without specifying the exception type violates guideline #6 about never silently swallowing exceptions. Either specify the specific exception types expected or let the exception bubble up.
        }

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

originalRepoName, originalDefaultBranch, originalClean, originalCheckoutSubmodules, originalTriggers);
testResult.RestoredSuccessfully = true;
}
catch
Copy link
Preview

Copilot AI Aug 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catching all exceptions without specifying the exception type violates guideline #6 about never silently swallowing exceptions. Either specify the specific exception types expected or let the exception bubble up.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant