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

Update to SDK V12 and add ETag and Last Modified support #179

Closed
wants to merge 18 commits into from
Closed
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
35 changes: 33 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2.1.0.{build}
version: 3.0.0.{build}

os: Visual Studio 2019

Expand All @@ -9,7 +9,7 @@ configuration: Release

environment:
# Version Suffix
version_suffix: alpha
version_suffix: beta3

install:
- ps: .\build\appveyor-semver.ps1
Expand Down Expand Up @@ -73,6 +73,16 @@ deploy:
on:
branch: develop-umbraco-version-8

# Umbraco MyGet community feed
- provider: NuGet
server: https://www.myget.org/F/umbraco-packages/api/v2/package
symbol_server: https://www.myget.org/F/umbraco-packages/symbols/api/v2/package
api_key:
secure: yvlnQEq6tmxGOdbtTuKyAhcdY1GCD98/sG9+Qo7y7SNb89GAbjLXxueOMspkjvUh
artifact: /.*\.nupkg/
on:
branch: feature/sdk12

# GitHub Deployment for releases
- provider: GitHub
auth_token:
Expand Down Expand Up @@ -114,3 +124,24 @@ deploy:
on:
branch: master-umbraco-version-8
appveyor_repo_tag: true

# GitHub Deployment for releases
- provider: GitHub
auth_token:
secure: Kucu1gQQf8bjRlkR72fyZUiUtmkz7rtZEIgK/RMT1pMnq700m5sSQTiFHOSQUdR5
artifact: /.*\.zip/ # upload all Zip packages to release assets
draft: false
prerelease: false
on:
branch: main-version-3
appveyor_repo_tag: true # deploy on tag push only

# NuGet Deployment for releases
- provider: NuGet
server:
api_key:
secure: TtE4dizVNNLoy4gfrJDGRH1/vfNMTXiAxuMW0va1bcO1ZPXCw0qy12PUfIB+h9O3
artifact: /.*\.nupkg/
on:
branch: main-version-3
appveyor_repo_tag: true
2 changes: 1 addition & 1 deletion build/UmbracoFileSystemProviders.Azure.Forms.proj
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
Description="$(Description)"
Summary="$(Readme)"
Version="$(FileVersion)"
MinimumRequiredUmbracoVersion ="$(MinUmbracoVersion)"
MinimumRequiredUmbracoVersion ="[$(MinUmbracoVersion),9.0.0)"
Authors="$(AuthorName)"
Owners="$(Owners)"
Copyright="$(Copyright)"
Expand Down
6 changes: 3 additions & 3 deletions build/UmbracoFileSystemProviders.Azure.Media.proj
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<!-- Umbraco specific -->
<!-- Newtonsoft.Json Excluded for now as Umbraco requires different major versions -->
<CoreBinFiles Include="$(CoreProjectDir)\bin\$(BuildConfig)\Our.Umbraco.FileSystemProviders.Azure.dll" />
<UmbracoOtherBinFiles Include="$(InstallerProjectDir)\bin\$(BuildConfig)\Microsoft.Web.XmlTransform.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Microsoft.Data.Edm.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Microsoft.Data.OData.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Microsoft.Data.Services.Client.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Microsoft.Azure.ConfigurationManager.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Microsoft.Azure.Storage.Blob.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Microsoft.Azure.Storage.Common.dll;$(CoreProjectDir)\bin\$(BuildConfig)\System.Spatial.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Microsoft.Azure.KeyVault.Core.dll" />
<UmbracoOtherBinFiles Include="$(InstallerProjectDir)\bin\$(BuildConfig)\Microsoft.Web.XmlTransform.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Microsoft.Data.Edm.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Microsoft.Data.OData.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Azure.Storage.Blobs.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Azure.Storage.Common.dll;$(CoreProjectDir)\bin\$(BuildConfig)\Azure.Core.dll;$(CoreProjectDir)\bin\$(BuildConfig)\System.Spatial.dll" />
<InstallerBinFiles Include="$(InstallerProjectDir)\bin\$(BuildConfig)\Our.Umbraco.FileSystemProviders.Azure.Installer.dll" />
<UmbracoInstallerFiles Include="$(InstallerProjectDir)\Configurator\**\*.*"/>
<UmbracoInstallerLogo Include="$(MSBuildProjectDirectory)\assets\logo\azure-logo-32.png"/>
Expand Down Expand Up @@ -136,7 +136,7 @@
<ManifestUpdate
ManifestFile="$(BuildUmbDir)\package.xml"
WorkingDirectory="$(BuildUmbDir)"
MinimumRequiredUmbracoVersion="$(MinUmbracoVersion)"
MinimumRequiredUmbracoVersion ="$(MinUmbracoVersion)"
PackageName="$(PackageName)"
PackageVersion="$(FileVersion)"
AuthorName="$(AuthorName)"
Expand All @@ -161,7 +161,7 @@
Description="$(Description)"
Summary="$(Readme)"
Version="$(FileVersion)"
MinimumRequiredUmbracoVersion ="$(MinUmbracoVersion)"
MinimumRequiredUmbracoVersion ="[$(MinUmbracoVersion),9.0.0)"
Authors="$(AuthorName)"
Owners="$(Owners)"
Copyright="$(Copyright)"
Expand Down
7 changes: 3 additions & 4 deletions build/UmbracoFileSystemProviders.Azure.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
<dependencies>
<dependency id="UmbracoCms.Core" version="0.0.0" />
<dependency id="UmbracoCms.Web" version="0.0.0" />
<dependency id="Microsoft.Azure.Storage.Blob" version="11.1.2" />
<dependency id="Microsoft.Azure.ConfigurationManager" version="4.0.0" />
<dependency id="Microsoft.Azure.KeyVault.Core" version="3.0.3" />
<dependency id="Microsoft.Data.Services.Client" version="5.8.4" />
<dependency id="Azure.Storage.Blobs" version="12.9.1" />
<dependency id="Azure.Storage.Common" version="12.8.0" />
<dependency id="Azure.Core" version="1.18.0" />
</dependencies>
</metadata>
</package>
2 changes: 1 addition & 1 deletion build/UmbracoFileSystemProviders.Azure.proj
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
Description="$(Description)"
Summary="$(Readme)"
Version="$(FileVersion)"
MinimumRequiredUmbracoVersion ="$(MinUmbracoVersion)"
MinimumRequiredUmbracoVersion ="[$(MinUmbracoVersion),9.0.0)"
Authors="$(AuthorName)"
Owners="$(Owners)"
Copyright="$(Copyright)"
Expand Down
10 changes: 0 additions & 10 deletions build/transforms/umbpak-web.config.install.xdt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" xdt:Transform="InsertIfMissing">
<dependentAssembly xdt:Transform="Remove" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Microsoft.Data.Services.Client')">
</dependentAssembly>
<dependentAssembly xdt:Transform="Remove" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Microsoft.Data.OData')">
</dependentAssembly>
<dependentAssembly xdt:Transform="Remove" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Microsoft.Data.Edm')">
</dependentAssembly>
<dependentAssembly xdt:Transform="Remove" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Microsoft.Azure.KeyVault.Core')">
</dependentAssembly>

<dependentAssembly xdt:Transform="InsertIfMissing" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Microsoft.Data.Services.Client')">
<assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.8.4.0" newVersion="5.8.4.0" xdt:Transform="SetAttributes" />
</dependentAssembly>
<dependentAssembly xdt:Transform="InsertIfMissing" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Microsoft.Data.OData')">
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.8.4.0" newVersion="5.8.4.0" xdt:Transform="SetAttributes" />
Expand All @@ -23,10 +17,6 @@
<assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.8.4.0" newVersion="5.8.4.0" xdt:Transform="SetAttributes" />
</dependentAssembly>
<dependentAssembly xdt:Transform="InsertIfMissing" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Microsoft.Azure.KeyVault.Core')">
<assemblyIdentity name="Microsoft.Azure.KeyVault.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" xdt:Transform="SetAttributes" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
4 changes: 0 additions & 4 deletions build/transforms/umbpak-web.config.uninstall.xdt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly xdt:Transform="Remove" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Microsoft.Data.Services.Client')">
</dependentAssembly>
<dependentAssembly xdt:Transform="Remove" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Microsoft.Data.OData')">
</dependentAssembly>
<dependentAssembly xdt:Transform="Remove" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Microsoft.Data.Edm')">
</dependentAssembly>
<dependentAssembly xdt:Transform="Remove" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Microsoft.Azure.KeyVault.Core')">
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ namespace Our.Umbraco.FileSystemProviders.Azure.Installer
using System.Web.Http;
using System.Xml;

using Microsoft.Azure.Storage;
using Microsoft.Azure.Storage.Blob;

using global::Umbraco.Core;
using global::Umbraco.Core.Composing;
using global::Umbraco.Core.Logging;
Expand All @@ -27,6 +24,8 @@ namespace Our.Umbraco.FileSystemProviders.Azure.Installer

using Enums;
using Models;
using global::Azure.Storage.Blobs;
using global::Azure.Storage.Blobs.Models;

/// <summary>
/// The installer controller for managing installer logic.
Expand Down Expand Up @@ -84,7 +83,7 @@ public InstallerStatus PostParameters(IEnumerable<Parameter> parameters)
bool usePrivateContainer = bool.Parse(newParameters.SingleOrDefault(k => k.Key == "UsePrivateContainer").Value);
string rootUrl = newParameters.SingleOrDefault(k => k.Key == "RootUrl").Value;

BlobContainerPublicAccessType blobContainerPublicAccessType = usePrivateContainer ? BlobContainerPublicAccessType.Off : BlobContainerPublicAccessType.Blob;
var blobContainerPublicAccessType = usePrivateContainer ? PublicAccessType.None : PublicAccessType.Blob;

if (!TestAzureCredentials(connection, containerName, blobContainerPublicAccessType))
{
Expand Down Expand Up @@ -445,19 +444,18 @@ private static bool ExecuteImageProcessorSecurityConfigTransform()
return true;
}

private static bool TestAzureCredentials(string connectionString, string containerName, BlobContainerPublicAccessType accessType)
private static bool TestAzureCredentials(string connectionString, string containerName, PublicAccessType accessType)
{
bool useEmulator = ConfigurationHelper.GetAppSetting(Azure.Constants.Configuration.UseStorageEmulatorKey) != null
&& ConfigurationHelper.GetAppSetting(Azure.Constants.Configuration.UseStorageEmulatorKey)
.Equals("true", StringComparison.InvariantCultureIgnoreCase);
try
{
CloudStorageAccount cloudStorageAccount = useEmulator ? CloudStorageAccount.DevelopmentStorageAccount : CloudStorageAccount.Parse(connectionString);

CloudBlobClient cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();
var cloudStorageAccount = connectionString;

// This should fully check that the connection works.
var testContainer = AzureFileSystem.CreateContainer(cloudBlobClient, containerName, accessType);
var azf = AzureFileSystem.GetInstance(containerName, "", connectionString, "", "", "");
var testContainer = azf.CreateContainer( containerName, accessType);

if (testContainer.Exists())
{
Expand Down
Loading