Skip to content

Commit

Permalink
added cliogate check for download command
Browse files Browse the repository at this point in the history
Signed-off-by: Kirill Krylov <[email protected]>
  • Loading branch information
kirillkrylov committed Jul 11, 2024
1 parent 3d0c86f commit 5542eaa
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 27 deletions.
2 changes: 1 addition & 1 deletion clio/Command/InstallerCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace Clio.Command;

[Verb("deploy-creatio", HelpText = "Deploy Creatio from zip file")]
[Verb("deploy-creatio", Aliases = new string[]{""}, HelpText = "Deploy Creatio from zip file")]
public class PfInstallerOptions : EnvironmentNameOptions
{

Expand Down
2 changes: 1 addition & 1 deletion clio/Command/ShowAppListCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Clio.Command
{
[Verb("show-web-app-list", Aliases = new string[] { "show-web-app", "envs"}, HelpText = "Show the list of web applications and their settings")]
[Verb("show-web-app-list", Aliases = new string[] { "envs" ,"show-web-app" }, HelpText = "Show the list of web applications and their settings")]
public class AppListOptions
{
[Value(0, MetaName = "App name", Required = false, HelpText = "Name of application")]
Expand Down
13 changes: 9 additions & 4 deletions clio/Package/ApplicationPackageListProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,15 @@ private PackageInfo CreatePackageInfo(Dictionary<string, string> package) {


public IEnumerable<PackageInfo> GetPackages(string scriptData) {
string responseFormServer = _applicationClient.ExecutePostRequest(PackagesListServiceUrl, scriptData);
var json = _jsonConverter.CorrectJson(responseFormServer);
var packages = _jsonConverter.DeserializeObject<List<Dictionary<string, string>>>(json);
return packages.Select(CreatePackageInfo);
try {
string responseFormServer = _applicationClient.ExecutePostRequest(PackagesListServiceUrl, scriptData);
var json = _jsonConverter.CorrectJson(responseFormServer);
var packages = _jsonConverter.DeserializeObject<List<Dictionary<string, string>>>(json);
return packages.Select(CreatePackageInfo);

} catch (Exception e) {
return Array.Empty<PackageInfo>();
}
}

#endregion
Expand Down
41 changes: 23 additions & 18 deletions clio/Workspace/ApplicationDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,26 +151,31 @@ private void CreateMarkerPackagesFolder() =>
public void Download(IEnumerable<string> packagesNames = null) {
packagesNames ??= Enumerable.Empty<string>();

IEnumerable<string> enumerablePackagesNames = packagesNames as string[] ?? packagesNames.ToArray();
IEnumerable<DownloadInfo> autogeneratedPackagesDownloadInfos =
GetAutogeneratedPackagesDownloadInfos(enumerablePackagesNames);
IEnumerable<DownloadInfo> allDownloadInfos = DownloadInfos.Union(autogeneratedPackagesDownloadInfos);
_downloader.Download(allDownloadInfos);


const string minClioGateVersion = "2.0.0.29";
if(_clioGateway.IsCompatibleWith(minClioGateVersion)) {
IEnumerable<DownloadInfo> files = GetDownloadInfoFromCsProj(enumerablePackagesNames) ;
IEnumerable<DownloadInfo> downloadInfos = files as DownloadInfo[] ?? files.ToArray();
if(downloadInfos.Any()) {
_downloader.DownloadPackageDll(downloadInfos);
const string minClioGateVersionForDownload = "2.0.0.0";
if(_clioGateway.IsCompatibleWith(minClioGateVersionForDownload)) {
IEnumerable<string> enumerablePackagesNames = packagesNames as string[] ?? packagesNames.ToArray();
IEnumerable<DownloadInfo> autogeneratedPackagesDownloadInfos =
GetAutogeneratedPackagesDownloadInfos(enumerablePackagesNames);
IEnumerable<DownloadInfo> allDownloadInfos = DownloadInfos.Union(autogeneratedPackagesDownloadInfos);
_downloader.Download(allDownloadInfos);

const string minClioGateVersion = "2.0.0.29";
if(_clioGateway.IsCompatibleWith(minClioGateVersion)) {
IEnumerable<DownloadInfo> files = GetDownloadInfoFromCsProj(enumerablePackagesNames) ;
IEnumerable<DownloadInfo> downloadInfos = files as DownloadInfo[] ?? files.ToArray();
if(downloadInfos.Any()) {
_downloader.DownloadPackageDll(downloadInfos);
}
}else {
_logger.WriteWarning($"Downloading of referenced package dlls requires cliogate version {minClioGateVersion} or higher.");
}
}else {
_logger.WriteWarning($"Downloading of referenced package dlls requires cliogate version {minClioGateVersion} or higher.");

CreateMarkerPackagesFolder();
DeleteSourceSchemasFromAutogenerated(enumerablePackagesNames);
}
else {
_logger.WriteWarning($"Downloading of cor libraries requires cliogate version {minClioGateVersionForDownload} or higher.");
}

CreateMarkerPackagesFolder();
DeleteSourceSchemasFromAutogenerated(enumerablePackagesNames);
}

public IEnumerable<DownloadInfo> GetDownloadInfoFromCsProj(IEnumerable<string> packagesNames){
Expand Down
17 changes: 14 additions & 3 deletions clio/clio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Authors>creatio rnd team</Authors>
<PackageTags>cli ATF clio creatio</PackageTags>
<NeutralLanguage>en</NeutralLanguage>
<AssemblyVersion>6.1.0.25</AssemblyVersion>
<AssemblyVersion>6.1.0.26</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<Version>$(AssemblyVersion)</Version>
<Description>CLI interface for Creatio</Description>
Expand Down Expand Up @@ -991,9 +991,20 @@
</Content>
<None Remove="tpl\package\Files\app-descriptor.json" />
</ItemGroup>

<Choose>
<When Condition="Exists('..\..\creatioclient\creatioclient\creatioclient.csproj')">
<ItemGroup>
<ProjectReference Include="..\..\creatioclient\creatioclient\creatioclient.csproj" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<PackageReference Include="creatio.client" Version="1.0.24" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<PackageReference Include="creatio.client" Version="1.0.24" />
<!-- <PackageReference Include="creatio.client" Version="1.0.24" />-->
<PackageReference Include="ATF.Repository" Version="2.0.2.2" />
<PackageReference Include="Autofac" Version="8.0.0" />
<PackageReference Include="CommandLineSDK" Version="1.0.11" />
Expand Down
10 changes: 10 additions & 0 deletions http_requests/CreatioApiGateway.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### Protected Access
< set-request-base_url.js

POST {{base_url}}/0/rest/CreatioApiGateway/GetPackages HTTP/2
Content-Type: application/json
BPMCSRF: {{BPMCSRF}}

{

}
6 changes: 6 additions & 0 deletions http_requests/http-client.env.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@
"UserName": "Supervisor",
"UserPassword": "Supervisor",
"isNetCore": false
},
"d_472": {
"base_url": "http://kkrylovn.tscrm.com:40030",
"UserName": "Supervisor",
"UserPassword": "Supervisor",
"isNetCore": false
}
}

0 comments on commit 5542eaa

Please sign in to comment.