How do I deploy to different azure function slots in the same project?

Hi all,

I am working on a proof of concept that utilized azure functions for my organization. I’ve read the documentation you have on it here. I created a deploy target for a function that has 5 deploy slots, DEV, QA, UAT, HOTFIX, and the default Production, with the deployable slot being DEV. There’s an alternate channel and lifecycle for HOTFIX that I’ll cover shortly. My process is as follows:

Default Channel:

  1. Deploy to DEV slot
  2. Auto-Promote to QA by swapping DEV for QA, do a health check, prompt user to pass or fail the build with some scripts in the background.
  3. Auto-Promote to UAT by swapping QA for UAT, Stakeholder Validates
  4. Promote to Production by swapping UAT for Production. In case of error with promotion(failed check ) it swaps back automatically.

Hotfix Channel:

  1. Deploy to HOTFIX slot
  2. Promote to Production by swapping HOTFIX for Production. In case of error with promotion(failed check ) it swaps back automatically.
    In case of a hot-fix, we just deploy to the HOT slot through a channel and lifecycle setup to accommodate this path, and when that gets promoted we swap HOT for PROD.

Because of how we’ve setup the infrastructure, I only have the DEV slot specified as what we deploy to. Would I have to register the same target with the HOT slot in order to get it to deploy?

Truthfully, am I overcomplicating this by having so many slots? When I originally tried making the project I made it with a prod slot and a staging slot(similar to what was in the docs) but then ended up remaking it to try and fit our current processes.

Greetings @Zoren_Manteuffel, thanks for reaching out! Couple of questions, are you using a specific template to do the initial deployment? If so, which one? I’ll admit to not being an expert in Azure, when I play with my Function, I don’t see a way to make a specific slot as deployable. It is entirely possible I missed something, would you be able to elaborate on that?

Regards,

Shawn

@Shawn_Sesna

When you register an azure web app (or azure function) as a deploy target in Octopus, you’re given the option to choose a deploy slot. Typically organizations would use this to create a swappable staging slot, and then switch to production in a seamless effort. If you don’t have a slot, or if you do not choose one, it will deploy to the Production slot by default.

For my deploy process:
I’m using Azure Functions Deployment version 4(community step). https://library.octopus.com/step-templates/03bb1a08-52be-43ad-bdfd-117eb562b414 . I’ve tried the updated version but neither of them seem to let me choose the slot as there’s no parameter.

I’ve also just found out that for the moment I probably won’t have to worry about this, as everyone’s ok with simplifying this and having it be 1 slot for staging and not 4 pseudo environments like Dev,QA when they’re not really real environments in the context of azure funtions/web apps.

Ah! Okay, now I’m following. Would you be able to tell me what version of Octopus you’re using? There was a new(ish) step added

image

This step has a Deployment slot section. One thought was to match Octopus Environment name to Slot name and use the Octopus.Environment.Name system variable so that it goes the correct slot when being deployed

Does this help at all?

Regards,

Shawn