Azure DevOps Hosted Build Controller - Is the Azure Storage Emulator supported?

守給你的承諾、 提交于 2019-11-28 02:59:26

问题


I'd like to run unit / integration tests that utilise the Azure Storage Emulator rather than real storage from a Azure DevOps build.

The emulator is installed on the Hosted Build Controller as part of the Azure SDK in its usual place (C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe).

However the emulator is in the uninitialised state on the Build Controller. When trying to run the command Init from the command line, I get the following error:

This operation requires an interactive window station

Is there an known workaround for this or plans to support the emulator in Azure DevOps builds?


回答1:


Despite all the answers here to the contrary, I've been running the Azure Storage Emulator on a VS2017 hosted build agent for over a year.

The trick is to initialise SQL LocalDB first (the emulator uses it), and then start the emulator. You can do this with a command line task that runs:

sqllocaldb create MSSQLLocalDB
sqllocaldb start MSSQLLocalDB
sqllocaldb info MSSQLLocalDB

"C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe" start



回答2:


As already stated you can't run the Azure Storage Emulator. What you can run though is Azurite an open source alternative.

Please note: Azurite can emulate blobs, tables and queues. However I have only used the blob storage emulation in this way.

At the start of your build configuration add a nuget step that runs a custom nuget command install Azurite -version 2.2.2. Then add a command line step that runs start /b $(Build.SourcesDirectory)\Azurite.2.2.2\tools\blob.exe.

It runs on the same port as the Azure Storage Emulator so you can use the standard connection strings.




回答3:


No, the Hosted Build Controller does not run in Interactive Mode, so the emulator won't work under the environment. See Q&A in Hosted build controller for XAML builds for details.

Q: Do you need to run your build service in interactive mode?

A: No. Then you can use the hosted build controller.

I recommend you setup on-premises build controller and run the build server in Interactive Mode. Refer to Setup Build Server and Setup Build Controller for details.




回答4:


Seems like the answer is maybe from the Visual Studio Online side. There's a User Voice entry if anyone has similar issues.

Not really sure why the emulator doesn't have a non-interactive mode, personally I don't use it's UI 99% of the time. There's a general User Voice entry for making Azure Storage more unit testable.



来源:https://stackoverflow.com/questions/33723795/azure-devops-hosted-build-controller-is-the-azure-storage-emulator-supported

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!