question

AmaraCodeLLC avatar image
0 Votes"
AmaraCodeLLC asked Tamara2008-4327 commented

Azure CI/CD Pipeline deployment

Greetings everyone and especially to @ryanchill for the help I've been receiving. I'm a late starter to the cloud world but a 25+ year veteran developer and I love all the Azure services but having trouble with a few things working together.

I have a repo setup in DevOps (not GitHub) and a build pipeline that is working. Doesn't mean it is correct but it has that nice green check-mark once it completes. Here is the yaml for that pipeline.:

 trigger:
   - master
    
 pool:
   vmImage: "ubuntu-latest"
    
 steps:
   - script: dotnet restore
   - script: dotnet build --configuration Release
     displayName: "dotnet build Release"
    
   - task: DotNetCoreCLI@2
     inputs:
       command: "publish"
       publishWebProjects: true
       arguments: "--configuration Release --output $(Build.ArtifactStagingDirectory)"
    
   - task: ArchiveFiles@2
     inputs:
       rootFolderOrFile: "$(Build.ArtifactStagingDirectory)"
       includeRootFolder: false
       archiveType: "zip"
       archiveFile: "$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip"
       replaceExistingArchive: true

For the Release pipeline the screen looks like this. Note that the trigger is set to run on build.
29729-azure1.jpg

Next Artifacts looks like this:
29815-azure2.jpg

Next is Stage:
29659-azure3.jpg

The Agent information I did nothing with:
29660-azure4.jpg

Finally is the app service deploy.
29799-image.png

However note that when I look at the yaml of the App Service Deploy it seems to not be happy:

 #Your build pipeline references an undefined variable named ‘Parameters.ConnectedServiceName’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
 #Your build pipeline references an undefined variable named ‘Parameters.WebAppKind’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
 #Your build pipeline references an undefined variable named ‘Parameters.WebAppName’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
 #Your build pipeline references an undefined variable named ‘Parameters.StartupCommand’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
    
 steps:
 - task: AzureRmWebAppDeployment@4
   displayName: 'Deploy Azure App Service'
   inputs:
     azureSubscription: '$(Parameters.ConnectedServiceName)'
     appType: '$(Parameters.WebAppKind)'
     WebAppName: '$(Parameters.WebAppName)'
     StartupCommand: '$(Parameters.StartupCommand)'



What I'm not understanding is once the build pipeline completes and the trigger is kicked off in Release, how do I tell the app service deploy where to find the Release build? I'm sure there are variables or something that I'm missing.

Thanks for all the assistance.
Scott
@AmaraCodeLLC


not-supported
azure1.jpg (32.6 KiB)
azure2.jpg (100.3 KiB)
azure3.jpg (93.3 KiB)
azure4.jpg (88.4 KiB)
image.png (410.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ryanchill avatar image
0 Votes"
ryanchill answered Tamara2008-4327 commented

Hi @AmaraCodeLLC,

First off, welcome to the cloud! It can be confusing because there are some options when going to the cloud. Thanks for your posting your yaml and I took the opportunity obfuscating your sub'id in your 5th image; it was next to your subscription name. It's happened to me before and takes a keen eye.

To answer your question, the parameters are defined on the stage, your 3rd screen shot.
29922-image.png

I'm assuming the snippet your pasted above is from View YAML button on the Deploy Azure App Service task. If so, then everything you've posted on your screen shots looks good. I can't explain the text other than to say its static text in case you decide to use the YAML outside of that pipeline. As long as you don't have any errors when viewing your App Service deploy task, you are good to go.

To answer your 2nd question, the release pipeline will release what's in your artifacts "bucket", your _AmaraCode Website in your 1st screens shot.

If you run your pipeline and get any errors, just paste them down below and we'll get it sorted out.


image.png (106.1 KiB)
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you @ryanchill for obfuscating that id.

Here are the steps I ran:

  1. I made a bogus "view" change and committed the changes.

  2. The CI pipeline ran successful.

  3. The Release pipeline executed but failed. Here is a screenshot of the result.

29863-image.png


0 Votes 0 ·
image.png (35.3 KiB)

@AmaraCodeLLC, your zip file isn't in the intended place. Instead of using ArchiveFiles task, use the PublishBildArtifacts task instead as I did here.

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'



1 Vote 1 ·

Thanks, indeed this works!

 - task: PublishBuildArtifacts@1
   inputs:
     PathtoPublish: '$(Build.ArtifactStagingDirectory)'
     ArtifactName: 'drop'
     publishLocation: 'Container'

I was struggling with ci/cd service pipeline deployment in Azure for a while..


1 Vote 1 ·

Thank you @ryanchill for all of your assistance. I now have it back up and running perfectly. All the pipelines are different from what I had and a lot simpler now as well. Original pipelines were several .net console steps. Now the only frustrating part for me is "how" would I have figured that out without assistance? Are these pipelines well documented somewhere?

Scott
@AmaraCodeLLC

0 Votes 0 ·
Show more comments