How to override environment variables from REST API when using build matrix

TAMAGAWA Hiroko's Avatar


09 Jun, 2020 04:06 AM

When using build matrix, I cannot find out how to override the environment variables from REST API.

My small example is in this repository

Assume I'm kicking the build with a command like this. I'm trying to overwrite the variable "VAR1".

curl -H "Authorization: Bearer $APPVEYOR_TOKEN" -H "Content-Type: application/json" -X POST -d "{
  \"accountName\": \"nkns165\", 
  \"projectSlug\": \"appveyor-test\", 
  \"branch\": \"master\", 
  \"environmentVariables\": {
    \"VAR1\": \"Value2\"

Success without build matrix

  • There are two images used, but there is no matrix
  • The script output the overridden value "Value2"

Failure with build matrix

  • Each image's build script is defined in matrix
  • The script output the default value "Value1" instead of expected value "Value2"

Is there any way to override the values by REST API parameters?

  1. Support Staff 1 Posted by Feodor Fitsner on 09 Jun, 2020 04:30 AM

    Feodor Fitsner's Avatar

    Removing VAR1 definition from the config should do the trick:

      - macos
      - macos-mojave
      - ps: echo "VAR1 = $env:VAR1"
          - image: macos
        - ps: echo "VAR1 for catalina = $env:VAR1"
          - image: macos-mojave
        - ps: echo "VAR1 for mojave = $env:VAR1"
  2. 2 Posted by TAMAGAWA Hiroko on 09 Jun, 2020 05:22 AM

    TAMAGAWA Hiroko's Avatar

    Confirmed, thanks.

    Umm, then we have to add some merging logic if we'd like to also have default values.
    OK, I think we can do it

  3. TAMAGAWA Hiroko closed this discussion on 09 Jun, 2020 05:23 AM.

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

Keyboard shortcuts


? 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