Intranoggin

Blither, Blather, Web Content Management.
Blog » Alexa on Azure: Part 6 - Functions Release Management

Alexa on Azure: Part 6 - Functions Release Management

Now that I’ve got a development environment set up for my Alexa Skill on Azure, I wanted to put in some release management. As described in my earlier post, Synchronizing code between GitHub and VSTS, I’m using GitHub for my development source repository, but I want to use VSTS for my release management.

The general pattern I’m envisioning is this:

  1. Check code into GitHub
  2. Code gets synced to stage branch on VSTS
  3. Code gets deployed to dev environment I’ve created on Azure
  4. <test code>
  5. manually create pull request.
  6. Manually approve pull request
  7. Code from stage branch on VSTS gets merged with master
  8. code deployed from master branch to production environment on Azure

First, I’ll need to create a staging branch in VSTS. On the code>branches tab in VSTS, click the new branch button.

New Branch

 

Name the branch ‘staging’. ensure it’s based on master and click the Create branch button.

Create Branch

I’ll now need to adjust the build definition I created in my earlier post, Synchronizing code between GitHub and VSTS. Locate the automated build we created earlier on the Builds tab and use the ellipse to select Edit.

Edit Build

On the Pull from VSTS action and the Push to VSTS action, change the branch in the Arguments form master to staging.

Pull from VSTS

Push to VSTS

Click Save.

If you want to test it now, pushing code up to GitHub should automatically sync to our VSTS Staging branch.

Next, we’ll update this definition to do two more things.

NOTE: When I first went through this process, I created this second portion as a Release definition. While I’m sure this is possible, I kept running into issues. I think most of my issues are because you don’t actually build and deploy a .dll for Azure Functions; instead you deploy the actual source code. I ultimately decided just to create add my deployment actions into my build definition.

ASIDE: yes it’s clear at this point that I have a naming mismatch between my staging branch on VSTS and my staging environment on Azure, which I’ve called Dev. I’ll keep it that way throughout this article, but in future posts you may see that I’ve changed my Azure environment to Staging or Stg

We’ll only need to add in two more build steps: Archive Files and Azure App Service Deploy.

Add Build Step

Archive Files Step

Azure App Service Deploy

 

Click on the Archive Files action. The default settings will look like this.

Default Settings

As you can see, this is geared toward zipping up the binaries that a build would create. Since we need to send up the actual source, we’ll adjust the root. Click the ellipse.

Ellipse

Select the root folder for your functions and click OK.

Select Path

When the system unzips this in Azure, we’ll need the individual function folders to reside at the root; so now add a /* on the end of this path.

Adjust Path

The .zip file has been created and the final step will be to upload it to Azure.

Click on the Azure App Service Deploy action.  Select your Azure Subscription and the Function’s App Service Name in the drop downs. If you don’t have the desired values available to you in the drop downs, you’ll need to use the Manage link to add the Azure connection.

Select Subscription

The Package or folder to upload is also geared to pull a zip file out of a working directory where it would have been put for a build. In our case, we want to update this value to pull the .zip file we just created.

Default Source

Look back in the Archive files action and copy the value for Archive file to create.

Get Source Value

then paste this value into the Package or Folder setting within the Azure App Service Deploy action.

Set Source

In the Additional Deployment Options, check the box to Remove Additional Files at Destination.

Remove Files Setting

Click Save

image

If you wish to try it, click Queue new build now. It should sync code from GitHub to your Staging Branch and deploy it to your Development function environment.

Queue Build

We aren’t done yet, but steps 1-3 of our vision are in place, and that’s a pretty good step in the right direction.

  1. Check code into GitHub
  2. Code gets synced to stage branch on VSTS
  3. Code gets deployed to dev environment I’ve created on Azure
  4. <test code>
  5. manually create pull request.
  6. Manually approve pull request
  7. Code from stage branch on VSTS gets merged with master
  8. code deployed from master branch to production environment on Azure

Posted: 3/9/2017 6:10:00 AM by Ryan Miller | with 0 comments