Skip to content

Commit

Permalink
Add Bamboo support to configure command (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaseshak authored May 11, 2023
1 parent 19083bc commit b3f8e99
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/ActionsImporter.UnitTests/Models/VariableTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class VariableTests
[TestCase(Provider.GitLabCI, "GitLab CI")]
[TestCase(Provider.Jenkins, "Jenkins")]
[TestCase(Provider.TravisCI, "Travis CI")]
[TestCase(Provider.Bamboo, "Bamboo")]
public void ProviderName_ValidName_ReturnsExpected(Provider provider, string providerName)
{
// Arrange
Expand Down
4 changes: 4 additions & 0 deletions src/ActionsImporter/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public static class Constants
new Variable("AZURE_DEVOPS_INSTANCE_URL", Provider.AzureDevOps, "Base url of the Azure DevOps instance", "https://dev.azure.com"),
new Variable("AZURE_DEVOPS_ORGANIZATION", Provider.AzureDevOps, "Azure DevOps organization name"),
new Variable("AZURE_DEVOPS_PROJECT", Provider.AzureDevOps, "Azure DevOps project name"),
new Variable("BAMBOO_ACCESS_TOKEN", Provider.Bamboo, "Personal access token for Bamboo"),
new Variable("BAMBOO_INSTANCE_URL", Provider.Bamboo, "Base url of the Bamboo instance"),
new Variable("CIRCLE_CI_ACCESS_TOKEN", Provider.CircleCI, "Personal access token for CircleCI"),
new Variable("CIRCLE_CI_INSTANCE_URL", Provider.CircleCI, "Base url of the CircleCI instance", "https://circleci.com"),
new Variable("CIRCLE_CI_ORGANIZATION", Provider.CircleCI, "CircleCI organization name"),
Expand All @@ -25,6 +27,8 @@ public static class Constants
new Variable("TRAVIS_CI_ORGANIZATION", Provider.TravisCI, "Travis CI organization name")
};

public static List<string> ProviderNames => UserInputVariables.Where(v => v.Provider != Provider.GitHub).Select(v => v.ProviderName).Distinct().ToList();

public static List<string> EnvironmentVariables
{
get
Expand Down
3 changes: 2 additions & 1 deletion src/ActionsImporter/Models/Provider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ public enum Provider
CircleCI,
GitLabCI,
Jenkins,
TravisCI
TravisCI,
Bamboo
}
3 changes: 2 additions & 1 deletion src/ActionsImporter/Models/Variable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public Variable(string key, Provider provider, string message, string? defaultVa
Provider.GitLabCI => "GitLab CI",
Provider.Jenkins => "Jenkins",
Provider.TravisCI => "Travis CI",
Provider.Bamboo => "Bamboo",
_ => throw new ArgumentOutOfRangeException()
};

Expand All @@ -28,5 +29,5 @@ public Variable(string key, Provider provider, string message, string? defaultVa

public string? Placeholder => DefaultValue is not null && IsPassword ? $"({DefaultValue})" : null;

private Provider Provider { get; }
public Provider Provider { get; }
}
3 changes: 1 addition & 2 deletions src/ActionsImporter/Services/ConfigurationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public ImmutableDictionary<string, string> GetUserInput()
{
var providers = Prompt.MultiSelect(
"Which CI providers are you configuring?",
new[] { "Azure DevOps", "CircleCI", "GitLab CI", "Jenkins", "Travis CI" },
pageSize: 5
Constants.ProviderNames
);

var input = ImmutableDictionary.CreateBuilder<string, string>();
Expand Down

0 comments on commit b3f8e99

Please sign in to comment.