Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VCI-920: Use Organization parameter in CloudDown target #147

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions docs/targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,23 @@ vc-build CloudEnvUpdate -CloudToken <your token> -Manifest <path to application
```
:::
:::
## CloudEnvSetParameter
## CloudEnvSetParameter
Updates parameters of cloud environment
Gets parameters: CloudToken, EnvironmentName, HelmParameters (Array), Organization (optional)
```console
vc-build CloudEnvSetParameter -CloudToken <your token> -EnvironmentName <environment name> -HelmParameters platform.config.paramname=somevalue123
```
:::
:::
## CloudEnvStatus
## CloudEnvStatus
Waits for health and/or sync statuses of the Environment
Gets parameters: CloudToken, EnvironmentName, HealthStatus, SyncStatus
```console
vc-build CloudEnvStatus -CloudToken <your token> -EnvironmentName <environment name> -HealthStatus Healthy -SyncStatus Progressing
```
:::
:::
## CloudAuth
## CloudAuth
This target saves a token for accessing the VirtoCloud portal, eliminating the need to use the CloudToken parameter with every call to targets in the Cloud group.
Gets parameters: AzureAD (optional)
```console
Expand All @@ -257,58 +257,60 @@ vc-build CloudAuth -AzureAD
```
:::
:::
## CloudInit
## CloudInit
This target creates a new environment. It additionally accepts the ServicePlan parameter to specify the service plan (default value is F1).
```console
vc-build CloudInit -EnvironmentName <EnvName>
vc-build CloudInit -EnvironmentName <EnvName> -ServicePlan F1
```
:::
:::
## CloudEnvList
## CloudEnvList
List Environments with Statuses
```console
vc-build CloudEnvList
```
:::
:::
## CloudEnvRestart
## CloudEnvRestart
Restart Environment
```console
vc-build CloudEnvRestart -EnvironmentName <EnvName>
```
:::
:::
## CloudEnvStatus
## CloudEnvStatus
Waits for health and/or sync statuses of the Environment
Gets parameters: CloudToken, EnvironmentName, HealthStatus, SyncStatus
```console
vc-build CloudEnvStatus -CloudToken <your token> -EnvironmentName <environment name> -HealthStatus Healthy -SyncStatus Progressing
```
:::
:::
## CloudEnvLogs
## CloudEnvLogs
Show Environment’s Logs
```console
vc-build CloudEnvLogs -EnvironmentName <EnvName>
```
:::
:::
## CloudDown
## CloudDown
Delete Environment
Parameters: Organization (optional), EnvironmentName (required)
```console
vc-build CloudDown -EnvironmentName <EnvName>
vc-build CloudDown -Organization <OrgName> -EnvironmentName <EnvName>
```
:::
:::
## CloudDeploy
## CloudDeploy
Deploy Custom Image to the Existing Environment
```console
vc-build CloudDeploy -EnvironmentName <EnvName> -DockerUsername <username of docker hub>
```
:::
:::
## CloudUp
## CloudUp
Deploy Custom Image to the New Environment
```console
vc-build CloudUp -EnvironmentName <EnvName> -DockerUsername <username of docker hub>
Expand Down
16 changes: 9 additions & 7 deletions src/VirtoCommerce.Build/Cloud/Build.SaaS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ public string CloudAuthProvider
}
[Parameter("Use Azure AD as SaaS Auth Provider")] public bool AzureAD = false;
private string cloudAuthProvider = "GitHub";
private string environmentName;

[Parameter("App Project Name")] public string AppProject { get; set; }
[Parameter("Cloud Environment Name")] public string EnvironmentName { get; set; }
[Parameter("App Project Name")] public string AppProject { get => SaaSOrganizationName; set => SaaSOrganizationName = value?.ToLowerInvariant(); }
[Parameter("Cloud Environment Name")] public string EnvironmentName { get => environmentName; set => environmentName = value?.ToLowerInvariant(); }
[Parameter("Cloud Environment Service Plan")] public string ServicePlan { get; set; } = "F1";
[Parameter("Cloud Environment Cluster Name")] public string ClusterName { get; set; }
[Parameter("Cloud Environment Db Provider")] public string DbProvider { get; set; }
Expand Down Expand Up @@ -300,7 +301,8 @@ private static void CopyPlatformDirectory(AbsolutePath platformDirectory, Absolu
var port = "60123";
var listenerPrefix = $"http://localhost:{port}/";

var listener = new HttpListener() {
var listener = new HttpListener()
{
Prefixes = { listenerPrefix }
};
listener.Start();
Expand Down Expand Up @@ -368,7 +370,7 @@ private void SaveCloudToken(string token)
var cloudClient = CreateVirtocloudClient(CloudUrl, await GetCloudTokenAsync());
var envList = await cloudClient.EnvironmentsListAsync();
Log.Information("There are {0} environments.", envList.Count);
foreach ( var env in envList)
foreach (var env in envList)
{
Log.Information("{0} - {1}", env.MetadataName, env.Status);
}
Expand Down Expand Up @@ -401,15 +403,15 @@ private void SaveCloudToken(string token)
Cluster = ClusterName,
DbProvider = DbProvider,
DbName = DbName,
Helm = new HelmObject(new Dictionary<string, string> ())
Helm = new HelmObject(new Dictionary<string, string>())
};

if(!string.IsNullOrEmpty(DockerImageName))
if (!string.IsNullOrEmpty(DockerImageName))
{
model.Helm.Parameters["platform.image.repository"] = DockerImageName;
}

if(!DockerImageTag.IsNullOrEmpty())
if (!DockerImageTag.IsNullOrEmpty())
{
model.Helm.Parameters["platform.image.tag"] = DockerImageTag[0];
}
Expand Down
Loading