Jerome2606
Jerome2606

Reputation: 955

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.

Here's my solution (based on ABP Boilerplate):

- 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:

For both the settings are the default one:

In Azure DevOps everything is green ...

2 Pipelines:

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''
# 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://learn.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:

It is created a subfolder UIApp within wwwroot but I don't understand why

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

I tried both Azure Web App Deploy and Azure App Service Deploy.

I tried to use deploy Zip / Run from package / deploy Web ... without success.

In the API, I see that it is created:

In /data/sitePackages/ a zip file with the datetime

In /site/wwwroot/ the zip file as well but named differently (wwwroot is readonly)

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)

I would like to prevent the creation of the subfolder UiApp in wwwroot for the frontend.

The backend is not working at all with the package and I don't know how to fix or debug the issue. BTW I don't need to run from package. I would prefer the "classic" way with IIS

Upvotes: 0

Views: 4088

Answers (1)

Jerome2606
Jerome2606

Reputation: 955

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".

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.

Next step: update-database for entity framework Core and apply the config variables.

Upvotes: 3

Related Questions