简体   繁体   English

Azure DevOps 管道部署问题

[英]Azure DevOps pipeline issue on deploy

I'm new with Azure and I was confident that it was just easy to configure a pipeline and deploy my solution within Azure... but I'm stuck for 2 days and I don't find an up-to-date article that explains the full CI/CD.我是 Azure 的新手,我相信在 Azure 中配置管道和部署我的解决方案很容易......但我被困了 2 天,我没有找到最新的文章解释了完整的 CI/CD。

Here's my solution (based on ABP Boilerplate):这是我的解决方案(基于 ABP 样板):

- solution folder
  - aspnet-core solution folder (API .NET Core 2.2)
  - angular (frontend part in Angular 8)

I have an Azure account and I created two App Service:我有一个 Azure 帐户,我创建了两个应用服务:

For both the settings are the default one:对于这两种设置都是默认设置:

  • WEBSITE_RUN_FROM_PACKAGE '1' WEBSITE_RUN_FROM_PACKAGE '1'
  • WEBSITE_ENABLE_SYNC_UPDATE_SITE 'true' WEBSITE_ENABLE_SYNC_UPDATE_SITE '真'

In Azure DevOps everything is green...在 Azure DevOps 中,一切都是绿色的……

2 Pipelines: 2条管道:

  • Angular: Angular:
trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '10.x'
  displayName: 'Install Node.js'

- script: |
    cd angular
    npm install -g @angular/cli
    npm install
    ng build --prod
  displayName: 'npm install and build'

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: 'angular/dist'
    TargetPath: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'UiApp'
    publishLocation: 'Container''
  • API: API:
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: PublishBuildArtifacts@1
  inputs:
    TargetPath: '$(Build.ArtifactStagingDirectory)'

For the release part:对于发布部分:

  • Angular Angular

It is created a subfolder UIApp within wwwroot but I don't understand why它在 wwwroot 中创建了一个子文件夹 UIApp 但我不明白为什么

steps:
- task: AzureWebApp@1
  displayName: 'Azure Web App Deploy: XXXXX'
  inputs:
    azureSubscription: 'XXXXXXXX'
    appType: webApp
    appName: 'XXXXX'
    package: '_XXX - Angular'
  enabled: false
  • API API

I tried both Azure Web App Deploy and Azure App Service Deploy.我尝试了 Azure Web App Deploy 和 Azure App Service Deploy。

I tried to use deploy Zip / Run from package / deploy Web... without success.我尝试使用 deploy Zip / Run from package / deploy Web ... 没有成功。

In the API, I see that it is created:在 API 中,我看到它是创建的:

In /data/sitePackages/ a zip file with the datetime在 /data/sitePackages/ 中带有日期时间的 zip 文件

In /site/wwwroot/ the zip file as well but named differently (wwwroot is readonly)在 /site/wwwroot/ zip 文件中,但名称不同(wwwroot 是只读的)

Yaml: Yaml:

steps:
- task: AzureWebApp@1
  displayName: 'Azure Web App Deploy: XXXXX'
  inputs:
    azureSubscription: 'XXXXXXXXXXX'
    appType: webApp
    appName: 'XXXXXX'
    package: '_XXXXX - API/drop'
    deploymentMethod: runFromPackage
  enabled: false

I don't understand what I miss, it should be easy to use the full azure stack... I should miss a detail somewhere (or maybe I miss a big picture and a training on Yaml)我不明白我错过了什么,使用完整的 azure 堆栈应该很容易......我应该在某个地方错过一个细节(或者我可能错过了一张大图和关于 Yaml 的培训)

I would like to prevent the creation of the subfolder UiApp in wwwroot for the frontend.我想阻止在 wwwroot 中为前端创建子文件夹 UiApp。

The backend is not working at all with the package and I don't know how to fix or debug the issue.后端根本无法与 package 一起使用,我不知道如何修复或调试该问题。 BTW I don't need to run from package.顺便说一句,我不需要从 package 运行。 I would prefer the "classic" way with IIS我更喜欢 IIS 的“经典”方式

I finally got it to work correctly.我终于让它正常工作了。

I'm now using for both app the Azure App Service Deploy and I didn't see the "..." button at the "Package or folder".我现在对这两个应用程序都使用 Azure App Service Deploy 并且我没有在“包或文件夹”中看到“...”按钮。

After selecting the right artifact file (zip file for.Net release and folder "drop" for Angular app), I got the files to sync with success.选择正确的工件文件(.Net 版本的 zip 文件和 Angular 应用程序的文件夹“drop”)后,我成功地同步了文件。

Next step: update-database for entity framework Core and apply the config variables.下一步:更新实体框架核心的数据库并应用配置变量。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM