Skip to content

Commit

Permalink
VCI-660: Fix ignoring of PackageManifestPath; Fix of an issue with th… (
Browse files Browse the repository at this point in the history
  • Loading branch information
krankenbro authored Aug 22, 2023
1 parent 518ea38 commit d91c70e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,23 @@ protected override Task InnerInstall(ModuleSource source)
foreach (var moduleBlobName in azureBlobSource.Modules.Select(m => m.BlobName))
{
Log.Information($"Installing {moduleBlobName}");
var zipName = $"{moduleBlobName}.zip";
var zipName = moduleBlobName;
if(!zipName.EndsWith(".zip"))
{
zipName += ".zip";
}

var zipPath = Path.Join(_destination, zipName);
var moduleDestination = Path.Join(_destination, moduleBlobName);
if (moduleDestination.EndsWith(".zip"))
{
moduleDestination = moduleDestination.Replace(".zip", "");
}
Log.Information($"Downloading Blob {moduleBlobName}");
var blobClient = containerClient.GetBlobClient(moduleBlobName);
blobClient.DownloadTo(zipPath);
Log.Information($"Extracting Blob {moduleBlobName}");
ZipFile.ExtractToDirectory(zipPath, moduleDestination);
ZipFile.ExtractToDirectory(zipPath, moduleDestination, true);
Log.Information($"Successfully installed {moduleBlobName}");
}
return Task.CompletedTask;
Expand Down
20 changes: 14 additions & 6 deletions src/VirtoCommerce.Build/PlatformTools/Build.PackageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ internal partial class Build
packageManifest.PlatformVersion = platformRelease.TagName;
}
PackageManager.ToFile(packageManifest);
PackageManager.ToFile(packageManifest, PackageManifestPath);
});

private void UpdateModules(string[] modulesArg, IModuleCatalog externalModuleCatalog, List<ModuleItem> modules)
Expand Down Expand Up @@ -194,6 +194,7 @@ private static bool PlatformVersionChanged()
.Triggers(Rollback, RemoveBackup)
.Before(Install, Update, InstallPlatform, InstallModules)
.OnlyWhenDynamic(() => !IsServerBuild && Directory.EnumerateFileSystemEntries(RootDirectory).Any())
.ProceedAfterFailure()
.Executes(() =>
{
var discoveryPath = Path.GetFullPath(GetDiscoveryPath());
Expand All @@ -208,7 +209,8 @@ private static bool PlatformVersionChanged()
});

public Target Rollback => _ => _
.After(Install, Update, InstallPlatform, InstallModules)
.DependsOn(Backup)
.After(Backup, Install, Update, InstallPlatform, InstallModules)
.OnlyWhenDynamic(() => FailedTargets.Any() && SucceededTargets.Contains(Backup))
.AssuredAfterFailure()
.Executes(() =>
Expand Down Expand Up @@ -321,6 +323,7 @@ private static bool IsPlatformInstallationNeeded(string version)
public Target InstallModules => _ => _
.After(InstallPlatform)
.OnlyWhenDynamic(() => !PlatformParameter)
.ProceedAfterFailure()
.Executes(async () =>
{
var packageManifest = PackageManager.FromFile(PackageManifestPath);
Expand Down Expand Up @@ -366,7 +369,6 @@ private static bool IsPlatformInstallationNeeded(string version)
if (m.Level == ProgressMessageLevel.Error)
{
Log.Error(m.Message);
Assert.Fail(m.Message);
}
else
{
Expand All @@ -389,7 +391,13 @@ private static bool IsPlatformInstallationNeeded(string version)
{
module.DependsOn.Clear();
});
moduleInstaller.Install(modulesToInstall, progress);
try
{
moduleInstaller.Install(modulesToInstall, progress);
} catch (Exception ex)
{
Assert.Fail(ex.Message);
}
foreach (var moduleSource in moduleSources)
{
Expand Down Expand Up @@ -464,7 +472,7 @@ private static ManifestModuleInfo LoadModuleInfo(ModuleItem module, ManifestModu
FileSystemTasks.DeleteDirectory(ProbingPath);
Module.ForEach(m => FileSystemTasks.DeleteDirectory(Path.Combine(discoveryPath, m)));
githubModules.RemoveAll(m => Module.Contains(m.Id));
PackageManager.ToFile(packageManifest);
PackageManager.ToFile(packageManifest, PackageManifestPath);
if (PlatformVersion.CurrentVersion == null)
{
var platformRelease = await GithubManager.GetPlatformRelease(null);
Expand All @@ -489,7 +497,7 @@ private static ManifestModuleInfo LoadModuleInfo(ModuleItem module, ManifestModu
manifest = await UpdateStableAsync(manifest, PlatformParameter, BundleName);
}
PackageManager.ToFile(manifest);
PackageManager.ToFile(manifest, PackageManifestPath);
});

private async Task<ManifestBase> UpdateEdgeAsync(ManifestBase manifest, bool platformOnly)
Expand Down

0 comments on commit d91c70e

Please sign in to comment.