Availability of Custom Environment in apvoyer config

pathrikumark's Avatar

pathrikumark

05 Jan, 2017 04:31 PM

Hi,

Where can the custom Environment variables be defined? and their scope?

For eg., if I define a custom Environemnt variable in install script, will it be available in build_script and artifacts block of the appveyor.yml?

For clear understanding, I am referring to the 'POM_VERSION' defined under the install script in the following config:
https://github.com/PathriK/GaanaDownloader/blob/master/appveyor.yml

Thanks,
Keerthi Kumar P

  1. 1 Posted by Ilya Finkelshte... on 05 Jan, 2017 05:10 PM

    Ilya Finkelshteyn's Avatar

    Hi Keerthi,

    It seems that you just fixed it, while I looked into your script, by pre-pending it with $env:

    Also it will not hurt if you set default value in YAML, as described here

    Thanks!
    Ilya.

  2. 2 Posted by pathrikumark on 06 Jan, 2017 12:35 AM

    pathrikumark's Avatar

    Nope. Even after appending $env it is not working :(. In the following build:

    https://ci.appveyor.com/project/PathriK/gaanadownloader/build/1.1-SNAPSHOT.12

    we can see that the custom env variable (POM_VERSION), that is set in the install script gist is not available outside in build script(did Writ-Host to check) and also the artifact block.

    Also this env variable needs to dynamic and hence setting it in script rather then in YAML.

    Thanks

  3. 3 Posted by Ilya Finkelshte... on 06 Jan, 2017 04:14 AM

    Ilya Finkelshteyn's Avatar

    Can you enter content of https://gist.github.com/PathriK/ac922260d2714cd0bf9ba9cc946092f3/ right into YAML, at install stage?

    I my example I was calling script this way because it was long script, to keep YAML readable, but you can easy add the following into install (still keeping it compact and actually better understandable):

    - ps: $env:POM_VERSION = ([xml](Get-Content .\pom.xml)).project.version
    - ps: Update-AppveyorBuild -Version "$env:POM_VERSION.$env:APPVEYOR_BUILD_NUMBER"
    

    Thanks!
    Ilya.

  4. 4 Posted by pathrikumark on 06 Jan, 2017 05:11 PM

    pathrikumark's Avatar

    Yup its working, when i place the lines as you suggested. Thanks a lot :D

    So does it mean that the Custom Environment variables set through 'iex', does not persist out side that script block?

    Thanks,
    Keerthi Kumar P

  5. 5 Posted by Ilya Finkelshte... on 09 Jan, 2017 07:29 PM

    Ilya Finkelshteyn's Avatar

    Setting variables with iex should work as well. I think it did not work fro you because link to raw gist is different for every revision, so script which was actually executed was not updated. To make it work with iex you have to update the gust, but again for such a small script it is better to keep it's content in YAML.

    --ilya.

  6. 6 Posted by pathrikumark on 10 Jan, 2017 12:28 AM

    pathrikumark's Avatar

    Oh... okie.. now I get it. Thanks a lot ilya :)

  7. pathrikumark closed this discussion on 10 Jan, 2017 12:28 AM.

  8. Ilya Finkelshteyn re-opened this discussion on 18 Feb, 2017 04:01 AM

  9. 7 Posted by Ilya Finkelshte... on 18 Feb, 2017 04:01 AM

    Ilya Finkelshteyn's Avatar

    BTW, recently found how to make permalink to GitHub gist

  10. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:15 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