-
Notifications
You must be signed in to change notification settings - Fork 679
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #235 from github/add-bb-commands
Add Bitbucket commands
- Loading branch information
Showing
15 changed files
with
166 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Collections.Immutable; | ||
using System.CommandLine; | ||
|
||
namespace ActionsImporter.Commands.Bitbucket; | ||
|
||
public class Audit : ContainerCommand | ||
{ | ||
public Audit(string[] args) : base(args) | ||
{ | ||
} | ||
|
||
protected override string Name => "bitbucket"; | ||
protected override string Description => "An audit will output a list of data used in a Bitbucket instance."; | ||
protected override ImmutableArray<Option> Options => ImmutableArray.Create<Option>( | ||
Common.AccessToken, | ||
Common.Workspace, | ||
Common.Project, | ||
Common.ConfigFilePath | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System.CommandLine; | ||
|
||
namespace ActionsImporter.Commands.Bitbucket; | ||
|
||
public static class Common | ||
{ | ||
|
||
|
||
public static readonly Option<string> AccessToken = new("--bitbucket-access-token") | ||
{ | ||
Description = "Access token for the Bitbucket instance.", | ||
IsRequired = false, | ||
}; | ||
|
||
public static readonly Option<string> Workspace = new(new[] { "--workspace", "-w" }) | ||
{ | ||
Description = "The Bitbucket workspace name.", | ||
IsRequired = true, | ||
}; | ||
|
||
public static readonly Option<string> Project = new(new[] { "--project-key", "-p" }) | ||
{ | ||
Description = "The Bitbucket project key.", | ||
IsRequired = false, | ||
}; | ||
|
||
public static readonly Option<string> Repository = new(new[] { "--repository", "-r" }) | ||
{ | ||
Description = "The Bitbucket repository name.", | ||
IsRequired = true, | ||
}; | ||
|
||
public static readonly Option<FileInfo> ConfigFilePath = new("--config-file-path") | ||
{ | ||
Description = "The file path to the GitHub Actions Importer configuration file.", | ||
IsRequired = false, | ||
}; | ||
|
||
public static readonly Option<FileInfo> SourceFilePath = new("--source-file-path") | ||
{ | ||
Description = "The file path corresponding to the Bamboo pipeline file.", | ||
IsRequired = false, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Collections.Immutable; | ||
using System.CommandLine; | ||
|
||
namespace ActionsImporter.Commands.Bitbucket; | ||
|
||
public class DryRun : ContainerCommand | ||
{ | ||
public DryRun(string[] args) : base(args) | ||
{ | ||
} | ||
|
||
protected override string Name => "bitbucket"; | ||
protected override string Description => "Convert a Bitbucket pipeline to a GitHub Actions workflow and output the yaml file."; | ||
|
||
protected override ImmutableArray<Option> Options => ImmutableArray.Create<Option>( | ||
Common.Workspace, | ||
Common.Repository, | ||
Common.AccessToken, | ||
Common.SourceFilePath, | ||
Common.ConfigFilePath | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Collections.Immutable; | ||
using System.CommandLine; | ||
|
||
namespace ActionsImporter.Commands.Bitbucket; | ||
|
||
public class Forecast : ContainerCommand | ||
{ | ||
public Forecast(string[] args) : base(args) | ||
{ | ||
} | ||
|
||
protected override string Name => "bitbucket"; | ||
protected override string Description => "Forecasts GitHub Actions usage from historical Bitbucket pipeline utilization."; | ||
|
||
private static readonly Option<FileInfo[]> SourceFilePath = new("--source-file-path") | ||
{ | ||
Description = "The file path(s) to existing jobs data.", | ||
IsRequired = false, | ||
AllowMultipleArgumentsPerToken = true, | ||
}; | ||
|
||
private static readonly Option<FileInfo> IncludeFrom = new("--include-from") | ||
{ | ||
Description = "The file path containing a list of line-delimited repository names to include in the forecast.", | ||
IsRequired = false, | ||
}; | ||
|
||
protected override ImmutableArray<Option> Options => ImmutableArray.Create<Option>( | ||
Common.Project, | ||
Common.Workspace, | ||
Common.AccessToken, | ||
SourceFilePath, | ||
IncludeFrom | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Collections.Immutable; | ||
using System.CommandLine; | ||
|
||
namespace ActionsImporter.Commands.Bitbucket; | ||
|
||
public class Migrate : ContainerCommand | ||
{ | ||
public Migrate(string[] args) : base(args) | ||
{ | ||
} | ||
|
||
protected override string Name => "bitbucket"; | ||
protected override string Description => "Convert a Bitbucket pipeline to a GitHub Actions workflow and open a pull request with the changes."; | ||
|
||
protected override ImmutableArray<Option> Options => ImmutableArray.Create<Option>( | ||
Common.Workspace, | ||
Common.Repository, | ||
Common.AccessToken, | ||
Common.SourceFilePath, | ||
Common.ConfigFilePath | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,6 @@ public enum Provider | |
GitLabCI, | ||
Jenkins, | ||
TravisCI, | ||
Bamboo | ||
Bamboo, | ||
Bitbucket | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters