mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
This change adds a --folder parameter to both 'vpk upload az' and 'vpk download az' commands, allowing users to organize releases in subdirectories within their Azure blob containers. Key changes: - Added Folder property to AzureUploadOptions and AzureDownloadOptions - Modified AzureRepository to prepend folder paths to all blob operations - Updated upload, download, and delete operations to work with folder paths - Retention policy (--keepMaxReleases) correctly handles files in folders - Release index and legacy release files are stored in the specified folder This enables multiple applications or environments to share a single Azure container by using folders as isolated namespaces. For example: - vpk upload az --folder "releases/v1" ... - vpk download az --folder "releases/v1" ... The implementation is backward compatible - existing deployments without folders continue to work as before.
65 lines
2.0 KiB
C#
65 lines
2.0 KiB
C#
using System.CommandLine;
|
|
using Velopack.Vpk.Commands.Deployment;
|
|
|
|
namespace Velopack.CommandLine.Tests.Commands;
|
|
|
|
public abstract class AzureCommandTests<T> : BaseCommandTests<T>
|
|
where T : AzureBaseCommand, new()
|
|
{
|
|
protected override string GetRequiredDefaultOptions()
|
|
{
|
|
return "--account \"test-account\" --key \"test-key\" --container \"test-container\" ";
|
|
}
|
|
|
|
[Fact]
|
|
public void Command_WithRequiredEndpointOptions_ParsesValue()
|
|
{
|
|
AzureBaseCommand command = new T();
|
|
|
|
string cli = $"--account \"account-name\" --key \"shhhh\" --endpoint \"https://endpoint\" --container \"mycontainer\"";
|
|
ParseResult parseResult = command.ParseAndApply(cli);
|
|
|
|
Assert.Empty(parseResult.Errors);
|
|
Assert.Equal("account-name", command.Account);
|
|
Assert.Equal("shhhh", command.Key);
|
|
Assert.Equal("https://endpoint/", command.Endpoint);
|
|
Assert.Equal("mycontainer", command.Container);
|
|
}
|
|
}
|
|
|
|
public class AzureDownloadCommandTests : AzureCommandTests<AzureDownloadCommand>
|
|
{
|
|
[Fact]
|
|
public void Folder_WithPath_ParsesValue()
|
|
{
|
|
var command = new AzureDownloadCommand();
|
|
|
|
string cli = GetRequiredDefaultOptions() + " --folder \"releases/v1\"";
|
|
ParseResult parseResult = command.ParseAndApply(cli);
|
|
|
|
Assert.Equal("releases/v1", command.Folder);
|
|
}
|
|
}
|
|
|
|
public class AzureUploadCommandTests : AzureCommandTests<AzureUploadCommand>
|
|
{
|
|
public override bool ShouldBeNonEmptyReleaseDir => true;
|
|
|
|
protected override string GetRequiredDefaultOptions()
|
|
{
|
|
return base.GetRequiredDefaultOptions() + "--releaseDir \"./releases\" ";
|
|
}
|
|
|
|
[Fact]
|
|
public void Folder_WithPath_ParsesValue()
|
|
{
|
|
var command = new AzureUploadCommand();
|
|
|
|
string cli = GetRequiredDefaultOptions() + " --folder \"releases/v1\"";
|
|
ParseResult parseResult = command.ParseAndApply(cli);
|
|
|
|
Assert.Equal("releases/v1", command.Folder);
|
|
}
|
|
|
|
}
|