Different images per branch / per project

Chris's Avatar

Chris

17 Apr, 2019 02:44 PM

Hi there!

Thanks for your help in the past!

So I'm trying to achieve the following:

- on develop branch, use one azure image
- on non develop branch, dependent on operating system / project use a different azure images e.g. Unix images for unix tests / windows for windows tests

Would you have examples of that?

Chris

  1. Support Staff 1 Posted by Owen McDonnell on 17 Apr, 2019 07:55 PM

    Owen McDonnell's Avatar

    For differentiation between branches you can specialize build matrix configuration using for.matrix construct.
    While for differentiation between operating system, you can use $isLinux variable and other strategies as outlined here.

    Let me know if you have more questions or if I've misunderstood what kind of information you're looking for.

  2. 2 Posted by Chris Belfield on 17 Apr, 2019 08:10 PM

    Chris Belfield's Avatar

    We are using the hybrid model where we are using our own azure vhds, do
    you have an example like that? Different cloud images in a matrix?

  3. Support Staff 3 Posted by Ilya Finkelshte... on 17 Apr, 2019 09:17 PM

    Ilya Finkelshteyn's Avatar

    Use branches-specific configuration and use specific images for the different branches using image or environment sections, by placing them under the for.branches construct.

    #default image matrix
    image:
    - Visual Studio 2017
    - Ubuntu
    
    ############################
    # default build scenario here #
    ############################
    
    # run develop branch builds on Azure
    for:
    -
      branches:
        only:
          - develop
    
      image: AzureImage
    
      # optionally develop-specific build scenario here
    

    For the build scenario, use this part of documentation to have a different scenarios for Linux and Windows. Note that both documentation and Owen (in previous answer) mention build matrix specialization. I would not recommend it for your case, as it does not work together with branches specialization you need to use. So use other options to distinguish between Windows and Linux build like sh and cmd prefixes or $isLinux/$isWindows variables.

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