Skip to content

Commit 34039c4

Browse files
authored
Merge branch 'main' into dependabot/github_actions/actions/download-artifact-6
2 parents fa49e75 + aff4219 commit 34039c4

File tree

23 files changed

+362
-59
lines changed

23 files changed

+362
-59
lines changed

.github/workflows/CI.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ jobs:
2222
runs-on: ${{ matrix.runner-os }}
2323

2424
steps:
25-
- uses: actions/checkout@v4
25+
- uses: actions/checkout@v5
2626
with:
2727
persist-credentials: false
2828
- uses: extractions/setup-just@v3
2929
- name: Initialize CodeQL
3030
if: matrix.runner-os == 'ubuntu-latest'
31-
uses: github/codeql-action/init@v3
31+
uses: github/codeql-action/init@v4
3232
with:
3333
languages: ${{ matrix.language }}
3434
queries: +security-and-quality
3535
config-file: ./.github/codeql/codeql-config.yml
3636

3737
- name: Setup .NET
38-
uses: actions/setup-dotnet@v4
38+
uses: actions/setup-dotnet@v5
3939
with:
4040
global-json-file: global.json
4141

@@ -52,12 +52,12 @@ jobs:
5252
run: just test-coverage
5353

5454
- name: Copy Coverage To Predictable Location
55-
if: always() && matrix.runner-os == 'ubuntu-latest'
55+
if: always() && matrix.runner-os == 'ubuntu-latest' && matrix.language == 'csharp'
5656
run: cp coverage/**/coverage.cobertura.xml coverage/coverage.cobertura.xml
5757

5858
- name: Code Coverage Summary Report
5959
uses: irongut/[email protected]
60-
if: always() && matrix.runner-os == 'ubuntu-latest'
60+
if: always() && matrix.runner-os == 'ubuntu-latest' && matrix.language == 'csharp'
6161
with:
6262
filename: coverage/coverage.cobertura.xml
6363
badge: true
@@ -66,22 +66,22 @@ jobs:
6666

6767
# This is used by the subsequent publish-test-results.yml
6868
- name: Upload Unit Test Results
69-
if: always() && matrix.runner-os == 'ubuntu-latest'
69+
if: always() && matrix.runner-os == 'ubuntu-latest' && matrix.language == 'csharp'
7070
uses: actions/upload-artifact@v4
7171
with:
7272
name: Unit Test Results
7373
path: src/OctoshiftCLI.Tests/unit-tests.xml
7474

7575
# This is used by the subsequent publish-test-results.yml
7676
- name: Upload Code Coverage Report
77-
if: always() && matrix.runner-os == 'ubuntu-latest'
77+
if: always() && matrix.runner-os == 'ubuntu-latest' && matrix.language == 'csharp'
7878
uses: actions/upload-artifact@v4
7979
with:
8080
name: Code Coverage Report
8181
path: code-coverage-results.md
8282

8383
- name: Perform CodeQL Analysis
84-
uses: github/codeql-action/analyze@v3
84+
uses: github/codeql-action/analyze@v4
8585
if: matrix.runner-os == 'ubuntu-latest'
8686

8787
upload-event-file:
@@ -102,13 +102,13 @@ jobs:
102102
target-os: [windows-latest, ubuntu-latest, macos-latest]
103103
runs-on: ubuntu-latest
104104
steps:
105-
- uses: actions/checkout@v4
105+
- uses: actions/checkout@v5
106106
with:
107107
persist-credentials: false
108108
- uses: extractions/setup-just@v3
109109

110110
- name: Setup .NET
111-
uses: actions/setup-dotnet@v4
111+
uses: actions/setup-dotnet@v5
112112
with:
113113
global-json-file: global.json
114114

@@ -150,12 +150,12 @@ jobs:
150150
runs-on: ${{ matrix.runner-os }}
151151
concurrency: integration-test-${{ matrix.source-vcs }}-${{ matrix.runner-os }}
152152
steps:
153-
- uses: actions/checkout@v4
153+
- uses: actions/checkout@v5
154154
with:
155155
persist-credentials: false
156156

157157
- name: Setup .NET
158-
uses: actions/setup-dotnet@v4
158+
uses: actions/setup-dotnet@v5
159159
with:
160160
global-json-file: global.json
161161

@@ -282,9 +282,8 @@ jobs:
282282
environment: PUBLISH_RELEASE
283283

284284
steps:
285-
- uses: actions/checkout@v4
285+
- uses: actions/checkout@v5
286286
with:
287-
persist-credentials: false
288287
token: ${{ secrets.RELEASE_NOTES_PAT }}
289288
fetch-depth: 0
290289

@@ -304,7 +303,7 @@ jobs:
304303
}
305304
306305
- name: Setup .NET
307-
uses: actions/setup-dotnet@v4
306+
uses: actions/setup-dotnet@v5
308307
with:
309308
global-json-file: global.json
310309

@@ -366,7 +365,7 @@ jobs:
366365
$TAG_NAME | Out-File ./LATEST-VERSION.txt
367366
368367
- name: Commit Release Notes and Version
369-
uses: stefanzweifel/git-auto-commit-action@v5
368+
uses: stefanzweifel/git-auto-commit-action@28e16e81777b558cc906c8750092100bbb34c5e3
370369
with:
371370
commit_message: Automated commit of archived release notes and version file [skip ci]
372371
file_pattern: RELEASENOTES.md releasenotes/*.md LATEST-VERSION.txt

.github/workflows/copilot-setup-steps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v5
2222

2323
- name: Setup .NET
2424
uses: actions/setup-dotnet@v2

.github/workflows/integration-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
target-os: [windows-latest, ubuntu-latest, macos-latest]
2424
runs-on: ubuntu-latest
2525
steps:
26-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@v5
2727
with:
2828
ref: 'refs/pull/${{ github.event.inputs.pr_number }}/merge'
2929
fetch-depth: 0
@@ -95,7 +95,7 @@ jobs:
9595
runs-on: ${{ matrix.runner-os }}
9696
concurrency: integration-test-${{ matrix.source-vcs }}-${{ matrix.runner-os }}
9797
steps:
98-
- uses: actions/checkout@v4
98+
- uses: actions/checkout@v5
9999
with:
100100
ref: 'refs/pull/${{ github.event.inputs.pr_number }}/merge'
101101
fetch-depth: 0

LATEST-VERSION.txt

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

releasenotes/v1.22.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Added `--migration-id` option to `download-logs` command to allow downloading logs directly by migration ID without requiring org/repo lookup

releasenotes/v1.23.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- bbs2gh : Added validation for `--archive-path` and `--bbs-shared-home` options to fail fast with clear error messages if the provided paths do not exist or are not accessible. Archive path is now logged before upload operations to help with troubleshooting
2+
- ado2gh: Fixed `--rewire-pipelines` for GitHub Enterprise Cloud with data residency by correctly matching GitHubProximaPipelines service connections by team project name instead of GitHub organization name

src/Octoshift/Commands/CreateTeam/CreateTeamCommandBase.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ public CreateTeamCommandBase() : base(name: "create-team", description: "Creates
1616

1717
public virtual Option<string> TeamName { get; } = new("--team-name") { IsRequired = true };
1818

19-
public virtual Option<string> IdpGroup { get; } = new("--idp-group");
20-
19+
public virtual Option<string> IdpGroup { get; } = new("--idp-group")
20+
{
21+
Description = "The Identity Provider Group to link the team to. For Enterprise Managed Users only."
22+
};
2123
public virtual Option<string> GithubPat { get; } = new("--github-pat")
2224
{
2325
Description = "Personal access token of the GitHub target. Overrides GH_PAT environment variable."

src/Octoshift/Commands/DownloadLogs/DownloadLogsCommandArgs.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ public class DownloadLogsCommandArgs : CommandArgs
55
{
66
public string GithubOrg { get; set; }
77
public string GithubRepo { get; set; }
8+
public string MigrationId { get; set; }
89
public string GithubApiUrl { get; set; }
910
[Secret]
1011
public string GithubPat { get; set; }

src/Octoshift/Commands/DownloadLogs/DownloadLogsCommandBase.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,19 @@ public class DownloadLogsCommandBase : CommandBase<DownloadLogsCommandArgs, Down
1818

1919
public virtual Option<string> GithubOrg { get; } = new("--github-org")
2020
{
21-
IsRequired = true,
2221
Description = "GitHub organization to download logs from."
2322
};
2423

2524
public virtual Option<string> GithubRepo { get; } = new("--github-repo")
2625
{
27-
IsRequired = true,
2826
Description = "Target repository to download latest log for."
2927
};
3028

29+
public virtual Option<string> MigrationId { get; } = new("--migration-id")
30+
{
31+
Description = "Migration ID to download logs for. If specified, --github-org and --github-repo are not required."
32+
};
33+
3134
public virtual Option<string> GithubApiUrl { get; } = new("--github-api-url")
3235
{
3336
Description = "Target GitHub API URL if not targeting github.com (default: https://api.github.com)."
@@ -79,6 +82,7 @@ protected void AddOptions()
7982
{
8083
AddOption(GithubOrg);
8184
AddOption(GithubRepo);
85+
AddOption(MigrationId);
8286
AddOption(GithubApiUrl);
8387
AddOption(GithubPat);
8488
AddOption(MigrationLogFile);

src/Octoshift/Commands/DownloadLogs/DownloadLogsCommandHandler.cs

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ public async Task Handle(DownloadLogsCommandArgs args)
3838
throw new ArgumentNullException(nameof(args));
3939
}
4040

41+
if (args.MigrationId.HasValue())
42+
{
43+
if (args.GithubOrg.HasValue() || args.GithubRepo.HasValue())
44+
{
45+
_log.LogWarning("--github-org and --github-repo are ignored when --migration-id is specified.");
46+
}
47+
}
48+
else
49+
{
50+
if (!args.GithubOrg.HasValue() || !args.GithubRepo.HasValue())
51+
{
52+
throw new OctoshiftCliException("Either --migration-id (GraphQL migration ID) or both --github-org and --github-repo must be specified.");
53+
}
54+
}
55+
4156
_log.LogWarning("Migration logs are only available for 24 hours after a migration finishes!");
4257

4358
_log.LogInformation("Downloading migration logs...");
@@ -49,22 +64,52 @@ public async Task Handle(DownloadLogsCommandArgs args)
4964
throw new OctoshiftCliException($"File {args.MigrationLogFile} already exists! Use --overwrite to overwrite this file.");
5065
}
5166

52-
var result = await _retryPolicy.RetryOnResult(async () => await _githubApi.GetMigrationLogUrl(args.GithubOrg, args.GithubRepo), r => r?.MigrationLogUrl.IsNullOrWhiteSpace() ?? false,
53-
"Waiting for migration log to populate...");
67+
string logUrl;
68+
string migrationId;
69+
string repositoryName;
5470

55-
if (result.Outcome == OutcomeType.Successful && result.Result is null)
71+
if (args.MigrationId.HasValue())
5672
{
57-
throw new OctoshiftCliException($"Migration for repository {args.GithubRepo} not found!");
58-
}
73+
// Use migration ID directly
74+
migrationId = args.MigrationId;
75+
var migrationResult = await _retryPolicy.RetryOnResult(
76+
async () => await _githubApi.GetMigration(migrationId),
77+
r => string.IsNullOrWhiteSpace(r.MigrationLogUrl),
78+
"Waiting for migration log to populate...");
79+
80+
if (migrationResult.Outcome == OutcomeType.Failure)
81+
{
82+
throw new OctoshiftCliException($"Migration log for migration {migrationId} is currently unavailable. Migration logs are only available for 24 hours after a migration finishes. Please ensure the migration ID is correct and the migration has completed recently.");
83+
}
5984

60-
if (result.Outcome == OutcomeType.Failure)
61-
{
62-
throw new OctoshiftCliException($"Migration log for repository {args.GithubRepo} unavailable!");
85+
var (_, RepositoryName, _, _, MigrationLogUrl) = migrationResult.Result;
86+
logUrl = MigrationLogUrl;
87+
repositoryName = RepositoryName;
6388
}
89+
else
90+
{
91+
// Use org/repo to find migration
92+
var result = await _retryPolicy.RetryOnResult(async () => await _githubApi.GetMigrationLogUrl(args.GithubOrg, args.GithubRepo), r => r?.MigrationLogUrl.IsNullOrWhiteSpace() ?? false,
93+
"Waiting for migration log to populate...");
94+
95+
if (result.Outcome == OutcomeType.Successful && result.Result is null)
96+
{
97+
throw new OctoshiftCliException($"Migration for repository {args.GithubRepo} not found!");
98+
}
6499

65-
var (logUrl, migrationId) = result.Result.Value;
100+
if (result.Outcome == OutcomeType.Failure)
101+
{
102+
throw new OctoshiftCliException($"Migration log for repository {args.GithubRepo} unavailable!");
103+
}
104+
105+
(logUrl, migrationId) = result.Result.Value;
106+
repositoryName = args.GithubRepo;
107+
}
66108

67-
args.MigrationLogFile ??= $"migration-log-{args.GithubOrg}-{args.GithubRepo}-{migrationId}.log";
109+
var defaultFileName = args.MigrationId.HasValue()
110+
? $"migration-log-{repositoryName}-{migrationId}.log"
111+
: $"migration-log-{args.GithubOrg}-{repositoryName}-{migrationId}.log";
112+
args.MigrationLogFile ??= defaultFileName;
68113

69114
if (FileExists(args.MigrationLogFile))
70115
{
@@ -76,9 +121,9 @@ public async Task Handle(DownloadLogsCommandArgs args)
76121
_log.LogWarning($"Overwriting {args.MigrationLogFile} due to --overwrite option.");
77122
}
78123

79-
_log.LogInformation($"Downloading log for repository {args.GithubRepo} to {args.MigrationLogFile}...");
124+
_log.LogInformation($"Downloading log for repository {repositoryName} to {args.MigrationLogFile}...");
80125
await _httpDownloadService.DownloadToFile(logUrl, args.MigrationLogFile);
81126

82-
_log.LogSuccess($"Downloaded {args.GithubRepo} log to {args.MigrationLogFile}.");
127+
_log.LogSuccess($"Downloaded {repositoryName} log to {args.MigrationLogFile}.");
83128
}
84129
}

0 commit comments

Comments
 (0)