Make environmental variables from build available in deployment

jake's Avatar

jake

25 Jun, 2015 03:01 PM

Our build writes out a bunch of variables using service messages, here is the log output:

Adding Environment Variable. name='GitVersion_Major' value='3']
Adding Environment Variable. name='GitVersion_Minor' value='0']
Adding Environment Variable. name='GitVersion_Patch' value='0']
Adding Environment Variable. name='GitVersion_PreReleaseTag' value='beta.4']
Adding Environment Variable. name='GitVersion_PreReleaseTagWithDash' value='-beta.4']
Adding Environment Variable. name='GitVersion_BuildMetaData' value='']
Adding Environment Variable. name='GitVersion_FullBuildMetaData' value='Branch.release/3.0.0.Sha.718b220502037ee8325b18aa828ce93715fa4152']
Adding Environment Variable. name='GitVersion_MajorMinorPatch' value='3.0.0']
Adding Environment Variable. name='GitVersion_SemVer' value='3.0.0-beta.4']
Adding Environment Variable. name='GitVersion_LegacySemVer' value='3.0.0-beta4']
Adding Environment Variable. name='GitVersion_LegacySemVerPadded' value='3.0.0-beta0004']
Adding Environment Variable. name='GitVersion_AssemblySemVer' value='3.0.0.0']
Adding Environment Variable. name='GitVersion_FullSemVer' value='3.0.0-beta.4']
Adding Environment Variable. name='GitVersion_InformationalVersion' value='3.0.0-beta.4+Branch.release/3.0.0.Sha.718b220502037ee8325b18aa828ce93715fa4152']
Adding Environment Variable. name='GitVersion_BranchName' value='release/3.0.0']
Adding Environment Variable. name='GitVersion_Sha' value='718b220502037ee8325b18aa828ce93715fa4152']
Adding Environment Variable. name='GitVersion_NuGetVersionV2' value='3.0.0-beta0004']
Adding Environment Variable. name='GitVersion_NuGetVersion' value='3.0.0-beta0004']
Adding Environment Variable. name='GitVersion_CommitDate' value='2015-06-25']

It would be good if these variables were available during deployments as well

  1. Support Staff 1 Posted by Feodor Fitsner on 25 Jun, 2015 10:45 PM

    Feodor Fitsner's Avatar

    What deployment method do you use?

  2. 2 Posted by jake on 25 Jun, 2015 10:49 PM

    jake's Avatar

    I actually have 3. 3 nuget packages to nuget.org, a chocolate package and a github releases with a zip file. I want the env variables for the GitHub releases.

    I also put a comment on another topic to have multiple providers per deployment :)

    Sent from my Windows Phone
    ________________________________

  3. Support Staff 3 Posted by Feodor Fitsner on 25 Jun, 2015 10:55 PM

    Feodor Fitsner's Avatar

    OK, I see. How would you like to use env variables while deploying with GitHub provider?

  4. 4 Posted by jake on 26 Jun, 2015 07:05 AM

    jake's Avatar

    I want to have the release and tag version set to `v$(GitVersion_NuGetVersion)`. At the moment I have to use $(appveyor_build_version) which is really verbose (v1.2.3-beta0004+5 (Build 6)) sort of thing. So I am publishing as draft, editing manually then releasing.

    I am currently switching all my open source over to appveyor. Loving it, thanks for an awesome service.

    Cheers,
    Jake

  5. Support Staff 5 Posted by Feodor Fitsner on 26 Jun, 2015 07:38 PM

    Feodor Fitsner's Avatar

    Do you publish from "Environments"?

  6. 6 Posted by jake on 26 Jun, 2015 07:48 PM

    jake's Avatar

    Yeah.

    I have my CI build produce packages, which I deploy later. I use GitVersion for versioning.

    This explains how I set things up in TeamCity: http://jake.ginnivan.net/blog/2014/07/09/my-typical-teamcity-build-setup/

    I am looking to replicate this with AppVeyor. If you want to have a quick chat on skype or something I can do that?

    Cheers,
    Jake

  7. Support Staff 7 Posted by Feodor Fitsner on 26 Jun, 2015 07:53 PM

    Feodor Fitsner's Avatar

    Ah, I see. Environment variables are getting passed to environment deployment only if it's called from a build with "Environment" deploy provider.

    Otherwise, build and deployment are disconnected and AppVeyor does not collect build environment variables as artifacts (maybe it should?).

  8. 8 Posted by jake on 26 Jun, 2015 08:00 PM

    jake's Avatar

    For things which use service messages to write out the version number passing the dynamically created environmental variables along would be awesome.

    Side note, I would love to get some feedback on how I am using GitVersion with AppVeyor. I have added generating a default appveyor.yml using GitVersion init, suggestions on ways to improve what is generated would be great. I am giving AppVeyor a decent spin to make it easy to get started using AppVeyor and GitVersion. The PR which adds the `gitversion init` support for AppVeyor is at https://github.com/GitTools/GitVersion/pull/479.

  9. 9 Posted by jake on 14 Jun, 2016 03:04 PM

    jake's Avatar

    Hey Feodor,

    Just picking this up again. This would still be handy, the scenario is I generate release notes during the build and want to use that in the github deployment. I don't want to do a github deployment on every build and want to trigger through the UI.

    The other option would be allowing an artifact from the source build to be used to populate the description field.

  10. Support Staff 10 Posted by Feodor Fitsner on 14 Jun, 2016 05:07 PM

    Feodor Fitsner's Avatar

    Hi Jake,

    You can create a custom "deployment project" with arbitrary logic. Take a look at this article explaining how to do that: http://www.appveyor.com/blog/2015/11/04/deployment-projects

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