How to use global environment variable to set project version?

michael's Avatar


22 Jun, 2020 02:44 PM

Hi there,

We are trying to use the long-awaited global YAML feature.
we have a bunch of projects withing our suite for which the Major.Minor version should be kept the same.

Previously our code looked like so. These few lines are duplicated in most of our projects (but not all)

  app_version: '10.0'

version: '$(app_version).{build}'

I have defined a variable int the global yaml called ospsuite_version

ospsuite_version: '10.0'

and I wanted to try to use this global version to set the build version
version: '$(ospsuite_version).{build}'

It does not seem to work as expected. The Variable is not available when the build is started and therefore, the version shown on appveyor is something lile

Previously it would show 10.1.xxxxxx 

I can see that this variable is available however as the script is executed because the components created have the right version (e.g. 10.0 in our case)

Is there a way for me to define a global variable and use it for the project version? Or is this not supported?


Take care,

  1. Support Staff 1 Posted by Feodor Fitsner on 22 Jun, 2020 04:41 PM

    Feodor Fitsner's Avatar

    Hi Michael,

    Indeed, global.yaml is getting injected after the information from project yaml was used to form a version string.

    However, you can update build version from a script like this:

    - ps: Update-AppveyorBuild -Version "$($env:ospsuite_version).$($env:appveyor_build_number)"
  2. 2 Posted by michael on 22 Jun, 2020 05:38 PM

    michael's Avatar

    Hi Feodor,

    This almost works.
    For PR, I'd like to get the version with the random characters
    For example 10.0.1-xasdhasd
    which is what {build} used to return

    What is the equivalent ?


    Does not work as it uses some other numbers


    does not exist

    Thanks for your help,



    *Michael Sevestre*

    *Design2Code Inc.*

    Email [email blocked]


  3. Support Staff 3 Posted by Feodor Fitsner on 22 Jun, 2020 05:45 PM

    Feodor Fitsner's Avatar

    You may set version as version: {build} and then use it to build a full version:

    - ps: Update-AppveyorBuild -Version "$($env:ospsuite_version).$($env:appveyor_build_version)"
  4. 4 Posted by michael on 22 Jun, 2020 05:50 PM

    michael's Avatar

    ah ah this works

    Nice trick Feodor. Thank you!

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


? 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