Problem parsing yml configuration on Conditional build configuration

dzakibagus's Avatar

dzakibagus

Jan 11, 2024 @ 08:41 PM

Hi, I have recently switched to Conditional build config instead of separate build config, but I have been having issues with parsing the config file.

I kept getting error parsing at the line where the first - is (line 7)
Full yml config is attached below.

The current config looks something like this:

version: '#{build}'
pull_requests:
  do_not_increment_build_number: true
skip_tags: true
skip_branch_with_pr: true
image: Visual Studio 2022
-
  branches:
    only:
    - preview
  configuration: Release
  platform: x64
  //proceeding install, clone, build script, artifact, and deploy config for preview branch
-
  branches:
    only:
    - stable
  configuration: Publish
  platform: x64
  //proceeding install, clone, build script, artifact, and deploy config for preview branch
-
  1. Support Staff 1 Posted by Owen McDonnell on Jan 11, 2024 @ 09:35 PM

    Owen McDonnell's Avatar

    I think what your missing is a for: keyword before the first conditional config. Some indentation might not be necessary but recommended.

    image: Visual Studio 2022
    for:
      -
        branches:
            only:
            - preview
        configuration: Release
        platform: x64
      -
        branches:
            only:
            - stable
        configuration: Publish
        platform: x64
    
    Lots more details in this blog post
  2. 2 Posted by dzakibagus on Jan 12, 2024 @ 07:30 AM

    dzakibagus's Avatar

    I see, my bad I was only reading the top "2nd approach requires appveyor.yml of the following format:" section where the for: is not mentioned, so I was a bit confused. Adding the for: fixed the issue and it builds just fine now.

    Another question is how to disable the build for other branch except stable and preview ? I already added it to the "branches to build: Only branches specified below" section but it still tries to build other branch

  3. Support Staff 3 Posted by Owen McDonnell on Jan 12, 2024 @ 07:11 PM

    Owen McDonnell's Avatar

    White/Black listing branches is described here.

  4. Feodor Fitsner closed this discussion on Mar 13, 2024 @ 09:02 PM.

Comments are currently closed for this discussion. You can start a new one.

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