Skip to content

Commit

Permalink
VCI-920: Use Organization parameter in CloudDown target
Browse files Browse the repository at this point in the history
  • Loading branch information
krankenbro committed Oct 3, 2024
1 parent 21c5329 commit 8d952b6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
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

0 comments on commit 8d952b6

Please sign in to comment.