Deploy same branch to multiple Azure cloud services?

Andreas's Avatar

Andreas

18 Dec, 2017 10:53 AM

We have 2 Azure Cloud Services: TEST and DEMO.

For some time, we used separate branches and this method: https://www.appveyor.com/blog/2017/08/01/sharing-configuration-between-branches-in-appveyor-yml/

Changes on "default" branch were triggering new TEST deployment
Changes on "stable" branch were triggering new DEMO deployment

Now we would like both Cloud Services to be automatically deployed when changes are pushed on "default" branch. Is it possible? How should we do it?

  1. Support Staff 1 Posted by Ilya Finkelshte... on 18 Dec, 2017 08:48 PM

    Ilya Finkelshteyn's Avatar

    Hi Andreas,

    You should be able to set 2 deployments side-by-side for default branch, like this:

    for:
    
    -
      branches:
        only:
          - default
        
      deploy:
        - provider: AzureCS      
          service: TEST
          ...
        - provider: AzureCS
          service: DEMO
          ...
    
    -
      branches:
        only:
          - stable
        
      deploy:
        - provider: AzureCS      
          service: DEMO
          ...
    

    This require duplication of DEMO deployment setting though. If build scenario difference between branches is only (or mostly) about deployment, then maybe more compact will be using conditional deployment.

    Ilya.

  2. 2 Posted by Andreas on 19 Dec, 2017 09:09 AM

    Andreas's Avatar

    Hi Ilya,

    Thanks for your answer. I should have mentioned it before, but we also use these variables:

    environment:
      TargetProfile: TEST_Config

    configuration: TEST_Config

    and DEMO_Config for the DEMO Cloud Service.

    Could you tell me how I can make sure the packages are compiled with the correct settings before deploying them?

    Thanks in advance.

    Andreas

  3. Support Staff 3 Posted by Ilya Finkelshte... on 20 Dec, 2017 02:32 AM

    Ilya Finkelshteyn's Avatar

    In this case I believe you need to introduce build matrix for default branch. Use only configuration dimension and use configuration to set TargetProfile.

    Also use conditional deployment.

    YAML can look like this:

    for:
    -
      branches:
        only:
          - default  
      configuration:
        - TEST_Config
        - DEMO_Config  
      environment:
        TargetProfile: $(configuration)  
      deploy:
        - provider: AzureCS
          service: TEST
          on:
            TargetProfile: TEST_Config
        - provider: AzureCS
          service: DEMO
          on:
            TargetProfile: DEMO_Config
    -
      branches:
        only:
          - stable  
      configuration: DEMO_Config  
      environment:
        TargetProfile: $(configuration)    
      deploy:
        - provider: AzureCS
          service: DEMO
          on:
            TargetProfile: DEMO_Config
    
  4. 4 Posted by Andreas on 21 Dec, 2017 02:28 PM

    Andreas's Avatar

    It worked, thanks a lot!

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac