Skip to content

Commit 4b1f8af

Browse files
Merge pull request #235 from github/add-bb-commands
Add Bitbucket commands
2 parents b36e329 + 587e99d commit 4b1f8af

File tree

15 files changed

+166
-12
lines changed

15 files changed

+166
-12
lines changed

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
[GitHub Actions Importer](https://docs.github.com/en/actions/migrating-to-github-actions/automating-migration-with-github-actions-importer) helps plan, test, and automate your migration to GitHub Actions from the following platforms:
66

77
- Azure DevOps
8-
- Bamboo (currently in beta)
8+
- Bamboo
9+
- Bitbucket
910
- CircleCI
1011
- GitLab
1112
- Jenkins
@@ -15,7 +16,7 @@
1516

1617
If you need assistance, you can file a support ticket [here](https://support.github.com).
1718

18-
## Getting started
19+
## Getting started
1920

2021
GitHub Actions Importer is distributed as a Docker container and this extension to the official [GitHub CLI](https://cli.github.com) to interact with the Docker container.
2122

@@ -32,15 +33,15 @@ The following requirements must be met to be able to use the GitHub Actions Impo
3233
Next, the GitHub Actions Importer CLI extension can be installed via this command:
3334

3435
```bash
35-
$ gh extension install github/gh-actions-importer
36+
gh extension install github/gh-actions-importer
3637
```
3738

3839
### Configuration
3940

4041
New versions of the GitHub Actions Importer are released on a regular basis. To ensure you're up to date, run the following command:
4142

4243
```bash
43-
$ gh actions-importer update
44+
gh actions-importer update
4445
```
4546

4647
In order for GitHub Actions Importer to communicate with your current CI/CD server and GitHub, various credentials must be available for the command. These can be configured using environment variables or a `.env.local` file. These environment variables can be configured in an interactive prompt by running the following command:
@@ -60,11 +61,12 @@ Detailed information about how to use GitHub Actions Importer can be found in th
6061
### Recordings
6162

6263
You can access recorded demos of GitHub Actions Importer performing migrations to Actions from the following CI/CD platforms:
63-
- [Azure DevOps](https://youtu.be/gG-2bkmBRlI)
64-
- [CircleCI](https://youtu.be/YkFnNEyM9Hg)
65-
- [GitLab](https://youtu.be/3t5ywu0_qk4)
66-
- [Jenkins](https://youtu.be/WqiGP6h4fa0)
67-
- [Travis CI](https://youtu.be/ndc-FNa_X3c)
64+
65+
- [Azure DevOps](https://youtu.be/gG-2bkmBRlI)
66+
- [CircleCI](https://youtu.be/YkFnNEyM9Hg)
67+
- [GitLab](https://youtu.be/3t5ywu0_qk4)
68+
- [Jenkins](https://youtu.be/WqiGP6h4fa0)
69+
- [Travis CI](https://youtu.be/ndc-FNa_X3c)
6870

6971
### Self-guided learning
7072

docs/jenkins/SCPPublish.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
scp scp_transfer.tar 127.0.0.1:
5656
ssh 127.0.0.1 'tar -xvf scp_transfer.tar -C /results && rm scp_transfer.tar'
5757
```
58+
5859
### Unsupported Options
5960
6061
- Keeps Hierarchy (currrently always keeps folder structure)
61-

src/ActionsImporter.UnitTests/Models/VariableTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class VariableTests
1313
[TestCase(Provider.Jenkins, "Jenkins")]
1414
[TestCase(Provider.TravisCI, "Travis CI")]
1515
[TestCase(Provider.Bamboo, "Bamboo")]
16+
[TestCase(Provider.Bitbucket, "Bitbucket")]
1617
public void ProviderName_ValidName_ReturnsExpected(Provider provider, string providerName)
1718
{
1819
// Arrange

src/ActionsImporter/Commands/Audit.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ protected override Command GenerateCommand(App app)
2929
command.AddGlobalOption(FoldersOption);
3030
command.AddCommand(new AzureDevOps.Audit(_args).Command(app));
3131
command.AddCommand(new Bamboo.Audit(_args).Command(app));
32+
command.AddCommand(new Bitbucket.Audit(_args).Command(app));
3233
command.AddCommand(new Circle.Audit(_args).Command(app));
3334
command.AddCommand(new GitLab.Audit(_args).Command(app));
3435
command.AddCommand(new Jenkins.Audit(_args).Command(app));
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System.Collections.Immutable;
2+
using System.CommandLine;
3+
4+
namespace ActionsImporter.Commands.Bitbucket;
5+
6+
public class Audit : ContainerCommand
7+
{
8+
public Audit(string[] args) : base(args)
9+
{
10+
}
11+
12+
protected override string Name => "bitbucket";
13+
protected override string Description => "An audit will output a list of data used in a Bitbucket instance.";
14+
protected override ImmutableArray<Option> Options => ImmutableArray.Create<Option>(
15+
Common.AccessToken,
16+
Common.Workspace,
17+
Common.Project,
18+
Common.ConfigFilePath
19+
);
20+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System.CommandLine;
2+
3+
namespace ActionsImporter.Commands.Bitbucket;
4+
5+
public static class Common
6+
{
7+
8+
9+
public static readonly Option<string> AccessToken = new("--bitbucket-access-token")
10+
{
11+
Description = "Access token for the Bitbucket instance.",
12+
IsRequired = false,
13+
};
14+
15+
public static readonly Option<string> Workspace = new(new[] { "--workspace", "-w" })
16+
{
17+
Description = "The Bitbucket workspace name.",
18+
IsRequired = true,
19+
};
20+
21+
public static readonly Option<string> Project = new(new[] { "--project-key", "-p" })
22+
{
23+
Description = "The Bitbucket project key.",
24+
IsRequired = false,
25+
};
26+
27+
public static readonly Option<string> Repository = new(new[] { "--repository", "-r" })
28+
{
29+
Description = "The Bitbucket repository name.",
30+
IsRequired = true,
31+
};
32+
33+
public static readonly Option<FileInfo> ConfigFilePath = new("--config-file-path")
34+
{
35+
Description = "The file path to the GitHub Actions Importer configuration file.",
36+
IsRequired = false,
37+
};
38+
39+
public static readonly Option<FileInfo> SourceFilePath = new("--source-file-path")
40+
{
41+
Description = "The file path corresponding to the Bamboo pipeline file.",
42+
IsRequired = false,
43+
};
44+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System.Collections.Immutable;
2+
using System.CommandLine;
3+
4+
namespace ActionsImporter.Commands.Bitbucket;
5+
6+
public class DryRun : ContainerCommand
7+
{
8+
public DryRun(string[] args) : base(args)
9+
{
10+
}
11+
12+
protected override string Name => "bitbucket";
13+
protected override string Description => "Convert a Bitbucket pipeline to a GitHub Actions workflow and output the yaml file.";
14+
15+
protected override ImmutableArray<Option> Options => ImmutableArray.Create<Option>(
16+
Common.Workspace,
17+
Common.Repository,
18+
Common.AccessToken,
19+
Common.SourceFilePath,
20+
Common.ConfigFilePath
21+
);
22+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Collections.Immutable;
2+
using System.CommandLine;
3+
4+
namespace ActionsImporter.Commands.Bitbucket;
5+
6+
public class Forecast : ContainerCommand
7+
{
8+
public Forecast(string[] args) : base(args)
9+
{
10+
}
11+
12+
protected override string Name => "bitbucket";
13+
protected override string Description => "Forecasts GitHub Actions usage from historical Bitbucket pipeline utilization.";
14+
15+
private static readonly Option<FileInfo[]> SourceFilePath = new("--source-file-path")
16+
{
17+
Description = "The file path(s) to existing jobs data.",
18+
IsRequired = false,
19+
AllowMultipleArgumentsPerToken = true,
20+
};
21+
22+
private static readonly Option<FileInfo> IncludeFrom = new("--include-from")
23+
{
24+
Description = "The file path containing a list of line-delimited repository names to include in the forecast.",
25+
IsRequired = false,
26+
};
27+
28+
protected override ImmutableArray<Option> Options => ImmutableArray.Create<Option>(
29+
Common.Project,
30+
Common.Workspace,
31+
Common.AccessToken,
32+
SourceFilePath,
33+
IncludeFrom
34+
);
35+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System.Collections.Immutable;
2+
using System.CommandLine;
3+
4+
namespace ActionsImporter.Commands.Bitbucket;
5+
6+
public class Migrate : ContainerCommand
7+
{
8+
public Migrate(string[] args) : base(args)
9+
{
10+
}
11+
12+
protected override string Name => "bitbucket";
13+
protected override string Description => "Convert a Bitbucket pipeline to a GitHub Actions workflow and open a pull request with the changes.";
14+
15+
protected override ImmutableArray<Option> Options => ImmutableArray.Create<Option>(
16+
Common.Workspace,
17+
Common.Repository,
18+
Common.AccessToken,
19+
Common.SourceFilePath,
20+
Common.ConfigFilePath
21+
);
22+
}

src/ActionsImporter/Commands/DryRun.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ protected override Command GenerateCommand(App app)
2121

2222
command.AddCommand(new AzureDevOps.DryRun(_args).Command(app));
2323
command.AddCommand(new Bamboo.DryRun(_args).Command(app));
24+
command.AddCommand(new Bitbucket.DryRun(_args).Command(app));
2425
command.AddCommand(new Circle.DryRun(_args).Command(app));
2526
command.AddCommand(new GitLab.DryRun(_args).Command(app));
2627
command.AddCommand(new Jenkins.DryRun(_args).Command(app));

0 commit comments

Comments
 (0)