Environment variables doesn't expand "{build}"

Alxandr's Avatar

Alxandr

04 Jun, 2014 09:31 PM

I don't know what to call the group of variables that is "{build}" and "{version}", etc. but they are not being expanded.

I have

environment:
  BUILD_NUMBER: "{build}"

in my appveyor.yml, and the first thing I do during build is echo it, and it return {build} instead of the build-number.
This breaks my build as the result is not a valid version string.

  1. Support Staff 1 Posted by Feodor Fitsner on 04 Jun, 2014 09:38 PM

    Feodor Fitsner's Avatar

    There are built-in variables for both build version and number: http://www.appveyor.com/docs/environment-variables

  2. 2 Posted by Alxandr on 04 Jun, 2014 09:50 PM

    Alxandr's Avatar

    That's fair and square, but some build-tools require spesific environment variables. So I need to be able to set the environment-variable "BUILD_NUMBER" to my build number. The alternative solution to this is obviously to do set BUILD_NUMBER=%APPVEYOR_BUILD_NUMBER%, but this should really be doable in the environment-settings if you ask me.

  3. Support Staff 3 Posted by Feodor Fitsner on 04 Jun, 2014 11:58 PM

    Feodor Fitsner's Avatar

    Right, environment section does not expand variables in values. I will add an issue to fix that.

  4. 4 Posted by Alxandr on 25 Jul, 2014 01:04 PM

    Alxandr's Avatar

    Was this ever fixed?

  5. Support Staff 5 Posted by Feodor Fitsner on 25 Jul, 2014 01:10 PM

    Feodor Fitsner's Avatar

    Not yet. Is there any other place where you need that functionality, except BUILD_NUMBER?

  6. 6 Posted by Alxandr on 30 Jul, 2014 07:57 PM

    Alxandr's Avatar

    I think the environment variable name has changed with later versions of "k" and "sake" (they are too volatile to keep up with at times), but I don't need the functionality anywhere but env vars. Anywhere else should be able to use the env vars.

  7. 7 Posted by Alxandr on 24 Oct, 2014 12:00 AM

    Alxandr's Avatar

    Any news on this?

  8. Support Staff 8 Posted by Feodor Fitsner on 24 Oct, 2014 12:03 AM

    Feodor Fitsner's Avatar

    Oh, is it still actual? :)

  9. 9 Posted by Alxandr on 24 Oct, 2014 04:29 AM

    Alxandr's Avatar

    I still have "stupid stuff" like this in my appveyor.yml file:

      - set K_BUILD_VERSION=000%APPVEYOR_BUILD_NUMBER% #temp
      - set K_BUILD_VERSION=%K_BUILD_VERSION:~-4%
    

    What would really be helpful was if I could do environment variable K_BUILD_VERSION: {build:0000} ala C# string.Format, though at least being able to use the build number itself. Also, the need to pad the numbers disappear once NuGet gets support for semver 2.0 which means I'd just need to set the environment variable K_BUILD_VERSION to equal the build number. Why this works other places and not in the environment variables I find strange.

  10. 10 Posted by Lorenz Leutgeb on 23 Nov, 2014 10:30 PM

    Lorenz Leutgeb's Avatar

    I'd like to do:

    environment:  
      - GOPATH: %BuildFolder%
    

    As suggested by this script except well, I want to have a declarative statement for that in my appveyor.yml.

    This is pretty much the same issue.

  11. 11 Posted by Lorenz Leutgeb on 23 Nov, 2014 10:44 PM

    Lorenz Leutgeb's Avatar

    Correction: It works, I was just using %BuildFolder%instead of %APPVEYOR_BUILD_FOLDER%. Maybe consider updateing your Go example on Bitbucket.

  12. Support Staff 12 Posted by Feodor Fitsner on 23 Nov, 2014 11:56 PM

    Feodor Fitsner's Avatar

    OK, sure.

  13. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:50 AM.

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