简体   繁体   English

从Visual Studio Team Services将Gulp构建文件夹部署到Azure

[英]Deploy the Gulp Build Folder To Azure from Visual Studio Team Services

I just started using VSO for one of my project. 我刚刚开始将VSO用于我的一个项目。 I have created the built definition and the built was successful. 我已经创建了构建定义,并且构建成功。 When I tried to create the release definition for that built its failing by throwing the error 当我尝试为该版本创建发布定义时,通过引发错误而失败

System.Management.Automation.RuntimeException: No files were found to deploy with search pattern C:\a\858bddd5b\**\*.zip

Its expecting .zip files. 其预期的.zip文件。 Since I need to deploy the distributed folder created by gulp build, I have given the Web Deploy Package path as 由于我需要部署由gulp build创建的分布式文件夹,因此我将Web Deploy Package路径指定为

$(System.DefaultWorkingDirectory)/{built name}

Any help is really appreciated 任何帮助都非常感谢

You should add a build step to create an archive with .zip extension for the output folder of the gulp step. 您应该添加一个构建步骤,以为gulp步骤的输出文件夹创建一个扩展名为.zip的存档。 Your steps should look like 您的步骤应如下所示

在此处输入图片说明

VSO/VSTS build has a task available with Archive files to achieve the same. VSO / VSTS构建具有Archive files可用的任务以实现相同目的。

Alternatively, if the standard Archive files step doesn't work for you, you can use a powershell step. 另外,如果标准存档文件步骤对您不起作用,则可以使用Powershell步骤。 The powershell command will look like the following. powershell命令将如下所示。

[io.compression.zipfile]::CreateFromDirectory($Source, $Destination) 
  • Source should be all the files/folders from gulp output you wish to deploy 源应该是您希望部署的gulp输出中的所有文件/文件夹
  • Destination here should correspond to input for the webdeploy/ WebApp deployment step. 此处的目标应该对应于webdeploy / WebApp部署步骤的输入。

You can also use this extension to create a ZIP file. 您也可以使用此扩展名来创建一个ZIP文件。 I used it for a situation similar to yours: 我将其用于与您类似的情况:

https://marketplace.visualstudio.com/items?itemName=trackyon.trackyonadvantage https://marketplace.visualstudio.com/items?itemName=trackyon.trackyon优点

"Azure Web App Deployment" task requires a web deploy zip package. “ Azure Web App部署”任务需要Web部署zip软件包。 You can either add one more task to create a zip package for the build output as other two answers indicated or add some code in your "gulpfile.js" to generate a zip package during the gulp build and then publish the zip package to artifact. 您可以添加另一个任务来为构建输出创建一个zip包,如其他两个答案所示,或者在gulpfile.js中添加一些代码以在gulp生成期间生成一个zip包,然后将该zip包发布到工件。

If you don't want to create a zip package for the build output, then you can use FTP Uploader task to deploy the build to Azure Web App via FTP Deploy . 如果您不想为构建输出创建一个zip包,则可以使用FTP Uploader任务通过FTP Deploy将构建部署到Azure Web App。

You can create a zip file with PowerShell, assuming you're running on a Windows agent. 假设您正在Windows代理上运行,则可以使用PowerShell创建一个zip文件。

Command Line task Command Line任务

Command: powershell Arguments: -Command "&{Add-Type -assembly 'system.io.compression.filesystem'; [io.compression.zipfile]::CreateFromDirectory('$(Build.StagingDirectory)\\Zip', '$(Build.StagingDirectory)\\$(BuildConfiguration)Deploy.zip')}" 命令: powershell参数:- -Command "&{Add-Type -assembly 'system.io.compression.filesystem'; [io.compression.zipfile]::CreateFromDirectory('$(Build.StagingDirectory)\\Zip', '$(Build.StagingDirectory)\\$(BuildConfiguration)Deploy.zip')}"

Obviously, replace $(Build.StagingDirectory)\\Zip with whatever folder you want zipped up and $(Build.StagingDirectory)\\$(BuildConfiguration)Deploy.zip with whatever you want the file named. 显然,将$(Build.StagingDirectory)\\Zip替换$(Build.StagingDirectory)\\Zip您要压缩的文件夹,将$(Build.StagingDirectory)\\$(BuildConfiguration)Deploy.zip为您想要的文件名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure:使用Visual Studio Team Services从源代码管理部署 - Azure: Deploy from source control using Visual Studio Team Services 从Visual Studio Team Services(VSO)部署Azure WebApp - Deploy Azure WebApp from Visual Studio Team Services (VSO) 如何从Visual Studio Team Services将静态网站部署到Azure - How to deploy a static website to Azure from Visual Studio Team Services 使用visual studio团队服务构建包含多个Web应用程序的解决方案,并将这些Web应用程序部署到azure - using visual studio team services to build a solution containing multiple web apps and deploy these web apps to azure Node.js Azure WebJob:如何通过持续交付从Visual Studio Team Services进行部署 - Node.js Azure WebJob: How to deploy from Visual Studio Team Services with Continuous Delivery Visual Studio团队服务/ Azure - Visual Studio Team Services / Azure Visual Studio Team Services构建 - Visual Studio Team Services build Visual Studio Team Services构建失败 - 数据库项目到Azure SQL - Visual Studio Team Services Build Failed - Database Project to Azure SQL 为什么Azure Visual Studio Team Services VSTS构建失败? - Why do Azure Visual Studio Team Services VSTS build fail? 在Visual Studio Team Services版本中创建Azure Cloud Service程序包 - Create Azure Cloud Service package in Visual Studio Team Services build
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM