Skip to content

Commit 504b1b3

Browse files
Merge branch 'main' into fix-url-input-error-1180
2 parents eb6d32f + 381a83f commit 504b1b3

34 files changed

+3859
-289
lines changed

.github/workflows/CI.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
runner-os: [windows-latest, ubuntu-latest, macos-latest]
20+
language: [ csharp, actions ]
2021

2122
runs-on: ${{ matrix.runner-os }}
2223

@@ -29,7 +30,8 @@ jobs:
2930
if: matrix.runner-os == 'ubuntu-latest'
3031
uses: github/codeql-action/init@v3
3132
with:
32-
languages: "csharp"
33+
languages: ${{ matrix.language }}
34+
queries: +security-and-quality
3335
config-file: ./.github/codeql/codeql-config.yml
3436

3537
- name: Setup .NET
@@ -231,8 +233,8 @@ jobs:
231233
ADO_SERVER_PAT: ${{ secrets.ADO_SERVER_PAT }}
232234
BBS_USERNAME: ${{ secrets.BBS_USERNAME }}
233235
BBS_PASSWORD: ${{ secrets.BBS_PASSWORD }}
234-
SSH_KEY_BBS_8_5_0: ${{ secrets.SSH_KEY_BBS_8_5_0 }}
235-
SSH_KEY_BBS_5_14_0: ${{ secrets.SSH_KEY_BBS_5_14_0 }}
236+
SSH_KEY_BBS: ${{ secrets.SSH_KEY_BBS }}
237+
SSH_PORT_BBS: ${{ secrets.SSH_PORT_BBS }}
236238
SMB_PASSWORD: ${{ secrets.SMB_PASSWORD }}
237239
AZURE_STORAGE_CONNECTION_STRING_BBS_LINUX: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_BBS_LINUX }}
238240
AZURE_STORAGE_CONNECTION_STRING_BBS_MACOS: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_BBS_MACOS }}

.github/workflows/integration-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ jobs:
186186
ADO_SERVER_PAT: ${{ secrets.ADO_SERVER_PAT }}
187187
BBS_USERNAME: ${{ secrets.BBS_USERNAME }}
188188
BBS_PASSWORD: ${{ secrets.BBS_PASSWORD }}
189-
SSH_KEY_BBS_8_5_0: ${{ secrets.SSH_KEY_BBS_8_5_0 }}
190-
SSH_KEY_BBS_5_14_0: ${{ secrets.SSH_KEY_BBS_5_14_0 }}
189+
SSH_KEY_BBS: ${{ secrets.SSH_KEY_BBS }}
190+
SSH_PORT_BBS: ${{ secrets.SSH_PORT_BBS }}
191191
SMB_PASSWORD: ${{ secrets.SMB_PASSWORD }}
192192
AZURE_STORAGE_CONNECTION_STRING_BBS_LINUX: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_BBS_LINUX }}
193193
AZURE_STORAGE_CONNECTION_STRING_BBS_MACOS: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING_BBS_MACOS }}

.github/workflows/publish-test-results.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
run: |
3838
eventjson=`cat 'artifacts/Event File/event.json'`
3939
prnumber=`echo $(jq -r '.pull_request.number' <<< "$eventjson")`
40-
echo "PR_NUMBER=$(echo $prnumber | tr -cd '[0-9]')" >> $GITHUB_ENV
40+
echo "PR_NUMBER=$(echo $prnumber | tr -cd '0-9')" >> $GITHUB_ENV
4141
4242
- name: Publish Unit Test Results
4343
uses: EnricoMi/publish-unit-test-result-action@v2

LATEST-VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.18.1
1+
v1.21.0

docs/pipeline-testing.md

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
# Pipeline Testing Feature
2+
3+
This document explains how to use the new pipeline testing functionality in the `gh ado2gh rewire-pipeline` command.
4+
5+
## Overview
6+
7+
The pipeline testing feature allows you to validate Azure DevOps pipelines before permanently migrating them to GitHub. It provides two testing modes:
8+
9+
1. **Single Pipeline Test (`--dry-run`)**: Test a specific pipeline
10+
2. **Batch Pipeline Test (`test-pipelines` command)**: Test multiple pipelines concurrently
11+
12+
## Single Pipeline Testing
13+
14+
### Usage
15+
16+
```bash
17+
gh ado2gh rewire-pipeline --ado-org "MyOrg" --ado-team-project "MyProject" \
18+
--ado-pipeline "MyPipeline" --github-org "MyGitHubOrg" --github-repo "MyRepo" \
19+
--service-connection-id "12345" --dry-run --monitor-timeout-minutes 45
20+
```
21+
22+
### Parameters
23+
24+
- `--dry-run`: Enables test mode (temporarily rewires, tests, then restores)
25+
- `--monitor-timeout-minutes`: How long to wait for build completion (default: 30 minutes)
26+
27+
### Process Flow
28+
29+
1. **Retrieve Pipeline Information**: Gets current pipeline configuration and repository details
30+
2. **Temporary Rewiring**: Points pipeline to GitHub repository temporarily
31+
3. **Build Execution**: Queues a test build and captures the build ID
32+
4. **Restoration**: Automatically restores pipeline to original ADO repository
33+
5. **Build Monitoring**: Monitors build progress until completion or timeout
34+
6. **Report Generation**: Provides detailed test results and recommendations
35+
36+
### Sample Output
37+
38+
```
39+
Starting dry-run mode: Testing pipeline rewiring to GitHub...
40+
Step 1: Retrieving pipeline information...
41+
Pipeline ID: 123
42+
Original ADO Repository: MyAdoRepo
43+
Step 2: Temporarily rewiring pipeline to GitHub...
44+
✓ Pipeline successfully rewired to GitHub
45+
Step 3: Queuing a test build...
46+
Build queued with ID: 456
47+
Build URL: https://dev.azure.com/MyOrg/MyProject/_build/results?buildId=456
48+
Step 4: Restoring pipeline back to original ADO repository...
49+
✓ Pipeline successfully restored to original ADO repository
50+
Step 5: Monitoring build progress (timeout: 30 minutes)...
51+
Build completed with result: succeeded
52+
53+
=== PIPELINE TEST REPORT ===
54+
ADO Organization: MyOrg
55+
ADO Team Project: MyProject
56+
Pipeline Name: MyPipeline
57+
Build Result: succeeded
58+
✅ Pipeline test PASSED - Build completed successfully
59+
```
60+
61+
## Batch Pipeline Testing
62+
63+
### Usage
64+
65+
```bash
66+
gh ado2gh test-pipelines --ado-org "MyOrg" --ado-team-project "MyProject" \
67+
--github-org "MyGitHubOrg" --github-repo "MyRepo" --service-connection-id "12345" \
68+
--pipeline-filter "CI-*" --max-concurrent-tests 3 --report-path "test-results.json"
69+
```
70+
71+
### Parameters
72+
73+
- `--pipeline-filter`: Wildcard pattern to filter pipelines (e.g., "CI-*", "*-Deploy", "*")
74+
- `--max-concurrent-tests`: Maximum number of concurrent tests (default: 3)
75+
- `--report-path`: Path to save detailed JSON report (default: pipeline-test-report.json)
76+
- `--monitor-timeout-minutes`: Timeout for each pipeline test (default: 30 minutes)
77+
78+
### Process Flow
79+
80+
1. **Pipeline Discovery**: Finds all pipelines matching the filter criteria
81+
2. **Concurrent Testing**: Runs multiple pipeline tests simultaneously (respecting concurrency limits)
82+
3. **Automatic Restoration**: Ensures all pipelines are restored to ADO
83+
4. **Progress Monitoring**: Tracks each pipeline's test progress independently
84+
5. **Comprehensive Reporting**: Generates both console summary and detailed JSON report
85+
86+
### Sample Output
87+
88+
```
89+
Starting batch pipeline testing...
90+
Step 1: Discovering pipelines...
91+
Found 15 pipelines to test
92+
Step 2: Testing pipelines (max concurrent: 3)...
93+
Testing pipeline: CI-Frontend (ID: 101)
94+
Testing pipeline: CI-Backend (ID: 102)
95+
Testing pipeline: CI-Database (ID: 103)
96+
...
97+
98+
=== PIPELINE BATCH TEST SUMMARY ===
99+
Total Pipelines Tested: 15
100+
Successful Builds: 12
101+
Failed Builds: 2
102+
Timed Out Builds: 1
103+
Rewiring Errors: 0
104+
Restoration Errors: 0
105+
Success Rate: 80.0%
106+
Total Test Time: 01:45:32
107+
```
108+
109+
## Report Structure
110+
111+
### JSON Report Format
112+
113+
```json
114+
{
115+
"TotalPipelines": 15,
116+
"SuccessfulBuilds": 12,
117+
"FailedBuilds": 2,
118+
"TimedOutBuilds": 1,
119+
"ErrorsRewiring": 0,
120+
"ErrorsRestoring": 0,
121+
"TotalTestTime": "01:45:32",
122+
"SuccessRate": 80.0,
123+
"Results": [
124+
{
125+
"AdoOrg": "MyOrg",
126+
"AdoTeamProject": "MyProject",
127+
"AdoRepoName": "MyAdoRepo",
128+
"PipelineName": "CI-Frontend",
129+
"PipelineId": 101,
130+
"PipelineUrl": "https://dev.azure.com/MyOrg/MyProject/_build/definition?definitionId=101",
131+
"BuildId": 201,
132+
"BuildUrl": "https://dev.azure.com/MyOrg/MyProject/_build/results?buildId=201",
133+
"Status": "completed",
134+
"Result": "succeeded",
135+
"StartTime": "2025-01-01T10:00:00Z",
136+
"EndTime": "2025-01-01T10:15:00Z",
137+
"BuildDuration": "00:15:00",
138+
"RewiredSuccessfully": true,
139+
"RestoredSuccessfully": true,
140+
"IsSuccessful": true
141+
}
142+
]
143+
}
144+
```
145+
146+
## Error Handling and Recovery
147+
148+
### Automatic Recovery
149+
150+
The testing system is designed to be resilient:
151+
152+
- **Restoration Guarantee**: Pipelines are always restored to ADO, even if tests fail
153+
- **Concurrent Safety**: Multiple tests run safely without interfering with each other
154+
- **Timeout Handling**: Tests that exceed timeout limits are automatically terminated
155+
- **Error Isolation**: One failed test doesn't affect others in batch mode
156+
157+
### Manual Recovery
158+
159+
If automatic restoration fails:
160+
161+
1. Check the console output for "MANUAL RESTORATION REQUIRED" messages
162+
2. Use the provided Pipeline ID and URL to manually restore the pipeline
163+
3. Review the detailed JSON report for specific error information
164+
165+
## Best Practices
166+
167+
### Before Testing
168+
169+
1. **Verify Service Connection**: Ensure the GitHub service connection works properly
170+
2. **Check Repository Access**: Confirm the GitHub repository is accessible from ADO
171+
3. **Review Branch Strategy**: Ensure the default branch exists in both repositories
172+
4. **Test with Small Batch**: Start with a few pipelines before testing all
173+
174+
### During Testing
175+
176+
1. **Monitor Progress**: Watch console output for any immediate issues
177+
2. **Check Build Status**: Use provided build URLs to monitor detailed progress
178+
3. **Resource Management**: Limit concurrent tests based on your ADO capacity
179+
180+
### After Testing
181+
182+
1. **Review Results**: Analyze both successful and failed test results
183+
2. **Address Issues**: Fix identified problems before permanent migration
184+
3. **Document Findings**: Use test results to plan migration strategy
185+
4. **Validate Restoration**: Ensure all pipelines were properly restored
186+
187+
## Troubleshooting
188+
189+
### Common Issues
190+
191+
**Build Failures**
192+
- Check GitHub repository exists and is accessible
193+
- Verify service connection has proper permissions
194+
- Ensure YAML pipeline files are compatible
195+
196+
**Restoration Failures**
197+
- Verify ADO permissions are sufficient
198+
- Check if original repository still exists
199+
- Manual restoration may be required
200+
201+
**Timeout Issues**
202+
- Increase `--monitor-timeout-minutes` for longer builds
203+
- Check if builds are queued but not starting
204+
- Verify agent pools are available
205+
206+
### Support Information
207+
208+
For issues or questions about pipeline testing:
209+
1. Review the detailed error messages in console output
210+
2. Check the JSON report for specific failure details
211+
3. Verify permissions and connectivity to both ADO and GitHub

releasenotes/v1.19.0.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- **ado2gh rewire-pipeline**: Migration now preserves all original trigger configurations (pullRequest, continuousIntegration, etc.) from Azure DevOps pipelines.
2+
- **ado2gh rewire-pipeline --dry-run --monitor-timeout-minutes 45**: Migration now supports a test mode to validate AzureDevOps pipeline is validated temporary rewiring to GitHub with status reported
3+
- **ado2gh rewire-pipeline**: New argument --ado-pipeline-idis supported for rewiring process vs pipeline name argument to ensure smoother migration where pipeline name can be ambiguous

releasenotes/v1.20.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fixed git archive URL expiration issue during GHES migrations when metadata archive generation takes longer than an hour. When GHES is configured with local storage for migrations, git archive download URLs expire after one hour. The CLI now automatically refreshes expired git archive download URLs and retries the download.

releasenotes/v1.21.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- **ado2gh**: Added support for GitHub Enterprise cloud with data residency app service connections when using `--rewire-pipelines`. The tool now recognizes both `GitHub` and `GitHubProximaPipelines` service connection types.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
using System.Collections.Generic;
2+
using Newtonsoft.Json;
3+
4+
namespace Octoshift.Models;
5+
6+
/// <summary>
7+
/// Represents an Azure DevOps branch policy configuration
8+
/// </summary>
9+
public class AdoBranchPolicy
10+
{
11+
[JsonProperty("id")]
12+
public string Id { get; set; }
13+
14+
[JsonProperty("type")]
15+
public AdoPolicyType Type { get; set; }
16+
17+
[JsonProperty("isEnabled")]
18+
public bool IsEnabled { get; set; }
19+
20+
[JsonProperty("settings")]
21+
public AdoBranchPolicySettings Settings { get; set; }
22+
}
23+
24+
/// <summary>
25+
/// Represents the type information for an Azure DevOps policy
26+
/// </summary>
27+
public class AdoPolicyType
28+
{
29+
[JsonProperty("id")]
30+
public string Id { get; set; }
31+
32+
[JsonProperty("displayName")]
33+
public string DisplayName { get; set; }
34+
}
35+
36+
/// <summary>
37+
/// Represents the settings for an Azure DevOps branch policy
38+
/// </summary>
39+
public class AdoBranchPolicySettings
40+
{
41+
[JsonProperty("buildDefinitionId")]
42+
public string BuildDefinitionId { get; set; }
43+
44+
[JsonProperty("displayName")]
45+
public string DisplayName { get; set; }
46+
47+
[JsonProperty("queueOnSourceUpdateOnly")]
48+
public bool QueueOnSourceUpdateOnly { get; set; }
49+
50+
[JsonProperty("manualQueueOnly")]
51+
public bool ManualQueueOnly { get; set; }
52+
53+
[JsonProperty("validDuration")]
54+
public double ValidDuration { get; set; }
55+
}
56+
57+
/// <summary>
58+
/// Represents the response wrapper for Azure DevOps branch policies
59+
/// </summary>
60+
public class AdoBranchPolicyResponse
61+
{
62+
[JsonProperty("value")]
63+
public IReadOnlyList<AdoBranchPolicy> Value { get; set; }
64+
65+
[JsonProperty("count")]
66+
public int Count { get; set; }
67+
}

0 commit comments

Comments
 (0)